Assign Tag in Context Menu - Update to PutOnLayer.rb

General discussion related to SketchUp Pro and Make

Assign Tag in Context Menu - Update to PutOnLayer.rb

Postby gamber » Wed May 12, 2021 7:55 pm

Looking for an update to the "PutOnLayer.rb" extension which applies to Tags vs Layers.

I have found this plugin works fine, but defaults to Layer0 vs Untagged. Unfortunately, though well versed in the tech world, Ruby is not an area where I have any expertise whatsoever.

Is there anyone within the forums who can take a quick look and offer some assistance?

Thanks in advance.


Re: Assign Tag in Context Menu - Update to PutOnLayer.rb

Postby slbaumgartner » Sat May 15, 2021 3:56 pm

There are several issues with that old Ruby plugin. I would advise against using it without thinking carefully about what it does and reworking it. In particular:

- It does not comply with the current practice of never assigning tags/layers to edges or faces (unless you are really expert and understand the risk you are taking). Only assign tags/layers to Groups, ComponentInstances, and non-geometric objects such as dimensions, texts, and images. Tagging edges and faces creates the mistaken impression that they are isolated against interaction, whereas in SketchUp the tags/layers have no effect on interaction. This is a cause of many errors and frustration as naive users edit their models. Layers in many 2D drawing and photo editing apps do isolate geometry, and there is a myth that layers in CAD also isolate geometry, but this is not true: edges never intersect in CAD unless you tell them to do so. SketchUp is different!
- In keeping with the previous, current advice is that you should very rarely make any tag/layer active besides "untagged"/"Layer0"
- The code should be wrapped in modules with distinctive (hence likely unique) names so that it can't clash with other code.
- The name change from layers to tags in SketchUp is purely a GUI thing to help avoid confusion, especially since LayOut has layers that behave the same as in many other 2D drawing apps. As a result, to avoid breaking many extensions, the name was left as "layers" and "Layer0" in the Ruby API. It is up to Ruby code to substitute "untagged" for "Layer0" if you want consistency with the GUI.

PluginStore Author
PluginStore Author

Re: Assign Tag in Context Menu - Update to PutOnLayer.rb

Postby orbital » Fri May 28, 2021 12:15 am

Naturally I agree with everything slbaumgartner says about assigning tags to edges and faces.

I had disabled the recursive part of the plugin as I did not need that.

I've been using this successfully over the years.

Following recent helpful discussions with slbaumgartner and another on the other forum regarding ruby coding, for my personal use, I have reworked the code and wrapped it in modules.


SketchUcation One-Liner Adverts

by Ad Machine » 5 minutes ago

Ad Machine 


Return to SketchUp Pro & Make Discussions

Who is online

Users browsing this forum: duyduc159, kumbar, philem and 13 guests

Visit our sponsors: