IndependentTag grabber code error: An internal error has occurred

IndependentTag grabber code error: An internal error has occurred

Anonymous
Not applicable
1,328 Views
3 Replies
Message 1 of 4

IndependentTag grabber code error: An internal error has occurred

Anonymous
Not applicable

I created a custom Python code that pulls the TagText from IndependentTags in the drawing:

 

# Import modules and clear references
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
clr.AddReference('RevitAPIUI')
from Autodesk.Revit.UI import *

# variables
doc = __revit__.ActiveUIDocument.Document

# Create a class to grab wall, from active doc,
# and filter out un-wanted types
tags_bin = (FilteredElementCollector(doc).
      OfClass(IndependentTag))

# Ittereate over tags and collect the names
list_tags = list() # variable to hold the strings
tags_bin = list(tags_bin)
for tags in tags_bin:
    temp = tags.TagText
    print(temp)
    list_tags.append(temp)

# pritn results
print(list_tags)

When I run the code, it grabs some of the TagTexts but then it gives me this error message.

 

python_pic2.PNG

 

Using Revit Lookup, an Add-in, I discovered that more than half of the IndependentTags has this error message with the TagText.

python_pic1.PNG

 

I had a friend of mine tried recreated it in C# and it still gives the same error message. Don't know how to fix this and any advice would be appreciated.

Running on Revit 2018.3 and using IronPython 2.7.7.

0 Likes
1,329 Views
3 Replies
Replies (3)
Message 2 of 4

jeremytammik
Autodesk
Autodesk

Glad to hear that the previous answer helped, and you can now access some of the desired tag text:

 

https://thebuildingcoder.typepad.com/blog/2019/08/new-pc-klh-snoop-annotations-and-vertices.html#4

 

Apparently, some tags use TagText and some do not.

 

Good to hear that you are using RevitLookup to explore the model and the tag properties.

 

I suggest you continue with that.

 

I assume that the text you are after is provide by some different property or relationship in the tags that are not using TagText.

 

Good luck hunting them down, and please let us know where you find them. Thank you!

 

Best regards,

 

Jeremy

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes
Message 3 of 4

Anonymous
Not applicable

Did a little digging and found out that the error occurs when the code tries to grab a TagText from a link model. The same issue as the one describe in the link below:

https://forums.autodesk.com/t5/revit-api-forum/revit-bug-in-independenttag-tagtext-with-link-model/m...

 

 

 

0 Likes
Message 4 of 4

jeremytammik
Autodesk
Autodesk

We recently successfully resolved the task of tagging a linked element:

 

https://thebuildingcoder.typepad.com/blog/2019/05/tagging-a-linked-element.html

 

Therefore, it would be rather strange if we could not also read the tag text back again.

 

I hope this helps.

 

Best regards,

 

Jeremy

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes