|
|
@ -1,83 +1,80 @@
|
|
|
|
import { Command } from "../Editor/CommandMachine";
|
|
|
|
|
|
|
|
import { app } from "../ApplicationServices/Application";
|
|
|
|
|
|
|
|
import { PromptStatus } from "../Editor/PromptResult";
|
|
|
|
|
|
|
|
import { ViewportEntity } from "../DatabaseServices/ViewportEntity";
|
|
|
|
|
|
|
|
import { Log } from "../Common/Log";
|
|
|
|
|
|
|
|
import { Vector3 } from "three";
|
|
|
|
|
|
|
|
import { DownPanelStore } from "../UI/Store/DownPanelStore";
|
|
|
|
|
|
|
|
import { Entity } from "../DatabaseServices/Entity/Entity";
|
|
|
|
|
|
|
|
import { ObjectId } from "../DatabaseServices/ObjectId";
|
|
|
|
|
|
|
|
import { AppToaster } from "../UI/Components/Toaster";
|
|
|
|
|
|
|
|
import { Intent } from "@blueprintjs/core";
|
|
|
|
import { Intent } from "@blueprintjs/core";
|
|
|
|
|
|
|
|
import { Vector3 } from "three";
|
|
|
|
|
|
|
|
import { app } from "../ApplicationServices/Application";
|
|
|
|
import { Sleep } from "../Common/Sleep";
|
|
|
|
import { Sleep } from "../Common/Sleep";
|
|
|
|
|
|
|
|
import { Hole } from "../DatabaseServices/3DSolid/Hole";
|
|
|
|
import { Board } from "../DatabaseServices/Entity/Board";
|
|
|
|
import { Board } from "../DatabaseServices/Entity/Board";
|
|
|
|
import { BoardOpenDir } from "../UI/Store/BoardInterface";
|
|
|
|
import { Entity } from "../DatabaseServices/Entity/Entity";
|
|
|
|
import { HardwareCompositeEntity } from "../DatabaseServices/Hardware/HardwareCompositeEntity";
|
|
|
|
import { HardwareCompositeEntity } from "../DatabaseServices/Hardware/HardwareCompositeEntity";
|
|
|
|
import { Hole } from "../DatabaseServices/3DSolid/Hole";
|
|
|
|
import { ObjectId } from "../DatabaseServices/ObjectId";
|
|
|
|
|
|
|
|
import { ViewportEntity } from "../DatabaseServices/ViewportEntity";
|
|
|
|
|
|
|
|
import { Command } from "../Editor/CommandMachine";
|
|
|
|
|
|
|
|
import { PromptStatus } from "../Editor/PromptResult";
|
|
|
|
import { RenderType } from "../GraphicsSystem/RenderType";
|
|
|
|
import { RenderType } from "../GraphicsSystem/RenderType";
|
|
|
|
|
|
|
|
import { AppToaster } from "../UI/Components/Toaster";
|
|
|
|
|
|
|
|
import { BoardOpenDir } from "../UI/Store/BoardInterface";
|
|
|
|
|
|
|
|
import { DownPanelStore } from "../UI/Store/DownPanelStore";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
async function GetViewportInfo()
|
|
|
|
async function GetViewportInfo(): Promise<{ p1: Vector3; p2: Vector3; ens: Entity[]; }>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
let isAll = false;
|
|
|
|
|
|
|
|
let ens: Entity[] = [];
|
|
|
|
|
|
|
|
const downStore = (DownPanelStore.GetInstance() as DownPanelStore);
|
|
|
|
const downStore = (DownPanelStore.GetInstance() as DownPanelStore);
|
|
|
|
|
|
|
|
let bak = downStore.isLayout;
|
|
|
|
downStore.isLayout = false;
|
|
|
|
downStore.isLayout = false;
|
|
|
|
|
|
|
|
|
|
|
|
const SelectEns = async () =>
|
|
|
|
const SelectEns = async () =>
|
|
|
|
{
|
|
|
|
{
|
|
|
|
let enRes = await app.Editor.GetSelection({
|
|
|
|
let enRes = await app.Editor.GetSelection({
|
|
|
|
Msg: "选择指定布局的柜体",
|
|
|
|
Msg: "选择指定布局的柜体<空格选择全部>:",
|
|
|
|
|
|
|
|
UseSelect: true,
|
|
|
|
|
|
|
|
AllowNone: true,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
if (enRes.Status === PromptStatus.Cancel)
|
|
|
|
if (enRes.Status === PromptStatus.Cancel)
|
|
|
|
{
|
|
|
|
|
|
|
|
downStore.isLayout = true;
|
|
|
|
|
|
|
|
isAll = true;
|
|
|
|
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
{
|
|
|
|
ens = enRes.SelectSet.SelectEntityList;
|
|
|
|
|
|
|
|
downStore.isLayout = true;
|
|
|
|
downStore.isLayout = true;
|
|
|
|
|
|
|
|
return enRes.SelectSet.SelectEntityList;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
await SelectEns();
|
|
|
|
let ens = await SelectEns();//当ens.length===0时,表示选择全部
|
|
|
|
|
|
|
|
if (!ens)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
downStore.isLayout = bak;
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
downStore.isLayout = true;
|
|
|
|
while (true)
|
|
|
|
while (true)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
let rectRes = await app.Editor.GetRectPoint({
|
|
|
|
let rectRes = await app.Editor.GetRectPoint({
|
|
|
|
KeyWordList: [{ key: "T", msg: isAll ? "指定柜体<当前为全部>" : "全部柜体<当前为指定柜体>" }]
|
|
|
|
KeyWordList: [{ key: "T", msg: ens.length === 0 ? "指定柜体<当前为全部>" : "全部柜体<当前为指定柜体>" }]
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
if (rectRes.Status === PromptStatus.OK)
|
|
|
|
if (rectRes.Status === PromptStatus.OK)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
let p1 = rectRes.Point1UCS;
|
|
|
|
let p1 = rectRes.Point1UCS;
|
|
|
|
let p2 = rectRes.Point2UCS;
|
|
|
|
let p2 = rectRes.Point2UCS;
|
|
|
|
|
|
|
|
let retEntitys = ens.length === 0 ? app.Database.ModelSpace.Entitys.filter(e => !e.IsErase) : ens;
|
|
|
|
return {
|
|
|
|
return {
|
|
|
|
p1, p2, ens
|
|
|
|
p1, p2, ens: retEntitys
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (rectRes.Status === PromptStatus.Keyword)
|
|
|
|
else if (rectRes.Status === PromptStatus.Keyword)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (rectRes.StringResult === "T")
|
|
|
|
if (rectRes.StringResult === "T")
|
|
|
|
{
|
|
|
|
{
|
|
|
|
isAll = !isAll;
|
|
|
|
if (ens.length === 0)
|
|
|
|
if (!isAll)
|
|
|
|
ens = await SelectEns();
|
|
|
|
{
|
|
|
|
|
|
|
|
downStore.isLayout = false;
|
|
|
|
|
|
|
|
await SelectEns();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
|
|
|
|
ens = [];
|
|
|
|
ens = [];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
else break;
|
|
|
|
else break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
|
|
|
|
|
|
|
|
downStore.isLayout = bak;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -85,12 +82,6 @@ export class DrawViewport implements Command
|
|
|
|
{
|
|
|
|
{
|
|
|
|
async exec()
|
|
|
|
async exec()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (!app.Viewer.isLayout)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Log("仅能在布局模式下使用");
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const data = await GetViewportInfo();
|
|
|
|
const data = await GetViewportInfo();
|
|
|
|
|
|
|
|
|
|
|
|
if (data)
|
|
|
|
if (data)
|
|
|
@ -106,7 +97,6 @@ export class DrawViewport implements Command
|
|
|
|
ids.push(en.Id);
|
|
|
|
ids.push(en.Id);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
vp.AppendShowObjects(ids);
|
|
|
|
vp.AppendShowObjects(ids);
|
|
|
|
|
|
|
|
|
|
|
|
app.Database.LayoutSpace.Append(vp);
|
|
|
|
app.Database.LayoutSpace.Append(vp);
|
|
|
|
vp.ZoomAll();
|
|
|
|
vp.ZoomAll();
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -116,12 +106,6 @@ export class Draw4Viewport implements Command
|
|
|
|
{
|
|
|
|
{
|
|
|
|
async exec()
|
|
|
|
async exec()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (!app.Viewer.isLayout)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Log("仅能在布局模式下使用");
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const data = await GetViewportInfo();
|
|
|
|
const data = await GetViewportInfo();
|
|
|
|
|
|
|
|
|
|
|
|
if (data)
|
|
|
|
if (data)
|
|
|
|