Hello Dynamo Friends
I managed to create new viewport types by duplicating existing ones.
Now i want to set the title annotation family for that type.
Would really appreciate any information and help on this topic.
Kind regards
def duplicate_viewport_type():
uidoc = __revit__.ActiveUIDocument
doc = uidoc.Document
builtInParameter = BuiltInParameter.SYMBOL_FAMILY_NAME_PARAM
rule = ParameterFilterRuleFactory.CreateEqualsRule(ElementId(int(builtInParameter)), "Viewport", False)
filter = ElementParameterFilter(rule)
viewport_types = FilteredElementCollector(doc).WhereElementIsElementType().WherePasses(filter)
duplicated_viewport_type = None
for viewport_type in viewport_types:
transaction = Transaction(doc, "Duplicate Viewport Type")
transaction.Start()
try:
name_parameter = viewport_type.get_Parameter(BuiltInParameter.SYMBOL_NAME_PARAM)
name = name_parameter.AsString()
duplicated_viewport_type = viewport_type.Duplicate(name + " copy")
print("Viewport type '{}' duplicated successfully.".format(name))
transaction.Commit()
break
except Exception as e:
transaction.RollBack()
print("Failed to duplicate viewport type.\nError: {}".format(e))
return duplicated_viewport_type
viewport_type = duplicate_viewport_type()