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

    Transforming multiple vertices simultaneously?

    Scheduled Pinned Locked Moved Developers' Forum
    15 Posts 5 Posters 405 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.
    • Chris FullmerC Offline
      Chris Fullmer
      last edited by

      Yes, except that I am applying a differet transformation to each vertex. The y tranformation axis changes depending on the x position of the original vertex. So I was thinking I need to apply the transformation one by one to the vertices. Unless I could put the y-axis finding function inside a {proc} block inside the yaxis slot in the transformation. does that make any sense?

      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

        Hey Hey!, I founf that instead of running the transformation on the vertices directly, I could run it on point3d objects, and put the vector between the original vertex to the new vertes into an array. Then use:

        entities = entities.transform_by_vectors sub_entities, vector_array

        as a way to apply it to my vertex array, using the vector array, all in one shot, and my geometry comes out very clean! I think this is the approach I will take, unless someone has a better suggestion?

        Chris

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

        1 Reply Last reply Reply Quote 0
        • X Offline
          xrok1
          last edited by

          you wouldn't be trying soft selection transformations would you? πŸ˜›

          β€œThere are three classes of people: those who see. Those who see when they are shown. Those who do not see.”

          http://www.Twilightrender.com try it!

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

            Sorry to disappoint, not soft selection at this point. The problem with soft selection is that the native SU tools won't recognize a soft selection. So that means that you have to rebuild the move, copy, scale, rotate, etc tools to work with the soft selection. And currently, I am sooo bad with the UI. Fredo has it down pat, but it will take some learning for me. So maybe in time, but for now I am working on a top secret project that is not soft selection. But its still cool.

            Chris

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

            1 Reply Last reply Reply Quote 0
            • X Offline
              xrok1
              last edited by

              πŸ˜† can't blame me for trying.

              anyway i'm sure what you're working on will keep me distracted for a good while while i wait πŸ˜‰

              β€œThere are three classes of people: those who see. Those who see when they are shown. Those who do not see.”

              http://www.Twilightrender.com try it!

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

                @chris fullmer said:

                Hey Hey!, I founf that instead of running the transformation on the vertices directly, I could run it on point3d objects, and put the vector between the original vertex to the new vertes into an array. Then use:

                entities = entities.transform_by_vectors sub_entities, vector_array

                as a way to apply it to my vertex array, using the vector array, all in one shot, and my geometry comes out very clean! I think this is the approach I will take, unless someone has a better suggestion?

                Chris

                So I understand, transform_by_vectors matches a each entity to a corresponding transformation by the index of the arrays? So that each entity is transformed one time?

                I never thought of it like this. I had thought it applied each transformation to all entities so each entity would get transformed N time (assuming the transformation array had N elements.)

                Another Aha! moment for me. Thanks.

                Hi

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

                  That's very interesting.

                  And now I'm very curious to what Chris is cooking. Can I bribe you with a cookie?

                  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

                    @jim said:

                    So I understand, transform_by_vectors matches a each entity to a corresponding transformation by the index of the arrays? So that each entity is transformed one time?

                    Unfortunately (I think), it doesn't accept an array of entities and an array of transformations. It accepts an array of entities and an array of vectors.

                    So what I did was instead of running each transformation on each vertex one by one (which messes up the model), I created a new array of the vertex positions, then transformed all those point3d objects one by one (since that doesn't mess up anything in the model), and each time I wrote their vector change to an array:
                    positions_array.each do |e| original_position = e t = Geom::Transformation.axes point, xaxis, yaxis, zaxis new_position = e.transformation t vector = original_position.vector_to new_position transformation_vectors << vector

                    That gives me a corresponding vector for each vertex. So then I have my array of vertices, and their corresponding vector to move them by for the method:

                    entities.transform_by_vectors sub_entities, vector_array

                    And as a note, I left out a few lines of code that calculate the yaxis change for each transofrmation which is why I'm going through this process of finding the vectors. And at this point it looks like it works well. But its possible that I'll have to make tweaks (well, a massive overhaul is more likely for me really).

                    Hope that made sense,

                    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

                      I forgot to mention that since I have 3d positions for all the new vertices before I actually transform them, I think I should be able to add temporary .draw_line's or something to show the user where the geometry is planning on going before they commit to the operation.

                      I just need to figure out how on earth to implement the stupid .draw method....... πŸ˜•

                      Chris

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

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

                        @chris fullmer said:

                        Unfortunately (I think), it doesn't accept an array of entities and an array of transformations. It accepts an array of entities and an array of vectors.

                        Yes, of course. I meantan array of vectors. Vectors are transformations in a way - they can be seen as directions from getting from point A to point B.

                        @chris fullmer said:

                        I just need to figure out how on earth to implement the stupid .draw method.....

                        If you mean the view.draw method - that only works from a Tool class.

                        Hi

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

                          yes, the view.draw method. I get confused with how it decides to execute or not. Or maybe I'm seeing things that are not really happening, or something like that. I don't have any great examples right now that I'm confused with, but I'm sure when I try to implement it, I'll come across some stuff that I'll need help with πŸ˜„

                          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

                            Isn't an easier way to find the required transformation of one vertex then group the vertices (by their edges ?) and rhen move the group by that transformation, finally then explode the group ?

                            TIG

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

                              Normally yes, but he wants to apply a different transformation to each vertex.

                              Hi

                              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