I’m trying to change Type, under Family. Not the Symbol parameter since this would change it for all family types in the project. Preferably not using the family type dropdown menu, since this can cause some problems when someone else opens the script with dynamo. Anyone knows how to do this with a code block?
It seems, my solution doesn’t work with levels
I think this will help you:
Python for copy/pasting:
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import BuiltInParameter, FilteredElementCollector
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
el_types = FilteredElementCollector(doc).WhereElementIsElementType().ToElements()
el = UnwrapElement(IN[1])
TransactionManager.Instance.EnsureInTransaction(doc)
for i in el_types:
name = i.get_Parameter(BuiltInParameter.SYMBOL_NAME_PARAM).AsString()
if name ==IN[0]:
type = i
for k in el:
k.ChangeTypeId(type.Id)
TransactionManager.Instance.TransactionTaskDone()
OUT = type