I am working on something that involves parsing a model from Revit and extracting the properties and parameters for elements and just had a couple of questions.
Firstly, I have noticed there are many parameters that are sent over, some of which it is hard to tell where they came from. Whilst it’s easy to tell what is a shared parameter, is there any way to tell where the other parameters are from e.g project parameters, family parameters etc. ?
Also, some of the parameters seem to have a value that corresponds to their id rather than their actual value. For example, in the image provided you can see that on the element level there is a phaseCreated attribute with the value Existing. PHASE_CREATED is also present in the parameters but the value is ‘12589’.
Is there any way to tell which parameters will have the actual values vs which parameter values are just ids? And if a parameter value is an id, is there any way to do a lookup to get the value for that parameter.
Thanks for the good question, as part of 2.16 we’ve included additional parameters when sending from Revit and I understand it can be confusing.
Here’s a quick explanation of how to distinguish among them:
shared parameters: their parameter name is a guid (their text name is localized and not consistent)
instance parameter: their isTypeParameter field is set to false
type parameters: their isTypeParameter field is set to true
Example shared parameters:
Example instance parameter:
When a parameter value is of type element in the Revit API, we’re currently only extracting its internal Revit Id; this is because there is no consistent logic we can use to extract the appropriate value.
Since we know this is not always useful outside Revit, in specific cases, such as the PHASE_CREATED we have also, explicitly added the phase name to the top-level Speckle element:
Please do let us know if you encounter more cases like these and we can look into “promoting” other parameters to the top-level element.
The type of each parameter value is currently not included in the parameter definition, but we could add it according to their ParameterType Enumeration.