How to Change Tag Color By Element Parameter?

I am trying to use Dynamo script to assign tags to ductwork (Revit MEP). And I would like to assign the color to the tags to match the air-system where the ductwork is in. For example, I would like to assign green color to tags to ductwork in “Exhaust Air” system, blue to tags to ductwork in "Supply Air: system, and so on…

I can do this by creating duplicated tags for each air system. For example, for showing duct length, I could have 4 different tags, like these:
MY_Duct_Length_(SA) ← for Supply Air
MY_Duct_Length_(EX) ← for Exhaust Air
MY_Duct_Length_(RA) ← for Return Air
MY_Duct_Length_(MA) ← for Make-up Air

But then there will be a lot of duplicated areas in my Dynamo Script. For example, in the attached simplified Dynamo script, the group shown in blue is for adding tags to a straight duct that is in Supply Air system:

If I had to use duplicated tags (one tag for one color), I would have to duplicate the group in blue for 3 more times (for Exhaust Air, Return Air, and Make-up Air). This seems like a lot of duplicated coding.

I wonder if I can ask the tag to show the color based on a “shared parameter” of a duct. Let say I create a shared parameter called MY_Tag_Color. I can use Dynamo script to determine the color and save the color into the shared parameter of each duct. The problem is that I don’t know how to ask the tag to use the color in the shared parameter.

I read another forum post about someone puts multiple labels inside a tag, each label has a different color, and then assigns under-strike characters to the labels that he doesn’t want to show. Effectively only show the label that has the correct color. That seems to work. But I have a feeling that this is more like a “hack”. I am wondering if there is an easy way.

If there is no other way, please also let me know. Then I will go ahead to stick with the “duplicated tags” approach.

Thanks in advance for any information.

JC_BL

Have you looked at possibly using view filters? That may give you more control and flexibility.

1 Like

It sounds like you need a dictionary to define the color based on system type. Then you can just apply the override to your full list of tags.

Thanks for replying.

I can use View Filter to assign the correct color to the duct body (by adding 4 filters and then overriding the color for “lines” in Filters page in in View/Graphics). But those filters setting don’t seem to have any effect on the tag color. The tag color remains to be black. May be this has to do with the fact that the tag color has already been defined to use black color in “Type Properties” of the tag family file? But I don’t seem to have a way to tell the tag to follow the view-filter.

I believe the problem may have to do with tag is not shown as something that can be filtered in a Filters definition:

If this is true, even if I manage to add a shared parameter to a tag to specify the tag color (or to add the air system name to the shared parameter), I still cannot use the shared parameter in the filter.

May be I am missing something?

JC_BL

1 Like

You’re correct. Tags are not available to view filters. You will have to override the graphics in view or use a specific tag (type) for each system.

2 Likes

Apologies for misleading you. I didn’t realize that annotations couldn’t be controlled by view filters.

No need to apology. I didn’t even know View-Filter until you mentioned this. A draftsman has created a drawing template that has view filters already defined; but I didn’t know this; I thought the duct-body-color-change-to-match-air-system was “magic”. Thanks for bringing this up. I learn something new every day.

JC_BL

1 Like

OK. I will stick with the one-tag-for-one-air-system approach then.

Thanks for the confirmation.

JC_BL

Hi @JC_BL genius loci have some ovveride nodes there do it but as @Nick_Boyts say only in view

1 Like

The nice thing about tags is they’re already view specific. So you would just get the tag and apply the override to the owner view. No need to replicate the override for multiple views.

@JC_BL, however, if you’re willing to select the appropriate tag type for each selection you don’t have to worry about running a Dynamo graph to get the results you want. Just depends on what you’re willing to do.

1 Like

Despite what I said, I end up using the “override the graphics” approach – that is to select the tags of the duct that are supposed to be in one air system, and then use Element.OverrideColorInView to color the tags according to the air system.

We end up using two Dynamo scripts: (1) Assign tags to ductwork but not coloring the tags (2) Color the tags of ductwork according to which air system they are in.

The reasons of changing to this approach instead of using tags that are specific to each air system are: (1) We would have to keep duplicated set of tags - one set for each air system, not good. (2) The Dynamo script would have been 5 times as big (to support 5 air systems). (3) Regardless if we assign the tags and color them in one script or not, we still need to use the second Dynamo script to color the tags; the reason is that there are some other tags that are not part of the original Dynamo script (that assigns tags to ductwork); those other tags also need to be colored; because we need the second script anyway, we may as well keep using it for coloring just to be consistent.

I mention this just in case someone wants to do a similar thing, and that person may want to know the pros and cons of either approach.

JC_BL