Create Tags and Color Tags in One Script

I am looking for a way to attach tags to duct elements and color the tags in one single Dynamo script. I know that I can do this in one script by assigning tags that have the specific color. For example, I could have a Size-tag for rectangular duct called “Rect Size in Blue” for assigning a Size tag in blue color. But doing this has a number of disadvantages (duplicated tags, very long Dynamo script, cannot cover misc. tags). I prefer to color the tags using Element.OverrideColorInView in Dynamo script. The problem is that I cannot use one single script to attach tags and to color the tags. I can only use one script to attach tags (using “Create Annotation Tag”), and use a different script to color the tags (using “Element.OverrideColorInView”). I cannot do both in the same script.

Here is how I attach tags to elements:

Here is how I color the tags:

I cannot figure out how to combine them into one script.

Currently I need to run two scripts to attach tags and to color the tags. I would like to do both in one step. Please let me know if this is possible (without using tags with specific colors). Thanks.

Please note that I had a previous post called “How to Change Tag Color By Element Parameter?” This new post is a question coming out of the previous post.

JC_BL

The tags have to exist before they can have their graphics overridden. This means you need to start a new transaction (Transaction.Start) after creating the tags.

Thanks for the great suggestion! I didn’t know Dynamo has Transaction.

Now I can use something similar to the below script to color the tags right after creating the tags:

Now, I just need to figure out how I can ask the script to use the correct color for the air system of the pieces. But this is a different story. I consider my post has been solved.

JC_BL