fix #IZPZC 限制DLI在UCS上标注

pull/457/MERGE
ChenX 5 years ago
parent 52fca8c52f
commit 2e8e52fa9e

@ -10,7 +10,6 @@ import { Command } from '../../Editor/CommandMachine';
import { JigUtils } from '../../Editor/JigUtils';
import { PromptStatus } from '../../Editor/PromptResult';
import { ContinueDrawDimension } from './Command_DimContinue';
import { equaln } from '../../Geometry/GeUtils';
export enum DimensionType
{
@ -31,7 +30,7 @@ export class DrawAlignedDimension implements Command
await this.PickUpDim();
}
private async SelectPointDim(footPt1: Vector3)
protected async SelectPointDim(footPt1: Vector3)
{
let ptRes = await app.Editor.GetPoint({
Msg: "请输入第二条尺寸线原点:",
@ -39,7 +38,7 @@ export class DrawAlignedDimension implements Command
AllowDrawRubberBand: true,
});
let footPt2 = ptRes.Point;
if (ptRes.Status != PromptStatus.OK)
if (ptRes.Status !== PromptStatus.OK)
return;
await this.BuildDim(footPt1, footPt2);
@ -77,7 +76,7 @@ export class DrawAlignedDimension implements Command
footPt2 = en.EndPoint;
await this.BuildDim(footPt1, footPt2);
}
private async BuildDim(footPt1: Vector3, footPt2: Vector3)
protected async BuildDim(footPt1: Vector3, footPt2: Vector3)
{
let alDim: AlignedDimension | LinearDimension;
if (this.DimType === DimensionType.Align)

@ -1,3 +1,6 @@
import { Matrix4, Vector3 } from 'three';
import { app } from '../../ApplicationServices/Application';
import { PromptStatus } from '../../Editor/PromptResult';
import { DimensionType, DrawAlignedDimension } from './DrawAlignedDimension';
export class DrawLinearDimension extends DrawAlignedDimension
@ -7,4 +10,21 @@ export class DrawLinearDimension extends DrawAlignedDimension
super();
this.DimType = DimensionType.Linear;
}
protected async SelectPointDim(footPt1: Vector3)
{
let ptRes = await app.Editor.GetPoint({
Msg: "请输入第二条尺寸线原点:",
BasePoint: footPt1,
AllowDrawRubberBand: true,
});
if (ptRes.Status !== PromptStatus.OK)
return;
let footPt2 = ptRes.Point;
let ucs = app.Editor.UCSMatrix.clone().setPosition(footPt1);
let ucsInv = new Matrix4().getInverse(ucs);
footPt2.applyMatrix4(ucsInv).setZ(0).applyMatrix4(ucs);
await this.BuildDim(footPt1, footPt2);
}
}

Loading…
Cancel
Save