Browse Source

自动启动轻量化
Signed-off-by: wangwei <wangwei@persagy.com>

wangwei 4 years ago
parent
commit
b33b27f7ea
4 changed files with 30 additions and 2 deletions
  1. 2 0
      .gitignore
  2. 2 0
      Starter/Starter/App.config
  3. 1 0
      Starter/Starter/ExportStart.csproj
  4. 25 2
      Starter/Starter/Program.cs

+ 2 - 0
.gitignore

@@ -1,2 +1,4 @@
 /OutputDll
 /packages
+/.vs/ServiceRevit/v16/*.suo
+/Dispatcher/Client/obj

+ 2 - 0
Starter/Starter/App.config

@@ -12,6 +12,8 @@
 		</assemblyBinding>
 	</runtime>
 	<appSettings>
+		<add key="RevitSimplifyPath" value="E:\Develop\3DTiles\Usefull\iBimSimplify\bin\netcoreapp3.1\RevitSimplify.exe"/>
+		<add key="Project" value="output/wanda"/>
 		<add key="UseablePhaseName" value="阶段1"/>
 		<add key="SagaSign" value="-wanda"/>
 		<add key="CheckItems" value="SagaCheck,UnitCheck,FamilyNameCheck,EquipPartLocationCheck,ColumnCheck,ElementRangeCheck,ConnectorCheck,SystemNameCheck,EquipInSpaceCheck,SystemReferEquipCheck,ParameterIntegrityCheck,PipeCheck,XYZOverlapCheck"/>

+ 1 - 0
Starter/Starter/ExportStart.csproj

@@ -59,6 +59,7 @@
       <HintPath>..\..\RevitDlls\SAGA.DotNetUtils.dll</HintPath>
     </Reference>
     <Reference Include="System" />
+    <Reference Include="System.Configuration" />
     <Reference Include="System.Core" />
     <Reference Include="System.Xml.Linq" />
     <Reference Include="System.Data.DataSetExtensions" />

+ 25 - 2
Starter/Starter/Program.cs

@@ -5,6 +5,8 @@ using System.IO;
 using Newtonsoft.Json.Linq;
 using SAGA.DotNetUtils.Extend;
 using SAGA.DotNetUtils.Logger;
+using System.Configuration;
+using System.Diagnostics;
 
 //using RevitToJBim.Common;
 
@@ -53,7 +55,7 @@ namespace ExportStart
                 //path = @"testdata\龙岗万达2020.12.10\LG-WDGC-B02-ALL.rvt";
                 //path = @"testdata\龙岗万达2020.12.10\LGWDGC-F01-ALL.rvt";
                 //path = @"testdata\龙岗万达2020.12.10\LG-WDGC-F03-ALL.rvt";
-                path = @"testdata\龙岗万达2020.12.10\LG-WDGC-F04-ALL.rvt";
+                path = @"E:\Develop\RevitProject\RevitPro\ServiceRevit-wanda\OutputDll\testdata\龙岗万达2020.12.10\LG-WDGC-F04-ALL.rvt";
                 //path = @"testdata\龙岗万达2020.12.10\LG-WDGC-F06-ALL.rvt";
                 //path = @"testdata\龙岗万达2020.12.10\LGWDGC-Q-B01-ALL.rvt";
                 //path = @"testdata\龙岗万达2020.12.10\LGWDGC-Q-F02-ALL.rvt";
@@ -109,8 +111,10 @@ namespace ExportStart
                 SaveResult(param, result);
                 Console.WriteLine("Task EndTime:" + DateTime.Now);
                 RevitCoreContext.Instance.Stop();
+
+                StartRevitSimplify(path);
             }
-            
+
             //强制退出
             Environment.Exit(0);
         }
@@ -141,6 +145,25 @@ namespace ExportStart
             }
         }
 
+        static void StartRevitSimplify(string filePath)
+        {
+            var filename = Path.GetFileNameWithoutExtension(filePath);
+            var project = ConfigurationManager.AppSettings["Project"];
+
+            Console.WriteLine(DateTime.Now + " 准备执行轻量化:");
+            string fullPath = ConfigurationManager.AppSettings["RevitSimplifyPath"];
+            Process process = new Process();
+            process.StartInfo.FileName = fullPath;//执行的exe路径
+            process.StartInfo.WorkingDirectory = Path.GetDirectoryName(fullPath);
+            process.StartInfo.UseShellExecute = true;
+            process.StartInfo.CreateNoWindow = false;
+            //process.StartInfo.RedirectStandardInput = true;//打开流输入
+            //process.StartInfo.RedirectStandardOutput = true;//打开流输出
+            //process.StartInfo.RedirectStandardError = true;//打开错误流
+            process.StartInfo.Arguments = $" InputFile={filePath} OutputDir={project}/{filename}";
+            process.Start();//执行
+            process.WaitForExit();
+        }
         enum CommandType
         {
             None = 0,