!194 标注实体捕捉,点选标注,多段线角度标注,连续标注

Merge pull request !194 from ZoeLeeFZ/dim_snap3
pull/194/MERGE
ChenX 6 years ago
parent cb471879bd
commit 4176b4021f

@ -0,0 +1,42 @@
import { app } from "../../ApplicationServices/Application";
import { LineAngularDimension } from "../../DatabaseServices/Dimension/2LineAngularDimension";
import { AlignedDimension } from "../../DatabaseServices/Dimension/AlignedDimension";
import { LinearDimension } from "../../DatabaseServices/Dimension/LinearDimension";
import { Command } from "../../Editor/CommandMachine";
import { PromptStatus } from "../../Editor/PromptResult";
import { DimContinueLineAngular } from "./DimContinueLineAngular";
import { DimContinueAligen } from "./DimContinueAligen";
export type Dimension = AlignedDimension | LineAngularDimension;
let aligenContinue = new DimContinueAligen();
let angularContinue = new DimContinueLineAngular();
export async function ContinueDrawDimension(lastDim: Dimension)
{
if (lastDim instanceof AlignedDimension)
{
await aligenContinue.StartDraw(lastDim);
}
else if (lastDim instanceof LineAngularDimension)
{
await angularContinue.StartDraw(lastDim);
}
}
export class Command_DimContinue implements Command
{
async exec()
{
let dimRes = await app.m_Editor.GetEntity({
Msg: "选择连续标注",
Filter: { filterTypes: [AlignedDimension, LineAngularDimension, LinearDimension] }
});
if (dimRes.Status !== PromptStatus.OK)
return;
let lastDim = dimRes.Entity as Dimension;
await ContinueDrawDimension(lastDim);
}
}

@ -0,0 +1,69 @@
import { Vector3 } from "three";
import { app } from "../../ApplicationServices/Application";
import { JigUtils } from "../../Editor/JigUtils";
import { PromptStatus } from "../../Editor/PromptResult";
import { Dimension } from "./Command_DimContinue";
export class DimContinue
{
protected m_LastDim: Dimension;
protected m_BasePoint: Vector3;
//开始绘制.
async StartDraw(lastDim: Dimension)
{
this.m_LastDim = lastDim.Clone();
let oldUcs = app.m_Editor.UCSMatrix;
app.m_Editor.UCSMatrix = this.m_LastDim.OCS;
while (true)
{
let newDim = this.CloneDimension(this.m_LastDim);
JigUtils.Draw(newDim);
let ptRes = await app.m_Editor.GetPoint({
BasePoint: this.m_BasePoint,
Msg: "指定第二个尺寸原点",
Callback: p => this.UpdateNextPoint(p, newDim)
});
if (ptRes.Status === PromptStatus.OK)
{
let p = ptRes.Value;
this.UpdateNextPoint(p, newDim);
app.m_Database.ModelSpace.Append(newDim);
this.Drawed(newDim, p);
}
else
break;
}
this.EndDraw();
app.m_Editor.UCSMatrix = oldUcs;
}
/**
* : ,,
* @param dim
* @returns and jig draw
*/
protected CloneDimension(dim: Dimension): Dimension
{
return undefined;
}
/**
* :,
* @param p
* @param dim
*/
protected UpdateNextPoint(p: Vector3, dim: Dimension)
{
}
/**
* ,
* @param dim
*/
protected Drawed(dim: Dimension, p: Vector3)
{
}
/**
* :,
*/
protected EndDraw()
{
this.m_LastDim.GoodBye();
}
}

