Select component with ruby?
-
what's the code for selecting a component by name?
(or is there one?)ie- what exactly would I type into the console to select a component named "board"..
(and I realize it may require more than one line.. in the past, I've typed multiple lines in a text editor then copy/pasted into the console.. and it works ok.. is there a better way to do that if need be?)
gracias!
-
Sketchup.active_model.selection.add( Sketchup.active_model.definitions['board'].instances )Note that this selects all instances in model - which might not be in the current context. Selections across context can make SketchUp behave oddly. Ye have been warned!
-
sweet.. thanks!
so far so good..
-
@unknownuser said:
in the past, I've typed multiple lines in a text editor then copy/pasted into the console.. and it works ok.. is there a better way to do that if need be?)
gracias!
hi Jeff,
did you know you can input multi-line scripts into 'Ruby Console' by using Alt/Return at the end of each typed line and then Return [on it's own] to enter/use it.
Also once somethings been entered you can re-use those same lines by toggling the up/down arrows to go back to a previously entered snip then hit return...john
-
@unknownuser said:
did you know you can input multi-line scripts into 'Ruby Console' by using Alt/Return at the end of each typed line and then Return [on it's own] to enter/use it.
Also once somethings been entered you can re-use those same lines by toggling the up/down arrows to go back to a previously entered snip then hit return...john
tip 1 -- thank you… that's good to know.. how about a way to type a long line with some sort of character in it indicating it's a new line..
something
like
this =something
like
this?
tip 2
awesome. that's a good one too! -
@driven said:
did you know you can input multi-line scripts into 'Ruby Console' by using Alt/Return at the end of each typed line and then Return [on it's own] to enter/use it.
Only on OSX. Not on Windows.

@driven said:
Also once somethings been entered you can re-use those same lines by toggling the up/down arrows to go back to a previously entered snip then hit return...
This works on both platforms, but I think OSX is a little bit smarter. If you execute a command multiple times OSX it will merge them together onto one item in the history stack.
-
Of course adding a '
;' into a line works as if it were a 'newline', needed in some code...
Soputs 123;puts 456;puts 789in the one line is like typing the commands on three separate lines in turn... -
ruby will allow spanning lines with a
\(in some cases.)
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