Assign Tag to Object Plugin

I’ve been using a crude modified version of Put On Layer where I disabled the recursion and removed the context menu and moved it to the menu bar.

Someone at Sketchucation Forum had recently asked if there was an ‘updated’ version of the plugin and I mentioned my modified version.

Anyway with much help from Dan Rathbun attached is a plugin that will assign an object to a tag by way of the context menu. It will also allow you to create a new tag.

It is not recursive, i.e. it will not assign the tag to a selected object’s nested objects.

Of course it’s not generally recommended to assign raw geometry to anything other than untagged. This plugin will not stop you from doing this.

PMC_Assign_To_Tag.rbz (1.4 KB)

If you’re interested there is also Curic’s LA extension which does the same (and more)

1 Like

So what’s the difference, Paul?

The original Put On Layer plugin created a context menu item that allowed you to to assign a layer to an object.

This Assign Tag to Object plugin does the same and also gives you the ability to create a tag ‘on the fly’ and assign it to the selected object.

I did try the Curic’s LA extension a while back but it didn’t quite fit my workflow at the time. Their extension provides a GUI which allows you to search for a tag and assign it to the selected object. You can also add a new tag, toggle visible, toggle visible all and do a filtered tag search from the GUI.

In a different thread Curic suggested that their extension would be better if you had many layers which could take up too much space in the context menu…

Yes, I can see how your extension makes life a little easier.

I don’t suppose there’s a way to do it, but it would be a nice touch if the tag already assigned were shown (say by being in bold type or asterisked or maybe by separating it out under the line that separates Untagged from the rest).

As I said in the other thread, the plugin does not make the assumption that there is only 1 object selected. It in fact works a loop to iterate all objects in the selection and assign them to use the chosen tag. (If there is only 1 object in the selection then the loop runs once.)

Regarding menu styling. We cannot embolden menu items, but we can disable and grayout items.

We can “mark” items with a checkmark, which is usually done to indicate a toggle set in the affirmative position (true, on, etc.)

It would not make much sense to check more than 1 tag if the selection had multiple items using different tags.

Currently the tag setting loop uses a conditional expression that only makes a reassignment if the object’s tag is not what the user chose via the submenu. So even though the loop runs when you chose the same tag an object is using, no undo operation is created as no change to the model occurs.

The difference is speed, using Curic LA to assign tags/layers will be many times faster than Entity Info, Tags/Layers toolbar, or context menu.
Usage is the same as you press Window (Win) or command + space (macOS) and type something to find and open them

Wouldn’t it alert you to the fact that the items chosen have different tags currently attached?

It might … however I would consider this as abnormal for UX design concerning menus, so it could also confuse.

What you propose is actually more alike a dropdown picklist (yes, like the one in the Entity Info panel,) which would say "<varies>" when there were multiple tags for the items in the selection.

This would mean a popup html dialog (which I think Curic has done,) rather than a context submenu.

It is a lot more work coding a html dialog.

Paul’s plugin grew from a simple example, which he “simply” tweaked for his own use. I helped clean it up, and added a simple “Create new tag…” command, again as part of a coding example of how to conditionally add or not add menu commands based upon the current editing context.

OK Dan, I know I am out of my depth here. I have been using the extension and find it does speed things up a bit, especially on my 27" monitor (where the Entity info box can be a long way away from the working area.

Does this work in older versions of SketchUp that still use Layers and not tags

The word “Tags” is just a GUI change.
They still are the same things and are still named “Layers” in the programming APIs.

And I just quickly tested Paul’s extension in SU 2017. No problems. Give it a full test drive.

1 Like

Thanks, I will