Program.cs 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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 = @"E:\导出测试\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.MbiExport.Export(doc);
  42. Console.WriteLine("End Export");
  43. }
  44. catch (Exception e)
  45. {
  46. Console.WriteLine("导出失败");
  47. Console.WriteLine(e.StackTrace);
  48. }
  49. }
  50. public static void Check(Document doc)
  51. {
  52. try
  53. {
  54. Console.WriteLine("Start DataCheck");
  55. ServiceDataCheckTest.Check(doc);
  56. Console.WriteLine("End DataCheck");
  57. }
  58. catch (Exception e)
  59. {
  60. Console.WriteLine("导出失败");
  61. Console.WriteLine(e.StackTrace);
  62. }
  63. }
  64. }
  65. }