| | |
| | | |
| | | foreach (SysMeta meta in list) |
| | | { |
| | | try |
| | | string modelFile = Path.Combine(uploadFolder, meta.path); |
| | | if (!File.Exists(modelFile)) |
| | | { |
| | | string modelFile = Path.Combine(uploadFolder, meta.path); |
| | | if (!File.Exists(modelFile)) |
| | | { |
| | | continue; |
| | | } |
| | | |
| | | string configFile = Path.Combine(Tool.BaseDir, ExportUtil.DateStr + ".json"); |
| | | string outPath = Path.Combine(tilesFolder, meta.type, meta.id.ToString()); |
| | | |
| | | if (!Directory.Exists(outPath)) Directory.CreateDirectory(outPath); |
| | | WriteText(configFile, string.Format(JobConfig, outPath)); |
| | | |
| | | ExecNavisworks(modelFile, configFile); |
| | | File.Delete(configFile); |
| | | |
| | | count++; |
| | | continue; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | LogOut.Error(ex.StackTrace); |
| | | } |
| | | |
| | | string configFile = Path.Combine(Tool.BaseDir, ExportUtil.DateStr + ".json"); |
| | | string outPath = Path.Combine(tilesFolder, meta.type, meta.id.ToString()); |
| | | |
| | | if (!Directory.Exists(outPath)) Directory.CreateDirectory(outPath); |
| | | WriteText(configFile, string.Format(JobConfig, outPath)); |
| | | |
| | | count += ExecNavisworks(modelFile, configFile); |
| | | File.Delete(configFile); |
| | | } |
| | | |
| | | return count; |
| | |
| | | /// <summary> |
| | | /// 运行Navisworks |
| | | /// </summary> |
| | | public static string ExecNavisworks(string modelFile, string configFile) |
| | | public static int ExecNavisworks(string modelFile, string configFile) |
| | | { |
| | | string args = string.Format("-licensing AdLM -OpenFile \"{0}\" -ExecuteAddInPlugin \"EngineBatch_Sample.SmartEarth\" \"{1}\" -NoGui -Exit", modelFile, configFile); |
| | | //string args = string.Format("-licensing AdLM -OpenFile \"{0}\" -ExecuteAddInPlugin \"EngineBatch_Sample.SmartEarth\" \"{1}\" -NoGui -Exit", modelFile, configFile); |
| | | |
| | | Process p = new Process(); |
| | | p.StartInfo.UseShellExecute = false; |
| | | p.StartInfo.ErrorDialog = true; |
| | | p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; |
| | | p.StartInfo.RedirectStandardError = false; |
| | | p.StartInfo.FileName = RoamerExe; |
| | | p.StartInfo.Arguments = args; |
| | | p.StartInfo.CreateNoWindow = true; |
| | | p.Start(); |
| | | //Process p = new Process(); |
| | | //p.StartInfo.UseShellExecute = false; |
| | | //p.StartInfo.ErrorDialog = true; |
| | | //p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; |
| | | //p.StartInfo.RedirectStandardError = false; |
| | | //p.StartInfo.FileName = RoamerExe; |
| | | //p.StartInfo.Arguments = args; |
| | | //p.StartInfo.CreateNoWindow = true; |
| | | //p.Start(); |
| | | |
| | | return string.Empty; |
| | | //return string.Empty; |
| | | |
| | | Process p = null; |
| | | try |
| | | { |
| | | string args = string.Format("-licensing AdLM -OpenFile \"{1}\" -ExecuteAddInPlugin \"EngineBatch_Sample.SmartEarth\" \"{2}\" -NoGui -Exit", RoamerExe, modelFile, configFile); |
| | | |
| | | // 启动进程 |
| | | p = Process.Start(RoamerExe, args); |
| | | // 让 Process 组件等候相关的进程进入闲置状态 |
| | | p.WaitForInputIdle(); |
| | | // 设定要等待相关的进程结束的时间,并且阻止目前的线程执行,直到等候时间耗尽或者进程已经结束为止 |
| | | p.WaitForExit(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | LogOut.Error(ex.StackTrace); |
| | | return 0; |
| | | } |
| | | finally |
| | | { |
| | | if (p != null) |
| | | { |
| | | p.Close(); |
| | | p.Dispose(); |
| | | p = null; |
| | | } |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | /// <summary> |