Jump to content
Developer Wiki and Function Reference Links ×

Retrieving the stacking order of objects and layers


Recommended Posts

FinLayer gets you the object at the bottom of the stacking order.  NextObject gets you the next object higher in the stacking order. Since you only care about Selected objects you can use FSObject(LayerHand) and NextSObject and not have to do the check for selection yourself.

 

If objects overlap then their relative positions in the stacking order will be such that the one lower in the stacking order will be the one that draws first and is "hidden" by the one higher in the stacking order.

 

Walk the tree and create your doppelgängers and it should work. The doppelgängers will be in the same absolute stacking order as the original selected objects.

Link to comment

I don't think FInLayer and FSObject(LayerHand) will yield the correct stacking order.  They don't seem to in the original application (PIO).  They seem to consistently yield creation order, but there is so much going on that file that I need to create a special limited file to test known stacking order against info yielded by vs functions

Link to comment

They will be in creation order unless someone has manually used HSendForward/Backward/Front/Back or the menu command equivalents.

 

HSendFront. and menu Send To Front, HSendBack and menu Send to Back seem to do exactly the same thing.

 

HSendForward and HSendBackward seem to always move the object one place in the stacking order.

 

menu Send Forward and menu Send Backward seem to only move objects if moving them will change their visibility, i.e. the move either obscures another object or is obscured by another object.

 

I think you are going to need to generate your own test file to prove this to yourself.

 

And if you are looking for objects inside of PIOs, that is a different question and you will need to nest even deeper using FInGroup or FIn3D to check the stacking order of those objects.

Link to comment

Well, Pat, you were right.  FInLayer and FSObject yield the bottom of the stacking order.  One needs to be sure there is not another routine sorting the object list, which was the case in the original application.  My bad.  It should be obvious that collecting objects should be by layer and then by the order in the layer, but it is hard to imagine that would not be the case whenever collecting objects across layers.  Maybe if a collection criteria dealt with classes as the main criteria the visibility stacking could be compromised.  For the moment, i don't care about that scenario.  Pat and Raymond, thanks.

  • Like 2
Link to comment

Just a fly on the wall here.

You could you store a list of handles to the objects in question.

Create an empty list for handles to store the handles as they are sorted.

Walk through each layer comparing each handle to your first list of handles looking for a match.

When one occurs, transfer that handle to the second to the second list.

Once the first list is empty of handles begin your creation process by using the second list of handles that are now sequential.

Eliminates the possibility that adding objects is changing the hierarchy of objects, but places them all the new objects at the top end relative to all existing objects.

If the intention is to slip a copy immediately in front or behind the existing the occurrence to maintain relativity to existing non-selected objects as well I suspect you would need to maintain your own count of the number of comparisons made. Storing that location number as each match is made and then doing a LOT of forward or back movements as you create your copies noting that you probably have to increase the stored location number by the quantity of copied items at the moment each copy is introduced to the drawing file. I don't know of any other way to subvert the handler of the handles to reorder handles as one slips new items into the database of the drawing.

 

I have probably over looked something due to my limited use of VS scripting.

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