|
@@ -49,7 +49,12 @@ function OnTest(){
|
|
|
// console.log(model.acax_app.path.Name(g_cur_id2index_cache["131"]));
|
|
|
//console.log(g_cur_id2index_cache);
|
|
|
// console.log(g_cur_index2id_cache);
|
|
|
- console.log(model.acax_app.model.materialProp.Current());
|
|
|
+ //console.log(model.acax_app.model.materialProp.Current());
|
|
|
+ //SetUserColor();
|
|
|
+ let str = unit.form.mainfrm.findRIdById(model.acax_app.model.project.GetModel().pro_model, 100005);
|
|
|
+ console.log(str);
|
|
|
+ console.log(comx.occio.GetFacePoint(comx.occore.GetEntryEx(), str));
|
|
|
+
|
|
|
}
|
|
|
//判断工作流程
|
|
|
function CheckCtrlProcess() {
|
|
@@ -111,7 +116,7 @@ function GenerateFile() {
|
|
|
console.log(cb);
|
|
|
});
|
|
|
model.acax_app.control.Export(info=>{
|
|
|
- console.log(JSON.stringify(info, null, 2));
|
|
|
+ //console.log(JSON.stringify(info, null, 2));
|
|
|
|
|
|
let cut_workcondition_index = model.acax_app.view.GetCurrentWorkConditionIndex();
|
|
|
var File = ['结构静力学前处理文件', '\n$ address', info.model3d.step.replace(/\\/g, "/")];
|
|
@@ -206,7 +211,7 @@ function GenerateFile() {
|
|
|
File.push("\n$ id RB3");
|
|
|
let str1 = info.cons_list[i]["编号"];
|
|
|
str1 = str1.split(" ");
|
|
|
- console.log(str1);
|
|
|
+ //console.log(str1);
|
|
|
for(let j = 0;j < str1.length;++j) {
|
|
|
if(str1[j] !== '') {
|
|
|
File.push(str1[j]);
|
|
@@ -221,7 +226,6 @@ function GenerateFile() {
|
|
|
}
|
|
|
|
|
|
}
|
|
|
- console.log("rb3");
|
|
|
//集中载荷rb3
|
|
|
File.push("\n$ arrow type id ids xn yn zn xr yr zr RB3");
|
|
|
for(let i = 0;i < info.cons_list.length;++i ) {
|
|
@@ -232,10 +236,10 @@ function GenerateFile() {
|
|
|
}
|
|
|
}
|
|
|
//固定支撑rb3
|
|
|
- File.push("\n$ con type id ids xn yn zn xr yr zr RB3");
|
|
|
+ File.push("\n$ fix type id ids xn yn zn xr yr zr RB3");
|
|
|
for(let i = 0;i < info.cons_list.length;++i ) {
|
|
|
if(info.cons_list[i].constraint === "固定支撑" && info.cons_list[i].type[0] === 'P') {
|
|
|
- let str1 = info.cons_list[i]["位置标记"] + " "+ info.cons_list[i]["固定支撑属性xd"] + " " + info.cons_list[i]["固定支撑属性yd"] + " " + info.cons_list[i]["固定支撑属性zd"] + " "+info.cons_list[i]["固定支撑属性xr"] + " " + info.cons_list[i]["固定支撑属性yr"] +" " + info.cons_list[i]["固定支撑属性zr"];
|
|
|
+ let str1 = info.cons_list[i].type + " "+ info.cons_list[i]["固定支撑属性xd"] + " " + info.cons_list[i]["固定支撑属性yd"] + " " + info.cons_list[i]["固定支撑属性zd"] + " "+info.cons_list[i]["固定支撑属性xr"] + " " + info.cons_list[i]["固定支撑属性yr"] +" " + info.cons_list[i]["固定支撑属性zr"];
|
|
|
File.push(str1);
|
|
|
}
|
|
|
}
|
|
@@ -281,7 +285,6 @@ function CreateContrainShow() {
|
|
|
}
|
|
|
ShowPoints();
|
|
|
}else{
|
|
|
- console.log("CreateContrainShow");
|
|
|
for(let i = 0;i < new_arr_key.length;++i) {
|
|
|
if(constrain_data.constrain.db[new_arr_key[i]].constraint === "集中载荷压力") {
|
|
|
unit.form.mainfrm.OnArrows(constrain_data.constrain.db[new_arr_key[i]]["位置坐标x"], constrain_data.constrain.db[new_arr_key[i]]["位置坐标y"], constrain_data.constrain.db[new_arr_key[i]]["位置坐标z"], constrain_data.constrain.db[new_arr_key[i]]["压力方向xn"], constrain_data.constrain.db[new_arr_key[i]]["压力方向yn"], constrain_data.constrain.db[new_arr_key[i]]["压力方向zn"], constrain_data.constrain.db[new_arr_key[i]].unique);
|
|
@@ -306,8 +309,7 @@ function CreateContrainShow() {
|
|
|
|
|
|
}
|
|
|
}
|
|
|
- //加载点
|
|
|
- console.log("OnLoadPoints");
|
|
|
+ //加载点
|
|
|
OnLoadPoints();
|
|
|
workcondition.push(cur_name);
|
|
|
|
|
@@ -326,7 +328,6 @@ function ShowPoints() {
|
|
|
}
|
|
|
//加载点
|
|
|
function OnLoadPoints() {
|
|
|
-
|
|
|
let work_condition = model.acax_app.view.GetCurrentWorkConditionIndex();
|
|
|
if(model.acax_app.view.GetProperty(work_condition) !== undefined && model.acax_app.view.GetProperty(work_condition).point !== undefined ) {
|
|
|
let point_model = model.acax_app.view.GetProperty(work_condition).point;
|
|
@@ -334,8 +335,7 @@ function OnLoadPoints() {
|
|
|
for(let i = 0;i < point_arr.length;++i) {
|
|
|
unit.form.mainfrm.OnSetPoints(point_model[point_arr[i]].x, point_model[point_arr[i]].y, point_model[point_arr[i]].z, point_model[point_arr[i]].radius, point_model[point_arr[i]].name);
|
|
|
}
|
|
|
- }
|
|
|
-
|
|
|
+ }
|
|
|
}
|
|
|
//隐藏旧的工况
|
|
|
function HideWorkcondition() {
|
|
@@ -400,7 +400,7 @@ function SetPoint(node) {
|
|
|
}else if(model_prop.point === undefined){
|
|
|
let point = {};
|
|
|
point.point1 = node;
|
|
|
- console.log(point);
|
|
|
+ //console.log(point);
|
|
|
model_prop.point = point;
|
|
|
model.acax_app.view.SetProperty(cut_workcondition_index, model_prop);
|
|
|
}else{
|
|
@@ -422,7 +422,7 @@ function SetBrepFile(brep_path){
|
|
|
model_prop = {};
|
|
|
let brep = {};
|
|
|
brep.brep1 = brep_path;
|
|
|
- console.log(brep);
|
|
|
+ //console.log(brep);
|
|
|
model_prop.brep = brep;
|
|
|
model.acax_app.view.SetProperty(cut_workcondition_index, model_prop);
|
|
|
|
|
@@ -436,8 +436,8 @@ function SetBrepFile(brep_path){
|
|
|
|
|
|
var i = 0;
|
|
|
for( i = 0;i < brep_arr.length;++i) {
|
|
|
- console.log(model_prop.brep[brep_arr[i]].brep);
|
|
|
- console.log(brep_path.brep);
|
|
|
+ //console.log(model_prop.brep[brep_arr[i]].brep);
|
|
|
+ //console.log(brep_path.brep);
|
|
|
if(model_prop.brep[brep_arr[i]].brep === brep_path.brep) {
|
|
|
break;
|
|
|
}
|
|
@@ -475,10 +475,11 @@ function ModifyConstraintName(new_name) {
|
|
|
let flag = model.acax_app.control.constrain.Rename(cur_name, new_name);
|
|
|
let cur_index = model.acax_app.view.GetCurrentWorkConditionIndex();
|
|
|
let cur_id;
|
|
|
- if(flag === true) {
|
|
|
- unit.form.mainfrm.OnCueline('修改成功', 'green');
|
|
|
+ if(flag === false) {
|
|
|
+ unit.form.mainfrm.OnCueline('修改失败', 'red');
|
|
|
+
|
|
|
}else{
|
|
|
- unit.form.mainfrm.OnCueline('修改失败', 'red');
|
|
|
+ unit.form.mainfrm.OnCueline('修改成功', 'green');
|
|
|
}
|
|
|
model.acax_app.view.RenderTree(() => {
|
|
|
g_cur_id2index_cache = {};
|
|
@@ -1071,21 +1072,25 @@ function OpenWorkArea(fname) {
|
|
|
}else{
|
|
|
model.acax_app.view.Render3D(info=>{
|
|
|
unit.form.mainfrm.OnloadModel(info.model3d.step);
|
|
|
+ //console.log(difference);
|
|
|
+ //unit.form.mainfrm.SetColor(difference);
|
|
|
+ //console.log("222222222");
|
|
|
CreateContrainShow();
|
|
|
+ //console.log("3333333332");
|
|
|
});
|
|
|
}
|
|
|
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
CheckCtrlProcess();
|
|
|
- //console.log(model.global_ctrl);
|
|
|
+ console.log(model.global_ctrl);
|
|
|
}
|
|
|
//切换工程
|
|
|
function ChangePro(pro_name) {
|
|
|
let tree_color = [];
|
|
|
model.acax_app.control.project.SwitchTo(pro_name);
|
|
|
//渲染3d模型
|
|
|
- console.log(model.acax_app.model.project.GetModel().step);
|
|
|
if(model.acax_app.model.project.GetModel().step === "unimported") {
|
|
|
unit.form.mainfrm.ClearCanvas();
|
|
|
model.acax_app.view.RenderTree(() => {
|
|
@@ -1142,7 +1147,7 @@ function ChangePro(pro_name) {
|
|
|
},
|
|
|
tree => {
|
|
|
//从工程中获取保存的model数据
|
|
|
- console.log(model.acax_app.model.project.GetModel().pro_model);
|
|
|
+ //console.log(model.acax_app.model.project.GetModel().pro_model);
|
|
|
if(model.acax_app.model.project.GetModel().pro_model){
|
|
|
//获取当前工程的名字
|
|
|
let pro_Index = model.acax_app.view.GetCurrentProjectIndex();
|
|
@@ -1161,6 +1166,7 @@ function ChangePro(pro_name) {
|
|
|
}else{
|
|
|
model.acax_app.view.Render3D(info=>{
|
|
|
unit.form.mainfrm.OnloadModel(info.model3d.step);
|
|
|
+ SetUserColor();
|
|
|
});
|
|
|
}
|
|
|
|
|
@@ -1243,7 +1249,7 @@ function ChangeWorkCondition(wor_name) {
|
|
|
|
|
|
ui.tree_Model.column = [1, tree_color];
|
|
|
CheckCtrlProcess();
|
|
|
- console.log(model.global_ctrl);
|
|
|
+ // console.log(model.global_ctrl);
|
|
|
return old_data;
|
|
|
}
|
|
|
//创建工作区
|
|
@@ -1325,6 +1331,7 @@ function CreateWorkArea(name) {
|
|
|
});
|
|
|
}
|
|
|
ui.tree_Model.column = [1, tree_color];
|
|
|
+ CheckCtrlProcess();
|
|
|
}
|
|
|
//创建工程
|
|
|
function CreateProject(name) {
|
|
@@ -1408,12 +1415,9 @@ function CreateProject(name) {
|
|
|
//渲染3d模型
|
|
|
if(model.acax_app.model.project.GetModel().step === "unimported") {
|
|
|
unit.form.mainfrm.ClearCanvas();
|
|
|
- }else{
|
|
|
- model.acax_app.view.Render3D(info=>{
|
|
|
- unit.form.mainfrm.OnloadModel(info.model3d.step);
|
|
|
- });
|
|
|
}
|
|
|
ui.tree_Model.column = [1, tree_color];
|
|
|
+ CheckCtrlProcess();
|
|
|
}
|
|
|
//导入模型
|
|
|
function OnOpenStepFile() {
|
|
@@ -1522,11 +1526,11 @@ function getTreeIdColorMap(tree) {
|
|
|
|
|
|
// 定义递归函数
|
|
|
function dfs(node) {
|
|
|
- // 如果当前节点有 id 和 color 属性,则加入对象
|
|
|
- if (node.id !== undefined && node.color !== undefined) {
|
|
|
+ // 检查当前节点的 name 属性是否包含 "face",以及是否具有 id 和 color 属性
|
|
|
+ if (node.name && node.name.includes("Face") && node.id !== undefined && node.color !== undefined) {
|
|
|
idColorMap[node.id] = node.color;
|
|
|
}
|
|
|
- // 按顺序遍历子节点
|
|
|
+ // 如果存在子节点,递归遍历
|
|
|
if (node.children && node.children.length > 0) {
|
|
|
node.children.forEach(child => dfs(child));
|
|
|
}
|
|
@@ -1538,9 +1542,11 @@ function getTreeIdColorMap(tree) {
|
|
|
// 返回存储的 id 和 color 键值对对象
|
|
|
return idColorMap;
|
|
|
}
|
|
|
+
|
|
|
//获取模型面的颜色保存到project
|
|
|
function SetModelColor(Idx) {
|
|
|
let model_color = getTreeIdColorMap(Idx);
|
|
|
+ console.log(model_color);
|
|
|
let cut_project_index = model.acax_app.view.GetCurrentProjectIndex();
|
|
|
let model_prop = model.acax_app.view.GetProperty(cut_project_index);
|
|
|
if(model_prop === undefined) {
|
|
@@ -1551,7 +1557,7 @@ function SetModelColor(Idx) {
|
|
|
model_prop.color = model_color;
|
|
|
model.acax_app.view.SetProperty(cut_project_index, model_prop);
|
|
|
}
|
|
|
- console.log(model.acax_app.view.GetProperty(cut_project_index));
|
|
|
+ //console.log(model.acax_app.view.GetProperty(cut_project_index));
|
|
|
}
|
|
|
//将颜色给模型赋回去
|
|
|
function assignColorsToTree(tree, idColorMap) {
|
|
@@ -1585,34 +1591,46 @@ function findDifferences(oldMap, newMap) {
|
|
|
|
|
|
return differences;
|
|
|
}
|
|
|
+var difference = {};
|
|
|
+//获取工程中颜色,为模型涂色
|
|
|
+function SetUserColor() {
|
|
|
+ var dif_key = Object.keys(difference);
|
|
|
+ console.log(dif_key.length);
|
|
|
+ for(let i = 0;i < dif_key.length;++i) {
|
|
|
+ let rgb = hexToRgb(difference[dif_key[i]]);
|
|
|
+ try {
|
|
|
+ unit.form.mainfrm.LightFace(dif_key[i], rgb); // 调用设置颜色
|
|
|
+ } catch (error) {
|
|
|
+ console.error(`Failed to apply color for key ${dif_key[i]}`, error);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+}
|
|
|
//导入模型树节点
|
|
|
function OnTree(Idx){
|
|
|
-
|
|
|
- //console.log(JSON.stringify(Idx, null, 2));
|
|
|
+
|
|
|
let tree_color = [];
|
|
|
+ //console.log(JSON.stringify(Idx, null, 2));
|
|
|
updateJsonNodes(Idx);
|
|
|
|
|
|
//模型树颜色
|
|
|
let cut_project_index = model.acax_app.view.GetCurrentProjectIndex();
|
|
|
- if(model.acax_app.view.GetProperty(cut_project_index) !== undefined ) {
|
|
|
+ /*if(model.acax_app.view.GetProperty(cut_project_index) !== undefined ) {
|
|
|
//获取工程中的模型颜色,为树赋颜色
|
|
|
if(model.acax_app.view.GetProperty(cut_project_index).color!==undefined ) {
|
|
|
- let old_map = getTreeIdColorMap(Idx);
|
|
|
- console.log(old_map);
|
|
|
- console.log( model.acax_app.view.GetProperty(cut_project_index).color);
|
|
|
- let difference = findDifferences(old_map, model.acax_app.view.GetProperty(cut_project_index).color);
|
|
|
- console.log(difference);
|
|
|
- let dif_key = Object.keys(difference);
|
|
|
- for(let i = 0;i < dif_key.length;++i) {
|
|
|
- let rgb = hexToRgb(difference[dif_key[i]]);
|
|
|
- unit.form.mainfrm.LightFace(dif_key[i], rgb);
|
|
|
- }
|
|
|
+ //var old_map = getTreeIdColorMap(Idx);
|
|
|
+ //console.log(old_map);
|
|
|
+ //console.log(model.acax_app.view.GetProperty(cut_project_index).color);
|
|
|
+ //difference = findDifferences(old_map, model.acax_app.view.GetProperty(cut_project_index).color);
|
|
|
+ difference = model.acax_app.view.GetProperty(cut_project_index).color;
|
|
|
+ console.log("difference", difference);
|
|
|
assignColorsToTree(Idx, model.acax_app.view.GetProperty(cut_project_index).color);
|
|
|
}
|
|
|
|
|
|
}else{
|
|
|
+ //console.log("SetModelColor");
|
|
|
SetModelColor(Idx);
|
|
|
- }
|
|
|
+ }*/
|
|
|
model.acax_app.view.RenderTree(() => {
|
|
|
g_cur_id2index_cache = {};
|
|
|
g_cur_index2id_cache = {};
|
|
@@ -1865,13 +1883,15 @@ function ModifyMaterial(material) {
|
|
|
}
|
|
|
//创建载荷
|
|
|
function CreateBoundary(Load, name) {
|
|
|
-
|
|
|
- if(model.global_ctrl[0] && model.global_ctrl[1] && model.global_ctrl[2] && model.global_ctrl[3]) {
|
|
|
+ console.log(model.global_ctrl);
|
|
|
+ if(!model.global_ctrl[0] || !model.global_ctrl[1] || !model.global_ctrl[2] || !model.global_ctrl[3]) {
|
|
|
unit.form.mainfrm.OnCueline('未满足创建条件', 'red');
|
|
|
return;
|
|
|
}
|
|
|
let tree_color = [];
|
|
|
+
|
|
|
let load = model.acax_app.control.constrain.Create(Load, name);
|
|
|
+
|
|
|
let cur_name = model.acax_app.model.constrain.Current();
|
|
|
|
|
|
let cur_index = model.acax_app.view.GetCurrentWorkConditionIndex();
|
|
@@ -1943,19 +1963,17 @@ function CreateBoundary(Load, name) {
|
|
|
}
|
|
|
//赋值给dcip的树结构
|
|
|
tree_color = getTreeColorsInOrder(tree);
|
|
|
-
|
|
|
ui.tree_Model.tree = tree;
|
|
|
}
|
|
|
);
|
|
|
//将载荷属性添加到模型信息中
|
|
|
- //console.log(cur_id);
|
|
|
ui.tree_Model.position = cur_id;
|
|
|
+ //console.log(tree_color);
|
|
|
+ ui.tree_Model.column = [1, tree_color];
|
|
|
model.acax_app.view.Render3D(info=>{
|
|
|
info.model3d.constrains.push(Load);
|
|
|
|
|
|
});
|
|
|
-
|
|
|
- ui.tree_Model.column = [1, tree_color];
|
|
|
|
|
|
}
|
|
|
//修改载荷面板属性
|