How can I read from the same position for all components when I read X, Y from transformation?

Hello guys,

I have a problem when I get X and Y for the component it indicates to a different place where I think.

like these two components where x and y equal to zero:

image

Can I determine where I will read this info from it and update it?

I’m not sure I understand exactly what you want to achieve…

If you have a component (instance) then you can retrieve the transformation of this instance. Then the #origin method retrieves the origin of a rigid transformation, which will return: (Geom::Point3d) — the origin of the transformation. That is, let say a position (an inserting point) of the componentinstance.

transformation_of_instance = instance.transformation
position = transformation_of_instance.origin

(Note this will work if the instance in question placed to the root of the model drawing context, if you have a nested instances you have to get and combine the transformations, search the forum, there are plenty of topics about this)

2 Likes

Thank you @dezmo