physicsCreate2_pane.js 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  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. //ui.stack_menu.index = 1;
  12. ui.list.table = [["密度质量"], [7.85e-9]]; //第一个元素为表头的数组,元素个数确定了列的个数。从第2个元素开始为每行的数据,也是数组,每行元素个数多于列数时不显示,少于列数时为空白
  13. ui.list2.table = [["杨氏模量", "泊松比"], [1000000, 0.3]];
  14. }
  15. //Callback after UI is fully loaded and displayed.
  16. function OnReady(reload, preview) {
  17. PUI(()=>{
  18. //you can access the 'ui' namespace in the parent form using the variable 'pui' here.
  19. //The 'pui' variable is valid in all functions of this document.
  20. //For robustness, you'd better use 'PUI(cb);' to access 'pui' variable.
  21. });
  22. }
  23. function OnCloseForm() {
  24. }
  25. function OnException(err) {
  26. //ui.MessageBox('Error', '' + err, MessageBox.Icon.Critical, MessageBox.Button.Ok);
  27. }
  28. var str = [];
  29. //////////////////////////////////////////////////////////////////////////
  30. // Callback Functions.
  31. // 641a254c-ef3e-11ea-bc8a-379bb908bdd7
  32. function OnChange(){
  33. //console.log(ui.box.value);
  34. if(ui.box.value === '通用'){
  35. OnMenu(0);
  36. }else if(ui.box.value === '弹性'){
  37. OnMenu(1);
  38. }
  39. }
  40. function OnClose(){
  41. unit.form.physicsCreate2.pane.Close();
  42. //unit.form.mainfrm.OnCueline('<h4 style="font-family:arial;color: Blue;font-size:20px;">您已将窗体关闭!</h4>');
  43. unit.form.mainfrm.OnCueline('您已将窗体关闭!', 'blue');
  44. }
  45. function OnYes(){
  46. if(ui.stack_menu.index === 0){
  47. str.push('通用');
  48. }
  49. if(ui.stack_menu.index === 1){
  50. str.push('弹性');
  51. }
  52. ui.box.list = [
  53. str
  54. ];
  55. ui.box.index = parseInt(str.length - 1);
  56. model.setMat(ui.list2.table[1][0]);
  57. model.setMidu(ui.list.table[1][0]);
  58. model.setPoi(ui.list2.table[1][1]);
  59. if(model.getNums() !== 0 && model.getPoi() !== 0){
  60. unit.form.mainfrm.OnChangePicture(2, 2);
  61. }else{
  62. unit.form.mainfrm.OnChangePicture(2, 1);
  63. }
  64. //unit.form.mainfrm.OnCueline('<h4 style="font-family:arial;color: green;font-size:20px;">恭喜您,您完成了模态分析材料的添加!</h4>');
  65. unit.form.mainfrm.OnCueline('您完成了模态分析材料的添加!', 'green');
  66. }
  67. function OnMenu(idx){
  68. ui.a.valid = ui.b.valid = ui.c.valid = ui.d.valid = ui.e.valid = false;
  69. if(idx == 0){
  70. ui.stack_menu.index = 0;
  71. ui.a.valid = true;
  72. }
  73. if(idx == 1){
  74. ui.stack_menu.index = 1;
  75. ui.b.valid = true;
  76. }
  77. }
  78. //The message corresponding callback executed by the docker pane.
  79. // when calling [side_pane].fireEvent(type,para) in the main form.
  80. function OnParentDockerMessage(type, para) {
  81. }
  82. //////////////////////////////////////////////////////////////////////////
  83. // Utils Functions.
  84. // 6c165ad6-ef3e-11ea-987c-b761a131c2fe
  85. function onDragFile(filepath) {
  86. }
  87. function PUI(cb) {
  88. if(pui){cb();}
  89. }
  90. /*Usage of BLOCK_EVENT
  91. BLOCK_EVENT(()=>{
  92. ui.[name].[var] = ...;
  93. });
  94. */
  95. function BLOCK_EVENT(cb) {
  96. ui.block_event = true;
  97. cb();
  98. ui.block_event = false;
  99. }
  100. //////////////////////////////////////////////////////////////////////////
  101. // template codes for cw callback js.
  102. function CW_DeclareVariable(name, setter, getter) {
  103. if(typeof(__DeclareVariable) === 'function') {
  104. __DeclareVariable(name, setter, getter);
  105. }
  106. }
  107. function CW_DeclareOuterVariable(name) {
  108. if(typeof(__DeclareOuterVariable) === 'function') {
  109. __DeclareOuterVariable(name);
  110. }
  111. }