|
@@ -38,15 +38,19 @@ namespace SAGA.MBI.Test
|
|
|
{
|
|
|
var list = GetRevitFiles(revitDir);
|
|
|
if (!list.Any()) return;
|
|
|
+
|
|
|
+ var jsonz_files = GetJsonZFiles(revitDir);
|
|
|
foreach (string fullPath in list)
|
|
|
{
|
|
|
- OperateFloor(fullPath);
|
|
|
+ OperateFloor(fullPath, jsonz_files);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private static void OperateFloor(string fullPath)
|
|
|
+ private static void OperateFloor(string fullPath,List<string> jsonZ_files)
|
|
|
{
|
|
|
Document doc = null;
|
|
|
+ var floorId = GetFloorId(fullPath);
|
|
|
+ if(jsonZ_files.Any(t=>t.Contains(floorId)))return;
|
|
|
try
|
|
|
{
|
|
|
var uiApp = ExternalDataWrapper.Current.UiApp;
|
|
@@ -56,7 +60,6 @@ namespace SAGA.MBI.Test
|
|
|
doc = uiApp.Application.OpenDocumentFile(mpath,options);
|
|
|
MbiElementManager.ExecuteExport(doc);
|
|
|
|
|
|
- var floorId = GetFloorId(fullPath);
|
|
|
|
|
|
string sagaName = doc.GetUseView()?.Name;
|
|
|
var result=MBIModelInfoUpload.GetCompressedExportInfo(sagaName);
|
|
@@ -69,8 +72,11 @@ namespace SAGA.MBI.Test
|
|
|
var dir = GetDirectory(fullPath);
|
|
|
string errorPath = Path.Combine(dir, "ErrorFiles");
|
|
|
if (!Directory.Exists(errorPath))
|
|
|
+ {
|
|
|
Directory.CreateDirectory(errorPath);
|
|
|
- File.Copy(fullPath,errorPath);
|
|
|
+ }
|
|
|
+
|
|
|
+ File.Copy(fullPath,Path.Combine(errorPath, floorId+".rvt"));
|
|
|
string errorLog = Path.Combine(errorPath, "errorLog.txt");
|
|
|
File.AppendAllText(errorLog,$"{DateTime.Now.TimeOfDay} | {fullPath} | {e.Message} | {e.StackTrace}");
|
|
|
}
|
|
@@ -117,5 +123,26 @@ namespace SAGA.MBI.Test
|
|
|
|
|
|
return list;
|
|
|
}
|
|
|
+ /// <summary>
|
|
|
+ /// 获取需要修改的Revit文件
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="revitDir"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ private static List<string> GetJsonZFiles(string revitDir)
|
|
|
+ {
|
|
|
+ DirectoryInfo directory = new DirectoryInfo(revitDir);
|
|
|
+ List<string> list = new List<string>();
|
|
|
+ try
|
|
|
+ {
|
|
|
+ list = directory.GetFiles("*.jsonz").Select(t => t.FullName).ToList();
|
|
|
+ }
|
|
|
+ catch (Exception e)
|
|
|
+ {
|
|
|
+ Console.WriteLine(e);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ return list;
|
|
|
+ }
|
|
|
}
|
|
|
}
|