sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    Select Only Solids

    Scheduled Pinned Locked Moved SketchUp Discussions
    sketchup
    22 Posts 7 Posters 4.0k Views 7 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.
    • K Offline
      KrisM
      last edited by

      Also tried opening the ruby in Notepad and Notepad++, copying and pasting into the Ruby console. Nothing happens. I am obviously missing something.

      1 Reply Last reply Reply Quote 0
      • J Offline
        Jim
        last edited by

        I found myself frequently turning to the Ruby Console for making anything more than simple selections.

        So I made a sel command, and now in the Ruby Console I can type things like:

        sel ;all
        sel ;edges
        sel ;faces
        sel ;groups
        sel 0 [or ;none or ;clear] 
        sel ;cons
        sel ;invert
        
        

        etc.

        Quite efficient. It's too hackish to share at the moment. I'll try to remember to fix it up and post it.

        Hi

        1 Reply Last reply Reply Quote 0
        • S Offline
          slbaumgartner
          last edited by

          @krism said:

          Feeling kind of dumb here. Put the ruby in the plugin folder but cannot for the life of me find where to use it from?

          It was a quick hack, not really a plugin. If you put it into the plugins folder, try opening the Ruby Console and typing SLBTest::all_but_solids or SLBTest::only_solids.

          1 Reply Last reply Reply Quote 0
          • K Offline
            KrisM
            last edited by

            Great. Works like a charm. Thanks very much.

            1 Reply Last reply Reply Quote 0
            • E Offline
              Einstein
              last edited by

              @tig said:

              Here's a one-liner... Copy+Paste in the Ruby Console + <enter>
              This highlights all solids in the selection.

              s=Sketchup.active_model.selection;a=s.to_a;s.clear;s.add(a.grep(Sketchup;;ComponentInstance)+a.grep(Sketchup;;Group).select{|i|i.manifold?})
              

              This highlights all solids in the active_entities context.

              m=Sketchup.active_model;s=m.selection;s.clear;s.add(m.active_entities.grep(Sketchup;;ComponentInstance)+a.grep(Sketchup;;Group).select{|i|i.manifold?})
              

              Hello, TIG,
              I know this thread is old, but the problem hasn't been completely solved.
              Thank you for the script you provided. It works well with groups, but doesn't take components into account. When I run it on a selection, it will filter solids among groups, but not components. All preselected components will stay selected, no matter whether they're solid or not.
              Tested on SketchUp 2021.
              I would love to have a plugin that would consider both groups and components and could be launched from Extensions menu. Do you think you could do that?

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

                The simple code snippets should select any component_instances AND groups which are solids...
                Please post an example of how it doesn't work...

                TIG

                1 Reply Last reply Reply Quote 0
                • E Offline
                  Einstein
                  last edited by

                  I have prepared an example model with:
                  1 solid group
                  1 non-solid group
                  1 solid component
                  1 non-solid component

                  In this model your second script selected both components, regardless of their solid state, leaving both groups unselected.
                  Your first script has removed the non-solid group from selection (I preselected all entities), but didn't filter components at all.
                  So none of the scripts worked 100% as expected.


                  solid entity selection - example.skp

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

                    There was a typo in my code - to select all solids in the active entities context use this fixed version...

                    m=Sketchup.active_model;s=m.selection;s.clear;a=m.active_entities;s.add(a.grep(Sketchup;;ComponentInstance)+a.grep(Sketchup;;Group).select{|i|i.manifold?})
                    

                    The other one, to select only solid components/groups in a selection, works OK...

                    TIG

                    1 Reply Last reply Reply Quote 0
                    • E Offline
                      Einstein
                      last edited by

                      That's strange.
                      In my case, your new code still only filters groups. No components are affected.
                      Do you think that some plugin could interfere with it?

                      1 Reply Last reply Reply Quote 0
                      • E Offline
                        Einstein
                        last edited by

                        I also tested it in SU 2020, where I only have a few basic plugins enabled.
                        I get the same wrong outcome.

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

                          You are right !
                          Another typo - misplaced (...)
                          Here's a working version [I hope!] to select all solids in the model [active-entities]

                          m=Sketchup.active_model;s=m.selection;s.clear;a=m.active_entities;s.add((a.grep(Sketchup;;ComponentInstance)+a.grep(Sketchup;;Group)).select{|i|i.manifold?})
                          

                          TIG

                          1 Reply Last reply Reply Quote 0
                          • E Offline
                            Einstein
                            last edited by

                            This one is working, great! 😄
                            I appreciate your help.

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

                            Advertisement