# Automate replacing tags

**URL:** <https://forum.dynamobim.com/t/automate-replacing-tags/28322>\
**Category:** Revit\
**Tags:** revit, dynamo\
**Created:** [November 12, 2018, 10:53am UTC](https://forum.dynamobim.com/t/automate-replacing-tags/28322 "2018-11-12T10:53:08Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![thomas.Dwarka](https://avatars.discourse-cdn.com/v4/letter/t/3d9bf3/32.png) [@thomas.Dwarka](https://forum.dynamobim.com/u/thomas.Dwarka)\
**Post date:** [November 12, 2018, 10:53am UTC](https://forum.dynamobim.com/t/automate-replacing-tags/28322/1 "2018-11-12T10:53:09Z")

</div>

Hi all,

I am new to Dynamo (and Revit) and I have some problems with the script I am trying to make.

Versions:  
Dynamo 1.3.3.4111  
Revit 2017 x64

The situation:  
We have old tags in a revit 2017 model.  
The old tags are without naming so everytime I tag I need to manually do a different tag for the name.  
This is using up a lot of time so we created a new tag with integrated naming.  
The only problem is I need to redo all the tags… because find and replace only works on text.  
(I am not allowed to change/edit the family and be done with it)  
Now am I trying to make a script in Dynamo which will automatically replace all the old tags with the new tags.  
The script I am trying to make will search a view for the old tag and automatically replace them with a new one.

My understanding of Dynamo is limited because I have not worked with Dynamo before.  
In my head I think I have the commands for it but I dont know how to write it down in Dynamo.  
Beacause I dont know what the description of most of the commands are in Dynamo.

So basically what I want to do is this:  
**Select a view \>**  
**See old tags \>**  
**Select old tags \>**  
**Replace old tags with new tags \>**  
**Done?**

Here is an overview of what I have, aka which module I think I need:

 ![Scheme](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/9/6/964c1906fc19590b9b68b35adf0d11aff462e853.png)

Similair questions found:  
I found some questions which look the same but I dont really understand them.

> [@How to change tag family and type?](https://forum.dynamobim.com/t/how-to-change-tag-family-and-type/17781):
>
> Hey, I can’t seem to figure out how to change tag types in general. I found a CW node to change room tag type specifically but that one is for rooms only. Any other attempt fails when I try to change the family and type with any node. I have tried with ID and the family itself. I have to change all the family and type for all the instances of the document. For test I have opened an empty revit and loaded two wall tag family. I want to swap one for the other. At the end it should work with any …

> [@Replacing Door Tags... but within a number of Attached Detail Annotation Group!](https://forum.dynamobim.com/t/replacing-door-tags-but-within-a-number-of-attached-detail-annotation-group/2690):
>
> Hi all, We are designing around 8 highrise apartments with many repetitive units within each respective tower. The problem is when pressed with deadlines users created their own versions of door tags, window tags, etc etc just so they could get the correct graphics standard for Working Drawings. We are due for another revision of drawings just before Christmas. As you might have guessed by now, it’s a big ask if u want to standardise the usage of dedicated Annotation tags across different Revit…

> [@Replace Tag Text by condition](https://forum.dynamobim.com/t/replace-tag-text-by-condition/13824):
>
> Hi! I have read through many of the discussions on and tried many of them too but it still doesn’t seem to work for me. I am very new to Dynamo, but was trying to figure out how to do this for our file. I am trying to replace the pipes tag text from “\_” into “-” according to an Excel file that I have prepared. I’m not sure I’m in the right way… Please help. Thank you all.

Thanks for reading and I hope you can help me.

---

<div class="post-metadata">

**Author:** ![thomas.Dwarka](https://avatars.discourse-cdn.com/v4/letter/t/3d9bf3/32.png) [@thomas.Dwarka](https://forum.dynamobim.com/u/thomas.Dwarka)\
**Post date:** [November 12, 2018, 10:53am UTC](https://forum.dynamobim.com/t/automate-replacing-tags/28322/2 "2018-11-12T10:53:49Z")

</div>

Here is an example of the old and the new tag.  
New users can only post 1 image per post…

 ![examplepng](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/1/f/1f54ea5bf06d9b704daf4edb9cc43716cc6e1bb4.png)

---

<div class="post-metadata">

**Author:** ![Nick\_Boyts](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/nick_boyts/32/76313_2.png) [@Nick\_Boyts](https://forum.dynamobim.com/u/Nick_Boyts)\
**Post date:** [November 12, 2018, 1:33pm UTC](https://forum.dynamobim.com/t/automate-replacing-tags/28322/3 "2018-11-12T13:33:45Z")

</div>

Couldn’t you right-click the old tag, Select All Instances in Entire Project, and change the type to the new tag?

---

<div class="post-metadata">

**Author:** ![thomas.Dwarka](https://avatars.discourse-cdn.com/v4/letter/t/3d9bf3/32.png) [@thomas.Dwarka](https://forum.dynamobim.com/u/thomas.Dwarka)\
**Post date:** [November 12, 2018, 1:37pm UTC](https://forum.dynamobim.com/t/automate-replacing-tags/28322/4 "2018-11-12T13:37:31Z")

</div>

Yes, but I want it for specific views.

---

<div class="post-metadata">

**Author:** ![Nick\_Boyts](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/nick_boyts/32/76313_2.png) [@Nick\_Boyts](https://forum.dynamobim.com/u/Nick_Boyts)\
**Post date:** [November 12, 2018, 1:47pm UTC](https://forum.dynamobim.com/t/automate-replacing-tags/28322/5 "2018-11-12T13:47:08Z")

</div>

So you’re not changing _all_ the old tags, only those in specific views…

I would start with a node that gets all elements of a category in a specified view (MEPover and Archilab both have one.) Get all the tags in your view and their type. Check this list against your Old Tag type and filter those elements with Filter.ByBoolMask. Now use Element.SetParameterByName to change the type to the New Tag.

---

<div class="post-metadata">

**Author:** ![thomas.Dwarka](https://avatars.discourse-cdn.com/v4/letter/t/3d9bf3/32.png) [@thomas.Dwarka](https://forum.dynamobim.com/u/thomas.Dwarka)\
**Post date:** [November 20, 2018, 8:30am UTC](https://forum.dynamobim.com/t/automate-replacing-tags/28322/6 "2018-11-20T08:30:55Z")

</div>

Hey Nick,

Thanks for all the help.  
I figured it out.  
I now got a working script to change tags level by level.  
Its not fully stable but it works.  
For those who are interested in the script:  
[Auto replace tags by level.dyn](https://forum.dynamobim.com/uploads/short-url/sKENdf1A88d4yoT5ZuHgcYV8rOk.dyn) (33.1 KB)  
These are the packages I have installed I used some of them.

 ![Auto%20replace%20tags%20level%20by%20level%20package%20usage](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/2/7/27b6757fc8b5b094237ab92da2b43e4367666ca0.png)  
(I dont know how to make an overview of which packages I used in this script.)  
Thanks for your help.

---

<div class="post-metadata">

**Author:** ![Revit\_Noob](https://avatars.discourse-cdn.com/v4/letter/r/a587f6/32.png) [@Revit\_Noob](https://forum.dynamobim.com/u/Revit_Noob)\
**Post date:** [November 20, 2018, 8:44am UTC](https://forum.dynamobim.com/t/automate-replacing-tags/28322/7 "2018-11-20T08:44:33Z")

</div>

What package is Tag Get Location?

---

<div class="post-metadata">

**Author:** ![thomas.Dwarka](https://avatars.discourse-cdn.com/v4/letter/t/3d9bf3/32.png) [@thomas.Dwarka](https://forum.dynamobim.com/u/thomas.Dwarka)\
**Post date:** [November 20, 2018, 8:46am UTC](https://forum.dynamobim.com/t/automate-replacing-tags/28322/8 "2018-11-20T08:46:24Z")

</div>

MEPover

---

<div class="post-metadata">

**Author:** ![Revit\_Noob](https://avatars.discourse-cdn.com/v4/letter/r/a587f6/32.png) [@Revit\_Noob](https://forum.dynamobim.com/u/Revit_Noob)\
**Post date:** [November 20, 2018, 8:56am UTC](https://forum.dynamobim.com/t/automate-replacing-tags/28322/9 "2018-11-20T08:56:49Z")

</div>

Thanks… and thanks for sharing the code

---

<div class="post-metadata">

**Author:** ![thomas.Dwarka](https://avatars.discourse-cdn.com/v4/letter/t/3d9bf3/32.png) [@thomas.Dwarka](https://forum.dynamobim.com/u/thomas.Dwarka)\
**Post date:** [November 20, 2018, 8:57am UTC](https://forum.dynamobim.com/t/automate-replacing-tags/28322/10 "2018-11-20T08:57:25Z")

</div>

No problem, happy to help the community.
