实现选择拉伸

pull/567/MERGE
ChenX 5 years ago
parent 538f62b638
commit a64504124a

@ -1,4 +1,4 @@
import { Matrix4, Vector3 } from 'three';
import { Matrix4, Object3D, Vector3 } from 'three';
import { app } from '../ApplicationServices/Application';
import { StretchData, StretchParse } from '../Common/StretchParse';
import { Command } from '../Editor/CommandMachine';
@ -8,9 +8,36 @@ import { PromptStatus } from '../Editor/PromptResult';
export class Stretch implements Command
{
constructor(private useSelectFilter = false)
{
}
async exec()
{
let ssRes = await app.Editor.GetSelection({ UseSelect: true, Msg: "请选择拉伸对象:" });
let filterEntitySet: Set<Object3D>;
if (this.useSelectFilter)
{
let filterRes = await app.Editor.GetSelection({ UseSelect: true, Msg: "请选择要被拉伸的对象:", AllowNone: true });
if (filterRes.Status === PromptStatus.Cancel)
return;
if (filterRes.Status === PromptStatus.OK)
{
filterEntitySet = new Set();
for (let e of filterRes.SelectSet.SelectObjectList)
filterEntitySet.add(e);
}
}
let ssRes = await app.Editor.GetSelection({
UseSelect: true, Msg: "请选择拉伸对象:", Filter: {
filterFunction: (obj, ent) =>
{
if (filterEntitySet)
return filterEntitySet.has(obj);
return true;
}
}
});
if (ssRes.Status !== PromptStatus.OK) return;
let p1 = await app.Editor.GetPoint({ Msg: "指定基点:", NotSnapZ: true });//, KeyWordList: [{ msg: "位移", key: "D" }]

@ -1,22 +0,0 @@
import { app } from '../ApplicationServices/Application';
import { Command } from '../Editor/CommandMachine';
import { PromptStatus } from '../Editor/PromptResult';
export class Command_Ssget implements Command
{
constructor()
{
}
async exec()
{
let ss = await app.Editor.GetSelection();
if (ss.Status === PromptStatus.OK)
{
for (let en of ss.SelectSet.SelectEntityList)
{
en.ColorIndex = 1;
}
}
}
}

@ -106,7 +106,6 @@ import { Command_Rotate } from "../Add-on/Rotate";
import { RotateLayerBoard } from "../Add-on/RotateLayerBoard";
import { New, Save, SaveAs, SaveAsBinary } from "../Add-on/Save";
import { Command_Scale } from "../Add-on/Scale";
import { Command_Ssget } from "../Add-on/ssget";
import { Stretch } from "../Add-on/Stretch";
import { Sweep } from "../Add-on/Sweep";
import { Command_SwitchCamera } from "../Add-on/SwitchCamera";
@ -184,7 +183,8 @@ export function registerCommand()
commandMachine.RegisterCommand("testPointParse", new Command_TestPointPickParse());
commandMachine.RegisterCommand("s", new Stretch());
commandMachine.RegisterCommand("Stretch", new Stretch());
commandMachine.RegisterCommand("SelectStretch", new Stretch(true));
commandMachine.RegisterCommand("fs", new ViewChange(new Vector3(0, 0, -1)));
commandMachine.RegisterCommand("qs", new ViewChange(new Vector3(0, 1)));
@ -232,8 +232,6 @@ export function registerCommand()
commandMachine.RegisterCommand("tr", new Command_Trim());
commandMachine.RegisterCommand("ss", new Command_Ssget());
commandMachine.RegisterCommand("f", new CommandFillet());
commandMachine.RegisterCommand("testFilletCode", new TestFillet());

@ -980,11 +980,22 @@ export const CommandList: ICommand[] = observable([
typeId: "util",
link: "#",
defaultCustom: "S",
command: "S",
command: "STRETCH",
type: "工具",
chName: "拉伸",
// enName: "Stretch",
chDes: "拉伸与选择窗口或多边形交叉的对象",
chDes: "拉伸与选择窗口或多边形交叉的对象.",
},
{
icon: IconEnum.Stretch,
typeId: "util",
link: "#",
defaultCustom: "SS",
command: "SELECTSTRETCH",
type: "工具",
chName: "选择拉伸",
// enName: "Stretch",
chDes: "先选择要拉伸的对象,在选择拉伸范围拉伸.",
},
{
icon: IconEnum.GridStretch,

Loading…
Cancel
Save