[Solved] How to create groups from layers, and move primitive geometry to Layer0




I am working with files made with another software (FME), which can handle sketchup layers, but only partially : faces are set to the wanted layer, but all edges are set to Layer0.

So, is their a way to retreive edges connected to “layered” faces and set them into the same layer ? And to create a group from thoses faces & edges ?

I have been looking to many posts, running several tests, but I still havn’t figured it out, so any help on this would be appreciated :slight_smile:

EDIT : Thanks to DaveR explanations, I am now looking for a way to :
1°) Create faces + edges groups from my current layers (which only “contains” faces),
2°) Assign those groups to their related layer,
3°) Move all primitive geometry to Layer0.
Here is the kind of file I am working on (generated by FME) :
groups_layers_test_file.skp (400.6 KB)


So you’re importing the file from FME into SketchUp?

All edges and faces should be on Layer 0, not on other layers. It sounds to me as if you need to be moving the imported faces to Layer 0.


I am generating .skp files from FME, then I open them in SketchUp.

So, my faces and edges should be in both their dedicated layer and in Layer0, right ?
I am trying to do this right now.


Entities can only be on one layer. Not two. All edges and faces should be on Layer 0. Only groups and components should get assigned to other layers. See: https://help.sketchup.com/en/article/3000122



And suddenly it became crystal clear … I probably have read about this without undersanding, thank you for rephrasing !

But then, my file is created that way, the only grouping information I have is the faces being set into named layers … any idea about how to make a group of it (faces + edges), and then set all geomtry entities into Layer0 ?


You’re welcome.

Leaving all geometry on Layer 0 and leaving Layer 0 as active at all times is actually quite liberating because there’s never any need to be remembering what layer you are working on. Less time screwing around with the layers and less of an opportunity to create problems.

I’m not a Ruby wizard but I expect some of the wizards will be along shortly.

TIG created a plugin that moves geometry to Layer 0. You might dig into it for some ideas. It is available on the Sketchucation site.

In SketchUp, layers do not provide separation between edges and faces. You can only provide separation by using components or groups. Moving your geometry to other layers will just create problems.


If that helps, here is an example of the kind of file I get from FME. Sadly I don’t have much control on groups or layers in FME :
groups_layers_test_file.skp (400.6 KB)


I’d be really irritated to have a file like that to work on. I can see why you want to fix it. I think what you need to be asking for is a way to create groups of connected faces that have the same layer name, assign the groups to those layers, and then move all the faces to Layer 0.


I used Rick Wilson’s Layers 2 Groups on your test model. I think it did what you wanted. I have attached the resulting model and plugin.

groups_layers_test_file.skp (666.1 KB)

EDIT: plugin modified as I had suggested.

Layers 2 Groups.rb (3.1 KB)


SketchUp “layers” are fundamentally different from layers in all other programs I have used. In SketchUp a “layer” isn’t a palce but a property of the entity, kind of like a color. SketchUp “layers” don’t separate objetcs or stop them from sticking to each other.

Any SketchUp importer should really create a group for each layer of the source file. Draw all the content inside their respective groups (without assigning layer data to the individual entities!) and assign layers the groups as wholes. The groups should probably also be named after the source layer, so you can explore the model through the Outliner.


Thank you @sdmitch dmitch, this is exactly what I was looking for !
The only thing is that the generated Layer0 group has to be deleted, so that my edges are not duplicated within this group.

So I have just added an additionnal condition on line 56 from the Layers 2 Groups.rb file you included :
&& ln != 'Layer0'
(where ln stands for layer name)

And now everything works fine, thank you all for explanations, I really needed to understand that. And now that I do, I agree with @eneroth3, if layers are really meant to wrap groups, I think it should be designed that way within code and UI.


Well, grouping the faces automatically add the related edges, that is why I need to avoid creating a group from my ‘initial’ Layer0 which contains all edges, because if so, there would be 2 groups containing the same edges. But faces and edges can be set in different layers, that is confusing.

And I did tried the same additionnal code as you suggest, before realising that, but eventually it is not necessary (but you need to know that, otherwise it feels unatural to only add faces).


Here are some behind-the-scenes SketchUp technical points that I hope will reduce rather than increase your confusion:

  • A face or edge can exist in only one context (group, component, or “loose” in the model) at a time. When you put a face or edge into a group or component, if it is shared with something that you left “loose” or in a different context, SketchUp makes a duplicate so there is one distinct copy in each context. That’s how it prevents grouped geometry from “sticking” to geometry from other contexts: they are actually separate duplicated entities.
  • A face is defined by a collection of structures called “loops”. The loops reference edges to define the perimeter of the face plus the perimeters of any holes in the face. A loop includes a flag that can say it wants to use the edge reversed so as to have a continuous flow of start->end=start of next->end=start of next… around the loop until it returns to the start point, regardless of which way the edges themselves were created. This is how two adjacent faces can share an edge without one face or the other having to be reversed (the order of traversal of edges is related to the choice of which sides are “front” and “back”).
  • SketchUp layers are separate attribute objects that multiple faces and edges can share for a second visibility flag (in addition to the basic “hidden” attribute of each face or edge). That is, a single layer’s visibility state turns on or off visibility for all the entities that share it. But it does not cause the faces or edges to be isolated or duplicated and is completely independent of what contexts they may be in. The entities share the layer, the layer does not “own” or “contain” them! A layer does not prevent entities from intersecting or sticking to each other. As mentioned earlier, this is quite different from what most other modeling apps call a “layer”, and is a frequent source of confusion for SketchUp newbies. Undoing the other app’s usage of layers is what the importers need to do, else you have to fix it up manually afterward.
  • When a face or edge is placed in a group or component, it becomes subject to visibility controls from that collection as well as its own. If a group is hidden, whether by its own flag or by its layer, nothing inside it is visible regardless of the contents’ layers or hidden values. But when the group is visible based on its layer or hidden flag, the contents are each controlled by their own individual layers and flags. Other than while you are editing a group or component and something is in the way of what you want to see, it is rarely useful to have faces and edges in a group hidden while the group itself is visible. The illogical situation of part of the group missing just causes confusion.