From 18da6c543b30811ac3bdb6727bd7e7cce4016960 Mon Sep 17 00:00:00 2001 From: ChenX Date: Thu, 4 Jul 2024 18:22:53 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=9F=E8=83=BD:=E5=8A=A8=E6=80=81=E6=8F=92?= =?UTF-8?q?=E5=85=A5=E6=A8=A1=E5=9D=97=E6=88=96=E8=80=85=E7=BB=98=E5=88=B6?= =?UTF-8?q?=E5=B7=A6=E5=8F=B3=E4=BE=A7=E6=9D=BF=E6=97=B6,=E5=85=81?= =?UTF-8?q?=E8=AE=B8=E4=BD=BF=E7=94=A8UCS=E5=9D=90=E6=A0=87=E7=B3=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Add-on/DrawBoard/DrawLeftRightBoard.ts | 9 +++++++++ .../Components/Template/InsertTemplateByBasePoint.ts | 11 ++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/Add-on/DrawBoard/DrawLeftRightBoard.ts b/src/Add-on/DrawBoard/DrawLeftRightBoard.ts index ba1972e69..2702932ef 100644 --- a/src/Add-on/DrawBoard/DrawLeftRightBoard.ts +++ b/src/Add-on/DrawBoard/DrawLeftRightBoard.ts @@ -14,6 +14,7 @@ import { JigUtils } from '../../Editor/JigUtils'; import { PromptPointResult, PromptStatus } from '../../Editor/PromptResult'; import { ParsePlaceEntitys } from '../../Editor/TranstrolControl/ParsePlaceEntitys'; import { ParsePlacePos, ParsePlacePosWithTemplate, ParsePlacePosWithTemplate2 } from '../../Editor/TranstrolControl/ParsePlacePos'; +import { CoordinateSystem } from '../../Geometry/CoordinateSystem'; import { ZeroVec, equalv3 } from '../../Geometry/GeUtils'; import { PointSelectSpaceClamp } from '../../Geometry/SpaceParse/PointSelectSpaceClamp'; import { BoardModal } from '../../UI/Components/Board/BoardModal'; @@ -166,6 +167,7 @@ export class DrawLeftRight implements Command KeyWordList: [ { key: "S", msg: "插入空间" }, { key: "B", msg: "基点" }, + { key: "T", msg: "UCS坐标系" }, ...keys ], Callback: ApplyPos @@ -187,6 +189,13 @@ export class DrawLeftRight implements Command baseP.applyMatrix4(parse.PlaceEntity.OCSInv); } } + else if (ptRes.StringResult === "T")//UCS + { + let mtx = app.Editor.UCSMatrix; + let cs = new CoordinateSystem().CopyForm(mtx); + mtx.makeBasis(cs.XAxis, cs.ZAxis.clone().negate(), cs.YAxis); + parse.PlaceEntity.ApplyMatrix(parse.PlaceEntity.OCSInv.premultiply(mtx)); + } else if (ptRes.StringResult === "1" || ptRes.StringResult === "2" || ptRes.StringResult === "3") { parseType = parseInt(ptRes.StringResult) - 1; diff --git a/src/UI/Components/Template/InsertTemplateByBasePoint.ts b/src/UI/Components/Template/InsertTemplateByBasePoint.ts index f02fd5a61..c8ebef1c5 100644 --- a/src/UI/Components/Template/InsertTemplateByBasePoint.ts +++ b/src/UI/Components/Template/InsertTemplateByBasePoint.ts @@ -19,6 +19,7 @@ import { PromptStatus } from "../../../Editor/PromptResult"; import { ParsePlaceEntitys } from "../../../Editor/TranstrolControl/ParsePlaceEntitys"; import { ParsePlacePos, ParsePlacePosWithTemplate, ParsePlacePosWithTemplate2 } from "../../../Editor/TranstrolControl/ParsePlacePos"; import { userConfig } from "../../../Editor/UserConfig"; +import { CoordinateSystem } from "../../../Geometry/CoordinateSystem"; import { ZeroVec, equaln, equalv3 } from "../../../Geometry/GeUtils"; import { DownPanelStore } from "../../Store/DownPanelStore"; import { IGetRoomInfo } from "./GetRoomCabName"; @@ -164,8 +165,9 @@ export async function InsertTemplateByBasePoint(template: TemplateRecord, roomIn let ptRes = await app.Editor.GetPoint({ Msg: "点取位置", KeyWordList: [ - { key: "S", msg: "插入空间" }, + // { key: "S", msg: "插入空间" }, { key: "B", msg: "基点" }, + { key: "T", msg: "UCS坐标系" }, ...keys ], AllowNone: true, @@ -189,6 +191,13 @@ export async function InsertTemplateByBasePoint(template: TemplateRecord, roomIn baseP.applyMatrix4(parse.PlaceEntity.OCSInv); } } + else if (ptRes.StringResult === "T")//UCS + { + let mtx = app.Editor.UCSMatrix; + let cs = new CoordinateSystem().CopyForm(mtx); + mtx.makeBasis(cs.XAxis, cs.ZAxis.clone().negate(), cs.YAxis); + parse.PlaceEntity.ApplyMatrix(parse.PlaceEntity.OCSInv.premultiply(mtx)); + } else if (ptRes.StringResult === "1" || ptRes.StringResult === "2" || ptRes.StringResult === "3") { parseType = parseInt(ptRes.StringResult) - 1;