Adjusting Python node for multiple families as input (sublists)

Generally to solve situations like this I turn to Python vs using my custom nodes, many of them are designed to work across one document currently.

This seems to work for replacing shared parameters with others in multiple families. The new parameters cannot be in the document as well or it will fail (I haven’t added all the try/except safeguards), and they must exist by name in the active shared parameter file.

I do not have time to customize it to fringe cases for people, but hopefully it’s helpful anyway. If you’re not familiar with Python these types of workflows are usually a good time to begin learning it as well.

# Made by Gavin Crump
# Free for use
# BIM Guru, www.bimguru.com.au

# Boilerplate text
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *

clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

#Inputdoc : Part of script by Andreas Dieckmann
docs = IN[0]

#unwrap all elements to use with API
param_lists = IN[1]
names_lists = IN[2]
def_lists = IN[3]

param_lists_out = []

# Collect values
for doc,plst,nlst,dlst in zip(docs,param_lists,names_lists, def_lists):
	
	param_list_out = []
	
	for p,n,d in zip(plst,nlst,dlst):
		
		# Start a transaction
		trans = Transaction(doc, 'replace parameter 1')
		trans.Start()
		
		# Replace parameter
		fam = doc.FamilyManager.ReplaceParameter(p, n, p.Definition.ParameterGroup, p.IsInstance)
		shp = doc.FamilyManager.ReplaceParameter(fam, d, fam.Definition.ParameterGroup, fam.IsInstance)
		
		param_list_out.append(shp)
		
		# Close a transaction
		trans.Commit()
		TransactionManager.Instance.ForceCloseTransaction()

	param_lists_out.append(param_list_out)

OUT = param_lists_out

Bulk replace paramameters (shared to shared).dyn (51.1 KB)

Sample files here: