boundary_constraint_pane.js 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520
  1. ////////////////////////////////////////////////////////////////////////////
  2. // System Pre-define Functions
  3. // 95099372-ef3e-11ea-9c81-bf848405c62e
  4. //Callback of data preparation stage before UI is fully loaded.
  5. function OnInitializeData(reload, preview) {
  6. PUI(()=>{
  7. //you can access the 'ui' namespace in the parent form using the variable 'pui' here.
  8. //The 'pui' variable is valid in all functions of this document.
  9. //For robustness, you'd better use 'PUI(cb);' to access 'pui' variable.
  10. });
  11. control(true);
  12. controls(true);
  13. //ui.stack_constraint.index = 1;
  14. //ui.stack_menu.index = 3;
  15. }
  16. //Callback after UI is fully loaded and displayed.
  17. function OnReady(reload, preview) {
  18. PUI(()=>{
  19. //you can access the 'ui' namespace in the parent form using the variable 'pui' here.
  20. //The 'pui' variable is valid in all functions of this document.
  21. //For robustness, you'd better use 'PUI(cb);' to access 'pui' variable.
  22. });
  23. }
  24. function OnCloseForm() {
  25. }
  26. function OnException(err) {
  27. //ui.MessageBox('Error', '' + err, MessageBox.Icon.Critical, MessageBox.Button.Ok);
  28. }
  29. //////////////////////////////////////////////////////////////////////////
  30. // Callback Functions.
  31. // 641a254c-ef3e-11ea-bc8a-379bb908bdd7
  32. function OnModify(){
  33. if(ui.limit_constraint.index === 0 && ui.constraint_type.index === 0) {
  34. let Load = {
  35. "constraint":"固定支撑",
  36. "约束类型":ui.constraint_type.value,
  37. "固定支撑属性xd":ui.con_xn.value,
  38. "固定支撑属性xr":ui.con_xr.value,
  39. "固定支撑属性yd":ui.con_yn.value,
  40. "固定支撑属性yr":ui.con_yr.value,
  41. "固定支撑属性zd":ui.con_zn.value,
  42. "固定支撑属性zr":ui.con_zr.value
  43. };
  44. unit.form.tree.ModifyConstraint(Load);
  45. }
  46. if(ui.limit_constraint.index ===1 && ui.misConstraints.index === 0 ) {
  47. let Load = {
  48. "constraint":"梁",
  49. "非约束类型":ui.misConstraints.value,
  50. "梁约束位置xDirection":ui.pb_xDiration.value,
  51. "梁约束位置yDirection":ui.pb_yDiration.value,
  52. "梁约束位置zDirection":ui.pb_zDiration.value,
  53. "梁约束位置xCoord":ui.pb_xCoord.value,
  54. "梁约束位置yCoord":ui.pb_yCoord.value,
  55. "梁约束位置zCoord":ui.pb_zCoord.value,
  56. "梁约束参数半径":ui.rad.value,
  57. "梁约束参数长度":ui.pb_length.value,
  58. "梁约束参数个数":ui.pb_size.value,
  59. "弹性模量":ui.m.value,
  60. "泊松比":ui.poi.value,
  61. "梁节点大小半径":ui.pb_node_size.value,
  62. "R":ui.R.value,
  63. "G":ui.G.value,
  64. "B":ui.B.value
  65. };
  66. unit.form.tree.ModifyConstraint(Load);
  67. }
  68. if(ui.limit_constraint.index ===1 && ui.misConstraints.index === 1 ) {
  69. let Load = {
  70. "constraint":"弹簧",
  71. "非约束类型":ui.misConstraints.value,
  72. "起点x":ui.pb_x.value,
  73. "起点y":ui.pb_y.value,
  74. "起点z":ui.pb_z.value,
  75. "终点x":ui.pb_X.value,
  76. "终点y":ui.pb_Y.value,
  77. "终点z":ui.pb_Z.value,
  78. "弹簧刚度x":ui.stiffness_x.value,
  79. "弹簧刚度y":ui.stiffness_y.value,
  80. "弹簧刚度z":ui.stiffness_z.value,
  81. "R":ui.R.value,
  82. "G":ui.G.value,
  83. "B":ui.B.value
  84. };
  85. unit.form.tree.ModifyConstraint(Load);
  86. }
  87. if(ui.limit_constraint.index ===1 && ui.misConstraints.index === 2 ) {
  88. let Load = {
  89. "constraint":"连接",
  90. "非约束类型":ui.misConstraints.value,
  91. "起点x":ui.pb_xn.value,
  92. "起点y":ui.pb_yn.value,
  93. "起点z":ui.pb_zn.value,
  94. "终点x":ui.pb_xr.value,
  95. "终点y":ui.pb_yr.value,
  96. "终点z":ui.pb_zr.value,
  97. "R":ui.pb_con_r.value,
  98. "G":ui.pb_con_g.value,
  99. "B":ui.pb_con_b.value
  100. };
  101. unit.form.tree.ModifyConstraint(Load);
  102. }
  103. }
  104. function OnChangeBeam(){
  105. if(parseFloat(ui.pb_length.value) <= 0 || parseFloat(ui.rad.value) <= 0 || parseFloat(ui.m.value) <= 0 || parseFloat(ui.poi.value) <= 0 || parseFloat(ui.rad.value) <= 0){
  106. unit.form.mainfrm.OnChangePicture(3, 3);
  107. //unit.form.mainfrm.OnCueline('<h4 style="font-family:arial;color: red;font-size:20px;">非常抱歉,您输入的数据不在参数范围内!</h4>');
  108. unit.form.mainfrm.OnCueline('您输入的数据不在参数范围内!', 'red');
  109. }else{
  110. unit.form.mainfrm.OnChangePicture(3, 2);
  111. //unit.form.mainfrm.OnCueline('<h4 style="font-family:arial;color: Blue;font-size:20px;">恭喜您,您输入了正确的数据!</h4>');
  112. unit.form.mainfrm.OnCueline('您输入了正确的数据!', 'blue');
  113. }
  114. }
  115. function OnFix(){
  116. var strss = 'fixHighLight ' + ui.con_xn.value + ' ' + ui.con_yn.value + ' ' + ui.con_zn.value + ' ' + ui.con_xr.value + ' ' + ui.con_yr.value + ' ' + ui.con_zr.value;
  117. unit.form.mainfrm.OnSend(strss);
  118. unit.form.mainfrm.OnChangePicture(3 );2;
  119. //unit.form.mainfrm.OnCueline('<h4 style="font-family:arial;color: green;font-size:20px;">恭喜您完成了固定支撑属性的添加,请用鼠标右键选中需要施加约束的物体并按快捷键T或者t进行添加!</h4>');
  120. let Load = {
  121. "constraint":"固定支撑",
  122. "约束类型":ui.constraint_type.value,
  123. "固定支撑属性xd":ui.con_xn.value,
  124. "固定支撑属性xr":ui.con_xr.value,
  125. "固定支撑属性yd":ui.con_yn.value,
  126. "固定支撑属性yr":ui.con_yr.value,
  127. "固定支撑属性zd":ui.con_zn.value,
  128. "固定支撑属性zr":ui.con_zr.value
  129. };
  130. unit.form.tree.CreateBoundary(Load);
  131. unit.form.mainfrm.OnCueline('您完成了固定支撑属性的添加,请用鼠标右键选中需要施加约束的物体并按快捷键T或者t进行添加!', 'green');
  132. }
  133. function OnBeam2(){
  134. unit.form.mainfrm.OnSend('beamHightLight2 ' + ui.m_seg.value + ' ' + ui.m_len.value + ' ' + ui.m_radius.value + ' ' + ui.m_mat.value + ' ' + ui.m_poi.value + ' ' + ui.m_R.value + ' '+ ui.m_G.value + ' ' + ui.m_B.value + ' ' + ui.m_ras.value);
  135. model.clearStr();
  136. unit.form.mainfrm.OnChangePicture(3, 2);
  137. //unit.form.mainfrm.OnCueline('<h4 style="font-family:arial;color: green;font-size:20px;">恭喜成功做好了不均匀梁的添加!</h4>');
  138. unit.form.mainfrm.OnCueline('您成功做好了不均匀梁的添加!', 'green');
  139. }
  140. function OnConnect(){
  141. var str = 'connects ' + ui.pb_start_x.value + ' ' + ui.pb_start_y.value + ' ' + ui.pb_start_z.value + ' ' + ui.pb_end_x.value + ' ' + ui.pb_end_y.value + ' ' + ui.pb_end_z.value + ' ' + ui.pb_start_mes.value + ui.pb_end_mes.value + ui.pb_con_r.value + ' ' + ui.pb_con_g.value + ' ' + ui.pb_con_b.value + ' ' + ui.pb_xn.value + ' ' + ui.pb_yn.value + ' ' + ui.pb_zn.value + ' ' + ui.pb_xr.value + ' ' + ui.pb_yr.value + ' ' + ui.pb_zr.value;
  142. unit.form.mainfrm.OnSend(str);
  143. unit.form.mainfrm.OnChangePicture(3, 2);
  144. //unit.form.mainfrm.OnCueline('<h4 style="font-family:arial;color: green;font-size:20px;">恭喜成功地做好了连接!</h4>');
  145. let Load = {
  146. "constraint":"连接",
  147. "非约束类型":ui.misConstraints.value,
  148. "起点x":ui.pb_xn.value,
  149. "起点y":ui.pb_yn.value,
  150. "起点z":ui.pb_zn.value,
  151. "终点x":ui.pb_xr.value,
  152. "终点y":ui.pb_yr.value,
  153. "终点z":ui.pb_zr.value,
  154. "R":ui.pb_con_r.value,
  155. "G":ui.pb_con_g.value,
  156. "B":ui.pb_con_b.value
  157. };
  158. unit.form.tree.CreateBoundary(Load);
  159. unit.form.mainfrm.OnCueline('您成功地做好了连接!', 'green');
  160. }
  161. function onEndMessage(){
  162. controls(false);
  163. }
  164. function onStartMessage(){
  165. controls(true);
  166. }
  167. function controls(idx){
  168. ui.pb_start_message.enable = !idx;
  169. ui.pb_start_mes.enable = !idx;
  170. ui.pb_start_x.enable = idx;
  171. ui.pb_start_y.enable = idx;
  172. ui.pb_start_z.enable = idx;
  173. ui.pb_end_message.enable = idx;
  174. ui.pb_end_mes.enable = idx;
  175. ui.pb_end_x.enable = !idx;
  176. ui.pb_end_y.enable = !idx;
  177. ui.pb_end_z.enable = !idx;
  178. if(idx === true){
  179. model.setStartEnd(0);
  180. }
  181. if(idx === false){
  182. model.setStartEnd(1);
  183. }
  184. }
  185. function OnChangeValue(){
  186. ui.pb_pass.enable = false;
  187. }
  188. function OnReturn(){
  189. unit.form.mainfrm.menu(4);
  190. }
  191. function OnFile(){
  192. ui.pb_pass.enable = true;
  193. model.setCon(1);
  194. if(ui.stack_menu.index === 0){
  195. let id = parent.setTimeout(() => {
  196. unit.form.mainfrm.OnSend('0');
  197. }, 100);
  198. unit.form.mainfrm.OnSend('beamSave ' + model.getCurrentDirectory());
  199. }
  200. if(ui.stack_menu.index === 1){
  201. let id = parent.setTimeout(() => {
  202. unit.form.mainfrm.OnSend('0');
  203. }, 100);
  204. unit.form.mainfrm.OnSend('springSave ' + model.getCurrentDirectory());
  205. }
  206. }
  207. function OnSpring(){
  208. unit.form.mainfrm.OnSend('springHightLight ' + ui.pb_x.value + ' ' + ui.pb_y.value + ' ' + ui.pb_z.value + ' ' + ui.pb_X.value + ' ' + ui.pb_Y.value + ' ' + ui.pb_Z.value + ' ' + ui.stiffness_x.value + ' ' + ui.stiffness_y.value + ' ' + ui.stiffness_z.value + ' ' + ui.pb_R.value + ' ' + ui.pb_G.value + ' ' + ui.pb_B.value + ' ' + ui.pb_type1.value + ui.pb_type2.value);
  209. unit.form.mainfrm.OnChangePicture(3, 2);
  210. //unit.form.mainfrm.OnCueline('<h4 style="font-family:arial;color: green;font-size:20px;">恭喜您完成了弹簧约束的添加!</h4>');
  211. let Load = {
  212. "constraint":"弹簧",
  213. "非约束类型":ui.misConstraints.value,
  214. "起点x":ui.pb_x.value,
  215. "起点y":ui.pb_y.value,
  216. "起点z":ui.pb_z.value,
  217. "终点x":ui.pb_X.value,
  218. "终点y":ui.pb_Y.value,
  219. "终点z":ui.pb_Z.value,
  220. "弹簧刚度x":ui.stiffness_x.value,
  221. "弹簧刚度y":ui.stiffness_y.value,
  222. "弹簧刚度z":ui.stiffness_z.value,
  223. "R":ui.R.value,
  224. "G":ui.G.value,
  225. "B":ui.B.value
  226. };
  227. unit.form.tree.CreateBoundary(Load);
  228. unit.form.mainfrm.OnCueline('您完成了弹簧约束的添加!', 'green');
  229. }
  230. function OnBeam(){
  231. unit.form.mainfrm.OnSend('beamHightLight ' + ui.pb_size.value + ' ' + ui.pb_length.value + ' ' + ui.pb_xDiration.value + ' ' + ui.pb_yDiration.value + ' ' + ui.pb_zDiration.value + ' ' + ui.pb_xCoord.value + ' ' + ui.pb_yCoord.value + ' ' + ui.pb_zCoord.value + ' ' + ui.rad.value + ' ' + ui.m.value + ' ' + ui.poi.value + ' ' + ui.R.value + ' '+ ui.G.value + ' ' + ui.B.value + ' ' + ui.pb_node_size.value);
  232. unit.form.mainfrm.OnChangePicture(3, 2);
  233. //unit.form.mainfrm.OnCueline('<h4 style="font-family:arial;color: green;font-size:20px;">恭喜您完成了梁约束的添加!</h4>');
  234. let Load = {
  235. "constraint":"梁",
  236. "非约束类型":ui.misConstraints.value,
  237. "梁约束位置xDirection":ui.pb_xDiration.value,
  238. "梁约束位置yDirection":ui.pb_yDiration.value,
  239. "梁约束位置zDirection":ui.pb_zDiration.value,
  240. "梁约束位置xCoord":ui.pb_xCoord.value,
  241. "梁约束位置yCoord":ui.pb_yCoord.value,
  242. "梁约束位置zCoord":ui.pb_zCoord.value,
  243. "梁约束参数半径":ui.rad.value,
  244. "梁约束参数长度":ui.pb_length.value,
  245. "梁约束参数个数":ui.pb_size.value,
  246. "弹性模量":ui.m.value,
  247. "泊松比":ui.poi.value,
  248. "梁节点大小半径":ui.pb_node_size.value,
  249. "R":ui.R.value,
  250. "G":ui.G.value,
  251. "B":ui.B.value
  252. };
  253. unit.form.tree.CreateBoundary(Load);
  254. unit.form.mainfrm.OnCueline('您完成了梁约束的添加!', 'green');
  255. }
  256. function control(idx){
  257. ui.pb_start.enable = !idx;
  258. ui.pb_x.enable = idx;
  259. ui.pb_y.enable = idx;
  260. ui.pb_z.enable = idx;
  261. ui.pb_end.enable = idx;
  262. ui.pb_X.enable = !idx;
  263. ui.pb_Y.enable = !idx;
  264. ui.pb_Z.enable = !idx;
  265. if(idx === true){
  266. model.setStartEnd(0);
  267. }
  268. if(idx === false){
  269. model.setStartEnd(1);
  270. }
  271. }
  272. function OnEed(){
  273. control(false);
  274. }
  275. function OnStart(){
  276. control(true);
  277. }
  278. function OnChangeMenu(){
  279. ui.stack_menu.index = parseFloat(ui.misConstraints.index);
  280. console.log(ui.no_limit_constraint.index === 1);
  281. //console.log(ui.limit_constraint.index);
  282. if(ui.stack_menu.index === 3){
  283. model.setBeam(true);
  284. }else{
  285. model.setBeam(false);
  286. }
  287. }
  288. function OnChangeConstraint(){
  289. ui.stack_constraint.index = ui.limit_constraint.index;
  290. /*if(parseFloat(idx) === 1){
  291. unit.form.mainfrm.OnChangePicture(3, 1);
  292. unit.form.mainfrm.OnCueline('<h4 style="font-family:arial;color: Blue;font-size:20px;">注意事项:弹簧单元的起点和终点需要自动添加,鼠标右键选中起始/终止点,点击按钮(在窗口左侧倒数第5个按钮)添加即可将坐标导入!</h4>');
  293. }else if(parseFloat(idx) === 2){
  294. unit.form.mainfrm.OnChangePicture(3, 1);
  295. unit.form.mainfrm.OnCueline('<h4 style="font-family:arial;color: Blue;font-size:20px;">注意事项:连接单元的起点和终点需要自动添加,鼠标右键选中起始/终止点,点击按钮(在窗口左侧倒数第5个按钮)添加即可将坐标导入!</h4>');
  296. }else if(parseFloat(idx) === 3){
  297. unit.form.mainfrm.OnChangePicture(3, 1);
  298. unit.form.mainfrm.OnCueline('<h4 style="font-family:arial;color: Blue;font-size:20px;">注意事项:非均匀梁的各个节点需要用鼠标右键拾取后点击H或h进行保存,梁上的各个点需要在一条直线上!</h4>');
  299. }*/
  300. if(parseFloat(idx) === 1){
  301. unit.form.mainfrm.OnChangePicture(3, 1);
  302. unit.form.mainfrm.OnCueline('注意事项:弹簧单元的起点和终点需要自动添加,鼠标右键选中起始/终止点,点击按钮(在窗口左侧倒数第3个按钮)添加即可将坐标导入!', 'blue');
  303. }else if(parseFloat(idx) === 2){
  304. unit.form.mainfrm.OnChangePicture(3, 1);
  305. unit.form.mainfrm.OnCueline('注意事项:连接单元的起点和终点需要自动添加,鼠标右键选中起始/终止点,点击按钮(在窗口左侧倒数第3个按钮)添加即可将坐标导入!', 'blue');
  306. }else if(parseFloat(idx) === 3){
  307. unit.form.mainfrm.OnChangePicture(3, 1);
  308. unit.form.mainfrm.OnCueline('注意事项:非均匀梁的各个节点需要用鼠标右键拾取后点击H或h进行保存,梁上的各个点需要在一条直线上!', 'blue');
  309. }
  310. }
  311. function ChangeRadiobutton(idx) {
  312. ui.limit_constraint.index = parseFloat(idx);
  313. }
  314. //The message corresponding callback executed by the docker pane.
  315. // when calling [side_pane].fireEvent(type,para) in the main form.
  316. function OnParentDockerMessage(type, para) {
  317. }
  318. //////////////////////////////////////////////////////////////////////////
  319. // Utils Functions.
  320. // 6c165ad6-ef3e-11ea-987c-b761a131c2fe
  321. CW_DeclareVariable("pb_x",
  322. val => {
  323. ui.pb_x.value = val;
  324. ui.pb_start_x.value = val;
  325. }, () => {});
  326. CW_DeclareVariable("pb_y",
  327. val => {
  328. ui.pb_y.value = val;
  329. ui.pb_start_y.value = val;
  330. }, () => {});
  331. CW_DeclareVariable("pb_z",
  332. val => {
  333. ui.pb_z.value = val;
  334. ui.pb_start_z.value = val;
  335. }, () => {});
  336. CW_DeclareVariable("pb_X",
  337. val => {
  338. ui.pb_X.value = val;
  339. ui.pb_end_x.value = val;
  340. }, () => {});
  341. CW_DeclareVariable("pb_Y",
  342. val => {
  343. ui.pb_Y.value = val;
  344. ui.pb_end_y.value = val;
  345. }, () => {});
  346. CW_DeclareVariable("pb_Z",
  347. val => {
  348. ui.pb_Z.value = val;
  349. ui.pb_end_z.value = val;
  350. }, () => {});
  351. CW_DeclareVariable("listbox",
  352. val => {
  353. ui.listbox.list = [
  354. val
  355. ];
  356. }, () => {});
  357. CW_DeclareVariable("start_mes",
  358. val => {
  359. ui.pb_type1.value = val;
  360. ui.pb_start_mes.value = val;
  361. }, () => {});
  362. CW_DeclareVariable("end_mes",
  363. val => {
  364. ui.pb_type2.value = val;
  365. ui.pb_end_mes.value = val;
  366. }, () => {});
  367. CW_DeclareVariable("change1",
  368. val => {
  369. ui.stack_constraint.index = val;
  370. }, () => {});
  371. CW_DeclareVariable("change2",
  372. val => {
  373. ui.stack_menu.index = val;
  374. ui.misConstraints.index = val;
  375. }, () => {});
  376. CW_DeclareVariable("setConstraint0",
  377. val => {
  378. ui.con_xn.value = val["固定支撑属性xd"];
  379. ui.con_xr.value = val["固定支撑属性xr"];
  380. ui.con_yn.value = val["固定支撑属性yd"];
  381. ui.con_yr.value = val["固定支撑属性yr"];
  382. ui.con_zn.value = val["固定支撑属性zd"];
  383. ui.con_zr.value = val["固定支撑属性zr"];
  384. }, () => {});
  385. CW_DeclareVariable("setConstraint1",
  386. val => {
  387. ui.pb_xDiration.value = val["梁约束位置xDirection"];
  388. ui.pb_yDiration.value = val["梁约束位置yDirection"];
  389. ui.pb_zDiration.value = val["梁约束位置zDirection"];
  390. ui.pb_xCoord.value = val["梁约束位置xCoord"];
  391. ui.pb_yCoord.value = val["梁约束位置yCoord"];
  392. ui.pb_zCoord.value = val["梁约束位置zCoord"];
  393. ui.rad.value = val["梁约束参数半径"];
  394. ui.pb_length.value = val["梁约束参数长度"];
  395. ui.pb_size.value = val["梁约束参数个数"];
  396. ui.m.value = val["弹性模量"];
  397. ui.poi.value = val["泊松比"];
  398. ui.pb_node_size.value = val["梁节点大小半径"];
  399. ui.R.value = val.R;
  400. ui.G.value = val.G;
  401. ui.B.value = val.B;
  402. }, () => {});
  403. CW_DeclareVariable("setConstraint2",
  404. val => {
  405. ui.pb_x.value = val["起点x"];
  406. ui.pb_y.value = val["起点y"];
  407. ui.pb_z.value = val["起点z"];
  408. ui.pb_X.value = val["终点x"];
  409. ui.pb_Y.value = val["终点y"];
  410. ui.pb_Z.value = val["终点z"];
  411. ui.stiffness_x.value = val["弹簧刚度x"];
  412. ui.stiffness_y.value = val["弹簧刚度y"];
  413. ui.stiffness_z.value = val["弹簧刚度z"];
  414. ui.pb_R.value = val.R;
  415. ui.pb_G.value = val.G;
  416. ui.pb_B.value = val.B;
  417. }, () => {});
  418. CW_DeclareVariable("setConstraint3",
  419. val => {
  420. ui.pb_xn.value = val["起点x"];
  421. ui.pb_yn.value = val["起点y"];
  422. ui.pb_zn.value = val["起点z"];
  423. ui.pb_xr.value = val["终点x"];
  424. ui.pb_yr.value = val["终点y"];
  425. ui.pb_zr.value = val["终点z"];
  426. ui.pb_con_r.value = val.R;
  427. ui.pb_con_g.value = val.G;
  428. ui.pb_con_b.value = val.B;
  429. }, () => {});
  430. function onDragFile(filepath) {
  431. }
  432. function PUI(cb) {
  433. if(pui){cb();}
  434. }
  435. /*Usage of BLOCK_EVENT
  436. BLOCK_EVENT(()=>{
  437. ui.[name].[var] = ...;
  438. });
  439. */
  440. function BLOCK_EVENT(cb) {
  441. ui.block_event = true;
  442. cb();
  443. ui.block_event = false;
  444. }
  445. //////////////////////////////////////////////////////////////////////////
  446. // template codes for cw callback js.
  447. function CW_DeclareVariable(name, setter, getter) {
  448. if(typeof(__DeclareVariable) === 'function') {
  449. __DeclareVariable(name, setter, getter);
  450. }
  451. }
  452. function CW_DeclareOuterVariable(name) {
  453. if(typeof(__DeclareOuterVariable) === 'function') {
  454. __DeclareOuterVariable(name);
  455. }
  456. }