[REQ]Explode Groups/Components selected
-
Wanted explode on all levels Groups & Components selected
Exist a total explosion of all groups components (selected or not) of the Model by Rick Wilson at Smustard
Too powerfull
Exist Exloder at the Ruby Depot but seems don't work!

So...
-
This code Explodes all Selected Groups/Instances [including all nested Groups/Instances inside these, down through all levels of nesting...]
Usage: in the Ruby Console typeTIG.exploderizer+ <enter>
Paste the code into a file called "TIG-exploderizer.rb" in the Plugins folder and restart Sketchup.require 'sketchup.rb' module TIG def TIG.exploderizer() model=Sketchup.active_model ss=model.selection return nil unless ss[0] toex=ss.to_a.find_all{|e|e.class==Sketchup;;Group or e.class==Sketchup;;ComponentInstance} more=true done=[] while more len=toex.length toex.clone.each{|e| next if done.include?(e) tarr=[] tarr=e.entities.to_a if e.class==Sketchup;;Group tarr=e.definition.entities.to_a if e.class==Sketchup;;ComponentInstance tarr.each{|ee| toex << ee if ee.class==Sketchup;;Group or ee.class==Sketchup;;ComponentInstance } done << e done.uniq! } toex.uniq! more=false if toex.length==len end model.start_operation("TIG.exploderizer") toex.uniq.reverse.each{|e|e.explode if e.valid?} puts "Exploded #{toex.length} Groups/Instances." model.commit_operation end endNote: it will Explode any inner Groups/Instances inside a Component Definition even if it is outside of the Selection, if there is an Instance of it in the Selection.
EDIT: fixed glitch with component entities... -
Bravo!

Works like a charm!
TIG The Terminatorizer!


-
Isn't
tarr=e.entities.to_a if e.class==Sketchup::Group or e.class==Sketchup::ComponentInstance
only true for groups? Wouldn't it need to be e.definition.entities for components? -
You are right - I rattled it off too quickly !
Well spotted...
I've adjusted the original code to suit...
Pilou... please re-copy/paste... -
Sure!
Terminatorizer the Return!
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