Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

DisplayUnitType in Revit 2022

5 REPLIES 5
Reply
Message 1 of 6
pmeigneux
4338 Views, 5 Replies

DisplayUnitType in Revit 2022

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

 

Have you a solution ?

5 REPLIES 5
Message 2 of 6
jeremy_tammik
in reply to: pmeigneux
Message 3 of 6
pmeigneux
in reply to: jeremy_tammik

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?

 

 

Message 4 of 6
pmeigneux
in reply to: pmeigneux

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

Message 5 of 6
jeremy_tammik
in reply to: pmeigneux

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
Message 6 of 6

Sorry, but page not found. 

Yes, but ))

It is the same info?

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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Rail Community