boundary_brep_pane.js 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  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 OnReturn(){
  29. unit.form.mainfrm.menu(4);
  30. }
  31. function OnBrep(){
  32. unit.form.mainfrm.OnSend('genBrep ' + ui.listBox.value);
  33. if(model.getModelCode()){
  34. unit.form.mainfrm.OnSend('genBrep ' + ui.listBox.value);
  35. unit.form.mainfrm.OnChangePicture(3, 2);
  36. //unit.form.mainfrm.OnCueline('<h4 style="font-family:arial;color: green;font-size:20px;">恭喜您,完成Brep文件的保存!</h4>');
  37. unit.form.mainfrm.OnCueline('完成Brep文件的保存!', 'green');
  38. }else{
  39. unit.form.mainfrm.OnChangePicture(3, 3);
  40. //unit.form.mainfrm.OnCueline('<h4 style="font-family:arial;color: red;font-size:20px;">非常抱歉,您并未在配点加载中设置参数或您设置的参数并未保存</h4>');
  41. unit.form.mainfrm.OnCueline('您并未在配点加载中设置参数或您设置的参数并未保存', 'red');
  42. }
  43. }
  44. function OnPickUp(){
  45. unit.form.mainfrm.OnSend('rendererFace ' + ui.listBox.value);
  46. unit.form.mainfrm.OnChangePicture(3, 1);
  47. //unit.form.mainfrm.OnCueline('<h4 style="font-family:arial;color: Blue;font-size:20px;">选取的面已在界面中选中,请不要忘记生成它的Brep文件!</h4>');
  48. unit.form.mainfrm.OnCueline('选取的面已在界面中选中,请不要忘记生成它的Brep文件!', 'blue');
  49. }
  50. function OnShow(){
  51. unit.form.mainfrm.OnSend('selectId');
  52. unit.form.mainfrm.OnChangePicture(3, 1);
  53. //unit.form.mainfrm.OnCueline('<h4 style="font-family:arial;color: Blue;font-size:20px;">拾取的各个面ID已在记录中,注意事项:选中功能不能有空值,否则界面会崩溃!</h4>');
  54. unit.form.mainfrm.OnCueline('拾取的各个面ID已在记录中,注意事项:选中功能不能有空值,否则界面会崩溃!', 'blue');
  55. }
  56. //The message corresponding callback executed by the docker pane.
  57. // when calling [side_pane].fireEvent(type,para) in the main form.
  58. function OnParentDockerMessage(type, para) {
  59. }
  60. //////////////////////////////////////////////////////////////////////////
  61. // Utils Functions.
  62. // 6c165ad6-ef3e-11ea-987c-b761a131c2fe
  63. function onDragFile(filepath) {
  64. }
  65. function PUI(cb) {
  66. if(pui){cb();}
  67. }
  68. CW_DeclareVariable("list",
  69. val => {
  70. ui.listBox.list = [
  71. val
  72. ];
  73. }, () => {});
  74. /*Usage of BLOCK_EVENT
  75. BLOCK_EVENT(()=>{
  76. ui.[name].[var] = ...;
  77. });
  78. */
  79. function BLOCK_EVENT(cb) {
  80. ui.block_event = true;
  81. cb();
  82. ui.block_event = false;
  83. }
  84. //////////////////////////////////////////////////////////////////////////
  85. // template codes for cw callback js.
  86. function CW_DeclareVariable(name, setter, getter) {
  87. if(typeof(__DeclareVariable) === 'function') {
  88. __DeclareVariable(name, setter, getter);
  89. }
  90. }
  91. function CW_DeclareOuterVariable(name) {
  92. if(typeof(__DeclareOuterVariable) === 'function') {
  93. __DeclareOuterVariable(name);
  94. }
  95. }