Changing an object's layer

Is there an extension or something that will allow me to right click on an object and change it’s layer rather than going back and forth to the tray all the time?

Thanks,
Velina

If you have thw ‘Entity Info’ window open, you can select the desired layer for whatever you select. You’ll see its current layer and the layers that are available.

1 Like

Yes, that is what I am using. I was thinking more along the lines of a shortcut. For example, in LayOut you can right click a viewport and go to the “Scenes” and pick the scene you want to change it to. I was kind of hoping for a similar procedure but for objects/components in the model where I could right click the object, hit the “Layers” menu and choose a layer from there. That way, the entity info is always visible so you can quickly double check what layer it’s on without scrolling up and down the tray a million times to get to the information you need.

1 Like

I haven’t seen an extension that would put the layers in a context menu and a quick search didn’t turn up anything. I can see how it could be useful but I also see how it could be harder than using Entity Info.

Ok. Just curious. Thanks.

Could this be what you are looking for? Extension | SketchUp Extension Warehouse

It allows you to pick up layers with an eye dropper and apply them to other entities. The layer painter tool also has a context menu for picking a layer to apply.

4 Likes

I’ll check it out. Thanks!

I can’t figure out how to tell it what layer I want to paint stuff with. What is the procedure?

I figured it out. I like it. Very close to what I was looking for. Thanks!

The “Default Tray” was never intended by Microsoft to be the organized tray that the user uses.
It is only a “parking” tray where all the application’s panels are parked “by default” at installation.

It is expected that each user will modify and create there own trays (plural,) organized the way that they best need them. (Ie, docked, floating, auto-hidden, etc.)

I myself have 4 custom tabbed trays docked on the right, and 2 custom trays (TREE and HELP) auto-hidden into the left margin (so they slide into view when I hover over their margin tab.)

I do not need to “scroll up and down a million times”. In fact, I’ve organized them in such a way that I never need to scroll to access any particular inspector panel.

How many layers do your models use ?

I’ve (in the past) posted code examples of a quick layer pick inputbox that could be assigned a shortcut.
It simply displays the layer names in a dropdown control just like the one on the Entity Info panel.
But I am not sure how it’d work if there were hundreds of layer names.


There is also (already) a native SketchUp “Layers” toolbar that does similar tasks.

Here it shows the currently active layer (checkmark and white background) when nothing is selected.
image

Here it shows the assigned layer of a selected entity (select cursor icon and yellow tooltip background.)
Choosing another layer from the toolbar’s dropdown reassigns the selected entity to that layer choice (same as the layer drop down control in the Entity Info panel.)
image

I myself have this toolbar docked at the top left in my second row of toolbars.
Switch it on via View (menu) > Toolbars… > Toolbars (tab) > Layers (checkbox)

This native toolbar display ~23 items and adds a scrollbar for accessing more.

