|
@@ -31,24 +31,32 @@ namespace RevitToJBim
|
|
|
public static void Export(Document document)
|
|
|
{
|
|
|
|
|
|
- var wrappers = ExportDataBuilder.CreateExportData(document);
|
|
|
- ExportInstance report = new ExportInstance(wrappers);
|
|
|
-
|
|
|
- JBimParseContext context = new JBimParseContext(ParseCore.GetUseParsers());
|
|
|
- context.Parser.Parse(report);
|
|
|
+ try
|
|
|
+ {
|
|
|
+ var wrappers = ExportDataBuilder.CreateExportData(document);
|
|
|
+ ExportInstance report = new ExportInstance(wrappers);
|
|
|
+
|
|
|
+ JBimParseContext context = new JBimParseContext(ParseCore.GetUseParsers());
|
|
|
+ context.Parser.Parse(report);
|
|
|
|
|
|
-
|
|
|
- var mbiDocument = MBIDocument.CreateDocument(document);
|
|
|
- mbiDocument.AttachElements(context.GetResultDocument());
|
|
|
-
|
|
|
- * 序列化的变化封装在这里,增加MBIDocument传输数据对象,
|
|
|
- * 增加一些和JBIM无关,又和当前业务逻辑相关的属性
|
|
|
- */
|
|
|
- var result = BimJsonUtil.Serializer(mbiDocument);
|
|
|
- string fileName = DateTime.Now.ToString("yyyyMMddHHmmss");
|
|
|
- string path = Path.Combine(@"D:\", $"{fileName}.json");
|
|
|
- File.WriteAllText(path, result);
|
|
|
- System.Diagnostics.Process.Start("notepad.exe", path);
|
|
|
+
|
|
|
+ var mbiDocument = MBIDocument.CreateDocument(document);
|
|
|
+ mbiDocument.AttachElements(context.GetResultDocument());
|
|
|
+
|
|
|
+ * 序列化的变化封装在这里,增加MBIDocument传输数据对象,
|
|
|
+ * 增加一些和JBIM无关,又和当前业务逻辑相关的属性
|
|
|
+ */
|
|
|
+ var result = BimJsonUtil.Serializer(mbiDocument);
|
|
|
+ string fileName = DateTime.Now.ToString("yyyyMMddHHmmss");
|
|
|
+ string path = Path.Combine(@"D:\", $"{fileName}.json");
|
|
|
+ File.WriteAllText(path, result);
|
|
|
+ System.Diagnostics.Process.Start("notepad.exe", path);
|
|
|
+ }
|
|
|
+ catch (Exception ex)
|
|
|
+ {
|
|
|
+
|
|
|
+ Console.WriteLine(ex.StackTrace.ToString());
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|