tree_pane.js 75 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597
  1. ////////////////////////////////////////////////////////////////////////////
  2. // System Pre-define Functions
  3. // 95099372-ef3e-11ea-9c81-bf848405c62e
  4. //Callback of data preparation stage before UI is fully loaded.
  5. //dcip节点和模型树节点对应值
  6. var g_cur_id2index_cache = {};
  7. var g_cur_index2id_cache = {};
  8. function OnInitializeData(reload, preview) {
  9. PUI(()=>{
  10. //you can access the 'ui' namespace in the parent form using the variable 'pui' here.
  11. //The 'pui' variable is valid in all functions of this document.
  12. //For robustness, you'd better use 'PUI(cb);' to access 'pui' variable.
  13. });
  14. ui.tree_menu.index = 2;
  15. ui.tree_Model;
  16. ui.tree_Model.title = ['Part Assemblies/Parts', '?Color', 'UID'];
  17. }
  18. //Callback after UI is fully loaded and displayed.
  19. function OnReady(reload, preview) {
  20. PUI(()=>{
  21. //you can access the 'ui' namespace in the parent form using the variable 'pui' here.
  22. //The 'pui' variable is valid in all functions of this document.
  23. //For robustness, you'd better use 'PUI(cb);' to access 'pui' variable.
  24. });
  25. }
  26. function OnCloseForm() {
  27. }
  28. function OnException(err) {
  29. //ui.MessageBox('Error', '' + err, MessageBox.Icon.Critical, MessageBox.Button.Ok);
  30. }
  31. var options = true;
  32. let myArray = [];
  33. //////////////////////////////////////////////////////////////////////////
  34. // Callback Functions.
  35. // 641a254c-ef3e-11ea-bc8a-379bb908bdd7
  36. //生成随机颜色
  37. function getRandomHexColor() {
  38. // 随机生成一个 0 到 16777215 之间的整数,并转换为十六进制字符串
  39. let color = Math.floor(Math.random() * 16777216).toString(16);
  40. // 确保颜色代码始终为 6 位
  41. return "#" + color.padStart(6, "0");
  42. }
  43. //生成求解文件
  44. function GenerateFile() {
  45. model.execs(model.getCurrentDirectory() + "/src/generateBrep/generateBrep.exe " + model.acax_app.model.project.GetModel().step.replace(/\\/g, "/") + " " + model.getCurrentDirectory(), cb => {
  46. console.log(cb);
  47. });
  48. model.acax_app.control.Export(info=>{
  49. console.log(JSON.stringify(info, null, 2));
  50. let cut_workcondition_index = model.acax_app.view.GetCurrentWorkConditionIndex();
  51. var File = ['结构静力学前处理文件', '\n$ address', info.model3d.step.replace(/\\/g, "/")];
  52. //添加材料
  53. File.push("\n$ materials");
  54. let str = info.mat_prop_list[0]["密度(g/cm^3)"] + " " + info.mat_prop_list[0]["弹性模量(MPa)"] + " " + info.mat_prop_list[0]["泊松比"] + " " +info.mat_prop_list[0]["屈服强度"];
  55. File.push(str);
  56. //添加BPP
  57. File.push("\n$ BPP");
  58. File.push(model.acax_app.view.GetProperty(cut_workcondition_index).BPP.BPP);
  59. //brepFiles
  60. File.push("\n$ brepFiles");
  61. //需要brepFiles文件
  62. let brep_data = model.acax_app.view.GetProperty(cut_workcondition_index).brep;
  63. let brep_arr = Object.keys(brep_data);
  64. for(let i = 0;i < brep_arr.length;++i) {
  65. File.push(brep_data[brep_arr[i]].brep);
  66. }
  67. /* if(self_prop.brep) {
  68. old_brep_path = model.acax_app.view.GetProperty(cut_workcondition_index).brep;
  69. brep_path = old_brep_path.concat(brep_path);
  70. brep_path = [...new Set(brep_path)];
  71. }
  72. let new_prop = model.acax_app.view.GetProperty(cut_workcondition_index);
  73. new_prop.brep = brep_path;
  74. model.acax_app.view.SetProperty(cut_workcondition_index, new_prop);*/
  75. //forceFace未实现
  76. File.push("\n$ forceFace id xn yn zn xr yr zr");
  77. for(let i = 0;i < info.cons_list.length;++i ) {
  78. if(info.cons_list[i].constraint === "分布载荷压力" && info.cons_list[i]["位置标记"][0] === 'F' ) {
  79. let str0 = info.cons_list[i]["位置标记"].split(" ");
  80. let str1 = str0[2] + " "+ info.cons_list[i]["压力方向fa_x"] + " " + info.cons_list[i]["压力方向fa_y"] + " " + info.cons_list[i]["压力方向fa_z"] + " "+info.cons_list[i]["压力大小fa_xr"] + " " + info.cons_list[i]["压力大小fa_yr"] +" " + info.cons_list[i]["压力大小fa_zr"];
  81. File.push(str1);
  82. }
  83. }
  84. //fixFace未实现
  85. File.push("\n$ fixFace id xn yn zn xr yr zr");
  86. for(let i = 0;i < info.cons_list.length;++i ) {
  87. if(info.cons_list[i].constraint === "固定支撑" && info.cons_list[i].type[0] === 'F' ) {
  88. let str0 = info.cons_list[i].type.split(" ");
  89. let str1 = str0[2] + " "+ info.cons_list[i]["固定支撑属性xd"] + " " + info.cons_list[i]["固定支撑属性yd"] + " " + info.cons_list[i]["固定支撑属性zd"] + " "+info.cons_list[i]["固定支撑属性xr"] + " " + info.cons_list[i]["固定支撑属性yr"] +" " + info.cons_list[i]["固定支撑属性zr"];
  90. File.push(str1);
  91. }
  92. }
  93. //添加梁和梁节点
  94. for(let i = 0;i < info.cons_list.length;++i ) {
  95. if(info.cons_list[i].constraint === "梁") {
  96. File.push("\n$ mat poi radius len seg Beam");
  97. let str1 = info.cons_list[i]["弹性模量"] + " " + info.cons_list[i]["泊松比"] + " " + info.cons_list[i]["梁约束参数半径"] + " " +info.cons_list[i]["梁约束参数长度"] + " " + info.cons_list[i]["梁约束参数个数"];
  98. File.push(str1);
  99. let len = info.cons_list[i]["梁约束参数个数"];
  100. File.push("\n$ x y z Beam");
  101. for(let j = 0 ; j <= len ;++j){
  102. let str = info.cons_list[i].point[j*3] + " " +info.cons_list[i].point[j*3 +1] + " " +info.cons_list[i].point[j*3 + 2];
  103. File.push(str);
  104. }
  105. }
  106. }
  107. //添加固定支撑
  108. File.push("\n$ con ids id xd yd zd xr yr zr Beam");
  109. for(let i = 0;i < info.cons_list.length;++i ) {
  110. if(info.cons_list[i].constraint === "固定支撑" && info.cons_list[i].type[0] === 'B') {
  111. let str0 = info.cons_list[i].type.split(" ");
  112. let str1 = str0[1] + " " + str0[2] + " "+ info.cons_list[i]["固定支撑属性xd"] + " " + info.cons_list[i]["固定支撑属性yd"] + " " + info.cons_list[i]["固定支撑属性zd"] + " "+info.cons_list[i]["固定支撑属性xr"] + " " + info.cons_list[i]["固定支撑属性yr"] +" " + info.cons_list[i]["固定支撑属性zr"];
  113. File.push(str1);
  114. }
  115. }
  116. //添加arrow
  117. File.push("\n$ arrow ids id xn yn zn xr yr zr Beam");
  118. for(let i = 0;i < info.cons_list.length;++i ) {
  119. if(info.cons_list[i].constraint === "固定支撑" && info.cons_list[i].type[0] === 'B') {
  120. let str0 = info.cons_list[i].type.split(" ");
  121. let str1 = str0[1] + " " + str0[2] + " "+ info.cons_list[i]["固定支撑属性xd"] + " " + info.cons_list[i]["固定支撑属性yd"] + " " + info.cons_list[i]["固定支撑属性zd"] + " "+info.cons_list[i]["固定支撑属性xr"] + " " + info.cons_list[i]["固定支撑属性yr"] +" " + info.cons_list[i]["固定支撑属性zr"];
  122. File.push(str1);
  123. }
  124. }
  125. //添加弹簧
  126. File.push("\n$ x y z X Y Z stiffness_x stiffness_y stiffness_z type1 type2 Spring");
  127. for(let i = 0;i < info.cons_list.length;++i ) {
  128. if(info.cons_list[i].constraint === "弹簧" && (info.cons_list[i].stypes[0] === 'P' ||info.cons_list[i].stypes[0] === 'B') && (info.cons_list[i].stypee[0] === 'P' ||info.cons_list[i].stypee[0] === 'B')) {
  129. let str1 = info.cons_list[i]["弹簧坐标x"] + " " + info.cons_list[i]["弹簧坐标y"] + " " + info.cons_list[i]["弹簧坐标z"] + " "+info.cons_list[i]["弹簧终点x"] + " " + info.cons_list[i]["弹簧终点y"] +" " + info.cons_list[i]["弹簧终点z"] + " " + info.cons_list[i].stiffness_x +" " + info.cons_list[i].stiffness_y+ " " + info.cons_list[i].stiffness_z + " " + info.cons_list[i].stypes[0] + " " + info.cons_list[i].stypee[0];
  130. File.push(str1);
  131. }
  132. }
  133. //添加连接
  134. File.push("\n$ type id1 id x1 y1 z1 type id1 id x2 y2 z2 xn yn zn xr yr zr Connect");
  135. for(let i = 0;i < info.cons_list.length;++i ) {
  136. if(info.cons_list[i].constraint === "连接" && (info.cons_list[i].ctypes[0] === 'P' ||info.cons_list[i].ctypes[0] === 'B') && (info.cons_list[i].ctpyee[0] === 'P' ||info.cons_list[i].ctpyee[0] === 'B')) {
  137. let str1 = info.cons_list[i].ctypes + " " + info.cons_list[i]["弹簧坐标x"] + " " + info.cons_list[i]["弹簧坐标y"] + " " + info.cons_list[i]["弹簧坐标z"] + " " + info.cons_list[i].ctpyee + " " + info.cons_list[i]["弹簧终点x"] + " " + info.cons_list[i]["弹簧终点y"] +" " + info.cons_list[i]["弹簧终点z"] + " " + info.cons_list[i]["弹簧材料xn"] +" " + info.cons_list[i]["弹簧材料yn"]+ " " + info.cons_list[i]["弹簧材料zn"] + " " + info.cons_list[i]["弹簧材料xr"] + " " + info.cons_list[i]["弹簧材料yr"]+ " "+ info.cons_list[i]["弹簧材料zr"];
  138. File.push(str1);
  139. }
  140. }
  141. //添加rb3
  142. for(let i = 0;i < info.cons_list.length;++i ) {
  143. if(info.cons_list[i].constraint === "rb3") {
  144. File.push("\n$ id RB3");
  145. let str1 = info.cons_list[i]["编号"];
  146. str1 = str1.split(" ");
  147. console.log(str1);
  148. for(let j = 0;j < str1.length;++j) {
  149. if(str1[j] !== '') {
  150. File.push(str1[j]);
  151. }
  152. }
  153. File.push("\n$ type id ids x y z RB3");
  154. let str = info.cons_list[i].types + " " +info.cons_list[i].x + " " + info.cons_list[i].y + " " + info.cons_list[i].z;
  155. File.push(str);
  156. }
  157. }
  158. console.log("rb3");
  159. //集中载荷rb3
  160. File.push("\n$ arrow type id ids xn yn zn xr yr zr RB3");
  161. for(let i = 0;i < info.cons_list.length;++i ) {
  162. if(info.cons_list[i].constraint === "集中载荷压力" && info.cons_list[i]["位置标记"][0] === 'P' ) {
  163. let str1 = info.cons_list[i]["位置标记"] + " " + info.cons_list[i]["压力方向xn"] + " " + info.cons_list[i]["压力方向yn"] + " "+info.cons_list[i]["压力方向zn"] + " " + info.cons_list[i]["压力大小xr"] +" " + info.cons_list[i]["压力大小yr"]+ " " + info.cons_list[i]["压力大小zr"];
  164. File.push(str1);
  165. }
  166. }
  167. //固定支撑rb3
  168. File.push("\n$ con type id ids xn yn zn xr yr zr RB3");
  169. for(let i = 0;i < info.cons_list.length;++i ) {
  170. if(info.cons_list[i].constraint === "固定支撑" && info.cons_list[i].type[0] === 'P') {
  171. let str1 = info.cons_list[i]["位置标记"] + " "+ info.cons_list[i]["固定支撑属性xd"] + " " + info.cons_list[i]["固定支撑属性yd"] + " " + info.cons_list[i]["固定支撑属性zd"] + " "+info.cons_list[i]["固定支撑属性xr"] + " " + info.cons_list[i]["固定支撑属性yr"] +" " + info.cons_list[i]["固定支撑属性zr"];
  172. File.push(str1);
  173. }
  174. }
  175. model.writeFile(File);
  176. });
  177. }
  178. function OnTest1(){
  179. //console.log(model.acax_app.model.constrain.Database());
  180. GenerateFile() ;
  181. //console.log(model.acax_app.model.constrain.Get(model.acax_app.model.constrain.Current()));
  182. }
  183. //创建约束显示
  184. function CreateContrainShow() {
  185. if(model.acax_app.model.workArea.Current() !== false && model.acax_app.model.project.Current() !== "" &&model.acax_app.model.workCondition.Current() !== ""){
  186. //获取工况数据库
  187. var new_arr_key ;
  188. var constrain_data;
  189. if(model.acax_app.model.workCondition.Current() === "") {
  190. new_arr_key = [];
  191. }else{
  192. constrain_data = model.acax_app.model.workCondition.Get(model.acax_app.model.workCondition.Current());
  193. if(Object.keys(constrain_data.constrain.db).length !== 0) {
  194. new_arr_key = Object.keys(constrain_data.constrain.db);
  195. }else{
  196. new_arr_key = [];
  197. }
  198. }
  199. //查看当前工程工况是否已加载
  200. const path1 = model.acax_app.model.workArea.Database().list[0];
  201. const workarea_name1 =path1.substring(path1.lastIndexOf('/') + 1);
  202. var cur_name = workarea_name1 + model.acax_app.model.project.Current() + model.acax_app.model.workCondition.Current();
  203. var flag = 1;
  204. if(workcondition.includes(cur_name)) {
  205. for(let i = 0;i < new_arr_key.length;++i) {
  206. let type = constrain_data.constrain.db[new_arr_key[i]].cons_type;
  207. unit.form.mainfrm.HideAndShow(type, constrain_data.constrain.db[new_arr_key[i]].unique, false);
  208. if(type === "rb3" && flag) {
  209. unit.form.mainfrm.HideAndShow("pick", "rb3", false);
  210. flag = 0;
  211. }
  212. }
  213. ShowPoints();
  214. }else{
  215. for(let i = 0;i < new_arr_key.length;++i) {
  216. if(constrain_data.constrain.db[new_arr_key[i]].constraint === "集中载荷压力") {
  217. unit.form.mainfrm.OnArrows(constrain_data.constrain.db[new_arr_key[i]]["位置坐标x"], constrain_data.constrain.db[new_arr_key[i]]["位置坐标y"], constrain_data.constrain.db[new_arr_key[i]]["位置坐标z"], constrain_data.constrain.db[new_arr_key[i]]["压力方向xn"], constrain_data.constrain.db[new_arr_key[i]]["压力方向yn"], constrain_data.constrain.db[new_arr_key[i]]["压力方向zn"], constrain_data.constrain.db[new_arr_key[i]].unique);
  218. console.log("集中载荷压力");
  219. }
  220. if(constrain_data.constrain.db[new_arr_key[i]].constraint === "固定支撑") {
  221. unit.form.mainfrm.OnConstrains(constrain_data.constrain.db[new_arr_key[i]].xc, constrain_data.constrain.db[new_arr_key[i]].yc, constrain_data.constrain.db[new_arr_key[i]].zc, constrain_data.constrain.db[new_arr_key[i]].unique);
  222. }
  223. if(constrain_data.constrain.db[new_arr_key[i]].constraint === "梁") {
  224. unit.form.mainfrm.OnBeams(constrain_data.constrain.db[new_arr_key[i]]["梁约束参数个数"], constrain_data.constrain.db[new_arr_key[i]]["梁约束位置xDirection"], constrain_data.constrain.db[new_arr_key[i]]["梁约束位置yDirection"], constrain_data.constrain.db[new_arr_key[i]]["梁约束位置zDirection"], constrain_data.constrain.db[new_arr_key[i]]["梁约束位置xCoord"], constrain_data.constrain.db[new_arr_key[i]]["梁约束位置yCoord"], constrain_data.constrain.db[new_arr_key[i]]["梁约束位置zCoord"], constrain_data.constrain.db[new_arr_key[i]].R, constrain_data.constrain.db[new_arr_key[i]].G, constrain_data.constrain.db[new_arr_key[i]].B, constrain_data.constrain.db[new_arr_key[i]]["梁节点大小半径"], constrain_data.constrain.db[new_arr_key[i]].unique);
  225. }
  226. if(constrain_data.constrain.db[new_arr_key[i]].constraint === "连接") {
  227. unit.form.mainfrm.OnConnects(constrain_data.constrain.db[new_arr_key[i]]["弹簧坐标x"], constrain_data.constrain.db[new_arr_key[i]]["弹簧坐标y"], constrain_data.constrain.db[new_arr_key[i]]["弹簧坐标z"], constrain_data.constrain.db[new_arr_key[i]]["弹簧终点x"], constrain_data.constrain.db[new_arr_key[i]]["弹簧终点y"], constrain_data.constrain.db[new_arr_key[i]]["弹簧终点z"], constrain_data.constrain.db[new_arr_key[i]].R, constrain_data.constrain.db[new_arr_key[i]].G, constrain_data.constrain.db[new_arr_key[i]].B, constrain_data.constrain.db[new_arr_key[i]].unique);
  228. }
  229. if(constrain_data.constrain.db[new_arr_key[i]].constraint === "弹簧") {
  230. unit.form.mainfrm.OnSpring(constrain_data.constrain.db[new_arr_key[i]]["弹簧坐标x"], constrain_data.constrain.db[new_arr_key[i]]["弹簧坐标y"], constrain_data.constrain.db[new_arr_key[i]]["弹簧坐标z"], constrain_data.constrain.db[new_arr_key[i]]["弹簧终点x"], constrain_data.constrain.db[new_arr_key[i]]["弹簧终点y"], constrain_data.constrain.db[new_arr_key[i]]["弹簧终点z"], constrain_data.constrain.db[new_arr_key[i]].R, constrain_data.constrain.db[new_arr_key[i]].G, constrain_data.constrain.db[new_arr_key[i]].B, constrain_data.constrain.db[new_arr_key[i]].unique);
  231. }
  232. if(constrain_data.constrain.db[new_arr_key[i]].constraint === "分布载荷压力") {
  233. unit.form.mainfrm.OnArrows(constrain_data.constrain.db[new_arr_key[i]]["位置坐标x"], constrain_data.constrain.db[new_arr_key[i]]["位置坐标y"], constrain_data.constrain.db[new_arr_key[i]]["位置坐标z"], constrain_data.constrain.db[new_arr_key[i]]["压力方向fa_x"], constrain_data.constrain.db[new_arr_key[i]]["压力方向fa_y"], constrain_data.constrain.db[new_arr_key[i]]["压力方向fa_z"], constrain_data.constrain.db[new_arr_key[i]].unique);
  234. }
  235. if(constrain_data.constrain.db[new_arr_key[i]].constraint === "rb3") {
  236. unit.form.mainfrm.OnSpheres(constrain_data.constrain.db[new_arr_key[i]].x, constrain_data.constrain.db[new_arr_key[i]].y, constrain_data.constrain.db[new_arr_key[i]].z, constrain_data.constrain.db[new_arr_key[i]].radius, constrain_data.constrain.db[new_arr_key[i]].unique);
  237. }
  238. }
  239. //加载点
  240. OnLoadPoints();
  241. workcondition.push(cur_name);
  242. }
  243. }
  244. }
  245. //已创建但被隐藏,显示点
  246. function ShowPoints() {
  247. let work_condition = model.acax_app.view.GetCurrentWorkConditionIndex();
  248. let point_model = model.acax_app.view.GetProperty(work_condition).point;
  249. let point_arr = Object.keys(point_model);
  250. for(let i = 0;i < point_arr.length;++i) {
  251. unit.form.mainfrm.HideAndShow("points", point_model[point_arr[i]].name, false);
  252. }
  253. }
  254. //加载点
  255. function OnLoadPoints() {
  256. let work_condition = model.acax_app.view.GetCurrentWorkConditionIndex();
  257. let point_model = model.acax_app.view.GetProperty(work_condition).point;
  258. let point_arr = Object.keys(point_model);
  259. for(let i = 0;i < point_arr.length;++i) {
  260. unit.form.mainfrm.OnSetPoints(point_model[point_arr[i]].x, point_model[point_arr[i]].y, point_model[point_arr[i]].z, point_model[point_arr[i]].radius, point_model[point_arr[i]].name);
  261. }
  262. }
  263. //隐藏旧的工况
  264. function HideWorkcondition() {
  265. if(model.acax_app.model.workArea.Current() !== false && model.acax_app.model.project.Current() !== "" &&model.acax_app.model.workCondition.Current() !== ""){
  266. let old_workcondition_index = model.acax_app.view.GetCurrentWorkConditionIndex();
  267. var point_model;
  268. var point_arr;
  269. if( model.acax_app.view.GetProperty(old_workcondition_index) === undefined || model.acax_app.view.GetProperty(old_workcondition_index).point === undefined) {
  270. point_model = {};
  271. }else{
  272. point_model = model.acax_app.view.GetProperty(old_workcondition_index).point;
  273. }
  274. point_arr = Object.keys(point_model);
  275. let constrain_data = model.acax_app.model.workCondition.Get(model.acax_app.model.workCondition.Current());
  276. var old_arr_key ;
  277. if(Object.keys(constrain_data.constrain.db).length !== 0) {
  278. old_arr_key = Object.keys(constrain_data.constrain.db);
  279. }else{
  280. old_arr_key = [];
  281. }
  282. //旧的隐藏
  283. //紫色包围盒开关
  284. var flag = 1;
  285. for(let i = 0;i <old_arr_key.length;++i ) {
  286. let type = constrain_data.constrain.db[old_arr_key[i]].cons_type;
  287. unit.form.mainfrm.HideAndShow(type, constrain_data.constrain.db[old_arr_key[i]].unique, true);
  288. if(type === "rb3" && flag) {
  289. unit.form.mainfrm.HideAndShow("pick", "rb3", true);
  290. flag = 0;
  291. }
  292. }
  293. for(let i = 0;i < point_arr.length;++i) {
  294. unit.form.mainfrm.HideAndShow("points", point_model[point_arr[i]].name, true);
  295. }
  296. }
  297. }
  298. //获取当前工作区名称加当前工程名称加当前工况名称
  299. function GetCurUniqueName() {
  300. const path = model.acax_app.model.workArea.Database().list[0];
  301. const workarea_name =path.substring(path.lastIndexOf('/') + 1);
  302. const proj_name = model.acax_app.model.project.Current();
  303. const workcondition_name = model.acax_app.model.workCondition.Current();
  304. return workarea_name + proj_name + workcondition_name;
  305. }
  306. //生成点
  307. function SetPoint(node) {
  308. let cut_workcondition_index = model.acax_app.view.GetCurrentWorkConditionIndex();
  309. let model_prop = model.acax_app.view.GetProperty(cut_workcondition_index);
  310. if(model_prop === undefined ) {
  311. model_prop = {};
  312. let point = {};
  313. point.point1 = node;
  314. console.log(point);
  315. model_prop.point = point;
  316. model.acax_app.view.SetProperty(cut_workcondition_index, model_prop);
  317. }else if(model_prop.point === undefined){
  318. let point = {};
  319. point.point1 = node;
  320. console.log(point);
  321. model_prop.point = point;
  322. model.acax_app.view.SetProperty(cut_workcondition_index, model_prop);
  323. }else{
  324. let len = Object.keys(model_prop.point).length;
  325. let temp = "point" + (len + 1);
  326. model_prop.point[temp] = node;
  327. model.acax_app.view.SetProperty(cut_workcondition_index, model_prop);
  328. }
  329. //console.log(model.acax_app.view.GetProperty(cut_workcondition_index));
  330. }
  331. //生成brep文件
  332. function SetBrepFile(brep_path){
  333. let cut_workcondition_index = model.acax_app.view.GetCurrentWorkConditionIndex();
  334. let model_prop = model.acax_app.view.GetProperty(cut_workcondition_index);
  335. if(model_prop === undefined ) {
  336. model_prop = {};
  337. let brep = {};
  338. brep.brep1 = brep_path;
  339. console.log(brep);
  340. model_prop.brep = brep;
  341. model.acax_app.view.SetProperty(cut_workcondition_index, model_prop);
  342. }else if(model_prop.brep === undefined){
  343. let brep = {};
  344. brep.brep1 = brep_path;
  345. //console.log(brep);
  346. model_prop.brep = brep;
  347. model.acax_app.view.SetProperty(cut_workcondition_index, model_prop);
  348. }else{
  349. let brep_arr = Object.keys(model_prop.brep);
  350. var i = 0;
  351. for( i = 0;i < brep_arr.length;++i) {
  352. console.log(model_prop.brep[brep_arr[i]].brep);
  353. console.log(brep_path.brep);
  354. if(model_prop.brep[brep_arr[i]].brep === brep_path.brep) {
  355. break;
  356. }
  357. }
  358. if(i === brep_arr.length) {
  359. let temp = "brep" + (brep_arr.length + 1);
  360. model_prop.brep[temp] = brep_path;
  361. model.acax_app.view.SetProperty(cut_workcondition_index, model_prop);
  362. }
  363. }
  364. //console.log(model.acax_app.view.GetProperty(cut_workcondition_index));
  365. }
  366. //生成BPP
  367. function SetBPPProperty(BPP) {
  368. let cut_workcondition_index = model.acax_app.view.GetCurrentWorkConditionIndex();
  369. let model_prop = model.acax_app.view.GetProperty(cut_workcondition_index);
  370. if(model_prop === undefined) {
  371. model_prop = {};
  372. model_prop.BPP = BPP;
  373. model.acax_app.view.SetProperty(cut_workcondition_index, model_prop);
  374. }else{
  375. model_prop.BPP = BPP;
  376. model.acax_app.view.SetProperty(cut_workcondition_index, model_prop);
  377. }
  378. console.log(model.acax_app.view.GetProperty(cut_workcondition_index));
  379. // console.log(model.acax_app.view.GetProperty(pro_index));
  380. }
  381. //修改约束属性的名字
  382. function ModifyConstraintName(new_name) {
  383. let cur_name = model.acax_app.model.constrain.Current();
  384. let flag = model.acax_app.control.constrain.Rename(cur_name, new_name);
  385. let cur_index = model.acax_app.view.GetCurrentWorkConditionIndex();
  386. let cur_id;
  387. if(flag === true) {
  388. unit.form.mainfrm.OnCueline('修改成功', 'green');
  389. }else{
  390. unit.form.mainfrm.OnCueline('修改失败', 'red');
  391. }
  392. model.acax_app.view.RenderTree(() => {
  393. g_cur_id2index_cache = {};
  394. g_cur_index2id_cache = {};
  395. }, info=>{
  396. //设置id
  397. let cur_check_state = 0;
  398. let cur_type = model.acax_app.path.Type(info.index);
  399. if( cur_type === 0 || cur_type === 2 || cur_type === 5) {
  400. cur_check_state = 3;
  401. }
  402. let id2index = g_cur_id2index_cache;
  403. let index2id = g_cur_index2id_cache;
  404. let index = info.index;
  405. let id = info.id;
  406. if(index) {
  407. id2index[id] = index;
  408. index2id[index] = id;
  409. }
  410. if((new_name === info.name) && (model.acax_app.path.Parent(info.index, 3) === cur_index)) {
  411. cur_id = info.id;
  412. }
  413. return {
  414. name : info.name,
  415. icon : info.icon,
  416. id : info.id,
  417. check_state : cur_check_state
  418. };
  419. },
  420. tree => {
  421. //从工程中获取保存的model数据
  422. if(model.acax_app.model.project.GetModel().pro_model){
  423. //获取当前工程的名字
  424. let pro_Index = model.acax_app.view.GetCurrentProjectIndex();
  425. let pro_name = model.acax_app.path.Name(pro_Index);
  426. let cur_model = model.acax_app.model.project.GetModel().pro_model;
  427. findAndAppendByName(tree, pro_name, cur_model);
  428. }
  429. //赋值给dcip的树结构
  430. ui.tree_Model.tree = tree;
  431. }
  432. );
  433. //渲染3d模型
  434. if(model.acax_app.model.project.GetModel().step === "unimported") {
  435. unit.form.mainfrm.ClearCanvas();
  436. }else{
  437. model.acax_app.view.Render3D(info=>{
  438. unit.form.mainfrm.OnloadModel(info.model3d.step);
  439. });
  440. }
  441. ui.tree_Model.position = cur_id;
  442. }
  443. //修改材料属性的名字
  444. function ModifyMaterialName(new_name) {
  445. let cur_name = model.acax_app.model.materialProp.Current();
  446. let flag = model.acax_app.control.materialProp.Rename(cur_name, new_name);
  447. let cur_index = model.acax_app.view.GetCurrentWorkConditionIndex();
  448. let cur_id;
  449. if(flag === true) {
  450. unit.form.mainfrm.OnCueline('修改成功', 'green');
  451. }else{
  452. unit.form.mainfrm.OnCueline('修改失败', 'red');
  453. }
  454. model.acax_app.view.RenderTree(() => {
  455. g_cur_id2index_cache = {};
  456. g_cur_index2id_cache = {};
  457. }, info=>{
  458. //设置id
  459. let cur_check_state = 0;
  460. let cur_type = model.acax_app.path.Type(info.index);
  461. if( cur_type === 0 || cur_type === 2 || cur_type === 5) {
  462. cur_check_state = 3;
  463. }
  464. let id2index = g_cur_id2index_cache;
  465. let index2id = g_cur_index2id_cache;
  466. let index = info.index;
  467. let id = info.id;
  468. if(index) {
  469. id2index[id] = index;
  470. index2id[index] = id;
  471. }
  472. if((new_name === info.name) && (model.acax_app.path.Parent(info.index, 3) === cur_index)) {
  473. cur_id = info.id;
  474. }
  475. return {
  476. name : info.name,
  477. icon : info.icon,
  478. id : info.id,
  479. check_state : cur_check_state
  480. };
  481. },
  482. tree => {
  483. //从工程中获取保存的model数据
  484. if(model.acax_app.model.project.GetModel().pro_model){
  485. //获取当前工程的名字
  486. let pro_Index = model.acax_app.view.GetCurrentProjectIndex();
  487. let pro_name = model.acax_app.path.Name(pro_Index);
  488. let cur_model = model.acax_app.model.project.GetModel().pro_model;
  489. findAndAppendByName(tree, pro_name, cur_model);
  490. }
  491. //赋值给dcip的树结构
  492. ui.tree_Model.tree = tree;
  493. }
  494. );
  495. //渲染3d模型
  496. if(model.acax_app.model.project.GetModel().step === "unimported") {
  497. unit.form.mainfrm.ClearCanvas();
  498. }else{
  499. model.acax_app.view.Render3D(info=>{
  500. unit.form.mainfrm.OnloadModel(info.model3d.step);
  501. });
  502. }
  503. ui.tree_Model.position = cur_id;
  504. }
  505. //修改的工程名
  506. function ModifyProName(new_name) {
  507. let cur_name = model.acax_app.path.Name(model.acax_app.view.GetCurrentProjectIndex());
  508. model.acax_app.model.project.Rename(cur_name, new_name);
  509. let cur_index = model.acax_app.view.GetCurrentWorkAreaIndex();
  510. let cur_id;
  511. model.acax_app.view.RenderTree(() => {
  512. g_cur_id2index_cache = {};
  513. g_cur_index2id_cache = {};
  514. }, info=>{
  515. //设置id
  516. let cur_check_state = 0;
  517. let cur_type = model.acax_app.path.Type(info.index);
  518. if( cur_type === 0 || cur_type === 2 || cur_type === 5) {
  519. cur_check_state = 3;
  520. }
  521. let id2index = g_cur_id2index_cache;
  522. let index2id = g_cur_index2id_cache;
  523. let index = info.index;
  524. let id = info.id;
  525. if(index) {
  526. id2index[id] = index;
  527. index2id[index] = id;
  528. }
  529. if((new_name === info.name) && (model.acax_app.path.Parent(info.index, 0) === cur_index)) {
  530. cur_id = info.id;
  531. }
  532. return {
  533. name : info.name,
  534. icon : info.icon,
  535. id : info.id,
  536. check_state : cur_check_state
  537. };
  538. },
  539. tree => {
  540. //从工程中获取保存的model数据
  541. if(model.acax_app.model.project.GetModel().pro_model){
  542. //获取当前工程的名字
  543. let pro_Index = model.acax_app.view.GetCurrentProjectIndex();
  544. let pro_name = model.acax_app.path.Name(pro_Index);
  545. let cur_model = model.acax_app.model.project.GetModel().pro_model;
  546. findAndAppendByName(tree, pro_name, cur_model);
  547. }
  548. //赋值给dcip的树结构
  549. ui.tree_Model.tree = tree;
  550. }
  551. );
  552. //渲染3d模型
  553. if(model.acax_app.model.project.GetModel().step === "unimported") {
  554. unit.form.mainfrm.ClearCanvas();
  555. }else{
  556. model.acax_app.view.Render3D(info=>{
  557. unit.form.mainfrm.OnloadModel(info.model3d.step);
  558. });
  559. }
  560. ui.tree_Model.position = cur_id;
  561. }
  562. //处理字符串截掉后五位
  563. function removeLastFiveCharacters(str) {
  564. str = String(str);
  565. if (str.length <= 5) {
  566. return ''; // 如果字符串长度小于等于 5,则返回空字符串
  567. }
  568. return str.substring(0, str.length - 5); // 提取从 0 到倒数第 5 位的子字符串
  569. }
  570. //点击弹出菜单
  571. function OnContentClick(){
  572. //获取一级子节点
  573. let str = removeLastFiveCharacters(ui.tree_Model.content_menu);
  574. let model_id = g_cur_id2index_cache[str];
  575. //let cur_name = model.acax_app.path.Name(model_id);
  576. switch (model.acax_app.path.Type(model_id)){
  577. case 2:
  578. unit.form.Rename.Show();
  579. break;
  580. case 3:
  581. break;
  582. case 4:
  583. unit.form.RenameConstraint.Show();
  584. break;
  585. case 5:
  586. unit.form.RenameMaterial.Show();
  587. break;
  588. default:
  589. break;
  590. }
  591. }
  592. //右键单击树效果
  593. function OnRightClick(){
  594. let model_id = g_cur_id2index_cache[ui.tree_Model.position];
  595. switch (model.acax_app.path.Type(model_id)){
  596. case 2:
  597. ui.tree_Model.content_menu =[{
  598. "name":"重命名",
  599. "icon":"",
  600. "id":ui.tree_Model.position + "13579"
  601. }];
  602. break;
  603. case 3:
  604. break;
  605. case 4:
  606. ui.tree_Model.content_menu =[{
  607. "name":"重命名",
  608. "icon":"",
  609. "id":ui.tree_Model.position + "13579"
  610. }];
  611. break;
  612. case 5:
  613. ui.tree_Model.content_menu =[{
  614. "name":"重命名",
  615. "icon":"",
  616. "id":ui.tree_Model.position + "13579"
  617. }];
  618. break;
  619. default:
  620. break;
  621. }
  622. }
  623. var workcondition = [];
  624. //点击树
  625. function OnClickTree(){
  626. //获取模型树的对应节点
  627. //ui.tree_Model.
  628. let model_id = g_cur_id2index_cache[ui.tree_Model.position];
  629. let cur_workarea = model.acax_app.view.GetCurrentWorkAreaIndex();
  630. let cur_proj = model.acax_app.view.GetCurrentProjectIndex();
  631. let cur_workcondition = model.acax_app.view.GetCurrentWorkConditionIndex();
  632. model.acax_app.view.RenderNode(model_id, info => {
  633. console.log(info);
  634. });
  635. switch (model.acax_app.path.Type(model_id)) {
  636. //切换工作区
  637. case 0:
  638. //不是当前工作区,切换工作区
  639. if(model_id !== cur_workarea){
  640. model.acax_app.view.RenderNode(model_id, info => {
  641. HideWorkcondition();
  642. OpenWorkArea(info.prop);
  643. //切换到当前工作区
  644. ui.tree_Model.position = g_cur_index2id_cache[model_id];
  645. });
  646. }
  647. break;
  648. //选中材料库
  649. case 1:
  650. break;
  651. //切换工程
  652. case 2:
  653. //不是当前工程,切换工程
  654. if(model_id !== cur_proj){
  655. //隐藏掉旧的工况
  656. HideWorkcondition();
  657. model.acax_app.view.RenderNode(model_id, info => {
  658. //切换工程
  659. ChangePro(model.acax_app.path.Name(model_id));
  660. //切换到当前工程
  661. ui.tree_Model.position = g_cur_index2id_cache[model_id];
  662. //在canvas显示新的约束
  663. CreateContrainShow();
  664. });
  665. }
  666. break;
  667. //切换工况
  668. case 3:
  669. //不是当前工况,切换工况
  670. if(model_id !== cur_workcondition){
  671. model.acax_app.view.RenderNode(model_id, info => {
  672. //隐藏工况
  673. HideWorkcondition();
  674. //切换工况,旧的隐藏
  675. let old_data = ChangeWorkCondition(model.acax_app.path.Name(model_id));
  676. ui.tree_Model.position = g_cur_index2id_cache[model_id];
  677. //显示工况
  678. CreateContrainShow();
  679. });
  680. }
  681. break;
  682. //选中约束
  683. case 4:
  684. model.acax_app.view.RenderNode(model_id, info => {
  685. //切换到当前约束
  686. model.acax_app.model.constrain.SwitchTo(model.acax_app.path.Name(model_id));
  687. //将约束属性设置到对应面板
  688. ChangeConstraint(Object.values(info.prop)[0], info.prop);
  689. //切换点击约束
  690. ui.tree_Model.position = g_cur_index2id_cache[model_id];
  691. //渲染到3D模型
  692. if(ui.tree_Model.node.check_state === 2) {
  693. unit.form.mainfrm.HideAndShow(info.prop.cons_type, info.prop.unique, false);
  694. console.log("show");
  695. }else if(ui.tree_Model.node.check_state === 0) {
  696. unit.form.mainfrm.HideAndShow(info.prop.cons_type, info.prop.unique, true);
  697. console.log("hide");
  698. }
  699. });
  700. break;
  701. //选中材料属性
  702. case 5:
  703. model.acax_app.view.RenderNode(model_id, info => {
  704. //切换当前材料
  705. model.acax_app.model.materialProp.SwitchTo(model.acax_app.path.Name(model_id));
  706. unit.form.mainfrm.menu(3);
  707. unit.form.mainfrm.OnChangePicture(2, 1);
  708. unit.form.mainfrm.OnCueline('结构静力学材料设置', 'blue');
  709. //将材料属性设置到面板
  710. unit.form.mainfrm.setMaterial(info.prop);
  711. //切换到点击材料
  712. ui.tree_Model.position = g_cur_index2id_cache[model_id];
  713. });
  714. break;
  715. default:
  716. break;
  717. }
  718. }
  719. //切换约束面板
  720. function ChangeConstraint(constraint_name, prop) {
  721. let constraint = {
  722. "固定支撑":function(){
  723. unit.form.mainfrm.menu(18);
  724. unit.form.mainfrm.changeConstrain(1, 0);
  725. unit.form.mainfrm.setConstraint(prop);
  726. },
  727. "梁":function(){
  728. unit.form.mainfrm.menu(18);
  729. unit.form.mainfrm.changeConstrain(1, 1);
  730. unit.form.mainfrm.changeConstrain(2, 0);
  731. unit.form.mainfrm.setConstraint(prop);
  732. },
  733. "弹簧":function(){
  734. unit.form.mainfrm.menu(18);
  735. unit.form.mainfrm.changeConstrain(1, 1);
  736. unit.form.mainfrm.changeConstrain(2, 1);
  737. unit.form.mainfrm.setConstraint(prop);
  738. },
  739. "连接":function(){
  740. unit.form.mainfrm.menu(18);
  741. unit.form.mainfrm.changeConstrain(1, 1);
  742. unit.form.mainfrm.changeConstrain(2, 2);
  743. unit.form.mainfrm.setConstraint(prop);
  744. },
  745. "梁(非均匀)":function(){
  746. },
  747. "集中载荷压力":function(){
  748. unit.form.mainfrm.menu(17);
  749. unit.form.mainfrm.changeConstrain(3, 0);
  750. unit.form.mainfrm.setConstraint(prop);
  751. },
  752. "分布载荷压力":function(){
  753. unit.form.mainfrm.menu(17);
  754. unit.form.mainfrm.changeConstrain(3, 1);
  755. unit.form.mainfrm.setConstraint(prop);
  756. },
  757. "rb3":function(){
  758. unit.form.mainfrm.menu(23);
  759. unit.form.mainfrm.setConstraint(prop);
  760. }
  761. };
  762. constraint[constraint_name]();
  763. }
  764. //测试函数
  765. function OnTest(){
  766. //GenerateFile();
  767. // console.log(model.acax_app.path.Name(g_cur_id2index_cache["131"]));
  768. //console.log(g_cur_id2index_cache);
  769. // console.log(g_cur_index2id_cache);
  770. }
  771. //切换工作区
  772. function OpenWorkArea(fname) {
  773. fname = fname.replace(/\/+/g, "\\");
  774. var work_path = model.acax_app.model.workArea.List();
  775. //渲染模型树
  776. for(var i = 0;i < work_path.length;++i) {
  777. work_path[i] = work_path[i].replace(/\/+/g, "\\");
  778. if(fname === work_path[i]){
  779. model.acax_app.control.workArea.SwitchTo(i);
  780. model.acax_app.view.RenderTree(() => {
  781. g_cur_id2index_cache = {};
  782. g_cur_index2id_cache = {};
  783. }, info=>{
  784. //设置id
  785. let cur_check_state = 0;
  786. let cur_type = model.acax_app.path.Type(info.index);
  787. if( cur_type === 0 || cur_type === 2 || cur_type === 5) {
  788. cur_check_state = 3;
  789. }else if((cur_type === 4 && model.acax_app.path.Parent(info.index, 3) === model.acax_app.view.GetCurrentWorkConditionIndex()) ||(info.index === model.acax_app.view.GetCurrentWorkConditionIndex())) {
  790. cur_check_state = 2;
  791. }
  792. let id2index = g_cur_id2index_cache;
  793. let index2id = g_cur_index2id_cache;
  794. let index = info.index;
  795. let id = info.id;
  796. if(index) {
  797. id2index[id] = index;
  798. index2id[index] = id;
  799. }
  800. return {
  801. name : info.name,
  802. icon : info.icon,
  803. id : info.id,
  804. check_state : cur_check_state
  805. };
  806. },
  807. tree => {
  808. //从工程中获取保存的model数据
  809. if(model.acax_app.model.project.GetModel().pro_model){
  810. //获取当前工程的名字
  811. let pro_Index = model.acax_app.view.GetCurrentProjectIndex();
  812. let pro_name = model.acax_app.path.Name(pro_Index);
  813. let cur_model = model.acax_app.model.project.GetModel().pro_model;
  814. findAndAppendByName(tree, pro_name, cur_model);
  815. }
  816. //赋值给dcip的树结构
  817. ui.tree_Model.tree = tree;
  818. }
  819. );
  820. }
  821. }
  822. //渲染3d模型
  823. if(model.acax_app.model.project.GetModel().step === "unimported") {
  824. unit.form.mainfrm.ClearCanvas();
  825. }else{
  826. model.acax_app.view.Render3D(info=>{
  827. unit.form.mainfrm.OnloadModel(info.model3d.step);
  828. CreateContrainShow();
  829. });
  830. }
  831. }
  832. //切换工程
  833. function ChangePro(pro_name) {
  834. model.acax_app.control.project.SwitchTo(pro_name);
  835. model.acax_app.view.RenderTree(() => {
  836. g_cur_id2index_cache = {};
  837. g_cur_index2id_cache = {};
  838. }, info=>{
  839. //设置id
  840. let cur_check_state = 0;
  841. let cur_type = model.acax_app.path.Type(info.index);
  842. if( cur_type === 0 || cur_type === 2 || cur_type === 5) {
  843. cur_check_state = 3;
  844. }else if((cur_type === 4 && model.acax_app.path.Parent(info.index, 3) === model.acax_app.view.GetCurrentWorkConditionIndex()) ||(info.index === model.acax_app.view.GetCurrentWorkConditionIndex())) {
  845. cur_check_state = 2;
  846. }
  847. let id2index = g_cur_id2index_cache;
  848. let index2id = g_cur_index2id_cache;
  849. let index = info.index;
  850. let id = info.id;
  851. if(index) {
  852. id2index[id] = index;
  853. index2id[index] = id;
  854. }
  855. return {
  856. name : info.name,
  857. icon : info.icon,
  858. id : info.id,
  859. check_state : cur_check_state
  860. };
  861. },
  862. tree => {
  863. //从工程中获取保存的model数据
  864. if(model.acax_app.model.project.GetModel().pro_model){
  865. //获取当前工程的名字
  866. let pro_Index = model.acax_app.view.GetCurrentProjectIndex();
  867. let pro_name = model.acax_app.path.Name(pro_Index);
  868. let cur_model = model.acax_app.model.project.GetModel().pro_model;
  869. findAndAppendByName(tree, pro_name, cur_model);
  870. }
  871. //赋值给dcip的树结构
  872. ui.tree_Model.tree = tree;
  873. }
  874. );
  875. //渲染3d模型
  876. if(model.acax_app.model.project.GetModel().step === "unimported") {
  877. unit.form.mainfrm.ClearCanvas();
  878. }else{
  879. model.acax_app.view.Render3D(info=>{
  880. unit.form.mainfrm.OnloadModel(info.model3d.step);
  881. });
  882. }
  883. }
  884. //切换工况
  885. function ChangeWorkCondition(wor_name) {
  886. var old_data = model.acax_app.model.workCondition.Get(model.acax_app.model.workCondition.Current());
  887. model.acax_app.control.workCondition.SwitchTo(wor_name);
  888. model.acax_app.view.RenderTree(() => {
  889. g_cur_id2index_cache = {};
  890. g_cur_index2id_cache = {};
  891. }, info=>{
  892. //设置id
  893. let cur_check_state = 0;
  894. let cur_type = model.acax_app.path.Type(info.index);
  895. if( cur_type === 0 || cur_type === 2 || cur_type === 5) {
  896. cur_check_state = 3;
  897. }else if((cur_type === 4 && model.acax_app.path.Parent(info.index, 3) === model.acax_app.view.GetCurrentWorkConditionIndex()) ||(info.index === model.acax_app.view.GetCurrentWorkConditionIndex())) {
  898. cur_check_state = 2;
  899. }
  900. let id2index = g_cur_id2index_cache;
  901. let index2id = g_cur_index2id_cache;
  902. let index = info.index;
  903. let id = info.id;
  904. if(index) {
  905. id2index[id] = index;
  906. index2id[index] = id;
  907. }
  908. return {
  909. name : info.name,
  910. icon : info.icon,
  911. id : info.id,
  912. check_state : cur_check_state
  913. };
  914. },
  915. tree => {
  916. //从工程中获取保存的model数据
  917. if(model.acax_app.model.project.GetModel().pro_model){
  918. //获取当前工程的名字
  919. let pro_Index = model.acax_app.view.GetCurrentProjectIndex();
  920. let pro_name = model.acax_app.path.Name(pro_Index);
  921. let cur_model = model.acax_app.model.project.GetModel().pro_model;
  922. findAndAppendByName(tree, pro_name, cur_model);
  923. }
  924. //赋值给dcip的树结构
  925. ui.tree_Model.tree = tree;
  926. }
  927. );
  928. //渲染3d模型
  929. /* if(model.acax_app.model.project.GetModel().step === "unimported") {
  930. unit.form.mainfrm.ClearCanvas();
  931. }else{
  932. model.acax_app.view.Render3D(info=>{
  933. unit.form.mainfrm.OnloadModel(info.model3d.step);
  934. });
  935. }*/
  936. return old_data;
  937. }
  938. //创建工作区
  939. function CreateWorkArea(name) {
  940. let tree_color = [];
  941. HideWorkcondition();
  942. model.acax_app.control.workArea.Append(name);
  943. let cur_id;
  944. model.acax_app.view.RenderTree(() => {
  945. g_cur_id2index_cache = {};
  946. g_cur_index2id_cache = {};
  947. }, info=>{
  948. //设置id
  949. let cur_check_state = 0;
  950. let cur_type = model.acax_app.path.Type(info.index);
  951. if( cur_type === 0 || cur_type === 2 || cur_type === 5) {
  952. cur_check_state = 3;
  953. }
  954. if((cur_type === 4 && model.acax_app.path.Parent(info.index, 3) === model.acax_app.view.GetCurrentWorkConditionIndex()) ||(info.index === model.acax_app.view.GetCurrentWorkConditionIndex())) {
  955. cur_check_state = 2;
  956. }
  957. if(cur_type === 0 || cur_type === 2 ||cur_type === 3) {
  958. tree_color.push("");
  959. }
  960. let id2index = g_cur_id2index_cache;
  961. let index2id = g_cur_index2id_cache;
  962. let index = info.index;
  963. let id = info.id;
  964. if(index) {
  965. id2index[id] = index;
  966. index2id[index] = id;
  967. }
  968. if("workArea" === info.name) {
  969. cur_id = info.id;
  970. }
  971. return {
  972. name : info.name,
  973. icon : info.icon,
  974. id : info.id,
  975. check_state : cur_check_state
  976. };
  977. },
  978. tree=>{
  979. ui.tree_Model.tree = tree;
  980. });
  981. ui.tree_Model.position = cur_id;
  982. //渲染3d模型
  983. if(model.acax_app.model.project.GetModel().step === "unimported") {
  984. unit.form.mainfrm.ClearCanvas();
  985. }else{
  986. model.acax_app.view.Render3D(info=>{
  987. unit.form.mainfrm.OnloadModel(info.model3d.step);
  988. });
  989. }
  990. ui.tree_Model.column = [1, tree_color];
  991. }
  992. //创建工程
  993. function CreateProject(name) {
  994. let tree_color = [];
  995. //隐藏掉旧的工况
  996. HideWorkcondition();
  997. model.acax_app.control.project.Create(name);
  998. let cur_name = model.acax_app.model.project.Current();
  999. let cur_index = model.acax_app.view.GetCurrentWorkAreaIndex();
  1000. let cur_id;
  1001. model.acax_app.view.RenderTree(() => {
  1002. g_cur_id2index_cache = {};
  1003. g_cur_index2id_cache = {};
  1004. }, info=>{
  1005. //设置id
  1006. let cur_check_state = 0;
  1007. let cur_type = model.acax_app.path.Type(info.index);
  1008. if( cur_type === 0 || cur_type === 2 || cur_type === 5) {
  1009. cur_check_state = 3;
  1010. }
  1011. if((cur_type === 4 && model.acax_app.path.Parent(info.index, 3) === model.acax_app.view.GetCurrentWorkConditionIndex()) ||(info.index === model.acax_app.view.GetCurrentWorkConditionIndex())) {
  1012. cur_check_state = 2;
  1013. }
  1014. if(cur_type === 0 || cur_type === 2 ||cur_type === 3) {
  1015. tree_color.push("");
  1016. }
  1017. let id2index = g_cur_id2index_cache;
  1018. let index2id = g_cur_index2id_cache;
  1019. let index = info.index;
  1020. let id = info.id;
  1021. if(index) {
  1022. id2index[id] = index;
  1023. index2id[index] = id;
  1024. }
  1025. if((cur_name === info.name) && (model.acax_app.path.Parent(info.index, 0) === cur_index)) {
  1026. cur_id = info.id;
  1027. }
  1028. return {
  1029. name : info.name,
  1030. icon : info.icon,
  1031. id : info.id,
  1032. check_state : cur_check_state
  1033. };
  1034. },
  1035. tree=>{
  1036. ui.tree_Model.tree = tree;
  1037. });
  1038. ui.tree_Model.position = cur_id;
  1039. //渲染3d模型
  1040. if(model.acax_app.model.project.GetModel().step === "unimported") {
  1041. unit.form.mainfrm.ClearCanvas();
  1042. }else{
  1043. model.acax_app.view.Render3D(info=>{
  1044. unit.form.mainfrm.OnloadModel(info.model3d.step);
  1045. });
  1046. }
  1047. ui.tree_Model.column = [1, tree_color];
  1048. }
  1049. //导入模型
  1050. function OnOpenStepFile() {
  1051. var model_file = myArray[parseFloat(ui.listbox.index)];
  1052. model.acax_app.control.ImportStep(model_file, (model_file, model_plyfile)=>{
  1053. model.acax_app.view.Render3D(info=>{
  1054. unit.form.mainfrm.OnloadModel(info.model3d.step);
  1055. });
  1056. }
  1057. );
  1058. }
  1059. //插入新子节点
  1060. function findAndAppendByName(json, targetName, newChild) {
  1061. if (json.name === targetName) {
  1062. // 拼接新的 JSON 数据
  1063. if (!json.children) {
  1064. json.children = [];
  1065. }
  1066. json.children.unshift(newChild);
  1067. return true; // 找到后返回 true
  1068. }
  1069. // 遍历子节点递归查找
  1070. if (json.children) {
  1071. for (const child of json.children) {
  1072. if (findAndAppendByName(child, targetName, newChild)) {
  1073. return true; // 如果找到目标节点,结束递归
  1074. }
  1075. }
  1076. }
  1077. return false; // 没找到返回 false
  1078. }
  1079. //给面节点改名字并添加check_state属性
  1080. function updateJsonNodes(jsonData) {
  1081. let count = 1; // 用于计数生成 Face1, Face2...
  1082. let count_id = 100000;
  1083. function traverse(node) {
  1084. // 为每个节点添加 check_state: 2 属性
  1085. node.check_state = 3;
  1086. node.icon = '';
  1087. node.r_id = node.id;
  1088. node.id = ++count_id;
  1089. node.color = getRandomHexColor();
  1090. // 如果存在 children 属性,则递归处理
  1091. if (node.children && Array.isArray(node.children)) {
  1092. for (let child of node.children) {
  1093. traverse(child); // 递归遍历子节点
  1094. }
  1095. } else if (node.name && node.name.startsWith("Face_")) {
  1096. // 修改 name 值为 Face1, Face2...
  1097. node.name = `Face${count}`;
  1098. count++;
  1099. }
  1100. }
  1101. traverse(jsonData);
  1102. return jsonData;
  1103. }
  1104. //查找模型的第一个节点值获取id
  1105. function getFirstId(obj) {
  1106. // 检查是否有 children 并提取第一个节点的 id
  1107. if (obj.children && obj.children.length > 0) {
  1108. return obj.children[0].id;
  1109. }
  1110. return null; // 如果没有子节点,返回 null
  1111. }
  1112. // 深度优先遍历函数赋值颜色
  1113. function dfsSetColor(node) {
  1114. // 如果节点有 color 属性,加入数组
  1115. if (node.color) {
  1116. tree_color.push(node.color);
  1117. }
  1118. // 遍历子节点
  1119. if (node.children && node.children.length > 0) {
  1120. node.children.forEach(child => dfs(child));
  1121. }
  1122. }
  1123. //导入模型树节点
  1124. function OnTree(Idx){
  1125. let tree_color = [];
  1126. updateJsonNodes(Idx);
  1127. model.acax_app.view.RenderTree(() => {
  1128. g_cur_id2index_cache = {};
  1129. g_cur_index2id_cache = {};
  1130. }, info=>{
  1131. //设置id
  1132. let color = "";
  1133. let cur_check_state = 0;
  1134. let cur_type = model.acax_app.path.Type(info.index);
  1135. if( cur_type === 0 || cur_type === 2 || cur_type === 5) {
  1136. cur_check_state = 3;
  1137. }
  1138. if((cur_type === 4 && model.acax_app.path.Parent(info.index, 3) === model.acax_app.view.GetCurrentWorkConditionIndex()) ||(info.index === model.acax_app.view.GetCurrentWorkConditionIndex())) {
  1139. cur_check_state = 2;
  1140. }
  1141. let id2index = g_cur_id2index_cache;
  1142. let index2id = g_cur_index2id_cache;
  1143. let index = info.index;
  1144. let id = info.id;
  1145. if(cur_type === 0 || cur_type === 2 ||cur_type === 3) {
  1146. color = "";
  1147. }
  1148. if(cur_type === 4 && model.acax_app.view.GetCurrentWorkConditionIndex() === model.acax_app.path.Parent(info.index, 3)) {
  1149. console.log(JSON.stringify(model.acax_app.model.constrain.Get(info.name), null, 2));
  1150. color = model.acax_app.model.constrain.Get(info.name).color;
  1151. }
  1152. if(index) {
  1153. id2index[id] = index;
  1154. index2id[index] = id;
  1155. }
  1156. return {
  1157. name : info.name,
  1158. icon : info.icon,
  1159. id : info.id,
  1160. check_state : cur_check_state,
  1161. color : color
  1162. };
  1163. },
  1164. tree => {
  1165. //插入模型树节点与工程节点进行拼接
  1166. let pro_Index= model.acax_app.view.GetCurrentProjectIndex();
  1167. let pro_name = model.acax_app.path.Name(pro_Index);
  1168. findAndAppendByName(tree, pro_name, Idx);
  1169. //将模型树节点与工程节点拼接后保存到model中
  1170. let pro_model = model.acax_app.model.project.GetModel();
  1171. pro_model.pro_model = Idx;
  1172. model.acax_app.model.project.SetModel(pro_model);
  1173. console.log(JSON.stringify(tree, null, 2));
  1174. dfsSetColor(tree);
  1175. ui.tree_Model.tree = tree;
  1176. }
  1177. );
  1178. ui.tree_Model.column = [1, tree_color];
  1179. ui.tree_Model.position = getFirstId(Idx);
  1180. }
  1181. //创建工况
  1182. function CreateWorkCondition(name){
  1183. //隐藏掉旧的工况
  1184. HideWorkcondition();
  1185. let condition_index = model.acax_app.control.workCondition.Create(name);
  1186. let cur_name = model.acax_app.model.workCondition.Current();
  1187. let cur_index = model.acax_app.view.GetCurrentProjectIndex();
  1188. let cur_id;
  1189. console.log(model.acax_app.path.Parent(cur_index, 2) === model.acax_app.view.GetCurrentProjectIndex());
  1190. model.acax_app.view.RenderTree(() => {
  1191. g_cur_id2index_cache = {};
  1192. g_cur_index2id_cache = {};
  1193. }, info=>{
  1194. //设置id
  1195. let cur_check_state = 0;
  1196. let cur_type = model.acax_app.path.Type(info.index);
  1197. if( cur_type === 0 || cur_type === 2 || cur_type === 5) {
  1198. cur_check_state = 3;
  1199. }
  1200. if((cur_type === 4 && model.acax_app.path.Parent(info.index, 3) === model.acax_app.view.GetCurrentWorkConditionIndex()) ||(info.index === model.acax_app.view.GetCurrentWorkConditionIndex())) {
  1201. cur_check_state = 2;
  1202. }
  1203. let id2index = g_cur_id2index_cache;
  1204. let index2id = g_cur_index2id_cache;
  1205. let index = info.index;
  1206. let id = info.id;
  1207. if(index) {
  1208. id2index[id] = index;
  1209. index2id[index] = id;
  1210. }
  1211. if((cur_name === info.name) && (model.acax_app.path.Parent(info.index, 2) === cur_index)) {
  1212. cur_id = info.id;
  1213. }
  1214. return {
  1215. name : info.name,
  1216. icon : info.icon,
  1217. id : info.id,
  1218. check_state : cur_check_state
  1219. };
  1220. },
  1221. tree => {
  1222. //获取当前工程的名字
  1223. let pro_Index = model.acax_app.view.GetCurrentProjectIndex();
  1224. let pro_name = model.acax_app.path.Name(pro_Index);
  1225. //模型存在在加载
  1226. if(model.acax_app.model.project.GetModel().pro_model) {
  1227. let cur_model = model.acax_app.model.project.GetModel().pro_model;
  1228. findAndAppendByName(tree, pro_name, cur_model);
  1229. }
  1230. //赋值给dcip的树结构
  1231. ui.tree_Model.tree = tree;
  1232. }
  1233. );
  1234. ui.tree_Model.position = cur_id;
  1235. tree_color.push("");
  1236. ui.tree_Model.column = [1, tree_color];
  1237. }
  1238. //创建材料属性
  1239. function CreateMaterial(mat) {
  1240. model.acax_app.control.materialProp.Create(mat);
  1241. let cur_name = model.acax_app.model.materialProp.Current();
  1242. let cur_index = model.acax_app.view.GetCurrentWorkConditionIndex();
  1243. let cur_id;
  1244. model.acax_app.view.RenderTree(() => {
  1245. g_cur_id2index_cache = {};
  1246. g_cur_index2id_cache = {};
  1247. }, info=>{
  1248. //设置id
  1249. let cur_check_state = 0;
  1250. let cur_type = model.acax_app.path.Type(info.index);
  1251. if( cur_type === 0 || cur_type === 2 || cur_type === 5) {
  1252. cur_check_state = 3;
  1253. }else if((cur_type === 4 && model.acax_app.path.Parent(info.index, 3) === model.acax_app.view.GetCurrentWorkConditionIndex()) ||(info.index === model.acax_app.view.GetCurrentWorkConditionIndex())) {
  1254. cur_check_state = 2;
  1255. }
  1256. let id2index = g_cur_id2index_cache;
  1257. let index2id = g_cur_index2id_cache;
  1258. let index = info.index;
  1259. let id = info.id;
  1260. if(index) {
  1261. id2index[id] = index;
  1262. index2id[index] = id;
  1263. }
  1264. if((cur_name === info.name) && (model.acax_app.path.Parent(info.index, 3) === cur_index)) {
  1265. cur_id = info.id;
  1266. }
  1267. return {
  1268. name : info.name,
  1269. icon : info.icon,
  1270. id : info.id,
  1271. check_state : cur_check_state
  1272. };
  1273. },
  1274. tree => {
  1275. //获取当前工程的名字
  1276. let pro_Index = model.acax_app.view.GetCurrentProjectIndex();
  1277. let pro_name = model.acax_app.path.Name(pro_Index);
  1278. if(model.acax_app.model.project.GetModel().pro_model) {
  1279. let cur_model = model.acax_app.model.project.GetModel().pro_model;
  1280. findAndAppendByName(tree, pro_name, cur_model);
  1281. }
  1282. //赋值给dcip的树结构
  1283. ui.tree_Model.tree = tree;
  1284. }
  1285. );
  1286. ui.tree_Model.position = cur_id;
  1287. //将材料属性添加到模型信息中
  1288. model.acax_app.view.Render3D(info=>{
  1289. info.model3d.materialProps.push(mat);
  1290. });
  1291. tree_color.push(getRandomHexColor());
  1292. ui.tree_Model.column = [1, tree_color];
  1293. }
  1294. //修改材料面板属性属性
  1295. function ModifyMaterial(material) {
  1296. //获取当前材料的名字
  1297. let material_name = model.acax_app.model.materialProp.Current();
  1298. model.acax_app.control.materialProp.Set(material, material_name);
  1299. unit.form.mainfrm.OnCueline('修改成功', 'green');
  1300. }
  1301. //创建载荷
  1302. function CreateBoundary(Load, name) {
  1303. let load = model.acax_app.control.constrain.Create(Load, name);
  1304. let cur_name = model.acax_app.model.constrain.Current();
  1305. let cur_index = model.acax_app.view.GetCurrentWorkConditionIndex();
  1306. var cur_id;
  1307. model.acax_app.view.RenderTree(() => {
  1308. g_cur_id2index_cache = {};
  1309. g_cur_index2id_cache = {};
  1310. }, info=>{
  1311. //设置id
  1312. let cur_check_state = 0;
  1313. let cur_type = model.acax_app.path.Type(info.index);
  1314. if( cur_type === 0 || cur_type === 2 || cur_type === 5) {
  1315. cur_check_state = 3;
  1316. }else if((cur_type === 4 && model.acax_app.path.Parent(info.index, 3) === model.acax_app.view.GetCurrentWorkConditionIndex()) ||(info.index === model.acax_app.view.GetCurrentWorkConditionIndex())) {
  1317. cur_check_state = 2;
  1318. }
  1319. let id2index = g_cur_id2index_cache;
  1320. let index2id = g_cur_index2id_cache;
  1321. let index = info.index;
  1322. let id = info.id;
  1323. if(index) {
  1324. id2index[id] = index;
  1325. index2id[index] = id;
  1326. }
  1327. if((cur_name === info.name) && (model.acax_app.path.Parent(info.index, 3) === cur_index)) {
  1328. cur_id = info.id;
  1329. cur_check_state = 2;
  1330. }
  1331. return {
  1332. name : info.name,
  1333. icon : info.icon,
  1334. id : info.id,
  1335. check_state : cur_check_state
  1336. };
  1337. },
  1338. tree => {
  1339. //获取当前工程的名字
  1340. let pro_Index = model.acax_app.view.GetCurrentProjectIndex();
  1341. let pro_name = model.acax_app.path.Name(pro_Index);
  1342. if(model.acax_app.model.project.GetModel().pro_model) {
  1343. let cur_model = model.acax_app.model.project.GetModel().pro_model;
  1344. findAndAppendByName(tree, pro_name, cur_model);
  1345. }
  1346. //赋值给dcip的树结构
  1347. ui.tree_Model.tree = tree;
  1348. }
  1349. );
  1350. //将载荷属性添加到模型信息中
  1351. console.log(cur_id);
  1352. ui.tree_Model.position = cur_id;
  1353. model.acax_app.view.Render3D(info=>{
  1354. info.model3d.constrains.push(Load);
  1355. });
  1356. tree_color.push(getRandomHexColor());
  1357. ui.tree_Model.column = [1, tree_color];
  1358. }
  1359. //修改载荷面板属性
  1360. function ModifyConstraint(constrain) {
  1361. let constrain_name = model.acax_app.model.constrain.Current();
  1362. model.acax_app.control.constrain.Set(constrain, constrain_name);
  1363. unit.form.mainfrm.OnCueline('修改成功', 'green');
  1364. }
  1365. function OnMessage(idx){
  1366. ui.cueline.value += idx + '\n';
  1367. ui.cueline.row = -1;
  1368. }
  1369. function OnChangeMenu(Idx){
  1370. ui.tree_menu.index = parseInt(Idx);
  1371. }
  1372. function OnDeleteFile() {
  1373. myArray.splice(parseFloat(ui.listbox.index), 1);
  1374. ui.listbox.list = [
  1375. myArray
  1376. ];
  1377. }
  1378. function OnOpenFile(){
  1379. var fname = ui.OpenFileDialog("Import File", unit.dir + 'data/', "Step Files(*.step *.stp);;Iges Files(*.iges *.igs);;Nastran Files(*.nas)");
  1380. model.write(fname, model.getCurrentDirectory() + '/data/address.txt');
  1381. myArray.push(fname);
  1382. ui.listbox.list = [
  1383. myArray
  1384. ];
  1385. }
  1386. function OnChangeOptions(){
  1387. options = !options;
  1388. ui.stack_options.visible = options;
  1389. }
  1390. function OnTopMenu(idx) {
  1391. ui.stack_import.visible = true;
  1392. ui.stack_import.index = parseInt(idx) - 1;
  1393. ui.pb_import01.valid = ui.pb_import02.valid = ui.pb_import03.valid = ui.pb_import04.valid = ui.pb_import05.valid = false;
  1394. //model.ide_info(idx);
  1395. if (parseInt(idx) === 1) {
  1396. ui.pb_import01.valid = true;
  1397. }
  1398. if (parseInt(idx) === 2) {
  1399. ui.pb_import02.valid = true;
  1400. }
  1401. if (parseInt(idx) === 3) {
  1402. ui.pb_import03.valid = true;
  1403. }
  1404. if (parseInt(idx) === 4) {
  1405. ui.pb_import04.valid = true;
  1406. }
  1407. if (parseInt(idx) === 5) {
  1408. ui.pb_import05.valid = true;
  1409. }
  1410. }
  1411. //The message corresponding callback executed by the docker pane.
  1412. // when calling [side_pane].fireEvent(type,para) in the main form.
  1413. function OnParentDockerMessage(type, para) {
  1414. }
  1415. //////////////////////////////////////////////////////////////////////////
  1416. // Utils Functions.
  1417. // 6c165ad6-ef3e-11ea-987c-b761a131c2fe
  1418. function onDragFile(filepath) {
  1419. }
  1420. function PUI(cb) {
  1421. if(pui){cb();}
  1422. }
  1423. /*Usage of BLOCK_EVENT
  1424. BLOCK_EVENT(()=>{
  1425. ui.[name].[var] = ...;
  1426. });
  1427. */
  1428. function BLOCK_EVENT(cb) {
  1429. ui.block_event = true;
  1430. cb();
  1431. ui.block_event = false;
  1432. }
  1433. //////////////////////////////////////////////////////////////////////////
  1434. // template codes for cw callback js.
  1435. function CW_DeclareVariable(name, setter, getter) {
  1436. if(typeof(__DeclareVariable) === 'function') {
  1437. __DeclareVariable(name, setter, getter);
  1438. }
  1439. }
  1440. function CW_DeclareOuterVariable(name) {
  1441. if(typeof(__DeclareOuterVariable) === 'function') {
  1442. __DeclareOuterVariable(name);
  1443. }
  1444. }