Associate family parameter in a family

This is extremely puzzling, lol. I wouldn’t think the version difference would be an issue either but it is the only thing I did differently. I ran it again to double check that I hadn’t just overlooked some that weren’t associating, but it certainly associated all of them. I’m not sure what exactly would cause that – maybe try this below to see if any of the elements are in fact not returning parameters. Not sure if that will help us get anywhere with it though, but I’d imagine that must be what is happening?

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

clr.AddReference('RevitNodes')

import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.ImportExtensions(Revit.Elements)

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

doc = DocumentManager.Instance.CurrentDBDocument

elem = UnwrapElement(IN[0])
paramNames = IN[1]
famNames = IN[2]

if not isinstance(paramNames, list):
	paramNames = [paramNames]
if not isinstance(famNames, list):
	famNames = [famNames]
famParams = doc.FamilyManager.Parameters
#tester =[]
elemP = []
famP = []
for e in elem:
	elemParams = e.Parameters
	
	elemAssoc = []
	famAssoc = []
	
	for param in elemParams:
		for name in paramNames:
			if param.Definition.Name == name:
				elemAssoc.append(param.Definition.Name)
	
	for fparam in famParams:
		#tester.append(fparam.Definition.Name)
		for fname in famNames:
			if fparam.Definition.Name == fname:
				famAssoc.append(fparam.Definition.Name)
	elemP.append(elemAssoc)
	famP.append(famAssoc)

	

OUT = zip(elem,elemP,famP)
1 Like