mainfrm_pane.js 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718
  1. ////////////////////////////////////////////////////////////////////////////
  2. // System Pre-define Functions
  3. // 95099372-ef3e-11ea-9c81-bf848405c62e
  4. var dock_widget = false;
  5. var dock_widget1 = false;
  6. var dock_widget2 = false;
  7. var dock_widget3 = false;
  8. var g_preview = false;
  9. var g_io = false;
  10. var g_wid = false;
  11. let myArray = [];
  12. var res = [];
  13. var judge = 0;
  14. var startEnd = 0;
  15. var vtkContext = null;
  16. var workData = null;
  17. var postManage = null;
  18. function OnDockerChange(){
  19. updateDockerButtonStatus();
  20. }
  21. function OnResize() {
  22. if (dock_widget && !ui.docker.isVisible(dock_widget)) {
  23. showLeftDocker(true);
  24. }
  25. }
  26. function OnInitDocker() {
  27. dock_widget1 = appendDockPane(unit.form.toolbar, "", 4, 1|2|4);
  28. dock_widget2 = appendDockPane(unit.form.tree, "模型树", 1, 1|2);
  29. }
  30. function updateDockerButtonStatus() {
  31. if (!dock_widget) {
  32. return;
  33. }
  34. //unit.form.cw_topmenu.onUpdateBtn(!ui.docker.isFloat(dock_widget), !ui.docker.isVisible(dock_widget));
  35. }
  36. function appendDockPane(sub_form, title, init_pos, allow_pos, features) {
  37. let dw = sub_form.CreateDock(title);
  38. if (features) {
  39. ui.docker.setFeatures(features);
  40. }
  41. ui.docker.setAllowAreas(dw, allow_pos);
  42. ui.docker.dock(dw, init_pos);
  43. return dw;
  44. }
  45. function showLeftDocker(flag) {
  46. ui.docker.show(dock_widget, flag);
  47. updateDockerButtonStatus();
  48. }
  49. function InitCanvasIOEngine() {
  50. ui.canvas.adaptor('nastran', function(fname_nas) {
  51. //console.log(fname_nas);
  52. console.time('Nastran Import');
  53. model.cueline('解析并加载Nastran文件 ...');
  54. model.updateGeometry(ui.geometry);
  55. ui.canvas.db = null;
  56. parent.mesh.shell.ClearCache();
  57. parent.mesh.shell.LoadNastranToCache(fname_nas);
  58. console.timeEnd('Nastran Import');
  59. model.cueline('创建图形缓冲区 ...');
  60. console.time('Nastran Buffer');
  61. var buf = parent.mesh.shell.RenderToGLCache();
  62. console.timeEnd('Nastran Buffer');
  63. model.cueline('生成图形数据库并渲染 ...');
  64. return buf;
  65. });
  66. ui.canvas.adaptor('step', function(fname_step) {
  67. console.log('Step');
  68. console.time('Step Import');
  69. model.cueline('解析并加载STEP文件 ...');
  70. model.updateGeometry(ui.geometry);
  71. ui.canvas.db = null;
  72. comx.occore.Clear();
  73. comx.occio.ImportStepEx(comx.occore.GetEntryEx(), fname_step);
  74. var modelTree = comx.occio.ImportStepEx(comx.occore.GetEntryEx(), fname_step);
  75. //ui.tree.tree = JSON.parse(modelTree);
  76. unit.form.tree.OnTree(JSON.parse(modelTree));
  77. var hashCodes = comx.occio.GetFaceHashCodes(comx.occore.GetEntryEx());
  78. //console.log(JSON.parse(hashCodes));
  79. model.setHash(JSON.parse(hashCodes));
  80. console.timeEnd('Step Import');
  81. model.cueline('创建图形缓冲区 ...');
  82. console.time('Step Buffer');
  83. var gl_buf = comx.occrender.RenderToBufferEx(comx.occore.GetEntryEx(), true, false);
  84. console.timeEnd('Step Buffer');
  85. model.cueline('生成图形数据库并渲染 ...');
  86. return gl_buf;
  87. });
  88. ui.canvas.adaptor('iges', function(fname_step) {
  89. console.time('Iges Import');
  90. model.cueline('解析并加载IGES文件 ...');
  91. model.updateGeometry(ui.geometry);
  92. ui.canvas.db = null;
  93. comx.occore.Clear();
  94. comx.occio.ImportIges(comx.occore.GetEntry(), fname_step);
  95. console.timeEnd('Iges Import');
  96. model.cueline('创建图形缓冲区 ...');
  97. console.time('Iges Buffer');
  98. var gl_buf = comx.occrender.RenderToBuffer(comx.occore.GetEntry());
  99. console.timeEnd('Iges Buffer');
  100. model.cueline('生成图形数据库并渲染 ...');
  101. return gl_buf;
  102. });
  103. }
  104. function SetCanvasProp() {
  105. ui.canvas.filter = [2025]; //面
  106. if (ui.canvas.view()) {
  107. //ui.canvas.view().setColor(0.75, 0.75, 0.75, 0.5);
  108. ui.canvas.view().setColor(1.0, 1.0, 0, 1.0);
  109. ui.canvas.view().setVisible(true);
  110. ui.canvas.view().setBlend(false);
  111. }
  112. ui.canvas.lamp = true;
  113. }
  114. //Callback of data preparation stage before UI is fully loaded.
  115. //隐藏显示
  116. function HideAndShow(type, name, flag) {
  117. comx.ply.hideShow(vtkContext.Interface(), workData, type, name, flag);
  118. }
  119. //显示3D模型
  120. function OnloadModel(path) {
  121. ui.canvas.step = path;
  122. }
  123. //清除canvas
  124. function ClearCanvas() {
  125. ui.canvas.db = null;
  126. }
  127. //设置材料参数界面
  128. function setMaterial(material) {
  129. ui.physics_mastk.setmaterial = material;
  130. }
  131. //设置约束
  132. function setConstraint(prop) {
  133. let constraint = {
  134. "固定支撑":function(){
  135. ui.cw_boundary_constraint_25.setConstraint0 = prop;
  136. },
  137. "梁":function(){
  138. ui.cw_boundary_constraint_25.setConstraint1 = prop;
  139. },
  140. "弹簧":function(){
  141. ui.cw_boundary_constraint_25.setConstraint2 = prop;
  142. },
  143. "连接":function(){
  144. ui.cw_boundary_constraint_25.setConstraint3 = prop;
  145. },
  146. "梁(非均匀)":function(){
  147. },
  148. "集中载荷压力":function(){
  149. ui.cw_boundary_force_24.setConstraint0 = prop;
  150. },
  151. "分布载荷压力":function(){
  152. ui.cw_boundary_force_24.setConstraint1 = prop;
  153. },
  154. "rb3":function(){
  155. ui.cw_boundary_brep_23.setConstraint = prop;
  156. }
  157. };
  158. constraint[prop.constraint]();
  159. }
  160. //显示重命名界面
  161. function RenameTreeNode(Idx) {
  162. if(Idx === 2) {
  163. unit.form.Rename.Show();
  164. }else if(Idx === 5){
  165. unit.form.RenameMaterial.Show();
  166. }
  167. }
  168. //点亮面
  169. function LightFace(id) {
  170. ui.canvas.view([ui.canvas.generateKey(2025, parseInt(id))]).setColor(1.0, 0.0, 0.0);
  171. }
  172. function OnInitializeData(reload, preview) {
  173. //model.ide_info(model.uuid().length);
  174. vtkContext = comx.vtk.CreateContext();
  175. ui.canvas.vtkContextInterface = vtkContext.Interface();
  176. workData = comx.ply.InitWorkArea();
  177. postManage = comx.ply.InitPostManage();
  178. ui.pc_geo.value = model.getPicturePath('蓝灰色.png');
  179. OnCueline('白色->未使用,蓝灰色->正在处理,绿色->未通过,蓝色->通过', 'blue');
  180. InitCanvasIOEngine();
  181. parent.setTimeout(() => {
  182. OnInitDocker();
  183. }, 0);
  184. ui.canvas.lamp = true;
  185. }
  186. //Callback after UI is fully loaded and displayed.
  187. function OnAnalysisShow(){
  188. //unit.form.form.Show();
  189. }
  190. function OnSolveShow(){
  191. }
  192. function OnReady(reload, preview) {
  193. }
  194. function OnCloseForm() {
  195. //console.log(11);
  196. //model.deleteFile(model.getCurrentDirectory() + 'data/faceID');
  197. //model.deleteFile(model.getCurrentDirectory() + 'data/face');
  198. //model.deleteFile(model.getCurrentDirectory() + 'data/peidian');
  199. //model.deleteFile(model.getCurrentDirectory() + 'data/restraint');
  200. //model.deleteFile(model.getCurrentDirectory() + 'data/force');
  201. //model.deleteFile(model.getCurrentDirectory() + 'data/beam');
  202. }
  203. function OnException(err) {
  204. //ui.MessageBox('Error', '' + err, MessageBox.Icon.Critical, MessageBox.Button.Ok);
  205. }
  206. //////////////////////////////////////////////////////////////////////////
  207. // Callback Functions.
  208. // 641a254c-ef3e-11ea-bc8a-379bb908bdd7
  209. function OnSetChangePost(attribute){
  210. comx.ply.setChangeData(vtkContext.Interface(), postManage, attribute);
  211. ui.canvas.update();
  212. }
  213. function OnPostBar(attribute, isBar){
  214. comx.ply.setPostBars(vtkContext.Interface(), postManage, attribute, isBar);
  215. ui.canvas.update();
  216. }
  217. function OnGenerateGuass(id){
  218. var res = comx.ply.generateBreps(vtkContext.Interface(), workData, id, model.getCurrentDirectory());
  219. ui.canvas.update();
  220. return res;
  221. }
  222. function OnGetName(){
  223. return comx.ply.getCurrentActorName(vtkContext.Interface(), workData);
  224. }
  225. function mousePick(type){
  226. if(type === "points"){
  227. comx.ply.mousePick(vtkContext.Interface(), workData, "points");
  228. }
  229. }
  230. function OnRenders(path, rate){
  231. comx.ply.renderer(vtkContext.Interface(), postManage, path, rate);
  232. ui.canvas.update();
  233. }
  234. function OnSpheres(x, y, z, radius, name){
  235. var res = comx.ply.setSpheres(vtkContext.Interface(), workData, parseFloat(x), parseFloat(y), parseFloat(z), parseFloat(radius), name);
  236. ui.canvas.update();
  237. return res;
  238. }
  239. function OnConnects(x, y, z, X, Y, Z, r, g, b, name){
  240. var res = comx.ply.setConnects(vtkContext.Interface(), workData, x, y, z, X, Y, Z, r, g, b, name);
  241. ui.canvas.update();
  242. return res;
  243. }
  244. function OnSpring(x, y, z, X, Y, Z, r, g, b, name){
  245. var res = comx.ply.setSprings(vtkContext.Interface(), workData, x, y, z, X, Y, Z, r, g, b, name);
  246. ui.canvas.update();
  247. return res;
  248. }
  249. function OnPic(){
  250. comx.ply.pickup(vtkContext.Interface(), workData, "points", 0);
  251. ui.canvas.update();
  252. }
  253. function OnBeams(seg, x1, y1, z1, x2, y2, z2, r, g, b, radius, name){
  254. var res = comx.ply.setBeams(vtkContext.Interface(), workData, seg, x1, y1, z1, x2, y2, z2, r, g, b, radius, name);
  255. ui.canvas.update();
  256. return res;
  257. }
  258. function OnConstrains(x, y, z, name){
  259. var res = comx.ply.setConstraints(vtkContext.Interface(), workData, x, y, z, name);
  260. ui.canvas.update();
  261. return res;
  262. }
  263. function OnArrows(x, y, z, xn, yn, zn, name){
  264. return comx.ply.setArrows(vtkContext.Interface(), workData, x, y, z, xn, yn, zn, name);
  265. ui.canvas.update();
  266. }
  267. function OnSetPoints(x, y, z, radius, name){
  268. comx.ply.setPoints(vtkContext.Interface(), workData, x, y, z, radius, name);
  269. ui.canvas.update();
  270. }
  271. function OnMat(){
  272. comx.ply.mousePick(vtkContext.Interface(), workData, "beams_point");
  273. }
  274. function setExecs(index){
  275. ui.cw_solve_setup.exec = index;
  276. }
  277. function OnWindowVisible(idx){
  278. ui.stack_menu.visible = idx;
  279. ui.stack_switch.visible = idx;
  280. }
  281. function OnChangePicture(id, value){
  282. if(id === 1){
  283. if(value === 1){
  284. ui.pc_geo.value = model.getPicturePath('蓝灰色.png');
  285. }else if(value === 2){
  286. ui.pc_geo.value = model.getPicturePath('绿色.png');
  287. }else if(value === 3){
  288. ui.pc_geo.value = model.getPicturePath('红色.png');
  289. }
  290. }else if(id === 2){
  291. if(value === 1){
  292. ui.pc_mat.value = model.getPicturePath('蓝灰色.png');
  293. }else if(value === 2){
  294. ui.pc_mat.value = model.getPicturePath('绿色.png');
  295. }else if(value === 3){
  296. ui.pc_mat.value = model.getPicturePath('红色.png');
  297. }
  298. }else if(id === 3){
  299. if(value === 1){
  300. ui.pc_bou.value = model.getPicturePath('蓝灰色.png');
  301. }else if(value === 2){
  302. ui.pc_bou.value = model.getPicturePath('绿色.png');
  303. }else if(value === 3){
  304. ui.pc_bou.value = model.getPicturePath('红色.png');
  305. }
  306. }else if(id === 4){
  307. if(value === 1){
  308. ui.pc_sol.value = model.getPicturePath('蓝灰色.png');
  309. }else if(value === 2){
  310. ui.pc_sol.value = model.getPicturePath('绿色.png');
  311. }else if(value === 3){
  312. ui.pc_sol.value = model.getPicturePath('红色.png');
  313. }
  314. }else if(id === 5){
  315. if(value === 1){
  316. ui.pc_res.value = model.getPicturePath('蓝灰色.png');
  317. }else if(value === 2){
  318. ui.pc_res.value = model.getPicturePath('绿色.png');
  319. }else if(value === 3){
  320. ui.pc_res.value = model.getPicturePath('红色.png');
  321. }
  322. }
  323. }
  324. function OnCueline(msg, color){
  325. let real_color = 'black';
  326. if(color){real_color = color;}
  327. if(!msg) {
  328. ui.cueline.value = "";
  329. return;
  330. }
  331. ui.cueline.value = `<span style=\"color:black\"><u><b>提示信息</b></u>:</span><span style="color:${real_color}">${msg}</span>`;// + msg;
  332. }
  333. function OnPoints(){
  334. //OnSend('pointsCoord');
  335. comx.ply.mousePick(vtkContext.Interface(), workData, "points");
  336. }
  337. function OnMaterial(){
  338. ui.stack_menu.index = 19;
  339. console.log(22);
  340. }
  341. function OnFalseOpacity(){
  342. var id = parent.setTimeout(() => {
  343. OnSend('0');
  344. }, 100);
  345. OnSend('Opacity 0');
  346. }
  347. function OnOpacity(){
  348. var id = parent.setTimeout(() => {
  349. OnSend('0');
  350. }, 100);
  351. OnSend('Opacity 1');
  352. }
  353. function OnFaceCanvas(){
  354. ui.canvas.filter = [2025]; //面
  355. if (ui.canvas.view()) {
  356. ui.canvas.view().setColor(0.5, 0.5, 0.5, 0.2);
  357. ui.canvas.view().setVisible(true);
  358. ui.canvas.view().setBlend(false);
  359. }
  360. }
  361. function OnLineCanvas(){
  362. ui.canvas.filter = [2025]; //面
  363. if (ui.canvas.view()) {
  364. //ui.canvas.view().setColor(1.0, 1.0, 0.0, 0.0);
  365. ui.canvas.view().setVisible(true);
  366. ui.canvas.view().setBlend(true);
  367. }
  368. }
  369. function OnHightFace(idx){
  370. ui.canvas.view([ui.canvas.generateKey(2025, parseInt(idx))]).setColor(1.0, 0.0, 0.0);
  371. }
  372. function OnSetProp(index){
  373. ui.prop.visible = true;
  374. ui.prop.value = parseFloat(index);
  375. if(parseFloat(index) === 100){
  376. ui.prop.visible = false;
  377. }
  378. }
  379. function OnGetBeam(idx){
  380. myArray.push(idx);
  381. ui.cw_boundary_spring.beam = myArray;
  382. }
  383. function OnDeleteBeam(idx){
  384. myArray.splice(idx, 1);
  385. ui.cw_boundary_spring.beam = myArray;
  386. }
  387. function OnModuleChange(idx){
  388. ui.stack_switch.index = parseInt(idx);
  389. }
  390. function OnTransform(idx) {
  391. //ui.pb_pan.valid = ui.pb_rotate.valid = ui.pb_zoom.valid = ui.pb_zoom_window.valid = false;
  392. if (idx === 1) {
  393. //ui.pb_pan.valid = true;
  394. ui.canvas.sensor = GL.Sensor.Pan;
  395. }
  396. if (idx === 2) {
  397. //ui.canvas.sensor = GL.Sensor.Rotate;
  398. ui.pb_rotate.valid = true;
  399. }
  400. if (idx === 3) {
  401. //ui.canvas.sensor = GL.Sensor.Scale;
  402. ui.pb_zoom.valid = true;
  403. }
  404. if (idx === 4) {
  405. //ui.canvas.sensor = GL.Sensor.RectScale;
  406. ui.pb_zoom_window.valid = true;
  407. }
  408. }
  409. function On3DPosition(idx) {
  410. //ui.pb_yox.valid = ui.pb_xoy.valid = ui.pb_zoy.valid = ui.pb_yoz.valid = ui.pb_zox.valid = ui.pb_xoz.valid = false;
  411. if (idx === 1) {
  412. //ui.pb_yox.valid = true;
  413. ui.canvas.sensor = GL.Sensor.YOX;
  414. }
  415. if (idx === 2) {
  416. //ui.pb_xoy.valid = true;
  417. ui.canvas.sensor = GL.Sensor.XOY;
  418. }
  419. if (idx === 3) {
  420. //ui.pb_zoy.valid = true;
  421. ui.canvas.sensor = GL.Sensor.ZOY;
  422. }
  423. if (idx === 4) {
  424. //ui.pb_yoz.valid = true;
  425. ui.canvas.sensor = GL.Sensor.YOZ;
  426. }
  427. if (idx === 5) {
  428. //ui.pb_xoz.valid = true;
  429. ui.canvas.sensor = GL.Sensor.XOZ;
  430. }
  431. if (idx === 6) {
  432. //ui.pb_zox.valid = true;
  433. ui.canvas.sensor = GL.Sensor.ZOX;
  434. }
  435. }
  436. //用树id取出真实id
  437. function findRIdById(jsonData, targetId) {
  438. let result = null; // 存储结果
  439. function traverse(node) {
  440. // 如果当前节点的 id 匹配目标值,记录其 r_id
  441. if (node.id === targetId) {
  442. result = node.r_id;
  443. return; // 提前结束递归
  444. }
  445. // 如果有子节点,则递归遍历子节点
  446. if (node.children && Array.isArray(node.children)) {
  447. for (let child of node.children) {
  448. traverse(child);
  449. if (result !== null) {return;} // 如果已找到,停止遍历
  450. }
  451. }
  452. }
  453. traverse(jsonData); // 开始遍历
  454. return result; // 返回结果或 null
  455. }
  456. //将真实id转换为对应树id
  457. function findNodeIdByRId(jsonData, targetRId) {
  458. let result = null; // 用于存储找到的节点的 id
  459. function traverse(node) {
  460. // 如果当前节点的 r_id 与目标值匹配,记录其 id
  461. if (node.r_id === targetRId) {
  462. result = node.id;
  463. return; // 提前结束当前递归
  464. }
  465. // 如果有子节点,则递归遍历子节点
  466. if (node.children && Array.isArray(node.children)) {
  467. for (let child of node.children) {
  468. traverse(child);
  469. if (result !== null) {return;} // 如果已经找到,停止遍历
  470. }
  471. }
  472. }
  473. traverse(jsonData); // 开始遍历
  474. return result; // 返回找到的 id 或 null
  475. }
  476. function OnPickUp() {
  477. if (!ui.canvas.hits) {
  478. return;
  479. }
  480. //放brep路径
  481. var rec = ui.canvas.hits[0];
  482. var key = rec.keyRecord;
  483. var keyObj = ui.canvas.parseKey(key);
  484. let id = findNodeIdByRId(model.acax_app.model.project.GetModel().pro_model, keyObj.sid);
  485. var path = model.getCurrentDirectory() + "data/brep/face" + id + ".brep";
  486. comx.occio.GetFaceBrep(comx.occore.GetEntryEx(), keyObj.sid, path);
  487. var facName = "type:F 0 " + id + " " + comx.occio.GetFacePoint(comx.occore.GetEntryEx(), keyObj.sid);
  488. OnSetFaceName(facName);
  489. let brep = {
  490. "brep":path.replace(/\\/g, "/")
  491. } ;
  492. unit.form.tree.SetBrepFile(brep);
  493. }
  494. function GetBrepPath() {
  495. return brep_path;
  496. }
  497. var faceName;
  498. function OnSetFaceName(input){
  499. faceName = input;
  500. }
  501. function OnGetFaceName(){
  502. return faceName;
  503. }
  504. function pick(idx) {
  505. console.log(idx);
  506. if (idx === 1) {
  507. ui.canvas.picker = {
  508. mode: GL.Picker.Mode.Single,
  509. autoHighlight: true,
  510. behavior: GL.Picker.Behavior.Point
  511. };
  512. }
  513. if (idx === 2) {
  514. ui.canvas.picker = {
  515. mode: GL.Picker.Mode.Multi,
  516. autoHighlight: true,
  517. behavior: GL.Picker.Behavior.None
  518. };
  519. }
  520. }
  521. function OnChangeWindows(Idx){
  522. if(Idx === 1){
  523. ui.pb_window.index = 0;
  524. }
  525. if(Idx === 2){
  526. ui.pb_window.index = 1;
  527. }
  528. }
  529. function OnOpenSTL(){
  530. var fname = ui.OpenFileDialog("Import File", unit.dir + 'data/', "Stl Files(*.stl *.STL)");
  531. ui.cw_boundary_STL.path = fname;
  532. }
  533. function OnSend(Idx) {
  534. //console.log(33);
  535. if (g_io) {
  536. g_io.send(Idx);
  537. }
  538. }
  539. function OnOpenFile(fname) {
  540. //console.log(1000);
  541. if (fname) {
  542. //console.log(fname);
  543. model.execs(model.getCurrentDirectory() + "/src/generateBrep/generateBrep.exe " + fname + " " + model.getCurrentDirectory(), cb => {
  544. console.log(cb);
  545. });
  546. var is_step = (fname.indexOf('.STEP') !== -1) ||
  547. (fname.indexOf('.step') !== -1) ||
  548. (fname.indexOf('.STP') !== -1) ||
  549. (fname.indexOf('.stp') !== -1);
  550. var is_nas = (fname.indexOf('.nas') !== -1) || (fname.indexOf('.NAS') !== -1);
  551. model.wait();
  552. ui.canvas.db = null;
  553. parent.setTimeout(() => {
  554. if (is_step) {
  555. console.time('Global Step Load');
  556. ui.canvas.step = fname;
  557. console.timeEnd('Global Step Load');
  558. } else if (is_nas) {
  559. console.time('Global Nastran Load');
  560. ui.canvas.nastran = fname;
  561. console.timeEnd('Global Nastran Load');
  562. SetCanvasProp();
  563. } else {
  564. console.time('Global Iges Load');
  565. ui.canvas.iges = fname;
  566. console.timeEnd('Global Iges Load');
  567. }
  568. SetCanvasProp();
  569. ui.canvas.lamp = true;
  570. model.stop();
  571. }, 100);
  572. }
  573. ui.cw_geometry_check.path = fname;
  574. }
  575. function OnChangeValue(idx){
  576. menu(idx);
  577. }
  578. function menu(Idx) {
  579. ui.stack_menu.index = parseInt(Idx);
  580. }
  581. function changeConstrain(index1, index2){
  582. if(index1 === 1){
  583. ui.cw_boundary_constraint_25.change1 = index2;
  584. }
  585. if(index1 === 2){
  586. ui.cw_boundary_constraint_25.change2 = index2;
  587. }
  588. if(index1 === 3){
  589. ui.cw_boundary_force_24.index = index2;
  590. }
  591. }
  592. //The message corresponding callback executed by the main form
  593. // when calling pui.fireEvent(type,para) in the Docker subform.
  594. function OnChildDockerMessage(type, para){
  595. }
  596. //////////////////////////////////////////////////////////////////////////
  597. // Utils Functions.
  598. // 6c165ad6-ef3e-11ea-987c-b761a131c2fe
  599. function onDragFile(filepath) {
  600. }
  601. /*Usage of BLOCK_EVENT
  602. BLOCK_EVENT(()=>{
  603. ui.[name].[var] = ...;
  604. });
  605. */
  606. function BLOCK_EVENT(cb) {
  607. ui.block_event = true;
  608. cb();
  609. ui.block_event = false;
  610. }