Solved: need help with groups and their names
-
hello rubies, is there a way to select groups by their name?
i want to be able to access the position of a specific group in the model and only know its name
thanks
(do you think that selecting all groups and checking each one in a loop is as good as it gets?)
-
found the solution myself, thanks for watching
Sketchup.active_model.active_entities.find_all {|e| e.name=="Group Name"} -
You should check the type too (e.type == 'Group') as there may be other drawing elements with the same name
-
fredo please go into more detail, because this combination doesn't find the group
Sketchup.active_model.active_entities.find_all {|e| e.class=="Sketchup;;Group" and e.name=="Group Name"} -
Sorry, I meant e.typename == 'Group'
If you prefer to use class id, then you must NOT enclose it between quotes
--> e.class == Sketchup::Group -
fantastic - thanks!!!
i guess that going through the basics of ruby in SU is inevitable, but doing mash-ups is so much fun

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