| | |
| | | /// </summary> |
| | | public static string GetReleaseUrl(SysMeta meta) |
| | | { |
| | | return "http://{host}/LFData/3d/3dtiles/" + meta.type + "/" + meta.id + "/tileset.json"; |
| | | return "{host}/LFData/3d/3dtiles/" + meta.type + "/" + meta.id + "/tileset.json"; |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | |
| | | List<SysMeta> list = XYZUtils.SelectMetas(args.ids, "and type in ('ifc', 'fbx', 'rvt')"); |
| | | if (null == list || list.Count == 0) return null; |
| | | |
| | | Tools.SetIsModel(args, list); |
| | | |
| | | List<int> ids = new List<int>(); |
| | | foreach (SysMeta meta in list) |
| | |
| | | if (File.Exists(jsonFile)) File.Delete(jsonFile); |
| | | |
| | | WriteText(configFile, string.Format(JobConfig, outPath.Replace("\\", "\\\\"))); |
| | | ExecNavisworks(modelFile, configFile); |
| | | SysTask task = TaskDBHelper.CreateTask(args, meta, "BIM", "三维模型(BIM)"); |
| | | ExecNavisworks(task, modelFile, configFile); |
| | | |
| | | File.Delete(configFile); |
| | | if (File.Exists(jsonFile)) |
| | |
| | | /// <summary> |
| | | /// 运行Navisworks |
| | | /// </summary> |
| | | public static void ExecNavisworks(string modelFile, string configFile) |
| | | public static void ExecNavisworks(SysTask task, string modelFile, string configFile) |
| | | { |
| | | Process p = null; |
| | | try |
| | | { |
| | | //string log = Path.Combine(ExportUtil.SourcesPath, "ns_log.txt"); |
| | | //string args = string.Format("-licensing AdLM -OpenFile \"{0}\" -ExecuteAddInPlugin \"EngineBatch_Sample.SmartEarth\" \"{1}\" -log \"{2}\" -NoGui -Exit", modelFile, configFile, log); |
| | | //string args = string.Format("-licensing AdLM -OpenFile \"{0}\" -ExecuteAddInPlugin \"EngineBatch_Sample.SmartEarth\" \"{1}\" -log \"{2}\" -NoGui -Exit", modelFile, configFile, Path.Combine(ExportUtil.SourcesPath, "ns_log.txt")); |
| | | string args = string.Format("-licensing AdLM -OpenFile \"{0}\" -ExecuteAddInPlugin \"EngineBatch_Sample.SmartEarth\" \"{1}\" -NoGui -Exit", modelFile, configFile); |
| | | LogOut.Info("Args:" + args); |
| | | |
| | | // 启动进程 |
| | | p = Process.Start(RoamerExe, args); |
| | | task.pid = p.Id; |
| | | task.id = TaskDBHelper.Insert(task); |
| | | |
| | | // 让组件等候相关的进程进入闲置状态 |
| | | p.WaitForInputIdle(); |
| | | p.WaitForInputIdle(); // 让组件等候相关的进程进入闲置状态 |
| | | p.WaitForExit(); // 让组件无限期地等待关联进程退出 |
| | | |
| | | // 让组件无限期地等待关联进程退出 |
| | | p.WaitForExit(); |
| | | task = TaskDBHelper.SelectById(task.id); |
| | | if (null != task && task.status < 2) |
| | | { |
| | | task.status = 2; |
| | | TaskDBHelper.Update(task); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | LogOut.Error(ex.Message + "\r\n" + ex.StackTrace); |
| | | task = TaskDBHelper.SelectById(task.id); |
| | | if (null != task && task.status < 2) |
| | | { |
| | | task.err = ex.Message; |
| | | task.status = 4; |
| | | TaskDBHelper.Update(task); |
| | | } |
| | | } |
| | | finally |
| | | { |
| | | if (p != null) |
| | | { |
| | | p.Close(); |
| | | p.Dispose(); |
| | | p = null; |
| | | } |
| | | } |
| | |
| | | /// </summary> |
| | | private static int InsertToDB(SysMeta meta, XYZArgs args, string path) |
| | | { |
| | | if (PubDBHelper.IsPublish(meta.id)) return 0; |
| | | //if (PubDBHelper.IsPublish(meta.id)) return 1; |
| | | int pubid = PubDBHelper.GetPushlishId(meta.id); |
| | | if (pubid > 0) |
| | | { |
| | | PubDBHelper.UpdatePublish(pubid, meta.name, args.userId, null); |
| | | return pubid; |
| | | } |
| | | |
| | | SysPublish sys = Tools.NewPublish(meta, args, GetReleaseUrl(meta), path); |
| | | |
| | | int pubid = PubDBHelper.InsertPublish(sys); |
| | | pubid = PubDBHelper.InsertPublish(sys); |
| | | if (pubid > 0) |
| | | { |
| | | sys.id = pubid; |