hello I am wondering, how to know if the built-in parameters of a list are Type parameters, Instance Parameters, Family Parameters, Global Parameters, Shared Parameters?
I am able to get the built-in parameters but I do not know where they sit on elements.
Sean Page, 2021
import clr
clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *
from Autodesk.Revit.DB.Structure import *
clr.AddReference('RevitAPIUI')
from Autodesk.Revit.UI import *
clr.AddReference('System')
from System.Collections.Generic import List
clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.ImportExtensions(Revit.Elements)
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
uidoc=DocumentManager.Instance.CurrentUIApplication.ActiveUIDocument
#Preparing input from dynamo to revit
element = UnwrapElement(IN[0])
#Do some action in a Transaction
TransactionManager.Instance.EnsureInTransaction(doc)
bindings = doc.ParameterBindings
defs = []
inst = []
types = []
it = bindings.ForwardIterator()
while(it.MoveNext()):
d = it.Key
b = it.Current
defs.append(d)
if b.GetType() == InstanceBinding:
inst.append("Instance")
else:
inst.append("Type")
#if doc.GetElement(d.Id) is SharedParameterElement:
# types.append("Shared")
#else:
# types.append("Project")
TransactionManager.Instance.TransactionTaskDone()
OUT = defs,inst,types
Hello
if we only refer to the BuiltInParameter I don’t think we can easily determine the type of each parameter from the enumeration (maybe with a filter and FilteredElementCollector)
for example
BuiltInParameter.OMNICLASS_DESCRIPTION → Family
my real intention is to get all existing Revit parameters sorted and grouped by type, instance. I am annoyed that in any new Revit version that can change and I do not know what is new to compare.
There are multiple ways to determine if a parameter is builtin. Best to start a new thread on the specific issue you’re having, complete with expectations and efforts so far.
@Nick_Boyts i have succeeded collecting the built in parameters but im facing the same challenge as @RubenVivancos which is determining if each builtin parameter is instance or type.
the problem is that builtin parameters can be type in some elements and instance in another elements, like Length or Width. i have a work around but i dont really like it…
in the code block i have used (x.Parameters) to get all the parameters of all alements, then i have extracted the names and used the unique values.
after that i have collected all builtin parameters using the clockworks node (BuiltInParameters).
if the name of the built in parameter is in the x.Parameters list then it will be instance otherwise it is a type.
*using x.Parameters on an element gives the instance parameters but when we use it on elementType we get the type parameters.
Correct. You have to use the relationship to the element instance or type in order to determine how builtin parameters are defined at a relative level. This just isn’t something that’s defined in the parameter definition.
Again, if you have any additional questions or want to continue the discussion, it’s best to start a new thread since this one is more than 3 years old.