1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Linq;
- using System.Text;
- using System.Text.RegularExpressions;
- using System.Threading.Tasks;
- using Autodesk.Revit.DB;
- using Autodesk.Revit.DB.Mechanical;
- using Autodesk.RevitAddIns;
- using ServiceRevitLib;
- //using RevitToJBim.Common;
- namespace ExportStart
- {
- class Program
- {
- static Program()
- {
- RevitCoreContext.Instance.Run();
- }
- [STAThread]
- static void Main(string[] args)
- {
- string command = args[0];
- string path = args[1];
- if (File.Exists(path)&&Enum.TryParse(command, out CommandType commandType))
- {
- var app = RevitCoreContext.Instance.Application;
- var doc = app.OpenDocumentFile(path);
- switch (commandType)
- {
- case CommandType.DataCheck:
- Check(doc);
- break;
- case CommandType.DataExport:
- Export(doc);
- break;
- }
- RevitCoreContext.Instance.Stop();
- }
- }
- enum CommandType
- {
- None = 0,
- DataCheck,
- DataExport
- }
- public static void Export(Document doc)
- {
- try
- {
- Console.WriteLine("Start Export");
- RevitToJBim.MbiExport.Export(doc);
- Console.WriteLine("End Export");
- }
- catch (Exception e)
- {
- Console.WriteLine("导出失败");
- Console.WriteLine(e.StackTrace);
- }
- }
- public static void Check(Document doc)
- {
- try
- {
- Console.WriteLine("Start DataCheck");
- ServiceDataCheckTest.Check(doc);
- Console.WriteLine("End DataCheck");
- }
- catch (Exception e)
- {
- Console.WriteLine("导出失败");
- Console.WriteLine(e.StackTrace);
- }
- }
- }
- }
|