@ -0,0 +1,77 @@
import { Vector3 } from "three";
import { AlignedDimension } from "../../DatabaseServices/Dimension/AlignedDimension";
import { Line } from "../../DatabaseServices/Line";
import { DimContinue } from "./DimContinue";
//对齐标注的连续标注
export class DimContinueAligen extends DimContinue
{
private m_line: Line;
/**
* : ,,
* @param dim
* @returns and jig draw
*/
protected CloneDimension(dim: AlignedDimension): AlignedDimension
{
let ndim = dim.Clone();
ndim.FootP1 = dim.FootP2;
ndim.ArmP1 = dim.ArmP2;
this.m_BasePoint = dim.FootP2;
if (!this.m_line)
this.m_line = new Line(dim.ArmP1, dim.ArmP2);
return ndim;
}
/**
* :,
* @param p
* @param dim
*/
protected UpdateNextPoint(p: Vector3, dim: AlignedDimension)
{
let last = this.m_LastDim as AlignedDimension;
let { closestPt, param } = this.m_line.GetClosestAtPoint(p, true);
if (param > 1)
{
dim.FootP1 = last.FootP2;
dim.FootP2 = p;
dim.ArmP1 = last.ArmP2;
dim.ArmP2 = closestPt;
}
else
{
dim.FootP1 = p;
dim.FootP2 = last.FootP1;
dim.ArmP1 = closestPt;
dim.ArmP2 = last.ArmP1;
}
}
/**
* ,
* @param dim
*/
protected Drawed(dim: AlignedDimension, p: Vector3)
{
let last = this.m_LastDim as AlignedDimension;
let { param } = this.m_line.GetClosestAtPoint(p, true);
if (param > 1)
{
last.FootP2 = p;
last.ArmP2 = dim.ArmP2;
}
else if (param < 0)
{
last.FootP1 = p;
last.ArmP1 = dim.ArmP1;
}
this.m_line.Join(new Line(dim.ArmP1, dim.ArmP2));
}
/**
* :,
*/
protected EndDraw()
{
super.EndDraw();
this.m_line.GoodBye();
this.m_line = undefined;
}
}

@ -0,0 +1,96 @@
import { Vector3 } from "three";
import { Arc } from "../../DatabaseServices/Arc";
import { LineAngularDimension } from "../../DatabaseServices/Dimension/2LineAngularDimension";
import { Line } from "../../DatabaseServices/Line";
import { equalv3 } from "../../Geometry/GeUtils";
import { DimContinue } from "./DimContinue";
//2直线角度标注的连续标注
export class DimContinueLineAngular extends DimContinue
{
private _l1Sp: Vector3;
private _l1Ep: Vector3;
private _l2Ep: Vector3;
private _arc: Arc;
private _narc: Arc;
/**
* : ,,
* @param dim
* @returns and jig draw
*/
protected CloneDimension(dim: LineAngularDimension): LineAngularDimension
{
let ndim = dim.Clone();
[this._l1Sp, this._l1Ep, this._l2Ep] =
[dim.L1StartPoint, dim.L1EndPoint, dim.L2EndPoint];
this._arc = dim.Arc;
this._narc = dim.Arc;
return ndim;
}
/**
* ,
* @param dim
*/
protected Drawed(dim: LineAngularDimension, p: Vector3)
{
this.m_LastDim.GoodBye();
this.m_LastDim = dim.Clone();
}
/**
* :,
* @param p
* @param dim
*/
protected UpdateNextPoint(p: Vector3, dim: LineAngularDimension)
{
let cp = this._arc.GetClosestPointTo(p, true);
let newL1Ep: Vector3;
let param = this._arc.GetParamAtPoint(cp);
let arcSpOnL1 = !isNaN(new Line(this._l1Sp, this._l1Ep).GetParamAtPoint(this._arc.StartPoint));
if (param > 0.5)
{
newL1Ep = arcSpOnL1 ? this._l2Ep : this._l1Ep;
if (equalv3(newL1Ep, this._arc.Center))
newL1Ep = this._arc.EndPoint;
if (param > 1)
{
this._narc.StartAngle = this._arc.GetAngleAtParam(1);
this._narc.EndAngle = this._arc.GetAngleAtParam(param);
}
else if (param === 1)
return;
else
{
this._narc.StartAngle = this._arc.GetAngleAtParam(param);
this._narc.EndAngle = this._arc.GetAngleAtParam(1);
}
}
else
{
newL1Ep = arcSpOnL1 ? this._l1Ep : this._l2Ep;
if (equalv3(newL1Ep, this._arc.Center))
newL1Ep = this._arc.StartPoint;
if (param < 0)
{
this._narc.StartAngle = this._arc.GetAngleAtParam(param);
this._narc.EndAngle = this._arc.GetAngleAtParam(0);
}
else
{
this._narc.StartAngle = this._arc.GetAngleAtParam(0);
this._narc.EndAngle = this._arc.GetAngleAtParam(param);
}
}
if (equalv3(p, this._arc.Center))
return;
dim.UpdateDimData(this._arc.Center, newL1Ep, this._arc.Center, p, this._narc.GetPointAtParam(0.5));
}
/**
* :,
*/
protected EndDraw()
{
super.EndDraw();
this._arc.GoodBye();
this._narc.GoodBye();
}
}

