//////////////////////////////////////////////////////////////////////////// // System Pre-define Functions // 95099372-ef3e-11ea-9c81-bf848405c62e //Callback of data preparation stage before UI is fully loaded. function OnInitializeData(reload, preview) { PUI(()=>{ //you can access the 'ui' namespace in the parent form using the variable 'pui' here. //The 'pui' variable is valid in all functions of this document. //For robustness, you'd better use 'PUI(cb);' to access 'pui' variable. }); } //Callback after UI is fully loaded and displayed. function OnReady(reload, preview) { PUI(()=>{ //you can access the 'ui' namespace in the parent form using the variable 'pui' here. //The 'pui' variable is valid in all functions of this document. //For robustness, you'd better use 'PUI(cb);' to access 'pui' variable. }); } function OnCloseForm() { } function OnException(err) { //ui.MessageBox('Error', '' + err, MessageBox.Icon.Critical, MessageBox.Button.Ok); } let myStressArray = []; ////////////////////////////////////////////////////////////////////////// // Callback Functions. // 641a254c-ef3e-11ea-bc8a-379bb908bdd7 function OnDelete(){ /*model.spawn(model.getCurrentDirectory() + 'src_exe/deleteFiles.exe', model.getCurrentDirectory(), cb => { console.log(cb); });*/ model.deleteFile(model.getCurrentDirectory() + 'data/restraint'); } var pick = false; function OnPickUp() { pick = !pick; if (pick === true) { unit.form.mainfrm.pick(1); ui.pb_pick.valid = true; } if (pick === false) { unit.form.mainfrm.pick(2); ui.pb_pick.valid = false; } } function OnReturnMenu(){ unit.form.mainfrm.menu(5); } function OnYes() { ui.pb_pass.enable = true; var str = myStressArray[parseFloat(ui.listbox.index)]; var str1 = str.split(','); var str2 = str1[0]; str1 = str1.join(' '); model.write(str1, model.getCurrentDirectory() + '/data/restraint/restrant' + str2 + '.txt'); } function OnDeleteFixFace() { ui.pb_pass.enable = false; myStressArray.splice(parseFloat(ui.listbox.index), 1); ui.listbox.list = [ myStressArray ]; } function OnAddFixFace() { ui.pb_pass.enable = false; var value = ui.pb_Id.value + ',' + parseFloat(ui.pb_Xd.value) + ',' + parseFloat(ui.pb_Yd.value) + ',' + parseFloat(ui.pb_Zd.value) + ',' + parseFloat(ui.pb_Xr.value) + ',' + parseFloat(ui.pb_Yr.value) + ',' + parseFloat(ui.pb_Zr.value); if (ui.pb_Id.value != "-") { myStressArray.push(value); ui.listbox.list = [ myStressArray ]; } } function OnChangeDirection05() { ui.pb_pass.enable = false; } function OnChangeDirection04() { ui.pb_pass.enable = false; } function OnChangeDirection03() { ui.pb_pass.enable = false; } function OnChangeDirection02() { ui.pb_pass.enable = false; } function OnChangeDirection01() { ui.pb_pass.enable = false; } function OnChangeDirection() { ui.pb_pass.enable = false; } //The message corresponding callback executed by the docker pane. // when calling [side_pane].fireEvent(type,para) in the main form. function OnParentDockerMessage(type, para) { } ////////////////////////////////////////////////////////////////////////// // Utils Functions. // 6c165ad6-ef3e-11ea-987c-b761a131c2fe function onDragFile(filepath) { } function PUI(cb) { if(pui){cb();} } /*Usage of BLOCK_EVENT BLOCK_EVENT(()=>{ ui.[name].[var] = ...; }); */ CW_DeclareVariable("ID", val => { ui.pb_Id.value = val; }, () => {}); function BLOCK_EVENT(cb) { ui.block_event = true; cb(); ui.block_event = false; } ////////////////////////////////////////////////////////////////////////// // template codes for cw callback js. function CW_DeclareVariable(name, setter, getter) { if(typeof(__DeclareVariable) === 'function') { __DeclareVariable(name, setter, getter); } } function CW_DeclareOuterVariable(name) { if(typeof(__DeclareOuterVariable) === 'function') { __DeclareOuterVariable(name); } }