ParameterType Enum obsolete

ParameterType Enum obsolete

Jaime_Alonso
Enthusiast Enthusiast
2,489 Views
6 Replies
Message 1 of 7

ParameterType Enum obsolete

Jaime_Alonso
Enthusiast
Enthusiast

Hey mates,

 

I used the following to get all parameter types in my model;

 

listaParameterType = Enum.GetValues(typeof(Autodesk.Revit.DB.ParameterType))
.Cast<Autodesk.Revit.DB.ParameterType>()
.Select(v => v.ToString())
.ToList();

 

Nonetheless, it appears that "Autodesk.Revit.DB.ParameterType" is deprecated in Revit 2022 and may be removed in a future version of Revit. Would you know another way to get those?

 

Thanks

 

 

0 Likes
Accepted solutions (1)
2,490 Views
6 Replies
Replies (6)
Message 2 of 7

tamas.deri
Advocate
Advocate
Message 3 of 7

Jaime_Alonso
Enthusiast
Enthusiast

Thank you @tamas.deri but I have not been able to get it working as I cannot cast it.

Any idea how can I get an enum from SpecTypeID as I did in my previous method?

Thanks

 

0 Likes
Message 4 of 7

RPTHOMAS108
Mentor
Mentor

You can now get a list of ForgeTypeIds from SpecUtils.GetAllSpecs

 

  1. For human readable strings put each item into LabelUtils.GetLabelForSpec instead of LabelUtils.GetLabelFor(ParameterType).
  2. For Type Catalogue representation use UnitUtils.GetTypeCatalogStringForSpec (where spec can be used in such, empty string returned otherwise).
Message 5 of 7

Jaime_Alonso
Enthusiast
Enthusiast

Thank you @RPTHOMAS108 for your help! Apologies for the delay in responding, I had some personal issues.

I implemented the method using:

            foreach (var SPEC in SpecUtils.GetAllSpecs())

            {

                if(UnitUtils.IsMeasurableSpec(SPEC))

                {

                    string speciteseste = LabelUtils.GetLabelForSpec(SPEC);

                         if (!listaParameterType.Contains(speciteseste))

                         {

                               listaParameterType.Add(speciteseste + " " + speciteseste);

                         }

                }

            }

I get the list discussed but there are some differences of what I was aiming for. I tried different type methods but I am enable to get them. Parameter type replication.jpg

The list in the left is the list I would like to get and the two in the right, those I get from the previous and modifications of the previous process. Would you know is there is any type that I can call and filter by to get the first? I get more elements...

Thanks for your help

0 Likes
Message 6 of 7

RPTHOMAS108
Mentor
Mentor
Accepted solution

For what I can tell most Specs have an equivalent ParameterType, some however share a parameter type with other spec types:

 

Length = 4
Length,Common,autodesk.spec.aec:length-2.0.0
Sheet Length,Common,autodesk.spec.aec:sheetLength-2.0.0
Angle = 7
Angle,Common,autodesk.spec.aec:angle-2.0.0
Site Angle,Common,autodesk.spec.aec:siteAngle-2.0.0
Custom = 99
Angular Speed,HVAC,autodesk.spec.aec.hvac:angularSpeed-2.0.0
Cost per Area,Common,autodesk.spec.aec:costPerArea-2.0.0
Cost Rate Energy,Electrical,autodesk.spec.aec.electrical:costRateEnergy-2.0.0
Cost Rate Power,Electrical,autodesk.spec.aec.electrical:costRatePower-2.0.0
Diffusivity,HVAC,autodesk.spec.aec.hvac:diffusivity-2.0.0
Distance,Common,autodesk.spec.aec:distance-2.0.0
Flow per Power,HVAC,autodesk.spec.aec.hvac:flowPerPower-2.0.0
Heat Capacity per Area,Energy,autodesk.spec.aec.energy:heatCapacityPerArea-2.0.0
Isothermal Moisture Capacity,Energy,autodesk.spec.aec.energy:isothermalMoistureCapacity-2.0.0
Mass per Time,HVAC,autodesk.spec.aec.hvac:massPerTime-2.0.0
Mass per Time,Piping,autodesk.spec.aec.piping:massPerTime-2.0.0
Power per Flow,HVAC,autodesk.spec.aec.hvac:powerPerFlow-2.0.0
Power per Length,Electrical,autodesk.spec.aec.electrical:powerPerLength-2.0.0
Rotation Angle,Common,autodesk.spec.aec:rotationAngle-2.0.0
Stationing Interval,Infrastructure,autodesk.spec.aec.infrastructure:stationingInterval-2.0.0
Thermal Gradient Coefficient for Moisture Capacity,Energy,autodesk.spec.aec.energy:thermalGradientCoefficientForMoistureCapacity-2.0.0

 

So I don't know where that list on the left comes from it may be representing not all of the Disciplines available.

 

Attached lists the grouping according to SpecUtils.GetParameterType

Message 7 of 7

Jaime_Alonso
Enthusiast
Enthusiast

Thank you very much @RPTHOMAS108 !

Really appreciate your help.

I will work on it and post if I find why this happened. 

0 Likes