Select last entity
-
Or (ssget "_p"), or tool "select", and Key "P" (in AutoCAD)...
You could do smth Perhaps with the last entity in the active entities selection list ?def entlast model = Sketchup.active_model sel = model.active_entities ss = model.selection n = sel.length - 1 ss.add(sel[n]) end
I have not tested yet...
-
He Matt ça marche !!! (Hey it works !)
-
-
okay. . . je suis perdu . . .comment ca marche?
-
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). -
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. -
-
@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. ]
-
works great. Thank you!
-
Here is another one, with context menu. Adds last entity to selection or select last entity only.
-
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.
-
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 ??? -
Like that ?
class Sketchup;;Model def entlast nb = self.active_entities.length return self.active_entities[nb-1] end end
-
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).
-
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?
Advertisement