💡 LightUp 7.1 | SketchUp's only real-time renderer that uses object-based rendering
Download Trial
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
Advertisement