sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    Getting Rotation Value From Rotate Tool

    Scheduled Pinned Locked Moved Developers' Forum
    4 Posts 2 Posters 308 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.
    • K Offline
      kayeee
      last edited by

      Hi,

      I'm having trouble obtaining a angle value for how much a group is rotated when the user uses the Rotate Tool. The Group is 2D sitting in the x and y plane and I would like to find out how much it is rotated about an axis at the center of the group in the z direction. From reading through the forums, I know you cannot directly obtain information from the built-in Rotate Tool, but I was hoping there would be an easy work around that compares the starting orientation with the ending orientation. I'm still new to Ruby and Sketchup so apologies if there is a simple solution I'm missing.

      Thanks in advanced.

      1 Reply Last reply Reply Quote 0
      • Dan RathbunD Offline
        Dan Rathbun
        last edited by

        1. Select the group instance
        2. Open the Ruby Console
        3. In the console type:
        
        sel = Sketchup;;active_model.selection
        g = sel[0]
        a = X_AXIS.angle_between(g.transformation.xaxis)
        
        

        The angle will be in radians.

        To display degrees:

        
        a.radians
        
        

        I'm not here much anymore.

        1 Reply Last reply Reply Quote 0
        • K Offline
          kayeee
          last edited by

          @dan rathbun said:

          1. Select the group instance
          1. Open the Ruby Console
          2. In the console type:
          
          > sel = Sketchup;;active_model.selection
          > g = sel[0]
          > a = X_AXIS.angle_between(g.transformation.xaxis)
          > 
          

          The angle will be in radians.

          To display degrees:

          
          > a.radians
          > 
          

          Thank you! Exactly what I needed!

          1 Reply Last reply Reply Quote 0
          • Dan RathbunD Offline
            Dan Rathbun
            last edited by

            @kayeee said:

            Thank you! Exactly what I needed!

            To see how to wrap that up into a macro file, look at the sample I posted here:
            forums.sketchup: [Code] Determining Angle Between View and Model’s Axes

            I'm not here much anymore.

            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