How to know if an element parameter is created into the family environment?
The parameter definition has a
BuiltInParameter property that tells you whether it’s built-in or not. If you query the family in the project environment then you won’t be able to differentiate project parameters from family parameters. If that matters to you, you’ll have to query within in the family environment.
that it is not an option for me, I was able to get family parameters with parameterElement type elements query, but I do not know if that parameter is from a family either straight away
Can you show us what you have? It sounds like you have the parameter element but you need to get the definition to see if it’s built-in or not. The only reason you’d need to get in the family environment is if you need to filter out project parameters as well, or just built-in parameters.
I don’t think you can determine that from the
ParameterElement represents the standalone parameter itself, not tied to any element. You have to have the parameter definition from the element to know where the parameter comes from, as it could be assigned at the project level or family level for different elements.
Here is what I was talking about with getting the parameter definition and checking for
BuiltInParameter. Anything that’s
INVALID should be a user defined parameter.
import clr clr.AddReference('DSCoreNodes') from DSCore import * clr.AddReference("RevitNodes") import Revit clr.ImportExtensions(Revit.GeometryConversion) from Revit.Elements import * clr.AddReference('System') from System.Collections.Generic import * clr.AddReference('RevitAPI') from Autodesk.Revit.DB import * clr.AddReference('RevitServices') import RevitServices #The inputs to this node will be stored as a list in the IN variables. dataEnteringNode = IN el = UnwrapElement(IN) params = IN out =  for param in params: type = el.LookupParameter(param).Definition.BuiltInParameter out.append(type) #Assign your output to the OUT variable. OUT = out
In that example you get only project parameters, shared parameters and some MEP calculation inputs builtin; but shared parameters can be located in a family or in the project as well, then how do you know the origin of the parameters? I was thinking to ask if the parameter can hold a formula then it is family parameter for sure but I am annoyed on having to rely on Python at the minute
It does include family parameters. The example I used, FLOW Air, is specifically a family parameter, however it is shared. If you wanted non-shared family parameters, then you’d have to look for family parameters first and then filter out the shared ones. Any parameter defined in the family environment also exists in the project representation of that family. Knowing whether the parameter is defined as a project parameter or a family parameter is what I have been referencing with the family environment. In order to be sure that the parameter is not defined in the project you would have to query the family document. You can have Dynamo do this for you by opening the family in the background.
Here’s an updated version that checks shared vs user-defined. In order to check whether a parameter is project or family defined you just have to check whether it exists in the family document or not.
import clr clr.AddReference('DSCoreNodes') from DSCore import * clr.AddReference("RevitNodes") import Revit clr.ImportExtensions(Revit.GeometryConversion) from Revit.Elements import * clr.AddReference('System') from System.Collections.Generic import * clr.AddReference('RevitAPI') from Autodesk.Revit.DB import * clr.AddReference('RevitServices') import RevitServices #The inputs to this node will be stored as a list in the IN variables. dataEnteringNode = IN el = UnwrapElement(IN) names = IN out =  for name in names: param = el.LookupParameter(name) type = param.Definition.BuiltInParameter if str(type) == "INVALID": if param.IsShared: out.append("Shared") else: out.append("UserDefined") else: out.append("BuiltIn") #Assign your output to the OUT variable. OUT = out
this is a nightmare because same parameter names can be created either by project parameter, family parameter or have same name of a builtin parameter, be also duplicated multiple times; and that python has to choose one of the possibilities, then the parameter ID is the key here, builtin parameters ID are always negative…
You cannot define parameters with duplicate names within the family, only in the project. Which means as long as you’re checking through the family document, you’re fine.
I can get shared parameters either from project or loadable families in same result list, but the parameter itself it is not telling me where is it living in, which I am looking for. I am not going to open any family in the background, discarded forever
As far as I’m aware, that’s the only way to know for sure. Hopefully you’ll prove me wrong though.