Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5

How to get a target's parent reference frame?

#1
How do I get a target's parent reference frame item? Meaning its direct parent frame, that is shown in the GUI by default under "Target position with respect to:"of the target properties window.

I tried
Code:
target.Parent()
at first, but that fails if a target is in a folder.

A way that seems to work is:
Code:
frame = robolinkutils.getAncestors(target,robolink.ITEM_TYPE_FRAME)[0]
which gets the first of all subsequent reference frames for a target.

Is there a cleaner way to get the frame item?

Kind regards,

Maarten
#2
There is no cleaner way.

To make sure your script doesn't break you should make sure you at least have one ancestor in the list, so you can index the first item (index 0).

另一方面,我建议你to place coordinate systems inside folders and not the other way around.




Users browsing this thread:
1 Guest(s)