| | |
| | | foreach (SysMeta meta in list) |
| | | { |
| | | string modelFile = Path.Combine(uploadFolder, meta.path); |
| | | if (!File.Exists(modelFile)) |
| | | { |
| | | continue; |
| | | } |
| | | if (!File.Exists(modelFile)) continue; |
| | | |
| | | string configFile = Path.Combine(Tool.BaseDir, ExportUtil.DateStr + ".json"); |
| | | string outPath = Path.Combine(tilesFolder, meta.type, meta.id.ToString()); |
| | | string jsonFile = Path.Combine(outPath, "tileset.json"); |
| | | |
| | | if (!Directory.Exists(outPath)) Directory.CreateDirectory(outPath); |
| | | WriteText(configFile, string.Format(JobConfig, outPath.Replace("\\", "\\\\"))); |
| | | if (File.Exists(jsonFile)) File.Delete(jsonFile); |
| | | |
| | | count += ExecNavisworks(modelFile, configFile); |
| | | WriteText(configFile, string.Format(JobConfig, outPath.Replace("\\", "\\\\"))); |
| | | ExecNavisworks(modelFile, configFile); |
| | | |
| | | File.Delete(configFile); |
| | | count += File.Exists(jsonFile) ? 1 : 0; |
| | | } |
| | | |
| | | return count; |
| | |
| | | /// <summary> |
| | | /// 运行Navisworks |
| | | /// </summary> |
| | | public static int ExecNavisworks(string modelFile, string configFile) |
| | | public static void ExecNavisworks(string modelFile, string configFile) |
| | | { |
| | | Process p = null; |
| | | try |
| | |
| | | |
| | | // 启动进程 |
| | | p = Process.Start(RoamerExe, args); |
| | | // 让 Process 组件等候相关的进程进入闲置状态 |
| | | |
| | | // 让组件等候相关的进程进入闲置状态 |
| | | p.WaitForInputIdle(); |
| | | // 设定要等待相关的进程结束的时间,并且阻止目前的线程执行,直到等候时间耗尽或者进程已经结束为止 |
| | | |
| | | // 让组件无限期地等待关联进程退出 |
| | | p.WaitForExit(); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | LogOut.Error(ex.StackTrace); |
| | | return 0; |
| | | } |
| | | finally |
| | | { |
| | |
| | | p = null; |
| | | } |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | /// <summary> |