Program.cs 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Text.RegularExpressions;
  7. using System.Threading.Tasks;
  8. using Autodesk.Revit.DB;
  9. using Autodesk.Revit.DB.Mechanical;
  10. using Autodesk.RevitAddIns;
  11. using ServiceRevitLib;
  12. //using RevitToJBim.Common;
  13. namespace ExportStart
  14. {
  15. class Program
  16. {
  17. static Program()
  18. {
  19. RevitCoreContext.Instance.Run();
  20. }
  21. [STAThread]
  22. static void Main(string[] args)
  23. {
  24. string path = @"C:\Users\SAGACLOUD\Desktop\数据检查\test.rvt";
  25. //path = @"C:\Users\SAGACLOUD\Desktop\数据检查\testR18.rvt";
  26. //path = @"C:\Users\SAGACLOUD\Desktop\数据检查\testR16.rvt";
  27. //path = @"D:\测试模型\OLD\机电模型2015.09.06\F5机电(改位置)\revit\5风管.rvt";
  28. string command = "Export";
  29. var app = RevitCoreContext.Instance.Application;
  30. var doc = app.OpenDocumentFile(path);
  31. //Export(doc);
  32. Check(doc);
  33. //Console.WriteLine("RevitVision:"+RevitVisionUtil.GetRevitVision(path));
  34. Console.ReadKey();
  35. }
  36. public static void Export(Document doc)
  37. {
  38. try
  39. {
  40. Console.WriteLine("Start Export");
  41. RevitToJBim.TestExport.Document = doc;
  42. RevitToJBim.TestExport.Export();
  43. Console.WriteLine("End Export");
  44. }
  45. catch (Exception e)
  46. {
  47. Console.WriteLine("导出失败");
  48. Console.WriteLine(e.StackTrace);
  49. }
  50. }
  51. public static void Check(Document doc)
  52. {
  53. try
  54. {
  55. Console.WriteLine("Start DataCheck");
  56. ServiceDataCheckTest.Check(doc);
  57. Console.WriteLine("End DataCheck");
  58. }
  59. catch (Exception e)
  60. {
  61. Console.WriteLine("导出失败");
  62. Console.WriteLine(e.StackTrace);
  63. }
  64. }
  65. }
  66. }