Postion of linked object

Need help, or want to share a macro? Post here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
browntoastjam
Posts: 37
Joined: Fri Aug 20, 2021 9:51 pm

Postion of linked object

Post by browntoastjam »

UPDATE: I did not see the negative sign.
PLEASE IGNORE THIS POST

Hello All,
I have two am trying to find the placement of two objects via code. It turns out that one object is a link of another.
Here are the objects of interest:

Code: Select all

objs=doc.Objects
for a in objs:
    if a.Label.__contains__("LED-Green"):
        print(a.Label,a.Placement)
This returns:

Code: Select all

D4_LED-Green_00006137f4de Placement [Pos=(-29.9581,6.25,-2.1), Yaw-Pitch-Roll=(0,0,0)]
D5_LED-Green_00006137f4f0 Placement [Pos=(-29.9581,-6.25,-2.1), Yaw-Pitch-Roll=(0,0,0)]


However D5 is a link of D4.

Code: Select all

>>> doc.getObjectsByLabel("D4_LED-Green_00006137f4de")[0]
<Part::PartFeature>
>>> doc.getObjectsByLabel("D5_LED-Green_00006137f4f0")[0]
<App::Link object>

How do I get D5's position.

D4 and D5 are visually in different positions.



Thanks.
Post Reply