123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802 |
- ////////////////////////////////////////////////////////////////////////////
- // 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_constraint.index = 1;
- // ui.stack_menu.index = 2;
- //control(true);
- //controls(true);
- //ui.stack_constraint.index = 2;
-
- //ui.stack_menu.index = 2;
- }
- //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 OnGetFaceName(){
- const str = unit.form.mainfrm.OnGetFaceName();
-
- // 匹配type对应内容的正则表达式,以type:开头,后面跟着非冒号的内容直到遇到空格或者字符串结束
- const typeRegex = /type:([^point]+)/;
- // 匹配center坐标对应内容的正则表达式
- const centerRegex = /point:([\d. ]+)/;
- const typeMatch = str.match(typeRegex);
- const typeInfo = typeMatch? typeMatch[1] : null;
- const centerMatch = str.match(centerRegex);
- const centerCoords = centerMatch? centerMatch[1].split(' ').map(x => x.trim()) : null;
-
- ui.type.value = typeInfo;
- ui.xc.value = centerCoords[0];
- ui.yc.value = centerCoords[1];
- ui.zc.value = centerCoords[2];
- }
- function OnCPointAddEnd(){
- const str = unit.form.mainfrm.OnGetName();
-
- // 匹配center坐标对应内容的正则表达式
- const centerRegex = /center:([\d. ]+)/;
-
- const typeInfo = str.split(' ').slice(1, 4).join(' ');
- const centerMatch = str.match(centerRegex);
- const centerCoords = centerMatch? centerMatch[1].split(' ').map(x => x.trim()) : null;
-
- ui.ctpyee.value = typeInfo;
- ui.cxe.value = centerCoords[0];
- ui.cye.value = centerCoords[1];
- ui.cze.value = centerCoords[2];
- }
- function OnCPointAddStart(){
- const str = unit.form.mainfrm.OnGetName();
-
- // 匹配center坐标对应内容的正则表达式
- const centerRegex = /center:([\d. ]+)/;
-
- const typeInfo = str.split(' ').slice(1, 4).join(' ');
- const centerMatch = str.match(centerRegex);
- const centerCoords = centerMatch? centerMatch[1].split(' ').map(x => x.trim()) : null;
-
- ui.ctypes.value = typeInfo;
- ui.cxs.value = centerCoords[0];
- ui.cys.value = centerCoords[1];
- ui.czs.value = centerCoords[2];
- }
- function OnSPointAddEnd(){
- const str = unit.form.mainfrm.OnGetName();
-
- // 匹配center坐标对应内容的正则表达式
- const centerRegex = /center:([\d. ]+)/;
-
- const typeInfo = str.split(' ').slice(1, 4).join(' ');
- const centerMatch = str.match(centerRegex);
- const centerCoords = centerMatch? centerMatch[1].split(' ').map(x => x.trim()) : null;
-
- ui.stypee.value = typeInfo;
- ui.sxe.value = centerCoords[0];
- ui.sye.value = centerCoords[1];
- ui.sze.value = centerCoords[2];
- }
- function OnSPointAddStart(){
- const str = unit.form.mainfrm.OnGetName();
-
- // 匹配center坐标对应内容的正则表达式
- const centerRegex = /center:([\d. ]+)/;
-
- const typeInfo = str.split(' ').slice(1, 4).join(' ');
- const centerMatch = str.match(centerRegex);
- const centerCoords = centerMatch? centerMatch[1].split(' ').map(x => x.trim()) : null;
-
- ui.stypes.value = typeInfo;
- ui.sxs.value = centerCoords[0];
- ui.sys.value = centerCoords[1];
- ui.szs.value = centerCoords[2];
- }
- function OnGetName(){
- const str = unit.form.mainfrm.OnGetName();
- console.log(str);
- // 匹配center坐标对应内容的正则表达式
- const centerRegex = /center:([\d. ]+)/;
-
- const typeInfo = str.split(' ').slice(1, 4).join(' ');
- const centerMatch = str.match(centerRegex);
- const centerCoords = centerMatch? centerMatch[1].split(' ').map(x => x.trim()) : null;
-
- ui.type.value = typeInfo;
- ui.xc.value = centerCoords[0];
- ui.yc.value = centerCoords[1];
- ui.zc.value = centerCoords[2];
- }
- //修改约束
- function OnModify(){
- if(ui.limit_constraint.index === 0 && ui.constraint_type.index === 0) {
- let color = model.acax_app.model.constrain.Get(model.acax_app.model.constrain.Current()).color;
- let Load = {
- "constraint":"固定支撑",
- "约束类型":ui.constraint_type.value,
- "type":ui.type.value,
- "xc":ui.xc.value,
- "yc":ui.yc.value,
- "zc":ui.zc.value,
- "固定支撑属性xd":ui.con_xn.value,
- "固定支撑属性xr":ui.con_xr.value,
- "固定支撑属性yd":ui.con_yn.value,
- "固定支撑属性yr":ui.con_yr.value,
- "固定支撑属性zd":ui.con_zn.value,
- "固定支撑属性zr":ui.con_zr.value,
- "cons_type":"constraints",
- "color":color,
- "unique":model.acax_app.model.constrain.Get(model.acax_app.model.constrain.Current()).unique
- };
- unit.form.tree.ModifyConstraint(Load);
- }
- if(ui.limit_constraint.index ===1 && ui.misConstraints.index === 0 ) {
- let color = model.acax_app.model.constrain.Get(model.acax_app.model.constrain.Current()).color;
- let Load = {
- "constraint":"梁",
- "非约束类型":ui.misConstraints.value,
- "梁约束位置xDirection":ui.pb_xDiration.value,
- "梁约束位置yDirection":ui.pb_yDiration.value,
- "梁约束位置zDirection":ui.pb_zDiration.value,
- "梁约束位置xCoord":ui.pb_xCoord.value,
- "梁约束位置yCoord":ui.pb_yCoord.value,
- "梁约束位置zCoord":ui.pb_zCoord.value,
- "梁约束参数半径":ui.rad.value,
- "梁约束参数长度":ui.pb_length.value,
- "梁约束参数个数":ui.pb_size.value,
- "弹性模量":ui.m.value,
- "泊松比":ui.poi.value,
- "梁节点大小半径":ui.pb_node_size.value,
- "R":ui.R.value,
- "G":ui.G.value,
- "B":ui.B.value,
- "cons_type":"beams",
- "color":color,
- "unique":model.acax_app.model.constrain.Get(model.acax_app.model.constrain.Current()).unique
- };
- unit.form.tree.ModifyConstraint(Load);
- }
- if(ui.limit_constraint.index ===1 && ui.misConstraints.index === 1 ) {
- let color = model.acax_app.model.constrain.Get(model.acax_app.model.constrain.Current()).color;
- let Load = {
- "constraint":"弹簧",
- "非约束类型":ui.misConstraints.value,
- "弹簧坐标x":ui.sxs.value,
- "弹簧坐标y":ui.sys.value,
- "弹簧坐标z":ui.szs.value,
- "stypes":ui.stypes.value,
- "弹簧终点x":ui.sxe.value,
- "弹簧终点y":ui.sye.value,
- "弹簧终点z":ui.sze.value,
- "stypee":ui.stypee.value,
- "stiffness_x":ui.sstifx.value,
- "stiffness_y":ui.sstify.value,
- "stiffness_z":ui.sstifz.value,
- "R":ui.sr.value,
- "G":ui.sg.value,
- "B":ui.sb.value,
- "cons_type":"spring",
- "color":color,
- "unique":model.acax_app.model.constrain.Get(model.acax_app.model.constrain.Current()).unique
- };
- unit.form.tree.ModifyConstraint(Load);
- }
- if(ui.limit_constraint.index ===1 && ui.misConstraints.index === 2 ) {
- let color = model.acax_app.model.constrain.Get(model.acax_app.model.constrain.Current()).color;
- let Load = {
- "constraint":"连接",
- "非约束类型":ui.misConstraints.value,
- "弹簧坐标x":ui.cxs.value,
- "弹簧坐标y":ui.cys.value,
- "弹簧坐标z":ui.czs.value,
- "ctypes":ui.ctypes.value,
- "弹簧终点x":ui.cxe.value,
- "弹簧终点y":ui.cye.value,
- "弹簧终点z":ui.cze.value,
- "ctpyee":ui.ctpyee.value,
- "弹簧材料xn":ui.cxn.value,
- "弹簧材料yn":ui.cyn.value,
- "弹簧材料zn":ui.czn.value,
- "弹簧材料xr":ui.cxr.value,
- "弹簧材料yr":ui.cyr.value,
- "弹簧材料zr":ui.czr.value,
- "R":ui.cr.value,
- "G":ui.cg.value,
- "B":ui.cb.value,
- "cons_type":"connect",
- "color":color,
- "unique":model.acax_app.model.constrain.Get(model.acax_app.model.constrain.Current()).unique
- };
- unit.form.tree.ModifyConstraint(Load);
- }
- }
- function OnChangeBeam(){
- if(parseFloat(ui.pb_length.value) <= 0 || parseFloat(ui.rad.value) <= 0 || parseFloat(ui.m.value) <= 0 || parseFloat(ui.poi.value) <= 0 || parseFloat(ui.rad.value) <= 0){
- unit.form.mainfrm.OnChangePicture(3, 3);
- //unit.form.mainfrm.OnCueline('<h4 style="font-family:arial;color: red;font-size:20px;">非常抱歉,您输入的数据不在参数范围内!</h4>');
- unit.form.mainfrm.OnCueline('您输入的数据不在参数范围内!', 'red');
- }else{
- unit.form.mainfrm.OnChangePicture(3, 2);
- //unit.form.mainfrm.OnCueline('<h4 style="font-family:arial;color: Blue;font-size:20px;">恭喜您,您输入了正确的数据!</h4>');
- unit.form.mainfrm.OnCueline('您输入了正确的数据!', 'blue');
- }
- }
- function OnFix(){
- let temp = unit.form.tree.GetCurUniqueName();
- let name = temp;
- let constrain_data = model.acax_app.model.constrain.Database();
- //console.log(workcondition_data);
- let i = 0;
- let j = 0;
- let constrain_arr = Object.keys(constrain_data.db);
- //console.log(constrain_data.db);
- name = name + "fix0";
- while(1){
- for( i = 0;i < constrain_arr.length;++i) {
- if(constrain_data.db[constrain_arr[i]].unique === name) {
- ++j;
- name = temp + "fix" + j;
- break;
- }
- }
- if(i === constrain_arr.length) {
- break;
- }
- }
- let name1 = unit.form.mainfrm.OnConstrains(ui.xc.value, ui.yc.value, ui.zc.value, name);
-
- name1 = name1.replace(temp, "");
-
- unit.form.mainfrm.OnChangePicture(3, 2);
- let color = unit.form.tree.getRandomHexColor();
- let Load = {
- "constraint":"固定支撑",
- "约束类型":ui.constraint_type.value,
- "type":ui.type.value,
- "xc":ui.xc.value,
- "yc":ui.yc.value,
- "zc":ui.zc.value,
- "固定支撑属性xd":ui.con_xn.value,
- "固定支撑属性xr":ui.con_xr.value,
- "固定支撑属性yd":ui.con_yn.value,
- "固定支撑属性yr":ui.con_yr.value,
- "固定支撑属性zd":ui.con_zn.value,
- "固定支撑属性zr":ui.con_zr.value,
- "cons_type":"constraints",
- "color":color,
- "unique":name
- };
- // console.log(name1);
- if(ui.type.value === '--') {
- unit.form.mainfrm.OnCueline('未添加中心坐标', 'green');
- }else{
- unit.form.tree.CreateBoundary(Load, name1);
- unit.form.mainfrm.OnCueline('您完成了固定支撑属性的添加,请用鼠标右键选中需要施加约束的物体并按快捷键T或者t进行添加!', 'green');
- }
-
- }
- function OnBeam2(){
- unit.form.mainfrm.OnSend('beamHightLight2 ' + ui.m_seg.value + ' ' + ui.m_len.value + ' ' + ui.m_radius.value + ' ' + ui.m_mat.value + ' ' + ui.m_poi.value + ' ' + ui.m_R.value + ' '+ ui.m_G.value + ' ' + ui.m_B.value + ' ' + ui.m_ras.value);
- model.clearStr();
- unit.form.mainfrm.OnChangePicture(3, 2);
- unit.form.mainfrm.OnCueline('您成功做好了不均匀梁的添加!', 'green');
- }
- function OnConnect(){
- let temp = unit.form.tree.GetCurUniqueName();
- let name = temp;
- let constrain_data = model.acax_app.model.constrain.Database();
- //console.log(workcondition_data);
- let i = 0;
- let j = 0;
- let constrain_arr = Object.keys(constrain_data.db);
- //console.log(constrain_data.db);
- name = name + "con0";
- while(1){
- for( i = 0;i < constrain_arr.length;++i) {
- if(constrain_data.db[constrain_arr[i]].unique === name) {
- ++j;
- name = temp + "con" + j;
- break;
- }
- }
- if(i === constrain_arr.length) {
- break;
- }
- }
- let name1 = unit.form.mainfrm.OnConnects(ui.cxs.value, ui.cys.value, ui.czs.value, ui.cxe.value, ui.cye.value, ui.cze.value, ui.cr.value, ui.cg.value, ui.cb.value, name);
-
- name1 = name1.replace(temp, "");
-
- unit.form.mainfrm.OnChangePicture(3, 2);
- let color = unit.form.tree.getRandomHexColor();
- let Load = {
- "constraint":"连接",
- "非约束类型":ui.misConstraints.value,
- "弹簧坐标x":ui.cxs.value,
- "弹簧坐标y":ui.cys.value,
- "弹簧坐标z":ui.czs.value,
- "ctypes":ui.ctypes.value,
- "弹簧终点x":ui.cxe.value,
- "弹簧终点y":ui.cye.value,
- "弹簧终点z":ui.cze.value,
- "ctpyee":ui.ctpyee.value,
- "弹簧材料xn":ui.cxn.value,
- "弹簧材料yn":ui.cyn.value,
- "弹簧材料zn":ui.czn.value,
- "弹簧材料xr":ui.cxr.value,
- "弹簧材料yr":ui.cyr.value,
- "弹簧材料zr":ui.czr.value,
- "R":ui.cr.value,
- "G":ui.cg.value,
- "B":ui.cb.value,
- "cons_type":"connect",
- "color":color,
- "unique":name
- };
- console.log(name1);
- if(ui.ctypes.value === '--' || ui.ctpyee.value === '--') {
- unit.form.mainfrm.OnCueline('未添加弹簧坐标', 'green');
- }else{
- unit.form.tree.CreateBoundary(Load, name1);
- unit.form.mainfrm.OnCueline('您成功地做好了连接!', 'green');
- }
-
- }
- function onEndMessage(){
- controls(false);
- }
- function onStartMessage(){
- controls(true);
- }
- function controls(idx){
- ui.pb_start_message.enable = !idx;
- ui.pb_start_mes.enable = !idx;
- ui.pb_start_x.enable = idx;
- ui.pb_start_y.enable = idx;
- ui.pb_start_z.enable = idx;
-
- ui.pb_end_message.enable = idx;
- ui.pb_end_mes.enable = idx;
- ui.pb_end_x.enable = !idx;
- ui.pb_end_y.enable = !idx;
- ui.pb_end_z.enable = !idx;
-
- if(idx === true){
- model.setStartEnd(0);
- }
- if(idx === false){
- model.setStartEnd(1);
- }
- }
- function OnChangeValue(){
- ui.pb_pass.enable = false;
- }
- function OnReturn(){
- unit.form.mainfrm.menu(4);
- }
- function OnFile(){
- ui.pb_pass.enable = true;
- model.setCon(1);
-
- if(ui.stack_menu.index === 0){
- let id = parent.setTimeout(() => {
- unit.form.mainfrm.OnSend('0');
- }, 100);
- unit.form.mainfrm.OnSend('beamSave ' + model.getCurrentDirectory());
- }
- if(ui.stack_menu.index === 1){
- let id = parent.setTimeout(() => {
- unit.form.mainfrm.OnSend('0');
- }, 100);
- unit.form.mainfrm.OnSend('springSave ' + model.getCurrentDirectory());
- }
- }
- function OnSpring(){
- let temp = unit.form.tree.GetCurUniqueName();
- let name = temp;
- let constrain_data = model.acax_app.model.constrain.Database();
- //console.log(workcondition_data);
- let i = 0;
- let j = 0;
- let constrain_arr = Object.keys(constrain_data.db);
- //console.log(constrain_data.db);
- name = name + "spring0";
- while(1){
- for( i = 0;i < constrain_arr.length;++i) {
- if(constrain_data.db[constrain_arr[i]].unique === name) {
- ++j;
- name = temp + "spring" + j;
- break;
- }
- }
- if(i === constrain_arr.length) {
- break;
- }
- }
- let name1 = unit.form.mainfrm.OnSpring(ui.sxs.value, ui.sys.value, ui.szs.value, ui.sxe.value, ui.sye.value, ui.sze.value, ui.sr.value, ui.sg.value, ui.sb.value, name);
-
- name1 = name1.replace(temp, "");
-
- unit.form.mainfrm.OnChangePicture(3, 2);
- let color = unit.form.tree.getRandomHexColor();
- let Load = {
- "constraint":"弹簧",
- "非约束类型":ui.misConstraints.value,
- "弹簧坐标x":ui.sxs.value,
- "弹簧坐标y":ui.sys.value,
- "弹簧坐标z":ui.szs.value,
- "stypes":ui.stypes.value,
- "弹簧终点x":ui.sxe.value,
- "弹簧终点y":ui.sye.value,
- "弹簧终点z":ui.sze.value,
- "stypee":ui.stypee.value,
- "stiffness_x":ui.sstifx.value,
- "stiffness_y":ui.sstify.value,
- "stiffness_z":ui.sstifz.value,
- "R":ui.sr.value,
- "G":ui.sg.value,
- "B":ui.sb.value,
- "cons_type":"spring",
- "color":color,
- "unique":name
-
- };
- console.log(name1);
- if(ui.stypes.value === '--' || ui.stypee.value === '--') {
- unit.form.mainfrm.OnCueline('未添加弹簧坐标', 'green');
- }else{
- unit.form.tree.CreateBoundary(Load, name1);
- unit.form.mainfrm.OnCueline('您完成了弹簧约束的添加!', 'green');
- }
-
- }
- function OnBeam(){
- let temp = unit.form.tree.GetCurUniqueName();
- let name = temp;
- let constrain_data = model.acax_app.model.constrain.Database();
- //console.log(workcondition_data);
- let i = 0;
- let j = 0;
- let constrain_arr = Object.keys(constrain_data.db);
- //console.log(constrain_data.db);
- name = name + "beam0";
- while(1){
- for( i = 0;i < constrain_arr.length;++i) {
- if(constrain_data.db[constrain_arr[i]].unique.split(" ")[0] === name) {
- ++j;
- name = temp + "beam" + j;
- break;
- }
- }
- if(i === constrain_arr.length) {
- break;
- }
- }
- name = name + " B 0";
- const str =unit.form.mainfrm.OnBeams(ui.pb_size.value, ui.pb_xDiration.value, ui.pb_yDiration.value, ui.pb_zDiration.value, ui.pb_xCoord.value, ui.pb_yCoord.value, ui.pb_zCoord.value, ui.R.value, ui.G.value, ui.B.value, ui.pb_node_size.value, name);
-
- let name1 = str.split(' ')[0].split(':')[1];
- name1 = name1.replace(temp, "");
- const centerRegex = /centers:([\d. ]+)/;
- const centerMatch = str.match(centerRegex);
- const centerCoords = centerMatch? centerMatch[1].split(' ').map(x => x.trim()) : null;
- let color = unit.form.tree.getRandomHexColor();
- unit.form.mainfrm.OnChangePicture(3, 2);
- let Load = {
- "constraint":"梁",
- "非约束类型":ui.misConstraints.value,
- "梁约束位置xDirection":ui.pb_xDiration.value,
- "梁约束位置yDirection":ui.pb_yDiration.value,
- "梁约束位置zDirection":ui.pb_zDiration.value,
- "梁约束位置xCoord":ui.pb_xCoord.value,
- "梁约束位置yCoord":ui.pb_yCoord.value,
- "梁约束位置zCoord":ui.pb_zCoord.value,
- "梁约束参数半径":ui.rad.value,
- "梁约束参数长度":ui.pb_length.value,
- "梁约束参数个数":ui.pb_size.value,
- "弹性模量":ui.m.value,
- "泊松比":ui.poi.value,
- "梁节点大小半径":ui.pb_node_size.value,
- "R":ui.R.value,
- "G":ui.G.value,
- "B":ui.B.value,
- "point":centerCoords,
- "cons_type":"beams",
- "color":color,
- "unique":name
- };
- console.log(name1);
- unit.form.tree.CreateBoundary(Load, name1);
- unit.form.mainfrm.OnCueline('您完成了梁约束的添加!', 'green');
- }
- function control(idx){
- ui.pb_start.enable = !idx;
- ui.pb_x.enable = idx;
- ui.pb_y.enable = idx;
- ui.pb_z.enable = idx;
-
- ui.pb_end.enable = idx;
- ui.pb_X.enable = !idx;
- ui.pb_Y.enable = !idx;
- ui.pb_Z.enable = !idx;
-
- if(idx === true){
- model.setStartEnd(0);
- }
- if(idx === false){
- model.setStartEnd(1);
- }
- }
- function OnEed(){
- control(false);
- }
- function OnStart(){
- control(true);
- }
- function OnChangeMenu(){
- ui.stack_menu.index = parseFloat(ui.misConstraints.index);
- console.log(ui.no_limit_constraint.index === 1);
- //console.log(ui.limit_constraint.index);
- if(ui.stack_menu.index === 3){
- model.setBeam(true);
- }else{
- model.setBeam(false);
- }
- }
- function OnChangeConstraint(){
-
- ui.stack_constraint.index = ui.limit_constraint.index;
- if(parseFloat(idx) === 1){
- unit.form.mainfrm.OnChangePicture(3, 1);
- unit.form.mainfrm.OnCueline('注意事项:弹簧单元的起点和终点需要自动添加,鼠标右键选中起始/终止点,点击按钮(在窗口左侧倒数第3个按钮)添加即可将坐标导入!', 'blue');
- }else if(parseFloat(idx) === 2){
- unit.form.mainfrm.OnChangePicture(3, 1);
- unit.form.mainfrm.OnCueline('注意事项:连接单元的起点和终点需要自动添加,鼠标右键选中起始/终止点,点击按钮(在窗口左侧倒数第3个按钮)添加即可将坐标导入!', 'blue');
- }else if(parseFloat(idx) === 3){
- unit.form.mainfrm.OnChangePicture(3, 1);
- unit.form.mainfrm.OnCueline('注意事项:非均匀梁的各个节点需要用鼠标右键拾取后点击H或h进行保存,梁上的各个点需要在一条直线上!', 'blue');
- }
- }
- function ChangeRadiobutton(idx) {
- ui.limit_constraint.index = parseFloat(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
- CW_DeclareVariable("pb_x",
- val => {
- ui.pb_x.value = val;
- ui.pb_start_x.value = val;
- }, () => {});
-
- CW_DeclareVariable("pb_y",
- val => {
- ui.pb_y.value = val;
- ui.pb_start_y.value = val;
- }, () => {});
- CW_DeclareVariable("pb_z",
- val => {
- ui.pb_z.value = val;
- ui.pb_start_z.value = val;
- }, () => {});
-
- CW_DeclareVariable("pb_X",
- val => {
- ui.pb_X.value = val;
- ui.pb_end_x.value = val;
- }, () => {});
-
- CW_DeclareVariable("pb_Y",
- val => {
- ui.pb_Y.value = val;
- ui.pb_end_y.value = val;
- }, () => {});
- CW_DeclareVariable("pb_Z",
- val => {
- ui.pb_Z.value = val;
- ui.pb_end_z.value = val;
- }, () => {});
- CW_DeclareVariable("listbox",
- val => {
- ui.listbox.list = [
- val
- ];
- }, () => {});
-
- CW_DeclareVariable("start_mes",
- val => {
- ui.pb_type1.value = val;
- ui.pb_start_mes.value = val;
- }, () => {});
-
- CW_DeclareVariable("end_mes",
- val => {
- ui.pb_type2.value = val;
- ui.pb_end_mes.value = val;
- }, () => {});
-
- CW_DeclareVariable("change1",
- val => {
- ui.stack_constraint.index = val;
- }, () => {});
-
- CW_DeclareVariable("change2",
- val => {
- ui.stack_menu.index = val;
- ui.misConstraints.index = val;
- }, () => {});
- //固定支撑
- CW_DeclareVariable("setConstraint0",
- val => {
- ui.type.value = val.type;
- ui.xc.value=val.xc;
- ui.yc.value=val.yc;
- ui.zc.value=val.zc;
- ui.con_xn.value = val["固定支撑属性xd"];
- ui.con_xr.value = val["固定支撑属性xr"];
- ui.con_yn.value = val["固定支撑属性yd"];
- ui.con_yr.value = val["固定支撑属性yr"];
- ui.con_zn.value = val["固定支撑属性zd"];
- ui.con_zr.value = val["固定支撑属性zr"];
- }, () => {});
- //梁
- CW_DeclareVariable("setConstraint1",
- val => {
- ui.pb_xDiration.value = val["梁约束位置xDirection"];
- ui.pb_yDiration.value = val["梁约束位置yDirection"];
- ui.pb_zDiration.value = val["梁约束位置zDirection"];
- ui.pb_xCoord.value = val["梁约束位置xCoord"];
- ui.pb_yCoord.value = val["梁约束位置yCoord"];
- ui.pb_zCoord.value = val["梁约束位置zCoord"];
- ui.rad.value = val["梁约束参数半径"];
- ui.pb_length.value = val["梁约束参数长度"];
- ui.pb_size.value = val["梁约束参数个数"];
- ui.m.value = val["弹性模量"];
- ui.poi.value = val["泊松比"];
- ui.pb_node_size.value = val["梁节点大小半径"];
- ui.R.value = val.R;
- ui.G.value = val.G;
- ui.B.value = val.B;
- }, () => {});
- //弹簧
- CW_DeclareVariable("setConstraint2",
- val => {
-
- ui.sxs.value = val["弹簧坐标x"];
- ui.sys.value = val["弹簧坐标y"];
- ui.szs.value = val["弹簧坐标z"];
- ui.stypes.value = val.stypes;
-
- ui.sxe.value = val["弹簧终点x"];
- ui.sye.value = val["弹簧终点y"];
- ui.sze.value = val["弹簧终点z"];
- ui.stypee.value = val.stypee;
-
- ui.sstifx.value = val.stiffness_x;
- ui.sstify.value = val.stiffness_y;
- ui.sstifz.value = val.stiffness_z;
-
- ui.sr.value = val.R;
- ui.sg.value = val.G;
- ui.sb.value = val.B;
- }, () => {});
- //连接
- CW_DeclareVariable("setConstraint3",
- val => {
-
- ui.cxs.value = val["弹簧坐标x"];
- ui.cys.value= val["弹簧坐标y"];
- ui.czs.value= val["弹簧坐标z"];
- ui.ctypes.value= val.ctypes;
- ui.cxe.value= val["弹簧终点x"];
- ui.cye.value= val["弹簧终点y"];
- ui.cze.value= val["弹簧终点z"];
- ui.ctpyee.value= val.ctpyee;
-
- ui.cxn.value = val["弹簧材料xn"];
- ui.cyn.value= val["弹簧材料yn"];
- ui.czn.value= val["弹簧材料zn"];
- ui.cxr.value= val["弹簧材料xr"];
- ui.cyr.value= val["弹簧材料yr"];
- ui.czr.value= val["弹簧材料zr"];
-
- ui.cr.value = val.R;
- ui.cg.value = val.G;
- ui.cb.value = val.B;
- }, () => {});
- 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);
- }
- }
|