sketchucation logo sketchucation
    • Login
    πŸ€‘ SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

    Dont understand rotation

    Scheduled Pinned Locked Moved Developers' Forum
    13 Posts 7 Posters 504 Views 7 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 have a problem with the rotation of the entity.
      I want to move the entity with the origin on the point 100,0,0 and rotated for 90 degrees.
      But the results of my code is that the entity is on the position cca 43.18 ,-105.42131 ,0
      What is wrong in the code?

      	point = Geom::Point3d.new 100,0,0
      	vector = Geom::Vector3d.new 0,0,1
      	degrees = 90
      	angle = degrees.degrees
      	t = Geom::Transformation.rotation point,vector,angle	
      	selected_entity.move! t
      

      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

        Just change the last line. You don't want to use the move! method, you want to apply the transformation with the transform! method. So it should look like this:

        selected_entity.transform! t

        See if that works,

        Chris

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

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

          hmm, I read up on the move! method. Seems that it should have been doing what you want perhaps. Are you trying to do this rotation within an animation? Or is it just a normal rotation transformation? I guess it says that the move! is good to use within an animation, but I have zero experience with animations.

          Chris

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

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

            Yes,thats it.
            Thans.
            Sorry for a very newby question.

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

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

              No,im not doing an animation,but only transaction.
              It is strange that with move metod i have different result.
              The same behaviour (not wanted)i get if i make a component in this way:

              point = Geom::Point3d.new 100,0,0
              vector = Geom::Vector3d.new 0,0,1
              degrees = 90
              angle = degrees.degrees
              t = Geom::Transformation.rotation point,vector,angle

              path = Sketchup.find_support_file "Bed.skp",
              "Components/Components Sampler/"
              definitions = model.definitions
              componentdefinition = definitions.load path

              instance = entities.add_instance componentdefinition, t

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

              1 Reply Last reply Reply Quote 0
              • C Offline
                cjthompson
                last edited by

                I tried some tests with your script, and I found that .transform! applies a transformation to an instance, and .move! applies a transformation to the definition.

                So, if you have multiple copies, when you use move!, it will move them all to one place.

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

                  This might use some looking into then. The Docs say that the move! method is identical to the transform! method, just it does not get applied to the undo stack, making it nice for animations.

                  Seems like it should not mess around with definitions or instances differently. interesting,

                  Chris

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

                  1 Reply Last reply Reply Quote 0
                  • M Offline
                    markozeta
                    last edited by

                    This seems like a trig problem

                    .move! may require angle in degrees - DCs use degrees exclusively for all their trig work.

                    .transform! may require the angle in radians.

                    Try changing to "angle = degree" with .move! and see if that fixes it.

                    Mark

                    BSME - Cal Poly Pomona
                    Sketchup Pipe Maniac

                    1 Reply Last reply Reply Quote 0
                    • J Offline
                      Jim
                      last edited by

                      move! is mis-documented or buggy, or both. I think move! is expecting a Point3d object to move the Grouponent to, because it sure acts strange otherwise.

                      I posted a little more here: http://forums.sketchucation.com/viewtopic.php?f=180&t=17047&p=166900&hilit=move#p166900

                      Hi

                      1 Reply Last reply Reply Quote 0
                      • M Offline
                        markozeta
                        last edited by

                        @jim said:

                        Grouponent

                        😎 😎 πŸ€“

                        Nice

                        BSME - Cal Poly Pomona
                        Sketchup Pipe Maniac

                        1 Reply Last reply Reply Quote 0
                        • J Offline
                          Jim
                          last edited by

                          I thought it was a great blend, but I can't take credit for it. I saw it in someone's source code. Fredo, I think.

                          Hi

                          1 Reply Last reply Reply Quote 0
                          • T Offline
                            tomot
                            last edited by

                            I'm in the process of making a Bifold door ruby: with 2 options open or closed
                            the open door position are 60 degrees. Ruby excepts only radians!

                            ie

                            pi = 3.141592653589793  # 180 degree angle = pi radians 
                            pi6 = 1.047             #  60 degree angle = pi*0.6666/2   
                            
                            
                            #-----rotation is about point $pt00 and about the blue axis 60 degrees
                            t = Geom;;Transformation.rotation($pt00,Geom;;Vector3d.new(0,0,1), -pi*0.6666/2)
                            group.move!(t)          
                            

                            bifold.png

                            [my plugins](http://thingsvirtual.blogspot.ca/)
                            tomot

                            1 Reply Last reply Reply Quote 0
                            • thomthomT Offline
                              thomthom
                              last edited by

                              60.degrees
                              http://code.google.com/intl/nb/apis/sketchup/docs/ourdoc/numeric.html

                              Thomas Thomassen β€” SketchUp Monkey & Coding addict
                              List of my plugins and link to the CookieWare fund

                              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