How to select without using the mouse
-
Guys, I have a model with 3 faces (face1, face2, face3)
how do i select any of them from the ruby console -
To find faces in a selection
model=Sketchup.active_model ss=model.selection faces=[]; ss.each{|e|faces<<e if e.class==Sketchup::Face}If you have a reference to the 'face'
ss.clear; ss.add(face1)
etc...To find ALL of the model's [active] faces
faces=[]; model.active_entities.each{|e|faces<<e if e.class==Sketchup::Face}Iterate through this array faces as desired...
-
You know when you select something and it highlights in blue or with dots, can i do that from the ruby console.
What it is i have managed to make a list of faces and identify them with names and display them on a dropdown menu in a webdialog. Now what i want is when the user chooses a face i want it to be highlighted in the model with dots just as if he would click on it.
Do i make any sense? -
Reread my code
ss.clear; ss.add(face1)clears the selection then adds 'face1' to the selection - this IS what you say you want to do.
To test it in the Ruby Console, make a reference to the model, then one to the model's selection [say 'ss'] and use .clear/.add etc as desired... -
Just for references: the API documentation on Selection: http://code.google.com/apis/sketchup/docs/ourdoc/selection.html
All the stuff you can do with selection via SU Ruby API. -
MAN U R Genius

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 LoginAdvertisement