So, here I am working happily along... until... I try to get parameters from certain elements.
I started erroring out with code that had worked previously in other circumstances and got to digging around and I believe that I have found a "Missing" BuiltInParameter.
I found this one while examining Material PropertySetElements.
Here is the ID: -1140313
Here it is in the context of an output text file:
Definition IS Built-in: -1140314 : Concrete compression : autodesk.revit.parameter:phyMaterialParamConcreteCompression-1.0.0
Forge Data Type: autodesk.spec.aec.structural:stress-2.0.0
Is Spec : True
Spec Display Name: Stress
Is Measurable Spec? : True
Forge Unit Type ID : autodesk.unit.unit:kipsPerSquareInch-1.0.1
Unit Display Name: Kips per square inch
Definition Group: -5000105 : PG_MATERIALS : Materials and Finishes
Is User Visible: True
Can Vary in Groups: False
Built-in Param: -1140314 : PHY_MATERIAL_PARAM_CONCRETE_COMPRESSION : Concrete compression
Is Read Only? : False
Is User Modifiable? : False
Double Value: 7355327.080352
Value String: 3.50 ksi
!! Cannot retrieve Parameter: -1140313
Definition IS Built-in: -1140312 : Thermal expansion coefficient Z : autodesk.revit.parameter:phyMaterialParamExpCoeff3-1.0.0
Forge Data Type: autodesk.spec.aec.structural:thermalExpansionCoefficient-2.0.0
Is Spec : True
Spec Display Name: Thermal Expansion Coefficient
Is Measurable Spec? : True
Forge Unit Type ID : autodesk.unit.unit:inverseDegreesFahrenheit-1.0.1
Unit Display Name: Inverse degrees Fahrenheit
Definition Group: -5000105 : PG_MATERIALS : Materials and Finishes
Is User Visible: True
Can Vary in Groups: False
Built-in Param: -1140312 : PHY_MATERIAL_PARAM_EXP_COEFF3 : Thermal expansion coefficient Z
Is Read Only? : False
Is User Modifiable? : False
Double Value: 1E-05
Value String: 0.00001 1/°F
And here is a clip from a text file created by a function that gets all BuiltInParameters by iterating the Enumeration:
-1140315 Enum Name: PHY_MATERIAL_PARAM_BENDING_REINFORCEMENT
- Display Name: Bending reinforcement
- Storage Type: Double
-1140314 Enum Name: PHY_MATERIAL_PARAM_CONCRETE_COMPRESSION
- Display Name: Concrete compression
- Storage Type: Double
-1140312 Enum Name: PHY_MATERIAL_PARAM_EXP_COEFF3
- Display Name: Thermal expansion coefficient Z
- Storage Type: Double
-1140311 Enum Name: PHY_MATERIAL_PARAM_EXP_COEFF2
- Display Name: Thermal expansion coefficient Y
- Storage Type: Double
-1140310 Enum Name: PHY_MATERIAL_PARAM_EXP_COEFF1
- Display Name: Thermal expansion coefficient X
- Storage Type: Double
notice the "missing" BIP between ...12 and ...14, the very one that is attached to the property set that I was trying to examine
Created the above BIP list using:
For Each item As RDB.BuiltInParameter In [Enum].GetValues(GetType(RDB.BuiltInParameter))...
I tried reversing the Enum (using GetNames then parsing for the value but no luck there either).
Anything that tries to look up anything about that parameter will fail (LabelUtils, TypeOfStroage, Internal definition, etc.)
It simply doesn't exist, yet it does and causes my code to error out any time that I run across it.
Along the way I found other BIPs that could not be looked up via LabelUtils or TypeOfStorage or trying to get the InternalDefinition:
-1152999 Enum Name: STRUCTURAL_CONNECTION_SYMBOL
-1151605 Enum Name: STAIRS_LANDINGTYPE_TREADRISER_TYPE
-1114354 Enum Name: SPACE_PEOPLE_ACTIVITY_LEVEL_PARAM
-1114137 Enum Name: RBS_DUCT_FITTING_LOSS_TABLE_PARAM
-1013353 Enum Name: SPACING_JUSTIFICATION
-1005364 Enum Name: VIEW_SOLARSTUDY_LIGHTING_PRESET_INDEX
-1005363 Enum Name: VIEW_SOLARSTUDY_MULTIDAY_PRESET_INDEX
-1005362 Enum Name: VIEW_SOLARSTU-1005361 Enum Name: VIEW_SOLARSTUDY_STILL_PRESET_INDEX
DY_SINGLEDAY_PRESET_INDEX
-1002102 Enum Name: SURFACE_PATTERN_ID_PARAM
Use caution folks, you never know what you're going to run into 🙂
-G
Solved! Go to Solution.
Solved by ricaun. Go to Solution.
Yes looks normal, the API change every year, and some BuiltInParameter goes away, that BuiltInParameter by the look was removed on version 2020 on the Revit API, if you look at the Revit API from 2019 there is "Damping ratio".
//
// Summary:
// "Concrete compression"
PHY_MATERIAL_PARAM_CONCRETE_COMPRESSION = -1140314,
//
// Summary:
// "Damping ratio"
PHY_MATERIAL_PARAM_DAMPING_RATIO = -1140313,
//
// Summary:
// "Thermal expansion coefficient Z"
PHY_MATERIAL_PARAM_EXP_COEFF3 = -1140312,
Have no idea what the parameter BuiltInParameter.PHY_MATERIAL_PARAM_DAMPING_RATIO was for and it's gone for good I guess.
@ricaun ,
Thanks for looking that up and confirming.
It looks like, when they removed it from the Revit code base they missed removing it from the material assets that it was previously connected to when the files got upgraded..
That probably also explains those other parameters as well, although they can still be looked up in the BuiltInParameter Enum, they just no longer have a definition which will still cause errors when trying to process them when they occur on an element.
Writing code using the Revit API is a challenge to begin with, but then you add in these situations where viable code doesn't work due to some one-off situation of leftover fragments and... It just takes forever to get through anything because you don't know if it's something wrong with your code or if it's something wrong with Autodesk's code...
Guess we need to put each and every call in a Try... Catch.. clause followed by an If.. that worked then Try.. the next line 🙂
but thanks again,
-G
Can't find what you're looking for? Ask the community or share your knowledge.