DisplayUnitType in Revit 2022

DisplayUnitType in Revit 2022

pmeigneux
Advocate Advocate
5,804 Views
5 Replies
Message 1 of 6

DisplayUnitType in Revit 2022

pmeigneux
Advocate
Advocate

When compile with Revit 2022 : Error CS0122 'DisplayUnitType' is inaccessible due to its protection level

 

Have you a solution ?

0 Likes
5,805 Views
5 Replies
Replies (5)
Message 2 of 6

jeremy_tammik
Alumni
Alumni
Message 3 of 6

pmeigneux
Advocate
Advocate

Hi,

I am looking for the type of unit from a character string.

value1 = string (example : "DUT_METERS",   "DUT_SQUARE_METERS",  "DUT_WATTS_PER_SQUARE_METER_KELVIN")

 

my code :

DisplayUnitType RevitMKS = DisplayUnitType.DUT_GENERAL;
if (value1 != "")
{

    foreach (DisplayUnitType P in Enum.GetValues(typeof(DisplayUnitType)))
    {
        if (P.ToString() == value1)
        {
            RevitMKS = P;
            break;
        }
    }
}

 

how to do the equivalent?

 

 

0 Likes
Message 4 of 6

pmeigneux
Advocate
Advocate

Have you list of string value for ForgeTypeId(String typeId); ?

0 Likes
Message 5 of 6

jeremy_tammik
Alumni
Alumni

The method ListForgeTypeIds in The Building Coder samples Util.cs module probably does that for you:

 

https://github.com/jeremytammik/the_building_coder_samples/blob/master/BuildingCoder/BuildingCoder/U...

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes
Message 6 of 6

dmitry.dronov
Explorer
Explorer

Sorry, but page not found. 

Yes, but ))

It is the same info?

The Building Coder: ForgeTypeId and Units Revisited (typepad.com)

0 Likes