123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
-
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text.RegularExpressions;
- using Autodesk.Revit.DB;
- using SAGA.DotNetUtils.Extend;
- using ServiceRevitLib.Common;
- using SAGA.RevitUtils.Extends;
- using ServiceRevitLib.Extend;
- namespace ServiceRevitLib.Mode
- {
-
-
-
- class ParameterIntegrityCheck : CheckBase
- {
- public override void Check()
- {
- base.Check();
- #region
- var doc = m_Doc;
- var instances = doc.GetEqEcElements();
- var familyGroups = instances.GroupBy(t => t.GetFamilyName());
- foreach (IGrouping<string, Element> familyGroup in familyGroups)
- {
- Element fi = familyGroup.FirstOrDefault();
- if (fi == null) continue;
- var result = GetCheckResult(fi);
- if (result == null) continue;
- result.FamilyName = familyGroup.Key;
- Content.Add(result);
- }
- #endregion
- }
-
-
-
-
-
- private ParameterIntegrityCheckResult GetCheckResult(Element fi)
- {
-
- var checkParamNames = new List<string>() { MBIConst.EquipLocalName, MBIConst.EquipLocalID };
- var result = new ParameterIntegrityCheckResult();
- List<string> list = new List<string>();
- foreach (var paramName in checkParamNames)
- {
- var parameter = fi.GetParameter(paramName);
- if (parameter == null)
- list.Add(paramName);
- }
- if (list.Any())
- {
- result.Result = ResultState.Failure;
- result.ResultMsg = $"缺失的参数为:{string.Join("、", list)}";
- }
- else
- {
- result.Result = ResultState.Success;
- }
- return result;
- }
- }
- }
|