Review all non-BuiltinParameters in element

Hi all, I’m looking for a method to review all user-defined parameters in loaded families. Looking at these it appears these all return a value ‘INVALID’ when tapping the BuiltinParameter value although I cant seem to find a means to filter these based on this result. Any ideas as to how to filter out only user-defined parameter values?

I believe that the GeniousLoci Node has the information you are looking for and more :wink:

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

clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.Elements)

clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application
version=int(app.VersionNumber)

if isinstance(IN[0], list) : elements = UnwrapElement(IN[0])
else : elements = [UnwrapElement(IN[0])]

params= []

for elem in elements:
	doc=elem.Document
	params=elem.GetOrderedParameters()
	pname, guid, pgroup, ptype, visible, userCreated, builtInParam, utype, dutype, stype,isshared,isreadonly, usermodifiable, hasvalue, value= [],[],[],[],[],[],[],[],[],[],[],[],[],[],[]
	for param in params:
		defi = param.Definition
		pname.append(defi.Name)
		try:guid.append(param.GUID)
		except: guid.append(None)
		pgroup.append(LabelUtils.GetLabelFor(defi.ParameterGroup))
		if version < 2022:
			ptype.append(defi.ParameterType)
		else:
			if SpecUtils.IsSpec(defi.GetDataType()):
				ptype.append(LabelUtils.GetLabelForSpec(defi.GetDataType()))
			else: ptype.append("Invalid")
		visible.append(defi.Visible)
		isBuiltIn = defi.BuiltInParameter
		if isBuiltIn != BuiltInParameter.INVALID :
			userCreated.append(False)
		else: userCreated.append(True)
		builtInParam.append(isBuiltIn)
		if version < 2022:
			utype.append(defi.UnitType)
			try: dutype.append(param.DisplayUnitType)
			except: dutype.append(None)
		else: 
			try:utype.append(UnitUtils.GetTypeCatalogStringForSpec(defi.GetDataType()))
			except : utype.append(None)
			try: dutype.append(UnitUtils.GetTypeCatalogStringForUnit(param.GetUnitTypeId()))
			except: dutype.append(None)
		stype.append(param.StorageType)
		isshared.append(param.IsShared)
		hasvalue.append(param.HasValue)
		if param.StorageType == StorageType.ElementId :
			if param.AsElementId().IntegerValue >0:
				value.append(doc.GetElement(param.AsElementId()))
			else: 
				value.append(param.AsValueString())
		#elif param.StorageType == StorageType.Integer : 
		#	value.append(param.AsInteger())
		#elif param.StorageType == StorageType.Double : 
		#	value.append(param.AsDouble())
		else :
			val = param.AsValueString()
			if val == None :
				val2 = param.AsString()
				value.append(val2)
			else:
				value.append(val)
		isreadonly.append(param.IsReadOnly)
		usermodifiable.append(param.UserModifiable)
	
OUT = params, pname,guid,pgroup,ptype,utype,dutype,stype,visible,builtInParam,userCreated,isshared,isreadonly,usermodifiable,hasvalue,value
1 Like