boundary_stress_more_Peidian_pane.js 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  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. console.log(33);
  22. }
  23. function OnException(err) {
  24. //ui.MessageBox('Error', '' + err, MessageBox.Icon.Critical, MessageBox.Button.Ok);
  25. }
  26. var txt = 1;
  27. //////////////////////////////////////////////////////////////////////////
  28. // Callback Functions.
  29. // 641a254c-ef3e-11ea-bc8a-379bb908bdd7
  30. function OnPosi(){
  31. var id = parent.setTimeout(() => {
  32. unit.form.mainfrm.OnSend('0');
  33. }, 100);
  34. unit.form.mainfrm.OnSend('sphere 2 ' + ui.pb_range.value + ' ' + ui.pb_a.value + ' ' + ui.pb_b.value + ' ' + ui.pb_c.value +' ' + ui.pb_x.value + ' ' + ui.pb_y.value + ' ' + ui.pb_z.value);
  35. }
  36. function OnDelete(){
  37. model.deleteFile(model.getCurrentDirectory() + 'data/face');
  38. }
  39. function OnGenerateFile(){
  40. var id = parent.setTimeout(() => {
  41. unit.form.mainfrm.OnSend('0');
  42. }, 100);
  43. unit.form.mainfrm.OnSend('txt ' + model.getCurrentDirectory() + 'data/peidian/demo' + txt + '.txt');
  44. txt = txt + 1;
  45. }
  46. function OnConnect(){
  47. var id = parent.setTimeout(() => {
  48. unit.form.mainfrm.OnSend('0');
  49. }, 100);
  50. unit.form.mainfrm.OnSend('connect');
  51. }
  52. function OnJudge(){
  53. var id = parent.setTimeout(() => {
  54. unit.form.mainfrm.OnSend('0');
  55. }, 100);
  56. unit.form.mainfrm.OnSend('judge');
  57. }
  58. function OnSendRange(){
  59. var id = parent.setTimeout(() => {
  60. unit.form.mainfrm.OnSend('0');
  61. }, 100);
  62. unit.form.mainfrm.OnSend('sphere 1 ' + ui.pb_range.value);
  63. }
  64. function OnSendArrow(){
  65. var str = "arrow " + ui.pb_x.value + ' ' + ui.pb_y.value + ' ' + ui.pb_z.value + ' ' + ui.pb_size.value;
  66. unit.form.mainfrm.OnSend(str);
  67. }
  68. function OnCloseArrow(){
  69. ui.stack_pickup.index = 0;
  70. var id = parent.setTimeout(() => {
  71. unit.form.mainfrm.OnSend('0');
  72. }, 100);
  73. unit.form.mainfrm.OnSend('arrowClose');
  74. }
  75. function OnOpenArrow(){
  76. ui.stack_pickup.index = 1;
  77. var id = parent.setTimeout(() => {
  78. unit.form.mainfrm.OnSend('0');
  79. }, 100);
  80. unit.form.mainfrm.OnSend('arrowOpen');
  81. }
  82. //The message corresponding callback executed by the docker pane.
  83. // when calling [side_pane].fireEvent(type,para) in the main form.
  84. function OnParentDockerMessage(type, para) {
  85. }
  86. //////////////////////////////////////////////////////////////////////////
  87. // Utils Functions.
  88. // 6c165ad6-ef3e-11ea-987c-b761a131c2fe
  89. function onDragFile(filepath) {
  90. }
  91. function PUI(cb) {
  92. if(pui){cb();}
  93. }
  94. /*Usage of BLOCK_EVENT
  95. BLOCK_EVENT(()=>{
  96. ui.[name].[var] = ...;
  97. });
  98. */
  99. CW_DeclareVariable("message",
  100. val => {
  101. ui.message.value += val + '\n';
  102. ui.message.row = -1;
  103. }, () => {});
  104. function BLOCK_EVENT(cb) {
  105. ui.block_event = true;
  106. cb();
  107. ui.block_event = false;
  108. }
  109. //////////////////////////////////////////////////////////////////////////
  110. // template codes for cw callback js.
  111. function CW_DeclareVariable(name, setter, getter) {
  112. if(typeof(__DeclareVariable) === 'function') {
  113. __DeclareVariable(name, setter, getter);
  114. }
  115. }
  116. function CW_DeclareOuterVariable(name) {
  117. if(typeof(__DeclareOuterVariable) === 'function') {
  118. __DeclareOuterVariable(name);
  119. }
  120. }