sketchucation logo sketchucation
    • Login
    🤑 SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

    Scaling + move!() == ant feast

    Scheduled Pinned Locked Moved Developers' Forum
    9 Posts 5 Posters 392 Views 5 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.
    • M Offline
      MartinRinehart
      last edited by

      Buggy as hell. I am trying to sort it out. Will let you know. transform!() is one solution. If you want to animate (and I do) ...

      You don't need an animation to study the critters. Just try scaling/transform and then the same scaling/move. Ugh.

      Aside: I now believe the docs are correct re move!(). It's the code that's bad. The guy who wrote this had a very bad day.

      Author, Edges to Rubies - The Complete SketchUp Tutorial at http://www.MartinRinehart.com/models/tutorial.

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

        You do not need to use the .move! method in a transformation. You can stick with .transform! if you prefer. You could keep it from being added to the undo stack yourself by wrapping your code in start and commit operation methods.

        Also, its hard to say if the docs are right and the programming is wrong or vice versa. But we can say how it actually works. And it works so that .move! is the same thing as .transformation=.

        So just keep that in mind, and you can use .move! with no glitches whatsoever (wow that leaves me wide open to get proven wrong in a million ways.... 😕 ). I even posted sample code for how to use .move! and keep scale and rotation intact, by first applying the scale and rotation to your transformation object before applying your transformation to the group/comp with .move!

        I think there is room for improvement in the docs and the ruby methods here. Taking the time to hash out some of this stuff will hopefully make changes possible for SU ver.8. We just need to have a coherent report of the problems, and desired results, and a list of possible fixes.

        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

          @chris fullmer said:

          You can stick with .transform! if you prefer. You could keep it from being added to the undo stack yourself by wrapping your code in start and commit operation methods.

          It will still add something to the undo stack - not really transparent. the start_operation will add one undo point. Where as .move! adds none. No way around that until they fix the third and fourth argument of .start_operation.

          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

            Ahh yes, true there. It will add a single undo command, no way around that then.

            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
              MartinRinehart
              last edited by

              @chris fullmer said:

              You do not need to use the .move! method in a transformation. You can stick with .transform! ... by wrapping your code in start and commit operation ...

              Wish I'd thought of that. I just want to fly my airplane.

              airplane.jpg

              Anyhow, I've got translation and rotation plus the global scaling cases done. These are xforms after transform (SU) and move (after me poking values into the xform).

              xf1.jpg

              xf2.jpg

              Now if only I could think of a nice, high-level way to describe movements. I've got some Ruby that taxis down the runway adding speed as it goes, lifts off, tilts tail down, gains altitude, levels off, flys away. It's great to watch. Need to turn, return, land...

              But the Ruby is an ugly mess. Not something you'd publish with your name on it. Hmmm.


              My airplane. Just over 50kB.

              Author, Edges to Rubies - The Complete SketchUp Tutorial at http://www.MartinRinehart.com/models/tutorial.

              1 Reply Last reply Reply Quote 0
              • mitcorbM Offline
                mitcorb
                last edited by

                Curiosity, here:
                Is the ! a special modifier for move or transform?

                I take the slow, deliberate approach in my aimless wandering.

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

                  It's a ruby naming convention. ! at the end of a method name indicates that the object it's performed on will be changed. Possilby destructible or irreversibly. like .erase!

                  Then you have the ? which denotes a query, like .is_a?() or .same_direction?()

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

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

                    You find it in pairs of commands too - like with arrays a2=a1.reverse makes a2 the reverse of a1, AND a1 is unchanged.
                    BUT a2=a1.reverse! makes a2 the reverse of a1 AND it also reverses a1 at the same time !

                    TIG

                    1 Reply Last reply Reply Quote 0
                    • mitcorbM Offline
                      mitcorb
                      last edited by

                      Damn! (notice modifier at end of damn)
                      So much to learn--so little time.

                      I take the slow, deliberate approach in my aimless wandering.

                      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