I have been trying this over and over again, and can’t seem to get it to work. I am working on a tool that should add wall tags to certain walls, however, I’m having trouble with the IndependentTag.Create() method. Below is my code (in python). I recycled this code from another tool that tags different element types and works just fine, so I’m pretty sure the syntax is correct:
families = DB.FilteredElementCollector(doc).OfCategory(DB.BuiltInCategory.OST_WallTags).OfClass(DB.FamilySymbol).ToElements()
for fam in families:
if fam.Family.Name == "MyTagName":
tag = fam
break
tag = DB.IndependentTag.Create(doc, tag.Id, view.Id, DB.Reference(wall), True, DB.TagOrientation.Horizontal, mid_point)
I keep getting this error:
Solved! Go to Solution.
I have been trying this over and over again, and can’t seem to get it to work. I am working on a tool that should add wall tags to certain walls, however, I’m having trouble with the IndependentTag.Create() method. Below is my code (in python). I recycled this code from another tool that tags different element types and works just fine, so I’m pretty sure the syntax is correct:
families = DB.FilteredElementCollector(doc).OfCategory(DB.BuiltInCategory.OST_WallTags).OfClass(DB.FamilySymbol).ToElements()
for fam in families:
if fam.Family.Name == "MyTagName":
tag = fam
break
tag = DB.IndependentTag.Create(doc, tag.Id, view.Id, DB.Reference(wall), True, DB.TagOrientation.Horizontal, mid_point)
I keep getting this error:
Solved! Go to Solution.
Solved by dgoff96. Go to Solution.
I wound up solving this myself. Somehow, the tag.Id was getting changed somewhere along the way (not sure how as I couldn't find anywhere in my loop where it would have been changed). Anyway, I just made sure to get the Id explicitly when I search for the correct Family Symbol. Then it worked just fine.
I wound up solving this myself. Somehow, the tag.Id was getting changed somewhere along the way (not sure how as I couldn't find anywhere in my loop where it would have been changed). Anyway, I just made sure to get the Id explicitly when I search for the correct Family Symbol. Then it worked just fine.
my guess would be the break in your for loop was causing tag to be nullified, not sure if you can do this in python, but c# i would use continue vs break for that reason.
my guess would be the break in your for loop was causing tag to be nullified, not sure if you can do this in python, but c# i would use continue vs break for that reason.
Can't find what you're looking for? Ask the community or share your knowledge.