@ -1,37 +1,124 @@
import { Matrix4, Vector3 } from "three";
import { app } from "../../ApplicationServices/Application";
import { Arc } from "../../DatabaseServices/Arc";
import { Circle } from "../../DatabaseServices/Circle";
import { Curve } from "../../DatabaseServices/Curve";
import { LineAngularDimension } from "../../DatabaseServices/Dimension/2LineAngularDimension";
import { Line } from "../../DatabaseServices/Line";
import { Polyline } from "../../DatabaseServices/Polyline";
import { JigUtils } from "../../Editor/JigUtils";
import { PromptStatus } from "../../Editor/PromptResult";
import { isParallelTo } from "../../Geometry/GeUtils";
import { ContinueDrawDimension } from "./Command_DimContinue";
export class Command_Draw2LineAngularDim
{
async exec()
{
let l1Res = await app.m_Editor.GetEntity({
let l1: Line;
let l2: Line;
let dimPt: Vector3;
let msg = "选择圆弧,圆,或者直线<选择顶点>";
while (true)
{
if (l1)
msg = "请选择第二条直线";
let lineRes = await app.m_Editor.GetEntity({
Msg: msg,
Filter: {
filterTypes: [Line]
filterTypes: [Curve],
}
});
if (l1Res.Status !== PromptStatus.OK) return;
let l2Res = await app.m_Editor.GetEntity({
Filter: {
filterTypes: [Line],
filterFunction: (obj, ent) =>
if (lineRes.Status === PromptStatus.Other)
{
return ent !== l1Res.Entity;
let res = await this.BuildDimByPoint();
if (res)
[l1, l2, dimPt] = res;
break;
}
else if (lineRes.Status === PromptStatus.Cancel)
return;
let en = lineRes.Entity;
if (l1 && en === l1)
return;
if (en instanceof Polyline)
{
let par = en.GetParamAtPoint(en.GetClosestPointTo(lineRes.Point, false));
en = en.GetCurveAtParam(par);
}
});
if (l2Res.Status !== PromptStatus.OK) return;
if (en instanceof Arc)
{
l1 = new Line(en.Center, en.StartPoint);
l2 = new Line(en.Center, en.EndPoint);
dimPt = lineRes.Point;
break;
}
else if (en instanceof Line)
{
if (!l1)
l1 = en;
else
{
l2 = en;
dimPt = lineRes.Point;
break;
}
}
else if (en instanceof Circle)
{
let res = await this.BuildDimByPoint(en.Center, lineRes.Point);
if (res)
{
[l1, l2, dimPt] = res;
}
break;
}
else
return;
}
if (l1 && l2 && dimPt)
await this.BuildDim(l1, l2, dimPt);
}
private async BuildDimByPoint(cenPt?: Vector3, p1?: Vector3): Promise<[Line, Line, Vector3]>
{
if (!cenPt)
{
let cenPtRes = await app.m_Editor.GetPoint({
Msg: "指定角的顶点"
})
if (cenPtRes.Status === PromptStatus.Cancel)
return;
cenPt = cenPtRes.Value;
}
if (!p1)
{
let ptRes = await app.m_Editor.GetPoint({
Msg: "指定角的第一个端点",
BasePoint: cenPt,
AllowDrawRubberBand: true
})
if (ptRes.Status === PromptStatus.Cancel)
return;
p1 = ptRes.Value;
}
let l1 = l1Res.Entity as Line;
let l2 = l2Res.Entity as Line;
let ptRes = await app.m_Editor.GetPoint({
Msg: "指定角的第二个端点",
BasePoint: cenPt,
AllowDrawRubberBand: true
})
if (ptRes.Status === PromptStatus.Cancel)
return;
let p2 = ptRes.Value;
let l1 = new Line(cenPt, p1);
let l2 = new Line(cenPt, p2);
return [l1, l2, p2];
}
private async BuildDim(l1: Line, l2: Line, dimPt: Vector3)
{
//ocs
let derv1 = l1.GetFistDeriv(0).normalize();
let derv2 = l2.GetFistDeriv(0).normalize();
@ -60,7 +147,6 @@ export class Command_Draw2LineAngularDim
app.m_Editor.Prompt("绘制的标注实体和当前的UCS坐标系不一致,绘制失败.");
return;
}
let dim = new LineAngularDimension();
dim.ApplyMatrix(ocs);
@ -69,7 +155,7 @@ export class Command_Draw2LineAngularDim
l1.EndPoint,
l2.StartPoint,
l2.EndPoint,
l2Res.Point
dimPt
);
JigUtils.Draw(dim);
@ -82,6 +168,9 @@ export class Command_Draw2LineAngularDim
});
if (ptRes.Status === PromptStatus.OK)
{
app.m_Database.ModelSpace.Append(dim);
await ContinueDrawDimension(dim);
}
}
}

