How to get the insertion point of a component?
-
how to get the insertion point of a component in the active model? That means the position of the component.
ss = Sketchup.active_model.selection for e in ss if (e.kind_of?(Sketchup;;ComponentInstance) ) point = e.definition.insertion_point puts point end end
it shoud bevery simple but I don't get it: I get 0,0,0 with this code but the component is not on 0,0,0...
What's could be wrong?
Thanks !!!!! -
Of course the insertion point of a component definition is always 0,0,0 !
You have to use this instead:ss = Sketchup.active_model.selection for e in ss if (e.kind_of?(Sketchup;;ComponentInstance) ) point = e.transformation.origin puts point end end
Hope this helps,
-
Yes, It does help!
Merci Didier. -
Yes, I remember now figuring this out when I wrote the 3D Text Tool.
Advertisement