Need some help again.
-
A few months ago, Tig helped me with some syntax for exploding walls in my model grouped by name, The specific line of code was:
Sketchup.active_model.active_entities.grep(Sketchup;;Group).each{|e| e.explode if e.name=~/^[Ww]all/ }
I now have to explode components by the same naming system, starting with 'wall'.
I was thinking I could add another line to the module and simply switch(Sketchup::Group)
with(Sketchup::ComponentInstance)
and everything should work fine... but it does not. I found myself frustrated again and decided to come back to the pros and ask for some help here. -
Unless the Instance itself is named 'wall' it needs to refer to the Definition thus:
Sketchup.active_model.active_entities.grep(Sketchup;;ComponentInstance).each{|e| e.explode if e.definition.name=~/^[Ww]all/ }
However, to delete Instances which are themselves named 'wall' use
Sketchup.active_model.active_entities.grep(Sketchup;;ComponentInstance).each{|e| e.explode if e.name=~/^[Ww]all/ }
-
Thanks again TIG! I am very grateful. I knew I was missing something, but was pretty much stumped. Thanks for putting me back on track, and so quickly. Cheers
Advertisement