Jump to content

vs.ForEachObject() based on selection order


Recommended Posts

  • Vectorworks, Inc Employee

No. Traversal is always done is creation order.
The only way to do this would be to have the the menu run a temp tool to let the user select the objects.
You can then capture the order the objects are selected as they are clicked.

  • Like 2
Link to comment
  • 4 weeks later...

You can think of the Vectorworks file format as an xml-like node tree with parent, container objects that contain child objects. Layers, groups, and symbol definitions are all examples of container objects.

In traversing a list, if an object is a container, you go into the container, iterate through objects until the last contained, and then continue with the object after the container.

So, in the case of layers, you iterate through every object in the layer, then move to the next layer. You can get some sense of the structure here: https://developer.vectorworks.net/index.php/SDK:The_Vectorworks_Environment

Traversal is via object's stacking order, from bottom to top. Unless you do a Send Forward/Back, this will be from oldest object to newest.

Selection state is just a true/false flag for each object, so iterating over selected objects still goes in stacking order, but also checks if the selected status is true. 

  • Like 2
Link to comment

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
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...