Assign Tag in Context Menu - Update to PutOnLayer.rb
-
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.
-
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.
-
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 anotheron the other forum regarding ruby coding, for my personal use, I have reworked the code and wrapped it in modules.
Advertisement