123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141 |
- ////////////////////////////////////////////////////////////////////////////
- // 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_menu.index = 1;
- ui.list.table = [["密度质量"], [7.85e-9]]; //第一个元素为表头的数组,元素个数确定了列的个数。从第2个元素开始为每行的数据,也是数组,每行元素个数多于列数时不显示,少于列数时为空白
- ui.list2.table = [["杨氏模量", "泊松比"], [1000000, 0.3]];
- }
- //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);
- }
- var str = [];
- //////////////////////////////////////////////////////////////////////////
- // Callback Functions.
- // 641a254c-ef3e-11ea-bc8a-379bb908bdd7
- function OnChange(){
- //console.log(ui.box.value);
- if(ui.box.value === '通用'){
- OnMenu(0);
- }else if(ui.box.value === '弹性'){
- OnMenu(1);
- }
- }
- function OnClose(){
- unit.form.physicsCreate2.pane.Close();
- //unit.form.mainfrm.OnCueline('<h4 style="font-family:arial;color: Blue;font-size:20px;">您已将窗体关闭!</h4>');
- unit.form.mainfrm.OnCueline('您已将窗体关闭!', 'blue');
- }
- function OnYes(){
-
- if(ui.stack_menu.index === 0){
- str.push('通用');
- }
- if(ui.stack_menu.index === 1){
- str.push('弹性');
- }
-
- ui.box.list = [
- str
- ];
-
- ui.box.index = parseInt(str.length - 1);
-
- model.setMat(ui.list2.table[1][0]);
- model.setMidu(ui.list.table[1][0]);
- model.setPoi(ui.list2.table[1][1]);
-
- if(model.getNums() !== 0 && model.getPoi() !== 0){
- unit.form.mainfrm.OnChangePicture(2, 2);
- }else{
- unit.form.mainfrm.OnChangePicture(2, 1);
- }
- //unit.form.mainfrm.OnCueline('<h4 style="font-family:arial;color: green;font-size:20px;">恭喜您,您完成了模态分析材料的添加!</h4>');
- unit.form.mainfrm.OnCueline('您完成了模态分析材料的添加!', 'green');
- }
- function OnMenu(idx){
-
- ui.a.valid = ui.b.valid = ui.c.valid = ui.d.valid = ui.e.valid = false;
-
- if(idx == 0){
- ui.stack_menu.index = 0;
- ui.a.valid = true;
- }
- if(idx == 1){
- ui.stack_menu.index = 1;
- ui.b.valid = true;
- }
- }
- //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] = ...;
- });
- */
- 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);
- }
- }
|