Jump to content

Recommended Posts

Posted

Just a quick question - is there a way to cycle through a variant, as one does with a collection using vlax-for?

 

I thought maybe:

 

(foreach x  (vlax-safearray->list
             (vlax-variant-value <Variant>))

           ;;  Do Something  ;;

)

 

But I just wondered if this was the only way to perform this type of operation.

 

Thanks

 

Lee

Posted

lee, that's the easier way for manipulating variants which is by converting it directly to a list thru (vlax-safearray->list) . The other way could be writing a routine which require some coding:

 

1. converting variant to safearray(vlax-variant-value),

2. getting its dimension(vlax-safearray-get-dim),

3. getting the bounds (vlax-safearray-get-l-bound/u-bound) for each dimension,

4. and using (vlax-safearray-get-element) for each element in the bound

Posted

Ahh, I understand Wizman - just extracting each element individually.

 

I just thought there might be a way to cycle through the elements directly, without having to go through the conversion - but thanks for the suggestion it is much appreciated :)

 

Lee

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...