Hide a Tag by its Value

Is there a way to create a script in Dynamo that can hide a tag based on its value? For example I created a shared parameter for the extension of a duct elbow. Then I made a tag for the parameter. What I would like dynamo to do is hide all tags for this parameter that equal 0".

@chansenT6MPV

  • if your tag is very simple, just a number, then you can access it TagText (string) to see if it’s “0”. Or you can just get the hosts from tags then access the parameter values to see if they are equal to 0. Filtering them.

  • iterate through the views where u want ur tags to be invisible, hiding them by View.HideElements.

My tag has a prefix of ST and then the value. So if the value is 0" the tag reads ST0". The next problem is I am not where to begin with Dynamo. Would you have a sample script that I could look at for starters?

@chansenT6MPV
Hide_Tag_Based_On_TagText.dyn (13.4 KB)

basically, the idea is to filter tags based on TagText property then hide them in views. (I just hided them in current view.)

Before:


After:
image

@chansenT6MPV

check this:
https://primer.dynamobim.org/06_Designing-with-Lists/6-2_working-with-lists.html

And I think this entire guide is worth learning and friendly to starters.

Hi @chansenT6MPV,

Please have a look at the script below:

-Biboy

I think I set up the script like you showed but I am getting an error. See attached.

Would it be easier just to create a script that only tags the non-0 elements?

@chansenT6MPV
It works fine for me as long as the selection contains Tags only. how about replacing Select Model Elements to Tag Category => All Elements Of Category to retrieve all tags in your document.

Your selection contains Duct?

Here is a short screen cast of what is happening when I run this dynamo script. I also posted a sampe revit project.