physics_material_H_pane.js 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  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. }
  12. //Callback after UI is fully loaded and displayed.
  13. function OnReady(reload, preview) {
  14. PUI(()=>{
  15. //you can access the 'ui' namespace in the parent form using the variable 'pui' here.
  16. //The 'pui' variable is valid in all functions of this document.
  17. //For robustness, you'd better use 'PUI(cb);' to access 'pui' variable.
  18. });
  19. }
  20. function OnCloseForm() {
  21. }
  22. function OnException(err) {
  23. //ui.MessageBox('Error', '' + err, MessageBox.Icon.Critical, MessageBox.Button.Ok);
  24. }
  25. //////////////////////////////////////////////////////////////////////////
  26. // Callback Functions.
  27. // 641a254c-ef3e-11ea-bc8a-379bb908bdd7
  28. function OnImage(){
  29. ui.pb_image.content_menu = [{
  30. name: "card image",
  31. id: 1
  32. }, {
  33. name: "-"
  34. }, {
  35. name: "no card image",
  36. id: 2
  37. }, {
  38. name: "-"
  39. }, {
  40. name:"same as",
  41. id: 3
  42. }];
  43. }
  44. function OnChangeCard(){
  45. switch (ui.pb_card.content_menu) {
  46. case 1:
  47. ui.stack_card.index = 0;
  48. break;
  49. case 2:
  50. ui.stack_card.index = 1;
  51. break;
  52. case 3:
  53. ui.stack_card.index = 2;
  54. break;
  55. }
  56. }
  57. function OnCard(){
  58. ui.pb_card.content_menu = [{
  59. name: "card image",
  60. id: 1
  61. }, {
  62. name: "-"
  63. }, {
  64. name: "no card image",
  65. id: 2
  66. }, {
  67. name: "-"
  68. }, {
  69. name:"same as",
  70. id: 3
  71. }];
  72. }
  73. function OnFile() {
  74. ui.pb_type.content_menu = [{
  75. name: "ALL",
  76. id: 1
  77. }, {
  78. name: "-"
  79. }, {
  80. name: "ANISOTROPIC",
  81. id: 2
  82. }, {
  83. name: "-"
  84. }, {
  85. name: "FLUID",
  86. id: 3
  87. }, {
  88. name: "-"
  89. }, {
  90. name: "GASKET",
  91. id: 4
  92. }, {
  93. name: "-"
  94. }, {
  95. name: "HYPERELASTIC",
  96. id: 5
  97. }, {
  98. name: "-"
  99. }, {
  100. name: "ISOTROPIC",
  101. id: 6
  102. }, {
  103. name: "-"
  104. }, {
  105. name:"ORTHOTROPIC",
  106. id: 7
  107. }];
  108. }
  109. function OnFileContentMenu() {
  110. //打开文件
  111. switch (ui.pb_type.content_menu) {
  112. case 1:
  113. ui.pb_type_name.value = "ALL";
  114. break;
  115. case 2:
  116. ui.pb_type_name.value = "ANISOTROPIC";
  117. break;
  118. case 3:
  119. ui.pb_type_name.value = "FLUID";
  120. break;
  121. case 4:
  122. ui.pb_type_name.value = "GASKET";
  123. break;
  124. case 5:
  125. ui.pb_type_name.value = "HYPERELASTIC";
  126. break;
  127. case 6:
  128. ui.pb_type_name.value = "ISOTROPIC";
  129. break;
  130. case 7:
  131. ui.pb_type_name.value = "ORTHOTROPIC";
  132. break;
  133. }
  134. }
  135. function OnCreat(){
  136. unit.form.mainfrm.menu(20);
  137. }
  138. function OnChange(idx){
  139. ui.stack.index = parseInt(idx);
  140. }
  141. //The message corresponding callback executed by the docker pane.
  142. // when calling [side_pane].fireEvent(type,para) in the main form.
  143. function OnParentDockerMessage(type, para) {
  144. }
  145. //////////////////////////////////////////////////////////////////////////
  146. // Utils Functions.
  147. // 6c165ad6-ef3e-11ea-987c-b761a131c2fe
  148. function onDragFile(filepath) {
  149. }
  150. function PUI(cb) {
  151. if(pui){cb();}
  152. }
  153. /*Usage of BLOCK_EVENT
  154. BLOCK_EVENT(()=>{
  155. ui.[name].[var] = ...;
  156. });
  157. */
  158. function BLOCK_EVENT(cb) {
  159. ui.block_event = true;
  160. cb();
  161. ui.block_event = false;
  162. }
  163. //////////////////////////////////////////////////////////////////////////
  164. // template codes for cw callback js.
  165. function CW_DeclareVariable(name, setter, getter) {
  166. if(typeof(__DeclareVariable) === 'function') {
  167. __DeclareVariable(name, setter, getter);
  168. }
  169. }
  170. function CW_DeclareOuterVariable(name) {
  171. if(typeof(__DeclareOuterVariable) === 'function') {
  172. __DeclareOuterVariable(name);
  173. }
  174. }