Get an origin point inside a Dynamic Component
-
Hi all,
I want to get the coordinates of an origin point inside my Dynamic Component.
I created a Dynamic Component composed of three sub components.
Every sub component has an origin point and axis to get oriented in a different way.I want to get the origin point position of one of the sub component in order to use it in my Ruby code.
I actually want to draw a line from this origin point to the point of the mouse's current location, inside of a onMouseMove method within my Tool Ruby code.
Does anybody know an answer ?
Thank you every one,
Marie
-
Try transformation origin - for the nested-dc's instance and the container-dc's instance...
Perhaps with adjustments for their relative placements too...
http://code.google.com/apis/sketchup/docs/ourdoc/transformation.html#origin -
But will the Point3D returned by the transformation method be the same point I decided for the origin of my sub component when I created it in SketchUp ? (in SketchUp : right-clic on the component, "Modify axes")
And if I named the sub component ("Light_Beam") of my component ("Light"), could I get directly the sub component from the selection ?
Instead of writing :
selection=Sketchup.active_model.selection
sub_component = selection[0].definition.entities[2].definition.instances[0]to get my sub component, and then get the origin point with sub_component.transformation.origin
The [] method is said not to be very efficient in the Google SketchUp Ruby API. And I don't want to use the .each method as I want to get only one sub component I named.
-
I tested it and it is actually the good origin point which is returned by the .origin method.
I need to call the method for the nested component as I decided another point for the container component's origin.And I will use a for loop to get the right subcomponent (with the right name).
Thanks a lot !
Marie
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register LoginAdvertisement