Tool or script to select all objects in a layer and make component

Hey all. I’ve been given a bunch of assets created in SketchUp but the original user only organized the model using layers. I will be exporting this to other software for rendering. Is there any tool or script you guys know about that will iterate through the model and make components out of all the objects on each layer. So for instance, all objects on layer “walls” will be made into a component called “walls?” Thanks in advance for your help!

I don’t envy you your job with this. I guess from what you describe, I would turn off the visibility for all but one layer at a time and then select the content that has that layer assigned to it (nothing is “on” a layer in SketchUp.) and make a group or component. Assign the same layer to the group/component in Entity Info. Turn off that layer and turn on the next. Select the entities and make a group/component. Rinse and repeat for the next layer. Make sure Layer 0 is the active layer for this whole process.

If I was given that job I would charge at least double. :wink:


This sounds like the way to go to me, and with shortcuts it would not be so bad. Start with all tags visibility off, so nothing visible, then turn one tag visibility on, command A to select all, shortcut key for make component, name, return. Next tag… Not automated but should go quick.


1 Like

Yes, that is what I did for the first model ( a smaller one). I made all layers invisible(off) and went through one by one and turned them on and selected one face and then selected all on same layer. Then created component. Rinse, repeat.

I have some programming experience but not with sketchup or ruby scripts. Do you know if that is something that could be done via script?

I expect that even with a script there’d still be a fair amount of manual input involved to get things right.


Depends if the model already contains nested components.

To only consider geometry on the top level would be pretty easy.

Sketchup.active_model.start_operation('Components By Layer', true)
Sketchup.active_model.layers.each do |layer|
  group = Sketchup.active_model.entities.add_group( { |e| e.layer == layer })
  component = group.to_component = "Component: #{}"
  component.layer = layer
1 Like

Try Selection Toys from Extension Warehouse!


This adds the Select/All on Selected Layers command to the context menu.


Triple if there are nested components with different Tags! :stuck_out_tongue_winking_eye:

This works great. I just have to make sure to purge empty layers. Thanks!

There is a script for that as well.

1 Like

Thanks. Delving into ruby scripts. A little different than what I’m used too.