mainfrm_pane.js 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695
  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. function OnDockerChange(){
  16. updateDockerButtonStatus();
  17. }
  18. function OnResize() {
  19. if (dock_widget && !ui.docker.isVisible(dock_widget)) {
  20. showLeftDocker(true);
  21. }
  22. }
  23. function OnInitDocker() {
  24. dock_widget1 = appendDockPane(unit.form.toolbar, "", 4, 1|2|4);
  25. dock_widget2 = appendDockPane(unit.form.tree, "模型树", 1, 1|2);
  26. //dock_widget1 = appendDockPane(unit.form.toolAF_bar, "", 4, 1|2|4);
  27. //dock_widget3 = appendDockPane(unit.form.toolAF, "", 4, 1|2|4);
  28. //dock_widget1 = appendDockPane(unit.form.toolAF_bar, "", 4, 1|2|4);
  29. //dock_widget1 = appendDockPane(unit.form.message, "消息反馈区", 8, 8|2);
  30. }
  31. function updateDockerButtonStatus() {
  32. if (!dock_widget) {
  33. return;
  34. }
  35. //unit.form.cw_topmenu.onUpdateBtn(!ui.docker.isFloat(dock_widget), !ui.docker.isVisible(dock_widget));
  36. }
  37. function appendDockPane(sub_form, title, init_pos, allow_pos, features) {
  38. /*
  39. sub_form.Show();
  40. dock_widget = ui.docker.wrapWindow(sub_form.getWindowID(), "参数面板");
  41. */
  42. let dw = sub_form.CreateDock(title);
  43. if (features) {
  44. ui.docker.setFeatures(features);
  45. }
  46. ui.docker.setAllowAreas(dw, allow_pos);
  47. ui.docker.dock(dw, init_pos);
  48. return dw;
  49. }
  50. function showLeftDocker(flag) {
  51. ui.docker.show(dock_widget, flag);
  52. updateDockerButtonStatus();
  53. }
  54. function InitCanvasIOEngine() {
  55. ui.canvas.adaptor('nastran', function(fname_nas) {
  56. //console.log(fname_nas);
  57. console.time('Nastran Import');
  58. model.cueline('解析并加载Nastran文件 ...');
  59. model.updateGeometry(ui.geometry);
  60. ui.canvas.db = null;
  61. parent.mesh.shell.ClearCache();
  62. parent.mesh.shell.LoadNastranToCache(fname_nas);
  63. console.timeEnd('Nastran Import');
  64. model.cueline('创建图形缓冲区 ...');
  65. console.time('Nastran Buffer');
  66. var buf = parent.mesh.shell.RenderToGLCache();
  67. console.timeEnd('Nastran Buffer');
  68. model.cueline('生成图形数据库并渲染 ...');
  69. return buf;
  70. });
  71. /*
  72. ui.canvas.adaptor('step', function(fname_step) {
  73. console.time('Step Import'1
  74. model.cueline('解析并加载STEP文件 ...');
  75. model.updateGeometry(ui.geometry);
  76. ui.canvas.db = null;
  77. //comx.occore.Clear();
  78. comx.occio.ImportStep(comx.occore.GetEntry(), fname_step);
  79. console.timeEnd('Step Import');
  80. model.cueline('创建图形缓冲区 ...');
  81. console.time('Step Buffer');
  82. var gl_buf = comx.occrender.RenderToBuffer(comx.occore.GetEntry());
  83. console.timeEnd('Step Buffer');
  84. model.cueline('生成图形数据库并渲染 ...');
  85. return gl_buf;
  86. });*/
  87. ui.canvas.adaptor('step', function(fname_step) {
  88. console.log('Step');
  89. console.time('Step Import');
  90. model.cueline('解析并加载STEP文件 ...');
  91. model.updateGeometry(ui.geometry);
  92. ui.canvas.db = null;
  93. comx.occore.Clear();
  94. comx.occio.ImportStepEx(comx.occore.GetEntryEx(), fname_step);
  95. var modelTree = comx.occio.ImportStepEx(comx.occore.GetEntryEx(), fname_step);
  96. //ui.tree.tree = JSON.parse(modelTree);
  97. unit.form.tree.OnTree(JSON.parse(modelTree));
  98. var hashCodes = comx.occio.GetFaceHashCodes(comx.occore.GetEntryEx());
  99. console.log(JSON.parse(hashCodes));
  100. model.setHash(JSON.parse(hashCodes));
  101. console.timeEnd('Step Import');
  102. model.cueline('创建图形缓冲区 ...');
  103. console.time('Step Buffer');
  104. var gl_buf = comx.occrender.RenderToBufferEx(comx.occore.GetEntryEx());
  105. console.timeEnd('Step Buffer');
  106. model.cueline('生成图形数据库并渲染 ...');
  107. return gl_buf;
  108. });
  109. ui.canvas.adaptor('iges', function(fname_step) {
  110. console.time('Iges Import');
  111. model.cueline('解析并加载IGES文件 ...');
  112. model.updateGeometry(ui.geometry);
  113. ui.canvas.db = null;
  114. comx.occore.Clear();
  115. comx.occio.ImportIges(comx.occore.GetEntry(), fname_step);
  116. console.timeEnd('Iges Import');
  117. model.cueline('创建图形缓冲区 ...');
  118. console.time('Iges Buffer');
  119. var gl_buf = comx.occrender.RenderToBuffer(comx.occore.GetEntry());
  120. console.timeEnd('Iges Buffer');
  121. model.cueline('生成图形数据库并渲染 ...');
  122. return gl_buf;
  123. });
  124. }
  125. function SetCanvasProp() {
  126. ui.canvas.filter = [2025]; //面
  127. if (ui.canvas.view()) {
  128. //ui.canvas.view().setColor(0.75, 0.75, 0.75, 0.5);
  129. ui.canvas.view().setColor(1.0, 1.0, 0, 1.0);
  130. ui.canvas.view().setVisible(true);
  131. ui.canvas.view().setBlend(false);
  132. }
  133. ui.canvas.lamp = true;
  134. }
  135. //Callback of data preparation stage before UI is fully loaded.
  136. //显示3D模型
  137. function OnloadModel(path) {
  138. ui.canvas.step = path;
  139. }
  140. //清除canvas
  141. function ClearCanvas() {
  142. ui.canvas.db = null;
  143. comx.occore.Clear();
  144. }
  145. //设置材料参数界面
  146. function setMaterial(material) {
  147. ui.physics_mastk.setmaterial = material;
  148. }
  149. function OnInitializeData(reload, preview) {
  150. //model.ide_info(model.uuid().length);
  151. ui.pc_geo.value = model.getPicturePath('蓝灰色.png');
  152. OnCueline('白色->未使用,蓝灰色->正在处理,绿色->未通过,蓝色->通过', 'blue');
  153. InitCanvasIOEngine();
  154. if (g_io) {
  155. ui.cons.appendWindowByID(g_wid);
  156. ui.Activate();
  157. return;
  158. }
  159. g_io = model.startSubProcess(pid => {
  160. g_wid = ui.GetWinID(pid);
  161. ui.cons.appendWindowByID(g_wid);
  162. ui.Activate();
  163. //ui.SetFocus(ui.pmsg.handle);
  164. },
  165. msg => {
  166. //console.log(msg);
  167. unit.form.tree.OnMessage(msg);
  168. //console.log(msg);
  169. if(msg == 'step_file_loaded_flag') {
  170. ui.cueline.value = '';
  171. unit.form.result_attribute.OnReset();
  172. }
  173. //ui.cw_boundary_stress_more_Peidian.message = msg;
  174. ui.cw_result_Play_collision.frame = msg;
  175. /*
  176. if(msg === "*0"){
  177. OnSetProp(0);
  178. }else if(msg === "*10"){
  179. OnSetProp(10);
  180. }else if(msg === "*50"){
  181. OnSetProp(50);
  182. }else if(msg === "*80"){
  183. OnSetProp(80);
  184. }else if(msg === "*100"){
  185. OnSetProp(100);
  186. //model.stop();
  187. }*/
  188. //ui.cw_boundary_beam.message = msg;
  189. },
  190. attribute => {
  191. //console.log(msg);
  192. //myArray.push(attribute);
  193. ui.cw_result_Play_collision.Array = attribute;
  194. },
  195. ids => {
  196. //ui.cw_boundary_beam.ID = ids;
  197. //ui.cw_boundary_spring.ID = ids;
  198. console.log('ll' + ids);
  199. ui.physics_mastk.pb_ID =ids;
  200. },
  201. spring => {
  202. //ui.cw_boundary_spring.message = spring;
  203. const str = spring.split(' ');
  204. if(model.getStartEnd() === 0){
  205. ui.cw_boundary_constraint_25.pb_x = str[0];
  206. ui.cw_boundary_constraint_25.pb_y = str[1];
  207. ui.cw_boundary_constraint_25.pb_z = str[2];
  208. var strs = "";
  209. for(var i = 3; i < str.length; i++){
  210. strs += str[i] + ' ';
  211. }
  212. ui.cw_boundary_constraint_25.start_mes = strs;
  213. ui.cw_geometry_mark_22.pb_x = str[0];
  214. ui.cw_geometry_mark_22.pb_y = str[1];
  215. ui.cw_geometry_mark_22.pb_z = str[2];
  216. }
  217. if(model.getStartEnd() === 1){
  218. ui.cw_boundary_constraint_25.pb_X = str[0];
  219. ui.cw_boundary_constraint_25.pb_Y = str[1];
  220. ui.cw_boundary_constraint_25.pb_Z = str[2];
  221. ui.cw_boundary_constraint_25.end_mes = str[3];
  222. var strs = "";
  223. for(var i = 3; i < str.length; i++){
  224. strs += str[i] + ' ';
  225. }
  226. ui.cw_boundary_constraint_25.end_mes = strs;
  227. ui.cw_geometry_mark_22.pb_x = str[0];
  228. ui.cw_geometry_mark_22.pb_y = str[1];
  229. ui.cw_geometry_mark_22.pb_z = str[2];
  230. }
  231. if(model.getBeam()){
  232. var mes = '(' + str[0] + ',' + str[1] + ',' + str[2] + ')';
  233. model.setStr(mes);
  234. ui.cw_boundary_constraint_25.listbox = model.getStr();
  235. }
  236. /*
  237. if(model.getJudge() === 0) {
  238. //var str = val.split(' ');
  239. if(model.getStartEnd() === 0){
  240. ui.cw_boundary_spring.pb_x = str[0];
  241. ui.cw_boundary_spring.pb_y = str[1];
  242. ui.cw_boundary_spring.pb_z = str[2];
  243. console.log(str[0] + 's ' + str[1] + 's ' + str[2]);
  244. }
  245. if(model.getStartEnd() === 1){
  246. ui.cw_boundary_spring.pb_X = str[0];
  247. ui.cw_boundary_spring.pb_Y = str[1];
  248. ui.cw_boundary_spring.pb_Z = str[2];
  249. console.log(str[0] + 'd ' + str[1] + 'd ' + str[2]);
  250. }
  251. }
  252. if(model.getJudge() === 1) {
  253. //var str = val.split(' ');
  254. if(model.getStartEnd() === 0){
  255. ui.cw_boundary_spring.pb_x = str[0];
  256. ui.cw_boundary_spring.pb_y = str[1];
  257. ui.cw_boundary_spring.pb_z = str[2];
  258. ui.cw_boundary_spring.pb_startID = str[3];
  259. console.log(str[0] + 'a ' + str[1] + ' a' + str[2]);
  260. }
  261. if(model.getStartEnd() === 1){
  262. ui.cw_boundary_spring.pb_X = str[0];
  263. ui.cw_boundary_spring.pb_Y = str[1];
  264. ui.cw_boundary_spring.pb_Z = str[2];
  265. ui.cw_boundary_spring.pb_endID = str[3];
  266. console.log(str[0] + ' s' + str[1] + ' s' + str[2]);
  267. }
  268. }*/
  269. },
  270. selectFace => {
  271. const str = selectFace.split(' ');
  272. ui.cw_boundary_brep_23.list = str;
  273. },
  274. Eigenvalue =>{
  275. res.push(Eigenvalue);
  276. ui.cw_result_ModelAnsys_24.list = res;
  277. }, model.getCurrentDirectory() + "src_post/QFrameSelect.exe", model.getCurrentDirectory() + "src_post", 3000);
  278. parent.setTimeout(() => {
  279. OnInitDocker();
  280. }, 0);
  281. }
  282. //Callback after UI is fully loaded and displayed.
  283. function OnAnalysisShow(){
  284. //unit.form.form.Show();
  285. }
  286. function OnSolveShow(){
  287. }
  288. function OnReady(reload, preview) {
  289. }
  290. function OnCloseForm() {
  291. //console.log(11);
  292. //model.deleteFile(model.getCurrentDirectory() + 'data/faceID');
  293. //model.deleteFile(model.getCurrentDirectory() + 'data/face');
  294. //model.deleteFile(model.getCurrentDirectory() + 'data/peidian');
  295. //model.deleteFile(model.getCurrentDirectory() + 'data/restraint');
  296. //model.deleteFile(model.getCurrentDirectory() + 'data/force');
  297. //model.deleteFile(model.getCurrentDirectory() + 'data/beam');
  298. }
  299. function OnException(err) {
  300. //ui.MessageBox('Error', '' + err, MessageBox.Icon.Critical, MessageBox.Button.Ok);
  301. }
  302. //////////////////////////////////////////////////////////////////////////
  303. // Callback Functions.
  304. // 641a254c-ef3e-11ea-bc8a-379bb908bdd7
  305. function OnPickup(){
  306. }
  307. function OnMat(){
  308. OnSend('MatIds');
  309. }
  310. function setExecs(index){
  311. ui.cw_solve_setup.exec = index;
  312. }
  313. function OnWindowVisible(idx){
  314. ui.stack_menu.visible = idx;
  315. ui.stack_switch.visible = idx;
  316. }
  317. function OnChangePicture(id, value){
  318. if(id === 1){
  319. if(value === 1){
  320. ui.pc_geo.value = model.getPicturePath('蓝灰色.png');
  321. }else if(value === 2){
  322. ui.pc_geo.value = model.getPicturePath('绿色.png');
  323. }else if(value === 3){
  324. ui.pc_geo.value = model.getPicturePath('红色.png');
  325. }
  326. }else if(id === 2){
  327. if(value === 1){
  328. ui.pc_mat.value = model.getPicturePath('蓝灰色.png');
  329. }else if(value === 2){
  330. ui.pc_mat.value = model.getPicturePath('绿色.png');
  331. }else if(value === 3){
  332. ui.pc_mat.value = model.getPicturePath('红色.png');
  333. }
  334. }else if(id === 3){
  335. if(value === 1){
  336. ui.pc_bou.value = model.getPicturePath('蓝灰色.png');
  337. }else if(value === 2){
  338. ui.pc_bou.value = model.getPicturePath('绿色.png');
  339. }else if(value === 3){
  340. ui.pc_bou.value = model.getPicturePath('红色.png');
  341. }
  342. }else if(id === 4){
  343. if(value === 1){
  344. ui.pc_sol.value = model.getPicturePath('蓝灰色.png');
  345. }else if(value === 2){
  346. ui.pc_sol.value = model.getPicturePath('绿色.png');
  347. }else if(value === 3){
  348. ui.pc_sol.value = model.getPicturePath('红色.png');
  349. }
  350. }else if(id === 5){
  351. if(value === 1){
  352. ui.pc_res.value = model.getPicturePath('蓝灰色.png');
  353. }else if(value === 2){
  354. ui.pc_res.value = model.getPicturePath('绿色.png');
  355. }else if(value === 3){
  356. ui.pc_res.value = model.getPicturePath('红色.png');
  357. }
  358. }
  359. }
  360. function OnCueline(msg, color){
  361. let real_color = 'black';
  362. if(color){real_color = color;}
  363. if(!msg) {
  364. ui.cueline.value = "";
  365. return;
  366. }
  367. ui.cueline.value = `<span style=\"color:black\"><u><b>提示信息</b></u>:</span><span style="color:${real_color}">${msg}</span>`;// + msg;
  368. }
  369. function OnPoints(){
  370. OnSend('pointsCoord');
  371. }
  372. function OnMaterial(){
  373. ui.stack_menu.index = 19;
  374. console.log(22);
  375. }
  376. function OnFalseOpacity(){
  377. var id = parent.setTimeout(() => {
  378. OnSend('0');
  379. }, 100);
  380. OnSend('Opacity 0');
  381. }
  382. function OnOpacity(){
  383. var id = parent.setTimeout(() => {
  384. OnSend('0');
  385. }, 100);
  386. OnSend('Opacity 1');
  387. }
  388. function OnFaceCanvas(){
  389. ui.canvas.filter = [2025]; //面
  390. if (ui.canvas.view()) {
  391. ui.canvas.view().setColor(0.5, 0.5, 0.5, 0.2);
  392. ui.canvas.view().setVisible(true);
  393. ui.canvas.view().setBlend(false);
  394. }
  395. }
  396. function OnLineCanvas(){
  397. ui.canvas.filter = [2025]; //面
  398. if (ui.canvas.view()) {
  399. //ui.canvas.view().setColor(1.0, 1.0, 0.0, 0.0);
  400. ui.canvas.view().setVisible(true);
  401. ui.canvas.view().setBlend(true);
  402. }
  403. }
  404. function OnHightFace(idx){
  405. ui.canvas.view([ui.canvas.generateKey(2025, parseInt(idx))]).setColor(1.0, 0.0, 0.0);
  406. }
  407. function OnSetProp(index){
  408. ui.prop.visible = true;
  409. ui.prop.value = parseFloat(index);
  410. if(parseFloat(index) === 100){
  411. ui.prop.visible = false;
  412. }
  413. }
  414. function OnGetBeam(idx){
  415. myArray.push(idx);
  416. ui.cw_boundary_spring.beam = myArray;
  417. }
  418. function OnDeleteBeam(idx){
  419. myArray.splice(idx, 1);
  420. ui.cw_boundary_spring.beam = myArray;
  421. }
  422. function OnModuleChange(idx){
  423. ui.stack_switch.index = parseInt(idx);
  424. }
  425. function OnTransform(idx) {
  426. //ui.pb_pan.valid = ui.pb_rotate.valid = ui.pb_zoom.valid = ui.pb_zoom_window.valid = false;
  427. if (idx === 1) {
  428. //ui.pb_pan.valid = true;
  429. ui.canvas.sensor = GL.Sensor.Pan;
  430. }
  431. if (idx === 2) {
  432. //ui.canvas.sensor = GL.Sensor.Rotate;
  433. ui.pb_rotate.valid = true;
  434. }
  435. if (idx === 3) {
  436. //ui.canvas.sensor = GL.Sensor.Scale;
  437. ui.pb_zoom.valid = true;
  438. }
  439. if (idx === 4) {
  440. //ui.canvas.sensor = GL.Sensor.RectScale;
  441. ui.pb_zoom_window.valid = true;
  442. }
  443. }
  444. function On3DPosition(idx) {
  445. //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;
  446. if (idx === 1) {
  447. //ui.pb_yox.valid = true;
  448. ui.canvas.sensor = GL.Sensor.YOX;
  449. }
  450. if (idx === 2) {
  451. //ui.pb_xoy.valid = true;
  452. ui.canvas.sensor = GL.Sensor.XOY;
  453. }
  454. if (idx === 3) {
  455. //ui.pb_zoy.valid = true;
  456. ui.canvas.sensor = GL.Sensor.ZOY;
  457. }
  458. if (idx === 4) {
  459. //ui.pb_yoz.valid = true;
  460. ui.canvas.sensor = GL.Sensor.YOZ;
  461. }
  462. if (idx === 5) {
  463. //ui.pb_xoz.valid = true;
  464. ui.canvas.sensor = GL.Sensor.XOZ;
  465. }
  466. if (idx === 6) {
  467. //ui.pb_zox.valid = true;
  468. ui.canvas.sensor = GL.Sensor.ZOX;
  469. }
  470. }
  471. function OnPickUp() {
  472. if (!ui.canvas.hits) {
  473. return;
  474. }
  475. var rec = ui.canvas.hits[0];
  476. //console.log(ui.canvas.hits[0]);
  477. var key = rec.keyRecord;
  478. var keyObj = ui.canvas.parseKey(key);
  479. console.log(keyObj.sid);
  480. //ui.cw_boundary_face.ID = keyObj.sid;
  481. //ui.cw_boundary_fix.ID = keyObj.sid;
  482. var hashCodes = comx.occio.GetFaceHashCodes(comx.occore.GetEntryEx());
  483. console.log(hashCodes);
  484. //ui.cw_boundary_load.ID = JSON.parse(hashCodes)[parseInt(keyObj.sid)];
  485. ui.cw_boundary_load.ID = keyObj.sid;
  486. if(model.getCon() === 0){
  487. ui.canvas.view().setColor(0.0, 0.0, 1.0, 0.8);
  488. }else if(model.getCon() === 1){
  489. ui.canvas.view().setColor(1.0, 0.0, 0.0, 0.8);
  490. }
  491. //ui.cw_geometry_nurbs.sci = comx.occore.GetBrepInfo(keyObj.sid);
  492. //ui.cw_geometry_nurbs.self = FilterNurbsInfo();
  493. }
  494. function pick(idx) {
  495. console.log(idx);
  496. if (idx === 1) {
  497. ui.canvas.picker = {
  498. mode: GL.Picker.Mode.Single,
  499. autoHighlight: true,
  500. behavior: GL.Picker.Behavior.Point
  501. };
  502. }
  503. if (idx === 2) {
  504. ui.canvas.picker = {
  505. mode: GL.Picker.Mode.Multi,
  506. autoHighlight: true,
  507. behavior: GL.Picker.Behavior.None
  508. };
  509. }
  510. }
  511. function OnChangeWindows(Idx){
  512. if(Idx === 1){
  513. ui.pb_window.index = 0;
  514. }
  515. if(Idx === 2){
  516. ui.pb_window.index = 1;
  517. }
  518. }
  519. function OnOpenSTL(){
  520. var fname = ui.OpenFileDialog("Import File", unit.dir + 'data/', "Stl Files(*.stl *.STL)");
  521. ui.cw_boundary_STL.path = fname;
  522. }
  523. function OnSend(Idx) {
  524. //console.log(33);
  525. if (g_io) {
  526. g_io.send(Idx);
  527. }
  528. }
  529. function OnOpenFile(fname) {
  530. if (fname) {
  531. var is_step = (fname.indexOf('.STEP') !== -1) ||
  532. (fname.indexOf('.step') !== -1) ||
  533. (fname.indexOf('.STP') !== -1) ||
  534. (fname.indexOf('.stp') !== -1);
  535. var is_nas = (fname.indexOf('.nas') !== -1) || (fname.indexOf('.NAS') !== -1);
  536. model.wait();
  537. ui.canvas.db = null;
  538. parent.setTimeout(() => {
  539. if (is_step) {
  540. console.time('Global Step Load');
  541. ui.canvas.step = fname;
  542. console.timeEnd('Global Step Load');
  543. } else if (is_nas) {
  544. console.time('Global Nastran Load');
  545. ui.canvas.nastran = fname;
  546. console.timeEnd('Global Nastran Load');
  547. SetCanvasProp();
  548. } else {
  549. console.time('Global Iges Load');
  550. ui.canvas.iges = fname;
  551. console.timeEnd('Global Iges Load');
  552. }
  553. SetCanvasProp();
  554. ui.canvas.lamp = true;
  555. model.stop();
  556. }, 100);
  557. }
  558. ui.cw_geometry_check.path = fname;
  559. }
  560. function OnChangeValue(idx){
  561. /*console.log(ui.geometry.index);
  562. if(ui.geo.index === 0){
  563. menu(0);
  564. }
  565. if(ui.geo.index === 1){
  566. menu(2);
  567. }
  568. if(ui.geo.index === 2){
  569. menu(5);
  570. }
  571. if(ui.geo.index === 3){
  572. menu(10);
  573. }
  574. if(ui.geo.index === 4){
  575. menu(12);
  576. } */
  577. menu(idx);
  578. }
  579. function menu(Idx) {
  580. ui.stack_menu.index = parseInt(Idx);
  581. }
  582. //The message corresponding callback executed by the main form
  583. // when calling pui.fireEvent(type,para) in the Docker subform.
  584. function OnChildDockerMessage(type, para){
  585. }
  586. //////////////////////////////////////////////////////////////////////////
  587. // Utils Functions.
  588. // 6c165ad6-ef3e-11ea-987c-b761a131c2fe
  589. function onDragFile(filepath) {
  590. }
  591. /*Usage of BLOCK_EVENT
  592. BLOCK_EVENT(()=>{
  593. ui.[name].[var] = ...;
  594. });
  595. */
  596. function BLOCK_EVENT(cb) {
  597. ui.block_event = true;
  598. cb();
  599. ui.block_event = false;
  600. }