@ -1,9 +1,15 @@
import { Vector3 } from 'three';
import { app } from '../../ApplicationServices/Application';
import { Circle } from '../../DatabaseServices/Circle';
import { Curve } from '../../DatabaseServices/Curve';
import { AlignedDimension } from '../../DatabaseServices/Dimension/AlignedDimension';
import { LinearDimension } from '../../DatabaseServices/Dimension/LinearDimension';
import { Line } from '../../DatabaseServices/Line';
import { Polyline } from '../../DatabaseServices/Polyline';
import { Command } from '../../Editor/CommandMachine';
import { PromptStatus } from '../../Editor/PromptResult';
import { JigUtils } from '../../Editor/JigUtils';
import { PromptStatus } from '../../Editor/PromptResult';
import { ContinueDrawDimension } from './Command_DimContinue';
export enum DimensionType
{
@ -16,12 +22,17 @@ export class DrawAlignedDimension implements Command
protected DimType = DimensionType.Align;
async exec()
{
let ptRes = await app.m_Editor.GetPoint({ Msg: "请指定第一条尺寸线原点:" });
if (ptRes.Status != PromptStatus.OK)
return;
let footPt1 = ptRes.Value;
let ptRes = await app.m_Editor.GetPoint({ Msg: "请指定第一条尺寸线原点:", AllowNone: true });
if (ptRes.Status === PromptStatus.OK)
await this.SelectPointDim(ptRes.Value);
if (ptRes.Status === PromptStatus.None)
await this.PickUpDim();
ptRes = await app.m_Editor.GetPoint({
}
private async SelectPointDim(footPt1: Vector3)
{
let ptRes = await app.m_Editor.GetPoint({
Msg: "请输入第二条尺寸线原点:",
BasePoint: footPt1,
AllowDrawRubberBand: true,
@ -31,6 +42,41 @@ export class DrawAlignedDimension implements Command
if (ptRes.Status != PromptStatus.OK)
return;
await this.BuildDim(footPt1, footPt2);
}
private async PickUpDim()
{
let enRes = await app.m_Editor.GetEntity({
Msg: "选择对象",
Filter: { filterTypes: [Curve] }
});
if (enRes.Status === PromptStatus.Cancel)
return;
let en = enRes.Entity as Curve;
let footPt1: Vector3;
let footPt2: Vector3;
if (en instanceof Polyline || en instanceof Circle)
{
let cp = en.GetClosestPointTo(enRes.Point, false);
if (en instanceof Polyline)
{
en = en.GetCurveAtParam(en.GetParamAtPoint(cp));
}
else
{
let cp = en.GetClosestPointTo(enRes.Point, false);
en = new Line(cp, en.Center);
en.Extend(2);
}
}
footPt1 = en.StartPoint;
footPt2 = en.EndPoint;
await this.BuildDim(footPt1, footPt2);
}
private async BuildDim(footPt1: Vector3, footPt2: Vector3)
{
let alDim: AlignedDimension | LinearDimension;
if (this.DimType === DimensionType.Align)
alDim = new AlignedDimension();
@ -46,9 +92,8 @@ export class DrawAlignedDimension implements Command
JigUtils.Draw(alDim);
ptRes = await app.m_Editor.GetPoint({
let ptRes = await app.m_Editor.GetPoint({
Msg: "指定尺寸线位置:",
// KeyWordList: [{ msg: "多行文字", key: "M" }, { msg: "文字", key: "T" }, { msg: "角度", key: "A" }],
Callback: (v) => { alDim.TextPosition = v; }
});
@ -56,9 +101,7 @@ export class DrawAlignedDimension implements Command
{
alDim.TextPosition = ptRes.Value;
app.m_Database.ModelSpace.Append(alDim);
}
else if (ptRes.Status == PromptStatus.Keyword)
{
await ContinueDrawDimension(alDim);
}
}
}

@ -1,9 +1,9 @@
import { Math as TMath, Mesh, Object3D, Vector3, Line as TLine } from "three";
import { Math as TMath, Mesh, Object3D, Vector3, Line as TLine, BufferGeometry } from "three";
import { arrayRemoveDuplicateBySort, arraySortByNumber } from "../../Common/ArrayExt";
import { ColorMaterial } from "../../Common/ColorPalette";
import { FixedNotZero, FixIndex } from "../../Common/Utils";
import { BufferGeometryUtils } from "../../Geometry/BufferGeometryUtils";
import { angle, equalv3 } from "../../Geometry/GeUtils";
import { angle, equalv3, equaln } from "../../Geometry/GeUtils";
import { RenderType } from "../../GraphicsSystem/Enum";
import { IntersectOption } from "../../GraphicsSystem/IntersectWith";
import { Arc } from "../Arc";
@ -12,6 +12,7 @@ import { CADFile } from "../CADFile";
import { Entity } from "../Entity";
import { Line } from "../Line";
import { Text, TextAligen } from "../Text/Text";
import { ObjectSnapMode } from "../../Editor/ObjectSnapMode";
/**
* 线
@ -30,7 +31,7 @@ export class LineAngularDimension extends Entity
)
{
super();
this.m_Arc.ColorIndex = 3;
this.m_Text.TextAligen = TextAligen.Down;
}
@ -54,7 +55,30 @@ export class LineAngularDimension extends Entity
}
this.Update();
}
get L1StartPoint()
{
return this.m_L1StartPoint.clone().applyMatrix4(this.OCS);
}
get L2StartPoint()
{
return this.m_L2StartPoint.clone().applyMatrix4(this.OCS);
}
get L1EndPoint()
{
return this.m_L1EndPoint.clone().applyMatrix4(this.OCS);
}
get L2EndPoint()
{
return this.m_L2EndPoint.clone().applyMatrix4(this.OCS);
}
get DimPoint()
{
return this.m_DimPoint.clone().applyMatrix4(this.OCS);
}
get Arc()
{
return this.m_Arc.Clone().ApplyMatrix(this.OCS);
}
//#region 动态拽拖
GetGripPoints(): Array<Vector3>
{
@ -106,7 +130,9 @@ export class LineAngularDimension extends Entity
ent.m_Arc.CopyFrom(this.m_Arc);
for (let [type, obj] of ent.m_DrawEntity)
{
let [arrow1, arrow2, line, textObj] = obj.children;
let [arrow1, arrow2, li1, li2, line, textObj] = obj.children;
(<TLine>li1).geometry = (<TLine>li1).geometry.clone();
(<TLine>li2).geometry = (<TLine>li2).geometry.clone();
(<TLine>line).geometry = (<TLine>line).geometry.clone();
}
return ent;
@ -121,10 +147,25 @@ export class LineAngularDimension extends Entity
this.m_Text.Clone().ApplyMatrix(this.OCS)
];
}
GetObjectSnapPoints(
snapMode: ObjectSnapMode,
pickPoint: Vector3,
lastPoint: Vector3
): Vector3[]
{
let arc = this.m_Arc.Clone().ApplyMatrix(this.OCS);
switch (snapMode)
{
case ObjectSnapMode.End:
return this.GetStretchPoints().concat([arc.StartPoint, arc.EndPoint]);
default:
return arc.GetObjectSnapPoints(snapMode, pickPoint, lastPoint);
}
}
InitDrawObject(renderType: RenderType = RenderType.Wireframe): Object3D
{
let obj = new Object3D();
this.ColorIndex = 3;
let colorMaterial = ColorMaterial.GetBasicMaterial(this.ColorIndex);
let line = this.m_Arc.Draw();
@ -135,19 +176,65 @@ export class LineAngularDimension extends Entity
arrow1.scale.set(arrowSize, arrowSize, arrowSize);
arrow2.scale.set(arrowSize, arrowSize, arrowSize);
obj.add(arrow1, arrow2, line, this.m_Text.Draw());
let l = new TLine(BufferGeometryUtils.CreateFromPts([new Vector3(), new Vector3()]), colorMaterial);
obj.add(arrow1, arrow2, l, l.clone(), line, this.m_Text.Draw());
this.UpdateDrawObject(renderType, obj);
return obj;
}
Update2Line(l1: Line, l2: Line, intPt: Vector3, li1: TLine, li2: TLine)
{
let intPar1 = l1.GetParamAtPoint(intPt);
if (intPar1 >= 1)
l1.Reverse();
let intPar2 = l2.GetParamAtPoint(intPt);
if (intPar2 >= 1)
l2.Reverse();
const updateLine = (l: Line, li: TLine, refPt: Vector3, refPt2?: Vector3) =>
{
let par = l.GetParamAtPoint(refPt);
let refPar = l.GetParamAtPoint(intPt);
if (par > 1)
{
li.visible = true;
let geo = li.geometry as BufferGeometry;
geo.copy(BufferGeometryUtils.CreateFromPts([l.EndPoint, refPt]));
}
else if (par < 0)
{
li.visible = true;
let geo = li.geometry as BufferGeometry;
geo.copy(
BufferGeometryUtils.CreateFromPts([par < refPar ? intPt : l.StartPoint, refPt])
);
}
else if (isNaN(par) && refPt2)
{
updateLine(l, li, refPt2);
}
else
{
li.visible = false;
}
}
updateLine(l1, li1, this.m_Arc.StartPoint, this.m_Arc.EndPoint);
updateLine(l2, li2, this.m_Arc.EndPoint, this.m_Arc.StartPoint);
}
UpdateDrawObject(type: RenderType, obj: Object3D)
{
let [arrow1, arrow2, line, textObj] = obj.children;
let [arrow1, arrow2, li1, li2, line, textObj] = obj.children;
let l1 = new Line(this.m_L1StartPoint, this.m_L1EndPoint);
let l2 = new Line(this.m_L2StartPoint, this.m_L2EndPoint);
let insP = l1.IntersectWith(l2, IntersectOption.ExtendBoth)[0];
if (insP)
{
@ -163,7 +250,7 @@ export class LineAngularDimension extends Entity
}).filter(a => !isNaN(a));
ans = ans.concat(ans.map(a => (a + Math.PI) % (Math.PI * 2)));
arraySortByNumber(ans);
arrayRemoveDuplicateBySort(ans);
arrayRemoveDuplicateBySort(ans, (a1, a2) => equaln(a1, a2));
let dimAn = angle(this.m_DimPoint.clone().sub(insP));
@ -178,7 +265,6 @@ export class LineAngularDimension extends Entity
obj.remove(line);
obj.remove(textObj);
obj.add(this.m_Arc.Draw());
arrow1.position.copy(this.m_Arc.StartPoint);
arrow1.rotation.z = this.m_Arc.GetFistDerivAngle(0) + Math.PI / 2;
arrow2.position.copy(this.m_Arc.EndPoint);
@ -189,9 +275,11 @@ export class LineAngularDimension extends Entity
this.m_Text.TextRotation = this.m_Arc.GetAngleAtParam(0.5) % (Math.PI) - Math.PI / 2;
obj.add(this.m_Text.Draw());
return;
break;
}
}
this.Update2Line(l1, l2, insP, li1 as TLine, li2 as TLine)
}
}

@ -9,6 +9,7 @@ import { Factory } from "../CADFactory";
import { CADFile } from "../CADFile";
import { Entity } from "../Entity";
import { Line } from "../Line";
import { Polyline } from "../Polyline";
import { Text, TextAligen } from "../Text/Text";
import THREE = require("three");
@ -94,11 +95,11 @@ export class AlignedDimension extends Entity
{
this.UpdateText();
return [
new Line(this.FootP1, this.ArmP1),
new Line(this.ArmP2, this.ArmP1),
new Line(this.ArmP2, this.FootP2),
this.m_Text.Clone().ApplyMatrix(this.OCS)
];
new Line(this.m_FootP1, this.m_ArmP1),
new Line(this.m_ArmP2, this.m_ArmP1),
new Line(this.m_ArmP2, this.m_FootP2),
this.m_Text.Clone()
].map(en => en.ApplyMatrix(this.OCS));
}
Clone(): this
@ -165,20 +166,25 @@ export class AlignedDimension extends Entity
this.m_Text.TextRotation = angleAndX(armV);
}
/**
*
* @param snapMode ()
* @param pickPoint const
* @param lastPoint const
* @returns object snap points
*/
GetObjectSnapPoints(
snapMode: ObjectSnapMode,
pickPoint: Vector3,
lastPoint: Vector3
): Vector3[]
{
return [];
let cus = this.Explode() as Line[];
cus.pop();
let pl = new Polyline();
for (let cu of cus)
pl.Join(cu);
switch (snapMode)
{
case ObjectSnapMode.End:
return this.GetStretchPoints();
default:
return pl.GetObjectSnapPoints(snapMode, pickPoint, lastPoint)
}
}
GetGripPoints(): Array<Vector3>

@ -94,6 +94,7 @@ import { ChangeColor } from '../Add-on/ChangeColor';
import { Command_Draw2LineAngularDim } from '../Add-on/DrawDim/Draw2LineAngularDim';
import { FeedingCommand } from '../Add-on/CommandFeeding';
import { MirrorCommand } from '../Add-on/Mirror';
import { Command_DimContinue } from '../Add-on/DrawDim/Command_DimContinue';
export function registerCommand()
{
commandMachine.RegisterCommand("b", new DrawBox())
@ -196,6 +197,7 @@ export function registerCommand()
commandMachine.RegisterCommand("dal", new DrawAlignedDimension());
commandMachine.RegisterCommand("dli", new DrawLinearDimension());
commandMachine.RegisterCommand("dan", new Command_Draw2LineAngularDim());
commandMachine.RegisterCommand("dco", new Command_DimContinue());
commandMachine.RegisterCommand("text", new DrawText());
commandMachine.RegisterCommand("int", new IntersectionOperation());

Loading…
Cancel
Save