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

    How to retrive the rotation

    Scheduled Pinned Locked Moved Developers' Forum
    5 Posts 3 Posters 263 Views 3 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.
    • voljankoV Offline
      voljanko
      last edited by

      Hello,
      i would like to retrieve the angle of the rotation of the transformation of the entity πŸ˜„ .
      But i cannot find the appropriate metod to do this.
      Maybe somebody knows some procedure to do this.

      SuSolid.com - solid check - solid repair- solid intersection check - weight plugin

      1 Reply Last reply Reply Quote 0
      • voljankoV Offline
        voljanko
        last edited by

        Ok,if nobody knows it πŸ˜„ ,i will tell you:
        The first 3 elements of the array that you get with transformation.to_a .
        The number that comes out is the cos of the angle.

        Interesting?

        3d.new 10,20,30
        t = Geom::Transformation.new point
        a = t.to_a
        UI.messagebox a [0]

        SuSolid.com - solid check - solid repair- solid intersection check - weight plugin

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

          ###
          trans=trans.to_a
                  scalex=Math.sqrt(trans[0]**2+trans[1]**2+trans[2]**2)
                  scaley=Math.sqrt(trans[4]**2+trans[5]**2+trans[6]**2)
                  scalez=Math.sqrt(trans[8]**2+trans[9]**2+trans[10]**2)
                           
                  scale=scalex
                  scale=scaley if scaley>scale
                  scale=scalez if scalez>scale
          
                  puts "         <pos>#{trans[12]} #{trans[13]} #{trans[14]}</pos>\n"
                  puts "         <scale>#{scale}</scale>\n"   
                  puts "         <rotation>\n"
                  puts "            <matrix>\n"
                  puts "               #{trans[0]/scalex} #{trans[4]/scaley} #{trans[8]/scalez} #{trans[1]/scalex} #{trans[5]/scaley} #{trans[9]/scalez} #{trans[2]/scalex} #{trans[6]/scaley} #{trans[10]/scalez}\n"
                  puts "            </matrix>\n"
                  puts "         </rotation>\n"
          ###
          

          Not mine... not sure who came up with it...

          TIG

          1 Reply Last reply Reply Quote 0
          • voljankoV Offline
            voljanko
            last edited by

            Wow,this is new for me that there are other classes (like Math) than that from SketchUp Ruby API documentation.
            Does anyone have a list and documentation of all included classes in SketchUp Ruby?
            Is it possible to include other classes and libraries and how?

            SuSolid.com - solid check - solid repair- solid intersection check - weight plugin

            1 Reply Last reply Reply Quote 0
            • Chris FullmerC Offline
              Chris Fullmer
              last edited by

              Hi Voljanko, SU has a basic ruby installation that comes with it. I think it was 1.8 or something. But it is missing a lot of things. I don't know if anyone has a complete (or partial) list of exactly what has been excluded.

              But you can include ruby files from a regular Ruby installation in your plugins. You just need to figure out what files you need, then include them with your plugin and require them in your plugins. Then you can use the methods and classes they provide.

              Chris

              Lately you've been tan, suspicious for the winter.
              All my Plugins I've written

              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