identifying orphaned tags…and Dynamo bugs

Image by sodatwist143

This is an old topic. Actually, it’s 2 years old at this point, but just like Autodesk software, it hasn’t really changed much since. 😜

About 2 years ago, a user on the Dynamo Forum, asked about being able to identify Orphaned tags and being able to create a list of views that contain them, so that they could “clean up”. Well, little you know, but I got involved, and once involved, I could not just let it go. I tried, believe me, I did:

It’s just not that easy to admit that one has been defeated, and let it go, especially that there was someone on the other end still waiting for a solution…yeah, two years later. Like all Autodesk customers, they “stayed on the line” for 2 years, hoping that someone would help them out.

Image result for please stay on the line meme

Anyways, two years ago I did some digging and thought that you can identify orphaned tags by simply checking their TagText property. If it had empty string or “???” in it, it meant that it was not reading the property it was supposed to and was orphaned. However, after the OP posted his model, and we realized the issue was really around the Material Tags, Mark A. made it clear to me that a solution based on Tag Text was not going to fly because Material Tags always have it empty. Yeah, I know, that Revit software is just great. Category tags pass the value from a Parameter into TagText property, but Material Tags don’t. Great. What do we do now?

It turns out that we can sort them out by getting their BoundingBox, and then measuring the distance from Tag’s text position to the nearest point on the BoundingBox. If tag is showing just a “?”, its position will be much closer to the edge than any other value, unless of course its a one letter tag. Technicalities aside, if someone is naming their materials with just one letter, I think they might have a bigger issue than identifying orphaned tags.

Ok, so we started with a custom collector (Python node). Why? It’s because as Mark A. has pointed out so accurately here: Link you cannot select – not an orphaned tag – but rather a tag who’s tagging an element in a linked document. It’s the ElementWrapper issue, that’s returning nulls. We can however simply return Ids instead, and perhaps we have to do some gymnastics to allow certain nodes to accept element ids instead of typical element objects. Dynamo is such a pain, but I learned to not bother asking Autodesk for solutions. I just don’t have the patience to wait around for a decade. So we do this instead:

Now, that we are only passing Ids (integer values) around, I had to add some new nodes to to make this work. First thing that I did was to recognize that we are dealing with potentially three (3) distinct solutions for three (3) different types of tags:

  • tags tagging linked elements – cannot be wrapped into Dynamo objects, have IsOrphaned property that works well
  • material tags – can be wrapped, but doesn’t have TagText property and IsOrphaned is not returning proper values
  • all other tags – can be wrapped, has TagText property and IsOrphaned also doesn’t return proper values

First we deal with tags tagging linked elements. Since we know their IsOrphaned property works well, we can simply use that:

Next up, we can deal with tags that are not Material Tags. They have the TagText property so we can evaluate that pretty easily:

Finally we have the Material Tags. These require a special approach. We can get their BoundingBox-es, and TagHeadPosition to measure their distance to the nearest corner of the BoundingBox Outline:

Once we have that we can isolate ones that are less than 0.2 feet from the edge, and those are our orphaned Material Tags:

One last thing to do would be to get a list of Views and tags for each view that are orphaned:

I do have to admit that in order to make this work, I had to add bunch of new nodes to the package, but it was fun. I hope that the two (2) year long wait was not for nothing, and that this will help.

All custom nodes can be found on the Package Manager:

As always you can download the sample file, by becoming a Patron on the Patreon page for Please see the link below.


Ps. I know we have a little solution above for identifying Orphaned tags that are tracking elements in the linked models, but so does Revit out of the box:

It’s under Reconcile Hosting button when you select a tag. It will allow you to track them all. Please use that instead of reinventing the wheel.

Support archi-lab on Patreon!

Leave a Comment