//////////////////////////////////////////////////////////////////////////// // 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. }); //ui.stack_force.index = 1; } //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); } ////////////////////////////////////////////////////////////////////////// // Callback Functions. // 641a254c-ef3e-11ea-bc8a-379bb908bdd7 function OnModify(idx){ if(idx ===0){ let Load = { "constraint":"集中载荷压力", "压力方向xn":ui.pb_xn.value, "压力方向yn":ui.pb_yn.value, "压力方向zn":ui.pb_zn.value, "压力大小xr":ui.pb_xr.value, "压力大小yr":ui.pb_yr.value, "压力大小zr":ui.pb_zr.value }; unit.form.tree.ModifyMConstraint(Load); }else if(idx === 1){ let Load = { "constraint":"分布载荷压力", "压力方向fa_x":ui.fa_x.value, "压力方向fa_y":ui.fa_y.value, "压力方向fa_z":ui.fa_z.value, "压力大小fa_xr":ui.fa_xr.value, "压力大小fa_yr":ui.fa_yr.value, "压力大小fa_zr":ui.fa_zr.value, "框选范围":ui.fa_radius.value }; unit.form.tree.ModifyMConstraint(Load); } } function OnValueChange2(){ if(ui.fa_x.value === '' || ui.fa_y.value === '' || ui.fa_z.value === '' || ui.fa_xr.value === '' || ui.fa_yr.value === '' || ui.fa_zr.value === '' || parseFloat(ui.fa_radius.value) <= 0){ unit.form.mainfrm.OnChangePicture(3, 3); //unit.form.mainfrm.OnCueline('

非常抱歉,您输入的数据不在范围内

'); unit.form.mainfrm.OnCueline('您输入的数据不在范围内!!!', 'red'); }else{ unit.form.mainfrm.OnChangePicture(3, 1); //unit.form.mainfrm.OnCueline('

恭喜您,您输入了正确的数据

'); unit.form.mainfrm.OnCueline('您输入了正确的数据!', 'green'); } } function OnChangeValue(){ if(ui.pb_xn.value === '' || ui.pb_yn.value === '' || ui.pb_zn.value === '' || ui.pb_xr.value === '' || ui.pb_yr.value === '' || ui.pb_zr.value === ''){ unit.form.mainfrm.OnChangePicture(3, 3); //unit.form.mainfrm.OnCueline('

非常抱歉,您输入的数据不在范围内

'); unit.form.mainfrm.OnCueline('您输入的数据不在范围内!!!', 'red'); }else{ unit.form.mainfrm.OnChangePicture(3, 1); //unit.form.mainfrm.OnCueline('

恭喜您,您输入了正确的数据

'); unit.form.mainfrm.OnCueline('您输入了正确的数据!', 'green'); } } function OnReturn(){ unit.form.mainfrm.menu(4); } function OnFrameSelect(){ //comx.ply.setArrows(); unit.form.mainfrm.OnSend('frameHightLight ' + ui.fa_x.value + ' ' + ui.fa_y.value + ' ' + ui.fa_z.value + ' ' + ui.fa_xr.value + ' ' + ui.fa_yr.value + ' ' + ui.fa_zr.value + ' ' + + ui.fa_radius.value); unit.form.mainfrm.OnChangePicture(3, 2); //unit.form.mainfrm.OnCueline('

恭喜您,您已将压力数据进行保存,请按鼠标右键选中您要施加约束的物体,并按快捷键R或者r进行添加!

'); let Load = { "constraint":"分布载荷压力", "压力方向fa_x":ui.fa_x.value, "压力方向fa_y":ui.fa_y.value, "压力方向fa_z":ui.fa_z.value, "压力大小fa_xr":ui.fa_xr.value, "压力大小fa_yr":ui.fa_yr.value, "压力大小fa_zr":ui.fa_zr.value, "框选范围":ui.fa_radius.value }; let name = "箭头100"; unit.form.tree.CreateBoundary(Load, name); unit.form.mainfrm.OnCueline('您已将压力数据进行保存,请按鼠标右键选中您要施加约束的物体,并按快捷键R或者r进行添加!', 'green'); } function OnArrowFrame(){ } function OnArrow(){ unit.form.mainfrm.OnSend('arrowHighLight ' + ui.pb_xn.value + ' ' + ui.pb_yn.value + ' ' + ui.pb_zn.value + ' ' + ui.pb_xr.value + ' ' + ui.pb_yr.value + ' ' + ui.pb_zr.value); unit.form.mainfrm.OnChangePicture(3, 2); //unit.form.mainfrm.OnCueline('

恭喜您,您已将压力数据和框选范围进行保存,请按鼠标右键选中您要施加约束的物体,并按快捷键R或者r进行添加以及快捷键U或u者进行框选!

'); let Load = { "constraint":"集中载荷压力", "压力方向xn":ui.pb_xn.value, "压力方向yn":ui.pb_yn.value, "压力方向zn":ui.pb_zn.value, "压力大小xr":ui.pb_xr.value, "压力大小yr":ui.pb_yr.value, "压力大小zr":ui.pb_zr.value }; let name = "箭头2"; unit.form.tree.CreateBoundary(Load, name); unit.form.mainfrm.OnCueline('您已将压力数据和框选范围进行保存,请按鼠标右键选中您要施加约束的物体,并按快捷键R或者r进行添加以及快捷键U或u者进行框选!', 'green'); } function OnChangeForce(idx){ ui.stack_force.index = parseInt(idx); } //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("index", val => { ui.stack_force.index = val; }, () => {}); CW_DeclareVariable("setConstraint0", val => { ui.pb_xn.value = val["压力方向xn"]; ui.pb_yn.value = val["压力方向yn"]; ui.pb_zn.value = val["压力方向zn"]; ui.pb_xr.value = val["压力大小xr"]; ui.pb_yr.value = val["压力大小yr"]; ui.pb_zr.value = val["压力大小zr"]; }, () => {}); CW_DeclareVariable("setConstraint1", val => { ui.fa_x.value = val["压力方向fa_x"]; ui.fa_y.value = val["压力方向fa_y"]; ui.fa_z.value = val["压力方向fa_z"]; ui.fa_xr.value = val["压力大小fa_xr"]; ui.fa_yr.value = val["压力大小fa_yr"]; ui.fa_zr.value = val["压力大小fa_zr"]; ui.fa_radius.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); } }