|
@@ -12,6 +12,8 @@ var workcondition = [];
|
|
|
var globalModelTree = {};
|
|
|
//模型颜色标志
|
|
|
var color_flag = 1;
|
|
|
+//存变化面的临时id
|
|
|
+var color_face = "";
|
|
|
function OnInitializeData(reload, preview) {
|
|
|
|
|
|
PUI(()=>{
|
|
@@ -949,16 +951,43 @@ function findFaceNodeIndices(tree) {
|
|
|
|
|
|
return { firstIndex, lastIndex };
|
|
|
}
|
|
|
+//点击面与3d图形形成交互
|
|
|
+function Light3DFace(cur_proj, id) {
|
|
|
+ console.log(model.acax_app.view.GetProperty(cur_proj).color.hasOwnProperty(ui.tree_Model.position));
|
|
|
+ if(model.acax_app.view.GetProperty(cur_proj).color.hasOwnProperty(ui.tree_Model.position)) {
|
|
|
+ unit.form.mainfrm.PickFaceLight(ui.tree_Model.position);
|
|
|
+ if(color_face ==="") {
|
|
|
+ color_face = id;
|
|
|
+ }else{
|
|
|
+ let clr = model.acax_app.view.GetProperty(cur_proj).color[color_face];
|
|
|
+ let rgb = hexToRgb(clr);
|
|
|
+ unit.form.mainfrm.LightFace(color_face, rgb);
|
|
|
+ color_face = id;
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ if(color_face ==="") {
|
|
|
+ return;
|
|
|
+ }else{
|
|
|
+ let clr = model.acax_app.view.GetProperty(cur_proj).color[color_face];
|
|
|
+ let rgb = hexToRgb(clr);
|
|
|
+ unit.form.mainfrm.LightFace(color_face, rgb);
|
|
|
+ color_face = "";
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
|
|
|
//点击树
|
|
|
function OnClickTree(id, column, text){
|
|
|
- //获取模型树的对应节点
|
|
|
-
|
|
|
+ //获取模型树的对应节点
|
|
|
let model_id = g_cur_id2index_cache[ui.tree_Model.position];
|
|
|
let cur_workarea = model.acax_app.view.GetCurrentWorkAreaIndex();
|
|
|
- let cur_proj = model.acax_app.view.GetCurrentProjectIndex();
|
|
|
+ let cur_proj = model.acax_app.view.GetCurrentProjectIndex();
|
|
|
let cur_workcondition = model.acax_app.view.GetCurrentWorkConditionIndex();
|
|
|
-
|
|
|
+ if(model.acax_app.view.GetProperty(cur_proj) && model.acax_app.view.GetProperty(cur_proj).color){
|
|
|
+ Light3DFace(cur_proj, ui.tree_Model.position);
|
|
|
+ }
|
|
|
/*model.acax_app.view.RenderNode(model_id, info => {
|
|
|
console.log(info);
|
|
|
});*/
|
|
@@ -1121,7 +1150,6 @@ function OnClickTree(id, column, text){
|
|
|
unit.form.mainfrm.SetColor( model.acax_app.view.GetProperty(cur_proj).color);
|
|
|
|
|
|
}
|
|
|
- //console.log(model.acax_app.path.Type(model_id));
|
|
|
switch (model.acax_app.path.Type(model_id)) {
|
|
|
//切换工作区
|
|
|
case 0:
|
|
@@ -1139,8 +1167,7 @@ function OnClickTree(id, column, text){
|
|
|
}
|
|
|
break;
|
|
|
//选中材料库
|
|
|
- case 1:
|
|
|
-
|
|
|
+ case 1:
|
|
|
break;
|
|
|
//切换工程
|
|
|
case 2:
|
|
@@ -1219,25 +1246,31 @@ function OnClickTree(id, column, text){
|
|
|
}
|
|
|
if(column === 1) {
|
|
|
var clr = ui.ColorDialog(text);
|
|
|
- if(model.acax_app.path.Type(model_id) === 5) {
|
|
|
- model.acax_app.view.RenderNode(model_id, info => {
|
|
|
- let materail = info.prop;
|
|
|
- materail.color = clr;
|
|
|
- model.acax_app.control.materialProp.Set(materail, model.acax_app.path.Name(model_id));
|
|
|
-
|
|
|
- });
|
|
|
+
|
|
|
+ if(clr === undefined) {
|
|
|
+ return;
|
|
|
}else{
|
|
|
- let cut_project_index = model.acax_app.view.GetCurrentProjectIndex();
|
|
|
- let temp = model.acax_app.view.GetProperty(cut_project_index);
|
|
|
- temp.color[id] = clr;
|
|
|
- model.acax_app.view.SetProperty(cut_project_index, temp);
|
|
|
- let rgb = hexToRgb(clr);
|
|
|
- unit.form.mainfrm.LightFace(id, rgb);
|
|
|
- }
|
|
|
+ if(model.acax_app.path.Type(model_id) === 5) {
|
|
|
+ model.acax_app.view.RenderNode(model_id, info => {
|
|
|
+ let materail = info.prop;
|
|
|
+ materail.color = clr;
|
|
|
+ model.acax_app.control.materialProp.Set(materail, model.acax_app.path.Name(model_id));
|
|
|
+
|
|
|
+ });
|
|
|
+ }else{
|
|
|
+ let cut_project_index = model.acax_app.view.GetCurrentProjectIndex();
|
|
|
+ let temp = model.acax_app.view.GetProperty(cut_project_index);
|
|
|
+ temp.color[id] = clr;
|
|
|
+ model.acax_app.view.SetProperty(cut_project_index, temp);
|
|
|
+ let rgb = hexToRgb(clr);
|
|
|
+ unit.form.mainfrm.LightFace(id, rgb);
|
|
|
+ }
|
|
|
|
|
|
- if(clr) {
|
|
|
- ui.tree_Model.column = [column, clr];
|
|
|
+ if(clr) {
|
|
|
+ ui.tree_Model.column = [column, clr];
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
unit.form.mainfrm.upDateCanvas();
|
|
|
}
|
|
@@ -1826,7 +1859,7 @@ function updateJsonNodes(jsonData) {
|
|
|
node.check_state = 3;
|
|
|
node.icon = '';
|
|
|
node.r_id = node.id;
|
|
|
- node.id = node.faceId + 100000;
|
|
|
+ node.id = parseInt(node.faceId) + 100000;
|
|
|
if(node.name === "Model") {
|
|
|
node.icon = 'model2';
|
|
|
}
|
|
@@ -1931,7 +1964,6 @@ function assignColorsToTree(tree, idColorMap) {
|
|
|
|
|
|
// 调用递归函数,传入根节点
|
|
|
dfs(tree);
|
|
|
-
|
|
|
// 返回更新后的树
|
|
|
return tree;
|
|
|
}
|
|
@@ -1967,6 +1999,7 @@ function OnTree(Idx){
|
|
|
let tree_color = [];
|
|
|
//console.log(JSON.stringify(Idx, null, 2));
|
|
|
updateJsonNodes(Idx);
|
|
|
+ //console.log(JSON.stringify(Idx, null, 2));
|
|
|
globalModelTree = Idx;
|
|
|
|
|
|
//模型树颜色
|
|
@@ -2041,6 +2074,13 @@ function OnTree(Idx){
|
|
|
},
|
|
|
tree => {
|
|
|
//从工程中获取保存的model数据
|
|
|
+
|
|
|
+ /* if(model.acax_app.model.project.GetModel().pro_model) {
|
|
|
+ let cur_model = model.acax_app.model.project.GetModel().pro_model;
|
|
|
+ findAndAppendByName(tree, pro_name, cur_model);
|
|
|
+ }*/
|
|
|
+ //console.log("11111");
|
|
|
+ //console.log("GetModel", model.acax_app.model.project.GetModel());
|
|
|
//插入模型树节点与工程节点进行拼接
|
|
|
let pro_Index= model.acax_app.view.GetCurrentProjectIndex();
|
|
|
let pro_name = model.acax_app.path.Name(pro_Index);
|
|
@@ -2068,7 +2108,6 @@ function CreateWorkCondition(name){
|
|
|
let cur_name = model.acax_app.model.workCondition.Current();
|
|
|
let cur_index = model.acax_app.view.GetCurrentProjectIndex();
|
|
|
let cur_id;
|
|
|
- //console.log(model.acax_app.path.Parent(cur_index, 2) === model.acax_app.view.GetCurrentProjectIndex());
|
|
|
model.acax_app.view.RenderTree(() => {
|
|
|
g_cur_id2index_cache = {};
|
|
|
g_cur_index2id_cache = {};
|
|
@@ -2125,7 +2164,6 @@ function CreateWorkCondition(name){
|
|
|
id : info.id,
|
|
|
check_state : cur_check_state,
|
|
|
color : color
|
|
|
-
|
|
|
};
|
|
|
|
|
|
},
|
|
@@ -2133,21 +2171,22 @@ function CreateWorkCondition(name){
|
|
|
//获取当前工程的名字
|
|
|
let pro_Index = model.acax_app.view.GetCurrentProjectIndex();
|
|
|
let pro_name = model.acax_app.path.Name(pro_Index);
|
|
|
- //模型存在在加载
|
|
|
- if(model.acax_app.model.project.GetModel().pro_model) {
|
|
|
- let cur_model = model.acax_app.model.project.GetModel().pro_model;
|
|
|
- findAndAppendByName(tree, pro_name, cur_model);
|
|
|
- }
|
|
|
-
|
|
|
+ //模型一定存在
|
|
|
+ let cur_model = model.acax_app.model.project.GetModel().pro_model;
|
|
|
+ findAndAppendByName(tree, pro_name, cur_model);
|
|
|
//赋值给dcip的树结构
|
|
|
tree_color = getTreeColorsInOrder(tree);
|
|
|
-
|
|
|
ui.tree_Model.tree = tree;
|
|
|
}
|
|
|
);
|
|
|
|
|
|
ui.tree_Model.position = cur_id;
|
|
|
ui.tree_Model.column = [1, tree_color];
|
|
|
+ const path1 = model.acax_app.model.workArea.Current();
|
|
|
+ const workarea_name1 =path1.substring(path1.lastIndexOf('/') + 1);
|
|
|
+ var cur_name1 = workarea_name1 + model.acax_app.model.project.Current() + model.acax_app.model.workCondition.Current();
|
|
|
+
|
|
|
+ workcondition.push(cur_name1);
|
|
|
}
|
|
|
//创建材料属性
|
|
|
function CreateMaterial(mat) {
|