!2730 新增:右键增加选中空间及子空间所有图元的功能

pull/2698/MERGE
黄诗津 4 months ago committed by ChenX
parent 2143b16b93
commit e7d423520f

@ -0,0 +1,71 @@
import { app } from "../ApplicationServices/Application";
import { Entity } from "../DatabaseServices/Entity/Entity";
import { TemplateRecord } from "../DatabaseServices/Template/TemplateRecord";
import { Command } from "../Editor/CommandMachine";
import { PromptStatus } from "../Editor/PromptResult";
//亮显本节点
export class Command_HighlightNode implements Command
{
async exec()
{
let ss = await app.Editor.GetSelection({ Msg: "选择需要亮显节点的实体:", UseSelect: true });
if (ss.Status !== PromptStatus.OK) return;
let ents = ss.SelectSet.SelectEntityList;
const entSet: Set<Entity> = new Set();
app.Editor.SelectCtrl.Cancel();
for (const en of ents)
{
if (entSet.has(en)) continue;
let temp = en.Template.Object as TemplateRecord;
for (let t of temp.Objects)
{
if (t && !t.IsErase)
{
let en = t.Object as Entity;
if (en.Visible)
entSet.add(en);
}
}
}
app.Editor.SetSelection([...entSet]);
}
}
//亮显本节点及子节点
export class Command_HighlightNodeAndChilds implements Command
{
async exec()
{
let ss = await app.Editor.GetSelection({ Msg: "选择需要亮显节点和子层的实体:", UseSelect: true });
if (ss.Status !== PromptStatus.OK) return;
let ents = ss.SelectSet.SelectEntityList;
const entSet: Set<Entity> = new Set();
app.Editor.SelectCtrl.Cancel();
for (const en of ents)
{
if (entSet.has(en)) continue;
let temp = en.Template.Object as TemplateRecord;
let treeNodes: TemplateRecord[] = [];
temp.Traverse((node) => { treeNodes.push(node); });
for (let tn of treeNodes)
{
for (let t of tn.Objects)
{
if (t && !t.IsErase)
{
let en = t.Object as Entity;
entSet.add(en);
}
}
}
}
app.Editor.SetSelection([...entSet]);
}
}

@ -398,4 +398,6 @@ export enum CommandNames
AlignLineGroup = "ALIGNLINEGROUP",//呼出对纹组
AddAlignLineGroup = "ADDALIGNLINEGROUP",//添加对纹组
DeleteAlignLineGroup = "DELETEALIGNLINEGROUP",//删除对纹组
HighlightNode = "HIGHLIGHTNODE",//高亮本节点
HighlightNodeAndChilds = "HIGHLIGHTNODEANDCHILDS",//亮显本节点及子节点
}

@ -229,6 +229,7 @@ import { AddAloneDrillLock } from "../Add-on/DrawDrilling/DrillLock/AloneDrillLo
import { RemoveAssocDrillLock } from "../Add-on/DrawDrilling/DrillLock/RemoveAssocDrillLock";
import { RemoveDrillLock } from "../Add-on/DrawDrilling/DrillLock/RemoveDrillLock";
import { Command_FBXImport } from "../Add-on/FBXLoad";
import { Command_HighlightNode, Command_HighlightNodeAndChilds } from "../Add-on/HighlightNode";
import { Command_Show2DPathLine } from "../Add-on/Show2DPathLine/Show2DPathLine";
import { Command_Show2DPathObject } from "../Add-on/Show2DPathLine/Show2DPathObject";
import { TestFb } from "../Add-on/TestFb";
@ -438,6 +439,9 @@ export function registerCommand()
//暂时关闭这个fbx导入
// commandMachine.RegisterCommand("fbx", new Fbx());
commandMachine.RegisterCommand(CommandNames.HighlightNode, new Command_HighlightNode());
commandMachine.RegisterCommand(CommandNames.HighlightNodeAndChilds, new Command_HighlightNodeAndChilds());
commandMachine.RegisterCommand(CommandNames.HideSelect, new Command_HideSelected());
commandMachine.RegisterCommand(CommandNames.HideUnSelect, new Command_HideUnselected());
commandMachine.RegisterCommand(CommandNames.Show, new Command_ShowAll());

@ -60,6 +60,9 @@ const KeyWordCommandMap: Map<string, string> = new Map(Object.entries({
"X": "SPLITTEMPLATEX",
"Y": "SPLITTEMPLATEY",
"Z": "SPLITTEMPLATEZ",
"N": CommandNames.HighlightNode,
"N2": CommandNames.HighlightNodeAndChilds,
}));
/**
@ -178,6 +181,7 @@ export class ContextMenuServices implements EditorService
if (selects[0].Template && selects[0].Template.Object)
{
let temp = selects[0].Template.Object;
menuKeywords.push({ key: "N", msg: "亮显本节点" }, { key: "N2", msg: "亮显空间子层" });
if (temp instanceof TemplateWineRackRecord)
menuKeywords.push({ key: "WR", msg: "编辑酒格模块" });
else if (temp instanceof TemplateBoardRecord || temp instanceof TemplateLeftRightBoardRecord || temp instanceof TemplateTopBottomBoard)

@ -3306,6 +3306,24 @@ export const CommandList: ICommand[] = [
chName: "显示所有",
chDes: "显示所有",
},
{
typeId: "hidedisplay",
link: `#`,
defaultCustom: CommandNames.HighlightNode,
command: CommandNames.HighlightNode,
type: "隐藏显示",
chName: "高亮本节点",
chDes: "亮显选中实体当前节点的实体",
},
{
typeId: "hidedisplay",
link: `#`,
defaultCustom: CommandNames.HighlightNodeAndChilds,
command: CommandNames.HighlightNodeAndChilds,
type: "隐藏显示",
chName: "高亮本节点及子节点",
chDes: "亮显选中实体当前节点的实体和子节点",
},
// 内置命令
{

Loading…
Cancel
Save