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
Advertisement