Change SharedParameter to FamilyParameter

Hi all,
long time reader first time poster!

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)

After a brief look through the API I think this should be possible…

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 :slight_smile:

I have nodes in my package for parameters in families… you can try if these can help you

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.

sure it is possible no doubt… You are welcome to file it on my github page as a wish for e new node. Then I will put it into my workflow :slight_smile:

Thanks will do.

After a few tries i managed to get something working.
Python node below for anyone else attempting the same thing.

import clr
from Autodesk.Revit.DB import *

# Import DocumentManager and TransactionManager
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

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]:

# "Start" the transaction

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)
# "End" the transaction

OUT = (newlist, namelist)
1 Like

@Josh it would be nice if you could post & format your code so we don’t have to retype it :wink:

no worries. I’ve added the code to the post above.

1 Like

I have released a node that convert shared parameters to family parameters, there cleans everyting up when converting…

1 Like