12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- /* ==============================================================================
- * 功能描述:SagaCheck
- * 创 建 者:Garrett
- * 创建日期:2019/6/11 16:09:09
- * ==============================================================================*/
- using System;
- using Autodesk.Revit.DB;
- using ServiceRevitLib.Mode;
- namespace ServiceRevitLib.DataCheck.Mode
- {
- /// <summary>
- /// SagaCheck
- /// </summary>
- class UnitCheck : CheckBase
- {
- public override void Check()
- {
- try
- {
- 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
- }
- catch (Exception e)
- {
- Result = ResultState.Failure;
- ResultMsg = $"{e.Message}\r\n{e.StackTrace}";
- }
-
- }
- }
- }
|