TestCommand.cs 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Diagnostics;
  4. using System.IO;
  5. using System.Linq;
  6. using Autodesk.Revit.Attributes;
  7. using Autodesk.Revit.DB;
  8. using Autodesk.Revit.UI;
  9. using Newtonsoft.Json;
  10. using SAGA.DotNetUtils.Data;
  11. using SAGA.DotNetUtils.Geometry;
  12. using SAGA.RevitUtils;
  13. using SAGA.RevitUtils.Extends;
  14. namespace ServiceRevitLib
  15. {
  16. #region 测试命令
  17. public class ServiceDataCheckTest
  18. {
  19. public static void Check(Document doc)
  20. {
  21. try
  22. {
  23. var factory = new CheckFactory();
  24. factory.SetCheckItems("SagaCheck,UnitCheck,FamilyNameCheck,EquipPartLocationCheck,ColumnCheck,ElementRangeCheck,ConnectorCheck,SystemNameCheck,EquipInSpaceCheck,SystemReferEquipCheck,ParameterIntegrityCheck");
  25. factory.Check(doc);
  26. var result = JsonConvert.SerializeObject(factory);
  27. string fileName = DateTime.Now.ToString("yyyyMMddHHmmss");
  28. string path = Path.Combine(@"D:\", $"DataCheck{fileName}.json");
  29. File.WriteAllText(path, result);
  30. //System.Diagnostics.Process.Start("notepad.exe", path);
  31. }
  32. catch (Exception e)
  33. {
  34. }
  35. }
  36. }
  37. #endregion
  38. }