123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
-
- using System;
- using Autodesk.Revit.DB;
- namespace ServiceRevitLib.Mode
- {
-
-
-
- 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
- }
- }
- }
|