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!
    ⚠️ Important | Libfredo 15.6b introduces important bugfixes for Fredo's Extensions Update

    Flip along Z

    Scheduled Pinned Locked Moved Developers' Forum
    15 Posts 4 Posters 1.2k Views 4 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.
    • TIGT Offline
      TIG Moderator
      last edited by

      If you want the centre simply find the instance's bounds and the centre of that
      point=instance.bounds.center
      Then use that in my scaling transformation - a flip is just a scale -1 in any axis...

      TIG

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

        Thanks TIG, I'll play with that. I had tried scaling to -1, but I think I was doing it wrong because I was scaling with a uniform factor of -1 and my component kept disappearing.

        I did evenetually get this to work by flipping the way I showed above and then moving the origin as needed so that the component looks like it stays put. But this is requiring determining the pre-existing scale on the component (which I finally got that working too).

        Anyhow, I think I have it working now, but I'll play with yours because it might be signinficantly easier πŸ˜„ Thanks!

        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

          So it seems I massively overthought this one.

          All I really wanted to do was rotate an object using its x local x or y axis, 180 degrees.

          Scaling uniformly with

          Geom::Transformation.scaling center_point, -1, -1, -1

          also gives an acceptable result. Thanks for pulling my head out (of the clouds) TIG πŸ˜„ You wouldn't believe the silliness I was going through using the point.offsets and vector scaling to get this to do what I wanted.......

          Chris

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

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

            Scaling -1 would be mirroring - not rotating.

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

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

              Yes, and I think I like it as an option to include in what I'm working on. I think the rotation does closer to what I had in mind, but I'll throw in the mirroring if the user has ctrl-atl-option-prt_scrn-num_lock held down or something πŸ˜†

              Chris

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

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

                Yea, speaking of what you're working on... what are you working on? Your transformation talk here recently has had be pondering.

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

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

                  Not much, I am adding a flipping capability to my componnet stringer. So its a tool that lets the user click on the string of components and it will flip them all so they are facing the other way.

                  But I've been using this as an excuse to attempt to learn the matrix and I've picked up some interesting things for sure!

                  Heres a snippet. This will tell you how much the selected component/group has been scaled in the z direction:

                  gp = Sketchup.active_model.selection[0] gpt = gp.transformation.to_a z_vec = Geom::Vector3d.new( gpt[8], gpt[9], gpt[10] ) z_scale = z_vec.length / gpt[15] z_scale

                  (I run that in the Jim's web console, with a group selected).

                  That is one of the things I was needing to know - just the z-scale.

                  I am holding on to hope that I might be able to figure this thing out yet!

                  Chris

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

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

                    Chris

                    Have you looked at my additional methods here http://forums.sketchucation.com/viewtopic.php?p=190874#p190874

                    TIG

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

                      😲 How did I miss that? Thanks TIG! Reading through what it does, I think I can do around 1/2 of that now with the matrix. Mostly its just the rotation stuff that I still get lost on. I'm intersted to check out the code. Thanks for pointung me to it!

                      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

                        well in the end, I've had to mix and match some thoughts from this thread. I realized that I can ont doa simple rotation or scaling because in my case, I have to scale using the components local axis. If their axis is set on one of the sides of the component, I want it to rotate or scae around that axis, not the boundingbox centerpoint.

                        So I just threw in a way to determine the the center of the component on the local z axis. Had to account for component z-scaling AND if the axis was set somewhere inside the component (not at the very bottom for example). All in all, I've got it working like a charm now (I think!). It will be in the next component stringer.

                        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