sketchucation logo sketchucation
    • Login
    Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
    πŸ«› Lightbeans Update | Metallic and Roughness auto-applied in SketchUp 2025+ Download

    [REQ]Explode Groups/Components selected

    Scheduled Pinned Locked Moved Plugins
    6 Posts 3 Posters 2.5k Views 3 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • pilouP Offline
      pilou
      last edited by

      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...

      Frenchy Pilou
      Is beautiful that please without concept!
      My Little site :)

      1 Reply Last reply Reply Quote 0
      • TIGT Offline
        TIG Moderator
        last edited by

        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 type TIG.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
        end
        

        Note: 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...

        TIG

        1 Reply Last reply Reply Quote 0
        • pilouP Offline
          pilou
          last edited by

          Bravo! 😎
          Works like a charm! πŸ‘

          TIG The Terminatorizer! 😎

          termi.jpg

          Frenchy Pilou
          Is beautiful that please without concept!
          My Little site :)

          1 Reply Last reply Reply Quote 0
          • sdmitchS Offline
            sdmitch
            last edited by

            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?

            Nothing is worthless, it can always be used as a bad example.

            http://sdmitch.blogspot.com/

            1 Reply Last reply Reply Quote 0
            • TIGT Offline
              TIG Moderator
              last edited by

              You are right - I rattled it off too quickly !
              Well spotted... β˜€
              I've adjusted the original code to suit...
              Pilou... please re-copy/paste...

              TIG

              1 Reply Last reply Reply Quote 0
              • pilouP Offline
                pilou
                last edited by

                Sure!
                Terminatorizer the Return! πŸ˜‰

                Frenchy Pilou
                Is beautiful that please without concept!
                My Little site :)

                1 Reply Last reply Reply Quote 0
                • 1 / 1
                • First post
                  Last post
                Buy SketchPlus
                Buy SUbD
                Buy WrapR
                Buy eBook
                Buy Modelur
                Buy Vertex Tools
                Buy SketchCuisine
                Buy FormFonts

                Advertisement