sketchucation logo sketchucation
    • Login
    Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
    ⚠️ Important | Libfredo 15.6b introduces important bugfixes for Fredo's Extensions Update

    How to place 'Groups' or 'Components' rotated ?

    Scheduled Pinned Locked Moved Developers' Forum
    1 Posts 1 Posters 132 Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • renderizaR Offline
      renderiza
      last edited by

      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	
      
      

      [url=https://www.sketchupcode.com/:z3kqsidd]My Extensions ...[/url:z3kqsidd]

      1 Reply Last reply Reply Quote 0
      • 1 / 1
      • First post
        Last post
      Buy SketchPlus
      Buy SUbD
      Buy WrapR
      Buy eBook
      Buy Modelur
      Buy Vertex Tools
      Buy SketchCuisine
      Buy FormFonts

      Advertisement