Placing Annotation Symbol

Hi,

I am trying to place an annotation symbol through the API.

I have tried both:

new_tag = doc.Create.NewFamilyInstance(XYZ(0,0,0),
                                       tag_family,
                                       doc.ActiveView)

new_tag = doc.Create.NewFamilyInstance(XYZ(0,0,0),
                                       tag_family,
                                       StructuralType.NonStructural) 

These resulted in the error:
TypeError: expected FamilySymbol, got AnnotationSymbol

Is there an other method for placing annotation symbols?

Hi @marentette,
try the IndependentTag Create method https://apidocs.co/apps/revit/2019/e52073e2-9d98-6fb5-eb43-288cf9ed2e28.htm & https://apidocs.co/apps/revit/2020/1f622654-786a-b8fd-1f81-278698bacd5b.htm
it changed between 2017 and 2018 revit api. Before it was something like NewTag

1 Like

Thanks, but there is no reference element. The variable ‘tag_family’ is a generic annotation not a tag to reference an other element. Found my issue.

doc = uidoc.Document 
collector = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_GenericAnnotation).OfClass(FamilySymbol)
tag_family = [i for i in collector if i.FamilyName == 'tag_family - Generic Annotation'][0]

with db.Transaction(doc=doc, name="Place Anno Symbol"):
    new_tag = doc.Create.NewFamilyInstance(XYZ(0,0,0),
                                           tag_family,
                                           doc.ActiveView)