Hi,
Can anybody help me with adjusting a (python) node from Crumple Package (@GavinCrump)?
The node is ‘ParameterReplaceShared’ and the total script is from this tutorial from him:
I’m having to replace all of my shared parameters.
I have the script working with one family at the time.
Now I want to adjust the script for batch processing all of my families.
I’m running into a problem with the node ParameterReplaceShared where it reconizes my sublists input (seperate revit families) but the output, i think, is still using the ‘current document’ i have opened.
I believe the python script within that node isn’t written for multiple entries and/or working with sublists.
# Made by Gavin Crump
# Free for use
# BIM Guru, www.bimguru.com.au
#Credit to Joshua Budarick for his assistance with this workflow!
# https://www.linkedin.com/in/joshua-budarick-9bb50b4b/
# 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
inputdoc = IN[0]
if inputdoc == None:
doc = DocumentManager.Instance.CurrentDBDocument
elif inputdoc.GetType().ToString() == "Autodesk.Revit.DB.Document":
doc = inputdoc
else:
doc = DocumentManager.Instance.CurrentDBDocument
# Functions
def uwlist(input):
result = input if isinstance(input, list) else [input]
return UnwrapElement(input)
#unwrap all elements to use with API
params = uwlist(IN[1])
names = uwlist(IN[2])
params_new, names_new = [],[]
# Collect values
if doc.IsFamilyDocument:
# "Start" the transaction
TransactionManager.Instance.EnsureInTransaction(doc)
for p,n in zip(params, names):
try:
new = doc.FamilyManager.ReplaceParameter(p, n, p.Definition.ParameterGroup, p.IsInstance)
params_new.append(new)
names_new.append(n)
except:
params_new.append(None)
names_new.append(None)
# "End" the transaction
TransactionManager.Instance.TransactionTaskDone()
OUT = [params_new, names]
else:
OUT = ["Document is not a family.",""]