Move all items in group and sub groups to new layer


#41

Having tried to follow these over the intervening period, I can say that they don’t work, and in fact it’s a bit ridiculous.

If you have two things on a page and you realise you want to put them on different layers, so you can switch them on or off, you move item 2, to layer 2, and then if you happen to be on layer 1, and do select all, delete, it will delete all the sub elements if that item2, because in reality everything was on layer 1, even through you moved it to layer2…

I used to love sketchup, and be a massive advocate, however every feature added now seems to make it harder to use… and simple features like layers don’t work as would make sense :frowning:


#42

I suspect this is your problem.
Never change the active layer.
Keep all raw geometry on Layer0 and assign visibility tag (also badly named as layers) only to groups or components.


#43

Just when I was starting to feel like I was getting a handle on things I started trying to organize a model I brought in from Archicad and I ran into this discussion and now I am thoroughly confused.
Please excuse my very basic questions, but I think I need to get back down to the very main things:

  1. Should I be making groups within layers or layers within groups? Or both?
    Please reply with in General and Specifically for creating floors of a building.

  2. Please explain this part of the discussion:


    How can you move a group to a new layer but keep the actual lines and faces on group0 (do you mean layer0?).
    When I select things on a layer and make them a group the layer setting in the layer tab automatically changes to layer 0. Is that just a default thing?
    Is that because I am supposed to be keeping everything on layer0?
    If I do group things and then place that group on a layer - what is actually happening?
    thank you


#44

This will be a lengthy post, but I hope it proves helpful!

For starters you need to realize that in SketchUp a Layer is a thing that an entity (a SketchUp drawing object) can reference to decide its visibility (and color and as of 2019 dash pattern). The effect is similar to the hidden attribute of an entity, but hidden is object-by-object whereas a layer controls multiple entities’ visibility at the same time. Almost anything that shows on a SketchUp drawing view can refer to a Layer to decide its visibility - edges, faces, groups, components, dimensions, text, …

The phrase “on a layer” comes from traditional 2D CAD and image editing, where layers combine the visibility control of SketchUp’s layers with the gathering/structuring control of SketchUp’s groups. To reiterate, in SketchUp these are two separate behaviors controlled by two separate constructs. I prefer to say an entity “uses” or “associates with” or “refers to” a layer, because that captures the idea that the entity points at the layer not the other way around.

Using different layers for edges and faces is a bad idea because SketchUp’s layers don’t prevent them from sticking to each other or intersecting. Sure, if they are spatially isolated (e.g. if you draw the second floor at a different height than the first floor or draw one object off to the side of others) they can’t interfere. But that’s because they don’t overlap, not because they use different layers! The risk of mixing layers on edges and faces is that when you modify edges that are visible you may be also altering attached ones that are not visible! That’s a quick road to madness, and is why the guru advice is to always draw edges and faces using Layer0 and leave them that way.

A group (or component - for simplicity I’ll just write “group” but everything applies equally to components) is an entity that gathers together several “nested” objects and isolates them in their own context so that they won’t “stick to” or intersect with anything outside the group. Edges and faces inside a group can still affect each other, but can’t affect ones in a different group. An entire group can be (for example) repositioned using the move tool without needing to grab each of its individual contents.

So, Layers and Groups in SketchUp are completely separate ideas.

On to your specific questions:

From what I wrote above, you may be able to see that this is not really a very meaningful question as layers aren’t “within” groups or vice versa. In fact, multiple groups can use the same layer - including groups nested inside different outer groups. You should always gather the pieces that you consider to make up a single object into a group, both so that you can manipulate them as a unit and so that they are isolated from other groups of pieces.

Usually you would consider the second floor to be independent of the first floor so that changes to one don’t automatically alter the other. For example, if you move a second floor wall over, you don’t necessarily want to warp the walls below it on the first floor. So, you would want them to be separate groups. But, you would very likely want to gather smaller collections within each floor for the same reasons. You also gain semantic power by such grouping - e.g. the bathroom can be a separate thing from the bedroom, not just one big mess of walls and floors.

Now, layers can in principle be used by both a group and its contents. But if a group’s layer is not visible, its contents will not be visible regardless of what layer(s) they use. It wouldn’t make sense for a thing’s contents to show if the thing itself is hidden!

Going the other way, it can happen that you want the thing as a whole to be visible but just some of its contents to be hidden. That would happen if the group’s layer is visible but the contents use other layers that are not visible. With a few special exceptions, you usually want an entire “thing” to be visible, not selectively some of its edges or faces, so when this behavior is needed you create another group nested inside the overall group, and set it to use a layer separate from the one for the overall group. For example, you could have two alternative sets of plumbing in nested groups of a bathroom group and by having them use different layers you can toggle visibility between the alternatives.

Again, the idea is that the groups are what make them separate “things” and the layers are what let you control which things show in the drawing.

You just assign the group to use the new layer and leave its contents alone (and yes, he did mean layer0).

New objects, including groups, are automatically assigned to use whatever is the currently “active” layer in the layers window/tray. Ordinarily layer0 should be left active during all drawing operations, including creating groups. That way you don’t have to remember to switch back to layer0 before drawing additional edges and faces. In entity info you can tell the group to use a different layer later if you need to.

The group changes to referencing the newly selected layer. Nothing else about it or its contents is affected.

Edited to correct “model info” to “entity info”. Good catch @DanRathbun


#45

Thanks for this lengthy answer! I will reread it a few times to make sure I got it all.

The main, somewhat embarrassing thing, I’m realizing through all this and hopefully other newbies may need this info too - groups can include things related to different layers and layers can include things related to different groups. I had been assuming until a week ago that when things were grouped the group “properties” all became the same and all parts grouped and then moved to a layer were then all on that layer - including sub groups and things not visible. It is kind of a relearning after using other programs.

I get it that I pretty much never want to change the default layer from layer0.

Like I said, I will reread this but can you just clarify the layer 0 part. If I draw something on layer0 then group it, select the group and put in on layer 1, does that mean the line work and faces remain on layer 0 but the group is related to and visible when ayer 1 is visible?

This is the part that confused me from the conversation.

I also think I will start learning and using the outliner.

Thanks again.


#46

Yes, exactly. There is no need for the contents of a group to use the same layer as the group, and usually no reason to change them from layer0.


#47

+1 For everything Steve said!

To clarify, SketchUp layers aren’t really layers in the sense of a place things can be in or on. They are more like tags or labels applied to the things, while the group/component is the place the thing live in.

Pretty much every new users gets confused though as the “layer” feature in SketchUp re-uses a name people are used to meaning something else. In my view the feature (global exclusive visibility tags) is well designed but badly named.

The “layer” is assigned as a property of the group/component, independent of what is inside it. You could apply the same layer to both the container and the content, but it’s quite redundant, a bit as labeling a dresser “socks” and then label the drawers inside of it “socks” too.


#48

To further explain …

In SketchUp you DO NOT draw on layers. You draw in entities contexts (called under the hood an entities collection.) The main model has an entities collection and components and it’s subtype groups each have a definition that has an entities collection.

In SketchUp, the active layer is no more than a default property that is assigned to each entity as you create it. This is why the active layer should always be set to “Layer0”, so all geometric entities (especially primitives) you create in geometric collections each get their individual .layer property automatically set to point at “Layer0”.

Then later you can set only groups or components to point at some other organizational layer that you create.

I like to refer to SketchUp’s Layer objects as “shared display behavior property sheets”, because that is all they are. Their “behaviors” can be shared by many entities, but they do not themselves have geometric entity collections.