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!
    πŸ›£οΈ Road Profile Builder | Generate roads, curbs and pavements easily Download

    [Question] on transformation.rotation

    Scheduled Pinned Locked Moved Developers' Forum
    3 Posts 2 Posters 421 Views 2 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.
    • R Offline
      rvs1977
      last edited by

      Hi all SUdudes... πŸ˜„

      I have a problem rotating a component instance around itself from a chosen inputpoint.
      the component instance have been added, and then I want to rotate it:

      
      ......
      ip.pick view, x, y
      point = ip.position
      vector = Geom;;Vector3d.new 0,0,1
      angle = 2
      t= Geom;;Transformation.rotation point, vector, angle
      yv_instance.transformation = t  
      
      

      I expected it to rotate around the point with the vector and rotate it 2 radians. BUT instead of rotating it around itself, it rotates around the ip-point and 0,0,0... hmmm hope you understand.

      the question is: How do I rotate a component around itself??? ❓

      tnx in advance πŸ˜„


      Get a Ruby

      1 Reply Last reply Reply Quote 0
      • TIGT Offline
        TIG Moderator
        last edited by

        The transformation
        t=Geom::Transformation.rotation(point, Z_AXIS, angle)
        [no need for another vector]
        and its use
        yv_instance.transform!(t)
        should rotate the 'instance' around the Z_AXIS centered on the point...
        The ' angle' should be in radians.
        You set it to ' 2' ? To use degrees try 2.degrees ...
        πŸ˜•
        Note how I have enclosed he arguments inside ( ) - the recommended way - as 'un-parenthesized' arguments might get deprecated in a future release of Sketchup's Ruby...

        TIG

        1 Reply Last reply Reply Quote 0
        • R Offline
          rvs1977
          last edited by

          Great, thanks TIG!

          Now it works 😍


          Get a Ruby

          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