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

Hi Paul

Your tool is very good.
but Now, Tags has folder structure on 2023 sketchup.
Do you have plan to add the folder structure too ?
it help lot of…
because Your tool is very good, but If we have 100-300 tags,
The list is too long…

: )

Hello Kazu,

I’m not an plugin developer – I tinker with the API to make scripts for my own productivity.

I had originally asked Dan for advice on this particular script and for some reason that I can’t remember, I decided to release it so that it might be useful for others.

If I remember correctly tag folders had already been released. but for my specific use I needed the ability to create keyboard shortcuts for my most frequently used tags and in that respect I didn’t need to integrate a tag folder structure into the menu command.

I don’t currently have any time to look at it and I’m certainly not in a coding frame of mind at the moment.

I’m easy if someone wants add a tag folder structure to this script…

Have you tried Curic LA ?

It’s quite good and I do occasionally use it.

Yes, it’s good plug-ins !! but I expect sketchup team improve natively : )

Question: Which options would you want for the context menu nested folders ?

  1. tags listed above folders

  2. folders listed above tags

  3. tags and folders mixed listed alphabetically