You can open this toolbar and move it to the center of your modeling space.
Then copy this code to a .rb file, name it "toggle_layers_toolbar.rb" or similar, and save it to your user “Plugins” folder (located in the “Users//AppData/SketchUp/…” folder hierarchy.)

If you do not know how to find your “plugins” folder, then right-click the .rb file in Windows explorer and choose Send to > Compressed (zipped) folder. Then rename the file’s extension from .zip to .rbz, and use the manual installation “Install Extension…” button at the bottom of the Extension Manager (or Extensions dialog if using an older version of SketchUp,) to browse to the rbz archive and install the script.

It will load each time SketchUp does. Then assign a shorcut to toggle this toolbar on/off as needed rather then a right-click. (But I did add a right-click handler.)

LAYERS_TOGGLE ||= UI::Command.new('Layers Toolbar') {
  state = UI.toolbar_visible?('Layers') # get the state
  UI.set_toolbar_visible('Layers', !state)  # toggle it
}.set_validation_proc {
  UI.toolbar_visible?('Layers') ? MF_CHECKED : MF_UNCHECKED
}

UI.menu('View').add_item(LAYERS_TOGGLE)

UI.add_context_menu_handler do |context_menu|
  if !Sketchup.active_model.selection.empty?
    context_menu.add_item(LAYERS_TOGGLE)
  end
end

ADD: If you also wish to have a submenu off the context menu, that lists layers so you can reassign, then use this context menu handler instead. (But, when you get up above 34 layers some will not show because SketchUp’s context menu does not automatically display new columns.)

UI.add_context_menu_handler do |context_menu|
  mdl = Sketchup.active_model
  if !mdl.selection.empty?
    sub = context_menu.add_submenu('Layer reassign',0)
    context_menu.add_separator
    lays = mdl.layers.map(&:name).sort
    lays.each do |name|
      sub.add_item(name) do
        mdl.selection.each {|e|
          next if [Sketchup::Edge,Sketchup::Face,Sketchup::Vertex].include?(e.class)
          e.layer= name 
        }
      end
    end
    context_menu.add_item(LAYERS_TOGGLE,1)
  end
end

Now whenever you hit the shortcut the native Layers toolbar will pop up in the center of your modeling view (or where ever you had positioned it last.) Hit the shortcut again (or the red X button) to hide the toolbar again.

Perhaps Eneroth or someone will add this toolbar toggle to one of their already existing Layering extensions ?

2 Likes

This is excellent Dan, thank you. I haven’t seen any models come my way here at work that had hundreds of layers yet, thank goodness.

I am new to SketchUp as of this past March so I didn’t know that you can customize trays as you described.

Thanks!

Oh yea. It is old Microsoft framework. See the linked topic where I posted links into the SketchUp User Guide that explains how to add trays, modify them, drag them around, “pin” and “unpin” them, etc.

1 Like

Since you’re relatively new to SketchUp, I would give you the advice to avoid using layers unless absolutely necessary. I wish someone had told me this when I first started, because I tried to use them to organize my model like I would have done in Adobe software. I learned eventually that layers simply aren’t the same in SketchUp, and it’s best to use them in special cases, where you actually need to have certain parts of your model hidden or not. Otherwise, it’s best to just keep things as minimal as possible. Hope this helps!

2 Likes

Hi Monospaced,

We have to use layers where I work. I guess everyone here is transitioning from Visio to SketchUp Pro to produce all kinds of custom cabinetry documentation. 95% of my background with design software has been with AutoCAD. (Since Release 2.6!!! HA! I’m old. )

Anyway, so I’m trying to apply my “efficiencies” or short cuts that I had in AutoCAD to SketchUp Pro. I need to watch more tutorials. I’m getting there. Thanks everyone, I appreciate the input.

-Velina

i don’t think that’s great advice.Layers aren’t like layers in other programs but that doesn’t mean they should be reserved for special cases. A properly constructed model includes correct use of Layers to control the visibility of groups and components. While all primitives should be created and remain on Layer 0, assigning layers to groups and components makes good sense.

1 Like

Make sure you are using layers in SketchUp correctly. That is, Layer 0 is ALWAYS the active layer. ALL edges and faces are created on Layer 0 and remain on Layer 0. Only groups and components get assigned to other layers.

1 Like

That’s exactly how we do it. Everything starts on Layer Zero and once I make something a component, then I assign it a layer. This is why I was wondering if there was a right click short cut because when I am handed a model that someone else started, I have to click on every single thing and make sure it’s on the right layer.

Once it comes time to make scenes for LayOut when I make the shop drawings, I need to have everything in order for engineering.

:slight_smile:

1 Like

You said it wasn’t great advice, and then said the same exact thing as me :slight_smile:

I was only encouraging her to use layers as required (to control visibility), and not solely for organizational purposes.

I agree that a right-click to assign to a layer would be a very, very efficient addition to SketchUp, and would improve overall workflow. As it stands, using the Layers and Entity Info palettes add additional steps that might not be required.

Did you try the code I posted above ?

… or are you thinking more along the lines of the code actually populating a layers submenu ON the context menu ?

EDIT: I added an optional context menu handler to the code samples above, that will dynamically populate a submenu of layer names. It will skip faces, edges and vertices. Good for models with under say 35 layers or so.

@Velina, this is more like what you were thinking of ?