Hello,
attached you'll find an example drawing incl. two blocks and a macro. That macro gets the coordinates of the instances of the selected block.
Select Block1 in the FM and run the macro. The coordinates of the block instances will be shown in the immediate window.
As you can see these coordinates are correct as long as the block instance does not belong to a nested block. If it is nested it will obviously give the position within the parental block (as "Block1-2" is definitely not located at x=0/y=0).
Now my question is how can I check if a block instance is nested and what are the higher level block instances. If I knew that I could calculate the correct position adding the coordinates of the parental block(s).
Any idea?
Thanks in advance.
Kind regards,
Ronny
PS: This is a simplified drawing. I know that the block position also depends on the sheet scale and, if placed in a view, on the view scale. I did not consider that in my example drawing to keep it simple and focussed on my question.
SolidworksApi macros