How to place 'Groups' or 'Components' rotated ?
-
Hi,
I want to expand my Canvas plugin to add rotation values when inserting groups or Components.
Problem is that with the code below the object is inserted using Z axis located on (0,0,0) coordinates and I want to rotate the object using cursor z axis coordinates instead.
I know how to position the position of the vector when I want to raytest but not this...Please Help!
def activate @@sel = Sketchup.active_model.selection[0] ; @@ents = Sketchup.active_model.active_entities ; end #def def onLButtonDown(flags,x,y,view) ip1 = view.inputpoint x,y ; @point = ip1.position ; add_object(@point) ; end #def def add_object(point) vector = Geom;;Vector3d.new 0,0,1 #Want the position to be on cursor t = Geom;;Transformation.new @point, vector, 45.degrees if @@sel.is_a? Sketchup;;ComponentInstance @@ents.add_instance(@@sel.definition,t) ; end if @@sel.is_a? Sketchup;;Group defn = @@sel.entities.parent ; @@ents.add_instance(defn, t) ; end end #def
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