mirror of https://gitee.com/cf-fz/WebCAD.git
!2730 新增:右键增加选中空间及子空间所有图元的功能
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]);
|
||||
}
|
||||
}
|
Loading…
Reference in new issue