Create GlobalParameter Error

This week I was testing a package extension to make parameters and Revit a little easier to work.

To test if the library is working like intended I create a little tester to generate all parameters with the available types and tested with SharedParameter and GlobalParameter.

In the end, the script throws some errors when creating the GlobalParameter on Revit 2022. Some SpecTypeId throws an exception when trying to create a parameter:

This happens only on 16 ForgeTypeIds below:

autodesk.spec.aec.electrical:costRateEnergy-2.0.0
autodesk.spec.aec.electrical:costRatePower-2.0.0
autodesk.spec.aec.electrical:powerPerLength-2.0.0
autodesk.spec.aec.energy:heatCapacityPerArea-2.0.0
autodesk.spec.aec.energy:isothermalMoistureCapacity-2.0.0
autodesk.spec.aec.energy:thermalGradientCoefficientForMoistureCapacity-2.0.0
autodesk.spec.aec.hvac:angularSpeed-2.0.0
autodesk.spec.aec.hvac:diffusivity-2.0.0
autodesk.spec.aec.hvac:flowPerPower-2.0.0
autodesk.spec.aec.hvac:massPerTime-2.0.0
autodesk.spec.aec.hvac:powerPerFlow-2.0.0
autodesk.spec.aec.infrastructure:stationingInterval-2.0.0
autodesk.spec.aec.piping:massPerTime-2.0.0
autodesk.spec.aec:costPerArea-2.0.0
autodesk.spec.aec:distance-2.0.0
autodesk.spec.aec:rotationAngle-2.0.0

I’m using the Revit 2022 build version 22.0.2.392, that’s means could be possible for the last hotfix to fix this issue, don’t care too much, by the look is some newer parameters type added in this version.

The strange part is the SharedParameter test works fine with this SpecTypeId.

Revit 2023 gonna remove the ParameterType and that’s a big deal if you have some ParameterType around in your code. Definitely gonna break and gonna be a pain to update to the next version.

That’s why I’m creating an extension to make this transaction between versions more simple. I predict the BuiltInParameterGroup and BuiltInParameter gonna become Obsolete on the next version.

On Revit 2022 Api BuiltInParameterGroup already has some ForgeTypeId connection, maybe on Revit 2023 or next.

Here is the link for the Autodesk Forum:

See yaa!