/* ============================================================================== * 功能描述:SagaCheck * 创 建 者:Garrett * 创建日期:2019/6/11 16:09:09 * ==============================================================================*/ using System; using Autodesk.Revit.DB; namespace ServiceRevitLib.Mode { /// /// SagaCheck /// class UnitCheck : CheckBase { public override void Check() { base.Check(); #region string resultMsg =null; ResultState resultState = ResultState.Failure; string unit = ""; var formatOptions = m_Doc.GetUnits().GetFormatOptions(UnitType.UT_Length); var ismmUnit= formatOptions.DisplayUnits == DisplayUnitType.DUT_MILLIMETERS; unit = formatOptions.DisplayUnits.ToString(); if (!ismmUnit) { resultMsg = "单位异常,请修改长度单位为毫米(mm)"; resultState = ResultState.Failure; } else { resultState = ResultState.Success; } Content.Add(new UnitCheckResult() { Unit = unit, Result = resultState, ResultMsg = resultMsg }); #endregion } } }