Select groups/components with selected materials
-
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 -
small update for this extension which still works at my level but does not select hidden elements (layers, geometry, etc.).
-
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
-
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
-
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.
-
thanks for your feedback and advise
-
🧩 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.
-
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 -
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...
Go there and you can add your RBZ files as listings on the site and accessible to users in SketchUp who use Sketchucation Tools
-
Hi, thanks for this indications. Extensions are now available for users.
-
Yeah, I needed to approve them. So they are live now...
SketchUp Plugins | PluginStore | SketchUcation
SketchUp Plugin and Extension Store by SketchUcation provides free downloads of hundreds of SketchUp extensions and plugins
(sketchucation.com)
Advertisement