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

    Select last entity

    Scheduled Pinned Locked Moved Developers' Forum
    18 Posts 6 Posters 3.3k Views 6 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.
    • david_hD
      david_h
      last edited by

      okay. . . je suis perdu . . .comment ca marche? 😕

      If I make it look easy...It is probably easy

      1 Reply Last reply
      Reply Quote 0
      • Didier BurD
        Didier Bur
        last edited by

        David,
        Just wait until me or Matt makes it a usable script.
        If you can't wait, 🎉 open the ruby console and when you need to select last entity drawn or inserted, type "entlast" (no quotes).

        DB

        1 Reply Last reply
        Reply Quote 0
        • R
          rhankc
          last edited by

          David,
          Last year RickW(http://www.sketchucation.com/forums/scf/memberlist.php?mode=viewprofile&u=370) wrote Selection Memory 2. Fantastic tool. Definite must have.

          Hank

          1 Reply Last reply
          Reply Quote 0
          • M
            Matt666
            last edited by

            Hi !
            Here's the code !


            entlast.rb

            Frenglish at its best !
            My scripts

            1 Reply Last reply
            Reply Quote 0
            • david_hD
              david_h
              last edited by

              @rhankc said:

              David,
              Last year RickW(http://www.sketchucation.com/forums/scf/memberlist.php?mode=viewprofile&u=370) wrote Selection Memory 2. Fantastic tool. Definite must have.

              %(#0040FF)[yeah . .that's the one I was referring to. Got it. Thanks! 😄]
              Didier and Matt!. . .Merci Mille Fois! I will give this one a test drive.

              %(#801000)[Just as a side note, at the 05 basecamp I went to the Ruby Scripting class to hopefully learn somewhat how to do it. Was totally blown out of the room. So I am glad there are you guys around for us dum dums. 💚]

              If I make it look easy...It is probably easy

              1 Reply Last reply
              Reply Quote 0
              • david_hD
                david_h
                last edited by

                works great. Thank you!

                If I make it look easy...It is probably easy

                1 Reply Last reply
                Reply Quote 0
                • Didier BurD
                  Didier Bur
                  last edited by

                  Here is another one, with context menu. Adds last entity to selection or select last entity only.


                  entlast.rb

                  DB

                  1 Reply Last reply
                  Reply Quote 0
                  • R
                    RickW
                    last edited by

                    You could also create this as a method for the Entities and Selection classes:

                    class Sketchup;;Entities
                     def last
                      return self[-1]
                     end
                    end #class
                    
                    class Sketchup;;Selection
                     def lastent
                      add Sketchup.active_model.entities.last
                     end
                     def lastentonly
                      clear
                      add Sketchup.active_model.entities.last
                     end
                    end #class
                    
                    

                    then add your user interface/dialog/menu item, whatever.

                    This also allows the methods to be called by other scripts in a predictable manner.

                    RickW
                    www.smustard.com

                    1 Reply Last reply
                    Reply Quote 0
                    • M
                      Matt666
                      last edited by

                      😲
                      Wouah !!
                      I wanted to do same thing but I but I didn't know how to...
                      How can you do that : Sketchup.active_model.entlast please ???

                      Frenglish at its best !
                      My scripts

                      1 Reply Last reply
                      Reply Quote 0
                      • M
                        Matt666
                        last edited by

                        Like that ?

                        class Sketchup;;Model
                        	def entlast
                        		nb = self.active_entities.length
                        		
                        		return self.active_entities[nb-1]
                        	end
                        end
                        

                        😄

                        Frenglish at its best !
                        My scripts

                        1 Reply Last reply
                        Reply Quote 0
                        • R
                          RickW
                          last edited by

                          Or like this:

                          class Sketchup;;Model
                          
                          def entlast
                            return entities[-1]
                          end
                          
                          end #class
                          
                          

                          Using entities or active_entities depends on whether you want the absolute last entity created, or the last entity created in that space (ie within a group or component).

                          RickW
                          www.smustard.com

                          1 Reply Last reply
                          Reply Quote 0
                          • M
                            msaryyev
                            last edited by

                            This is quite useful for selecting the last object extension. Could there be a variation of this that selects and zooms into the last object?

                            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