I’m trying to find a way automate the conversion of a bunch of SharedParameters in a bunch of families to equivalent FamilyParameters. I would usually do this manually through the parameter properties of the family. (note i though i should also point out this script to be run while in the family editor, not a project)
So far I’ve managed to use a python node to get the properties I think i need from all the parameters in the family editor. I can then filter down to the shared parameters with a boolmask but am but i have no idea where to start in translating the syntax mentioned in the APIdocs into another python node (i have extremely limited knowledge of coding). Any help would be appreciated
Thanks erfajo,
I have used the some of the orchid package before, great work by the way. However none of the parameter nodes have the ability to change the parameter property I’m after.
Theoretically i could make duplicate family parameters of the shared parameters with the orchid package, assign the same values from the shared parameters to the new family parameters but then i would also need get all instances where that parameter is used in the family(dimensions, materials, visibility, associated etc) and swap the shared parameter for the new family parameter.
I’m trying to avoid the extra steps by accessing the existing parameter properties directly. Which i think should be possible through the API.
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
# Import DocumentManager and TransactionManager
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
doc = DocumentManager.Instance.CurrentDBDocument
dataEnteringNode = IN
#unwrap all elements to use with API
elements = []
newlist = list()
namelist = list()
for i in IN[0]:
elements.append(UnwrapElement(i))
# "Start" the transaction
TransactionManager.Instance.EnsureInTransaction(doc)
for i in elements:
originalName = i.Definition.Name
new = doc.FamilyManager.ReplaceParameter(i, i.Definition.Name + " - temp",
i.Definition.ParameterGroup, i.IsInstance)
doc.FamilyManager.RenameParameter(new, originalName)
newlist.append(new)
namelist.append(new.Definition.Name)
# "End" the transaction
TransactionManager.Instance.TransactionTaskDone()
OUT = (newlist, namelist)