/// <summary> /// Get current length display unit type /// </summary> /// <param name="document">Revit's document</param> /// <returns>Current length display unit type</returns> private static ForgeTypeId GetLengthUnitType(Document document) { ForgeTypeId specTypeId = SpecTypeId.Length; Units projectUnit = document.GetUnits(); try { Autodesk.Revit.DB.FormatOptions formatOption = projectUnit.GetFormatOptions(specTypeId); return(formatOption.GetUnitTypeId()); } catch (System.Exception /*e*/) { return(UnitTypeId.Feet); } }
/// <summary> /// Get current length display unit type /// </summary> private void GetLengthUnitType() { ForgeTypeId specTypeId = SpecTypeId.Length; Units projectUnit = m_document.GetUnits(); try { Autodesk.Revit.DB.FormatOptions formatOption = projectUnit.GetFormatOptions(specTypeId); m_LengthUnit = formatOption.GetUnitTypeId(); } catch (System.Exception /*e*/) { m_LengthUnit = UnitTypeId.Feet; } }