mirror of https://gitee.com/cf-fz/WebCAD.git
parent
70a91c813d
commit
dc3af49127
@ -0,0 +1,54 @@
|
||||
import { app } from "../ApplicationServices/Application";
|
||||
import { EntitysUpdateWrap } from "../Common/EntityUpdateWrap";
|
||||
import { Entity } from "../DatabaseServices/Entity/Entity";
|
||||
import { Command } from "../Editor/CommandMachine";
|
||||
import { PromptStatus } from "../Editor/PromptResult";
|
||||
|
||||
interface MatchProp
|
||||
{
|
||||
color: number;
|
||||
}
|
||||
|
||||
export class Command_MatchProp implements Command
|
||||
{
|
||||
async exec()
|
||||
{
|
||||
let enRes = await app.Editor.GetEntity({
|
||||
Msg: "请选择源实体",
|
||||
NotNone: true,
|
||||
Filter: { filterTypes: [Entity] }
|
||||
});
|
||||
|
||||
if (enRes.Status !== PromptStatus.OK) return;
|
||||
|
||||
while (true)
|
||||
{
|
||||
let ssRes = await app.Editor.GetSelection({
|
||||
Once: true,
|
||||
AllowNone: true,
|
||||
Msg: "选择需要修改的实体",
|
||||
Filter: { filterTypes: [Entity] },
|
||||
});
|
||||
|
||||
if (ssRes.Status === PromptStatus.Other || ssRes.Status === PromptStatus.Cancel)
|
||||
return;
|
||||
|
||||
if (ssRes.Status !== PromptStatus.OK) continue;
|
||||
|
||||
let matchProp: MatchProp = {
|
||||
color: 7
|
||||
};
|
||||
matchProp.color = enRes.Entity.ColorIndex;
|
||||
|
||||
let ents = ssRes.SelectSet.SelectEntityList as Entity[];
|
||||
|
||||
EntitysUpdateWrap(ents, () =>
|
||||
{
|
||||
for (let ent of ents)
|
||||
{
|
||||
ent.ColorIndex = matchProp.color;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in new issue