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!
    ⚠️ Update | Sketchucation Tools 5.0.8 released with licensing improvements and bugfixes Download

    Transform to local axis question

    Scheduled Pinned Locked Moved Developers' Forum
    6 Posts 2 Posters 6.8k 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.
    • PixeroP
      Pixero
      last edited by

      What is the best way of doing a transform along a components local axis?
      Is it:

      
      component.transformation.inverse * new_transform * component.transformation
      
      

      Or can one apply a new transform, let's say:

      new_transform = Geom;;Vector3d.new(1, 0, 0)
      

      to a local axis directly?

      1 Reply Last reply
      Reply Quote 0
      • fredo6F
        fredo6
        last edited by

        @pixero said:

        What is the best way of doing a transform along a components local axis?

        It all depends on what you wish to transform and where it is.

        1 Reply Last reply
        Reply Quote 0
        • PixeroP
          Pixero
          last edited by

          I want to transform a component along its internal local axis and settled with:

          
          c_trans = c.transformation.clone
          c.transform!(c_trans.inverse)
          c.transform!(Geom;;Transformation.translation(@vector)) 
          c.transform!(c_trans)
          
          

          It works for this case but it has always felt backwards to me and I'm interested if there is a way to do the same with some matrix multiplication magic instead?

          1 Reply Last reply
          Reply Quote 0
          • fredo6F
            fredo6
            last edited by

            @pixero said:

            I want to transform a component along its internal local axis and settled with:

            You mean that you want to translate the component along:

            • one of its axis?
            • a given vector? (what is @vector in your code snippet?)

            In any case, you can compute the transformation, and then apply it once, via c.transformation =.

            1 Reply Last reply
            Reply Quote 0
            • PixeroP
              Pixero
              last edited by

              The thing is that @vector could be any value but it is in World-space coordinates and I want to move the component from its current position and rotation in its own local axis coordinates the length of @vector. @vector could be either just a x value or in any other combination like (25, 50, 43).

              What I do above is inversing the components transformation and then applying the @vector global axis transformation and finally returning the component to its rotation.
              Can it be done the other way? transforming the global @vector values into the components local coordinatsystem and applied.

              1 Reply Last reply
              Reply Quote 0
              • fredo6F
                fredo6
                last edited by

                If the vector is given in world coordinates, then you need the total transformation from the top model to the component.

                This is not something you can derive from the component itself. Usually it comes from

                1. a picking process in an interactive tool
                2. or the knowledge of the chain of containers from the top model down to the component
                1 Reply Last reply
                Reply Quote 0

                Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                With your input, this post could be even better 💗

                Register Login
                • 1 / 1
                • First post
                  Last post
                Buy SketchPlus
                Buy SUbD
                Buy WrapR
                Buy eBook
                Buy Modelur
                Buy Vertex Tools
                Buy SketchCuisine
                Buy FormFonts

                Advertisement