• Login
sketchucation logo sketchucation
  • Login
🤑 SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

Select groups/components with selected materials

Scheduled Pinned Locked Moved Extensions & Applications Discussions
11 Posts 2 Posters 40 Views
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.
  • J Offline
    JujuSKP Extension Creator
    last edited by 23 days ago

    Hello,
    I'm not a developer but according to a precise need I tested chatgpt with which I was able to generate an extension allowing me to select all the groups and/or components containing the selected material(s) on one or more faces.
    Once again I'm not a developer but it works for me. I even have an icon that I can insert into my toolbars or an action by simply right-clicking.
    So I'm sharing it for someone who's qualified and would like to improve it to create a new extension allowing this selection that I couldn't get with one like Material Selection or Selection Toy.
    Good day to all
    SelectByMaterial.rbz

    1 Reply Last reply Reply Quote 0
    • J Offline
      JujuSKP Extension Creator
      last edited by 23 days ago

      small update for this extension which still works at my level but does not select hidden elements (layers, geometry, etc.).

      SelectByMaterial_IgnoreHidden.rbz

      1 Reply Last reply Reply Quote 0
      • J Offline
        JujuSKP Extension Creator
        last edited by 23 days ago

        well one last improvement where in summary this plugin does:

        • Detects inherited materials (applied to group or component),
        • Ignores hidden entities or entities on non-visible layers,
        • Works in the active context (open model or group),
        • Handles multiple material selections,
        • Adds an entry in the Plugins menu, right-click, and an icon in the toolbar.
          SelectByMaterial_InheritedSupport.rbz
        1 Reply Last reply Reply Quote 0
        • J Offline
          JujuSKP Extension Creator
          last edited by 23 days ago

          I'm turning into a chat-developer 🙂
          even better, if the material is part of a component comprising several entities, the selection will be made with the ‘master’ component.
          For example, I have a table with a wooden top and metal legs. I automatically select the ‘wooden top’ material and the table will be selected.
          Another summary of what this extension does (tested and working for me):

          • Multi-material (several faces selected),
          • Active context respected (in group or model),
          • Ignores hidden entities / hidden layers,
            Takes into account :
          • materials applied directly to faces,
          • materials applied globally to components/groups,
          • master components, even if the material is in a nested sub-level,
          • Plugins menu integration, right-click and toolbar with icon.
            SelectByMaterial_AncestorSupport.rbz
          1 Reply Last reply Reply Quote 1
          • R Offline
            Rich O Brien Moderator
            last edited by 23 days ago

            Vibe-coding as you iterate through ideas. It's interesting little tool. Nice job to you both 😋

            If you use a more conventional extension setup the Plugins folder root .rb file would have something like this...

            require 'sketchup.rb'
            require 'extensions.rb'
            
            module JujuSKP
              module JujuSKP_SelectByMaterial
            
                unless file_loaded?(__FILE__)
                  ex = SketchupExtension.new('Select By Material', 'JujuSKP_SelectByMaterial/main.rb')
                  ex.description = 'Your description'
                  ex.version     = '1.0'
                  ex.copyright   = 'JujuSKP © 2025'
                  ex.creator     = 'JujuSKP'
                  Sketchup.register_extension(ex, true)
                  file_loaded(__FILE__)
                end
            
              end # module JujuSKP
            end # module JujuSKP_SelectByMaterial
            

            Poke around your own plugins folder too see how others a packing extensions.

            Download the free D'oh Book for SketchUp 📖

            1 Reply Last reply Reply Quote 1
            • J Offline
              JujuSKP Extension Creator
              last edited by 23 days ago

              thanks for your feedback and advise

              1 Reply Last reply Reply Quote 0
              • J Offline
                JujuSKP Extension Creator
                last edited by 23 days ago

                🧩 Extensions SketchUp – JB_SelectByMaterial & JB_IFCCleaner
                📌 JB_SelectByMaterial_v1.0
                Fonction : sélectionne tous les groupes et composants du modèle contenant un ou plusieurs matériaux actifs, même s’ils sont imbriqués dans des sous-composants.

                Caractéristiques :

                Lance la recherche à partir de faces sélectionnées,

                Prend en compte les matériaux appliqués :

                sur les faces,

                sur les groupes/composants (au niveau supérieur),

                Sélectionne toutes les instances identiques visibles dans le modèle,

                Très utile pour appliquer rapidement un calque, balise ou action groupée sur une catégorie visuelle de composants.

                🧼 JB_IFCCleaner_v1.0
                Fonction : nettoie un fichier SketchUp issu d’un import IFC complexe.

                Objectif :

                Supprimer tous les attributs IFC à chaque niveau,

                Aplatir la hiérarchie excessive de composants imbriqués,

                Purgez automatiquement les composants inutilisés.

                Options proposées :

                Choix du niveau de profondeur de flatten (ex : 2 niveaux),

                Option pour conserver ou supprimer les métadonnées IFC du composant maître sélectionné.

                🧠 Pourquoi ces extensions ?
                Dans mon cas concret de projet BIM :

                J’ai dû importer un fichier IFC très lourd, avec des milliers de composants imbriqués (jusqu’à 4 ou 5 niveaux). SketchUp devenait quasi inutilisable.

                J’ai alors développé deux approches complémentaires :

                🔁 Via Blender, j’ai exporté une version FBX optimisée du modèle (géométriquement plus léger), mais j’y ai perdu les balises. Grâce à JB_SelectByMaterial, j’ai pu récupérer très vite une sélection logique par matériaux pour les reclasser facilement (dans un projet avec plus de 20 000 composants).

                🧹 Pour le modèle IFC brut, j’ai utilisé JB_IFCCleaner pour :

                Supprimer les métadonnées IFC (non nécessaires dans SketchUp),

                Réduire les imbrications à 1 ou 2 niveaux maximum,

                Et retrouver un modèle navigable.

                🤝 Contexte de développement
                Je ne suis pas développeur, juste utilisateur avancé confronté à une problématique réelle.

                Grâce à ChatGPT, aux conseils de Rich O’Brien sur ce forum, et à beaucoup de tests, j’ai réussi à créer deux outils qui fonctionnent pour mon usage professionnel – et je les partage ici pour tous ceux confrontés aux mêmes difficultés.

                JB_IFCCleaner_v1.0.rbz
                JB_SelectByMaterial_v1.0.rbz

                1 Reply Last reply Reply Quote 0
                • J Offline
                  JujuSKP Extension Creator
                  last edited by 23 days ago

                  English version 🙂

                  🧩 SketchUp Extensions – JB_SelectByMaterial & JB_IFCCleaner
                  📌 JB_SelectByMaterial_v1.0
                  Function: Select all groups and components that contain one or more selected materials, even if deeply nested inside other components.

                  Features:

                  Starts from one or more selected faces,

                  Detects materials applied:

                  directly on faces,

                  or on parent components/groups (applied at instance level),

                  Selects all visible matching instances in the model,

                  Very handy to quickly apply tags, layers, or actions based on visual/material logic.

                  🧼 JB_IFCCleaner_v1.0
                  Function: Clean up a SketchUp file imported from IFC (typically overloaded and deeply nested).

                  Purpose:

                  Remove all IFC attributes at all nesting levels,

                  Flatten component hierarchies down to a usable depth,

                  Automatically purge unused components.

                  Available Options:

                  Set the depth level of flattening (e.g., 2),

                  Choose whether to preserve or remove IFC data on the top-level (master) component.

                  🧠 Why were these extensions created?
                  In my real-world workflow:

                  I had to import a very heavy IFC file, with thousands of components and excessive nesting (up to 4–5 levels deep). SketchUp became almost unusable.

                  So I developed two parallel strategies:

                  🔁 After exporting a simplified FBX version through Blender, I lost my tags/layers.
                  Thanks to JB_SelectByMaterial, I was able to recreate selections by material logic and reassign the correct tags (in a model with over 20,000 components).

                  🧹 For the original IFC version, JB_IFCCleaner helped me:

                  Strip out unneeded IFC attributes,

                  Flatten over-complicated component hierarchies,

                  And regain a usable, lag-free model in SketchUp.

                  🤝 About the development
                  I’m not a developer, just a SketchUp user facing real technical limitations.

                  With the help of ChatGPT and guidance from Rich O’Brien here on the SketchUcation forums,
                  I managed to create two lightweight extensions that solve my actual needs — and I’m happy to share them with anyone facing similar problems.
                  JB_IFCCleaner_v1.0.rbz
                  JB_SelectByMaterial_v1.0.rbz

                  1 Reply Last reply Reply Quote 1
                  • R Offline
                    Rich O Brien Moderator
                    last edited by 22 days ago

                    Great stuff!

                    If you go to our homepage sketchucation.com and login(if you are already logged in then logout and login)

                    You should see Dev Tools in the header...

                    image.png

                    Go there and you can add your RBZ files as listings on the site and accessible to users in SketchUp who use Sketchucation Tools

                    Download the free D'oh Book for SketchUp 📖

                    1 Reply Last reply Reply Quote 0
                    • J Offline
                      JujuSKP Extension Creator
                      last edited by 22 days ago

                      Hi, thanks for this indications. Extensions are now available for users.

                      1 Reply Last reply Reply Quote 1
                      • R Offline
                        Rich O Brien Moderator
                        last edited by 22 days ago

                        Yeah, I needed to approve them. So they are live now...

                        Link Preview Image
                        SketchUp Plugins | PluginStore | SketchUcation

                        SketchUp Plugin and Extension Store by SketchUcation provides free downloads of hundreds of SketchUp extensions and plugins

                        favicon

                        (sketchucation.com)

                        image.png

                        Download the free D'oh Book for SketchUp 📖

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

                        Advertisement