Message 1 of 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Sometime ago I did a Revit API Course on Udemy by Boost Your BIM. Some part of the code were not updated and I had to play with new UnitTypeId. For most of the time it was somehow easy and revit help plus some googling was sufficient. Except setting unit symbol to none.
So I posted below 2 snippets of code:
Old way (pre 2022):
FormatOptions foVolume = units.GetFormatOptions(UnitType.UT_Volume);
foVolume.DisplayUnits = DisplayUnitType.DUT_CUBIC_METERS;
foVolume.UnitSymbol = UnitSymbolType.UST_NONE;
My brute force way:
FormatOptions foVolume = units.GetFormatOptions(SpecTypeId.Volume);
foVolume.SetUnitTypeId(UnitTypeId.CubicMeters);
foVolume.SetSymbolTypeId(foVolume.GetValidSymbols()[0]);
My solution does work, but it doesn't look nice. Is there any better way of doing it?
Solved! Go to Solution.