|
|
@ -1,9 +1,9 @@
|
|
|
|
import { BufferGeometry, Line as TLine, Matrix3, Mesh, Object3D, Vector3, Vector2, Material } from "three";
|
|
|
|
import { BufferGeometry, Line as TLine, Matrix3, Mesh, Object3D, Vector3, Vector2, Material, Matrix4 } from "three";
|
|
|
|
import { ColorMaterial } from "../../Common/ColorPalette";
|
|
|
|
import { ColorMaterial } from "../../Common/ColorPalette";
|
|
|
|
import { FixedNotZero } from "../../Common/Utils";
|
|
|
|
import { FixedNotZero } from "../../Common/Utils";
|
|
|
|
import { ObjectSnapMode } from "../../Editor/ObjectSnapMode";
|
|
|
|
import { ObjectSnapMode } from "../../Editor/ObjectSnapMode";
|
|
|
|
import { BufferGeometryUtils } from "../../Geometry/BufferGeometryUtils";
|
|
|
|
import { BufferGeometryUtils } from "../../Geometry/BufferGeometryUtils";
|
|
|
|
import { angle, angleAndX, midPoint, ZeroVec } from "../../Geometry/GeUtils";
|
|
|
|
import { angle, angleAndX, midPoint, ZeroVec, ZAxis, equaln, equalv3 } from "../../Geometry/GeUtils";
|
|
|
|
import { RenderType } from "../../GraphicsSystem/RenderType";
|
|
|
|
import { RenderType } from "../../GraphicsSystem/RenderType";
|
|
|
|
import { Factory } from "../CADFactory";
|
|
|
|
import { Factory } from "../CADFactory";
|
|
|
|
import { CADFiler } from "../CADFiler";
|
|
|
|
import { CADFiler } from "../CADFiler";
|
|
|
@ -20,6 +20,11 @@ interface LeadOutLinePts
|
|
|
|
dragPt: Vector3;
|
|
|
|
dragPt: Vector3;
|
|
|
|
endPt: Vector3;
|
|
|
|
endPt: Vector3;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
interface DefaultValue
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
offset: Vector2;
|
|
|
|
|
|
|
|
isFlipped: boolean;
|
|
|
|
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 对齐标注
|
|
|
|
* 对齐标注
|
|
|
|
* 存在子类重载(线性标注 LinearDimension)
|
|
|
|
* 存在子类重载(线性标注 LinearDimension)
|
|
|
@ -34,12 +39,11 @@ export class AlignedDimension extends Entity
|
|
|
|
private _LeadOutLine = new TLine();
|
|
|
|
private _LeadOutLine = new TLine();
|
|
|
|
private _LeadOutOffsetY = 72;
|
|
|
|
private _LeadOutOffsetY = 72;
|
|
|
|
private _LeadOutOffsetX = 30;
|
|
|
|
private _LeadOutOffsetX = 30;
|
|
|
|
//引线是否反向(往左伸/往右伸)
|
|
|
|
private _DefaultVal: DefaultValue = { offset: new Vector2(30, 72), isFlipped: false };
|
|
|
|
private _LeadOutIsFlipped: boolean = false;
|
|
|
|
|
|
|
|
//引线的拖拽点和终点
|
|
|
|
//引线的拖拽点和终点
|
|
|
|
private _LeadOutPts: LeadOutLinePts = { dragPt: midPoint(this.m_ArmP1, this.m_ArmP2), endPt: new Vector3() };
|
|
|
|
private _LeadOutPts: LeadOutLinePts = { dragPt: midPoint(this.m_ArmP1, this.m_ArmP2), endPt: new Vector3() };
|
|
|
|
//文字是否比footer间距更宽
|
|
|
|
//引线是否反向(往左伸/往右伸)
|
|
|
|
private needLeadOut: boolean = true;
|
|
|
|
private _LeadOutIsFlipped: boolean = false;
|
|
|
|
//是否由拖拽更新_LeadOutPts.dragPt. 关系到引线的update
|
|
|
|
//是否由拖拽更新_LeadOutPts.dragPt. 关系到引线的update
|
|
|
|
private isDragLeadOutPt: boolean = false;
|
|
|
|
private isDragLeadOutPt: boolean = false;
|
|
|
|
constructor(
|
|
|
|
constructor(
|
|
|
@ -50,8 +54,8 @@ export class AlignedDimension extends Entity
|
|
|
|
protected m_ArmP1: Vector3 = new Vector3(),
|
|
|
|
protected m_ArmP1: Vector3 = new Vector3(),
|
|
|
|
protected m_ArmP2: Vector3 = new Vector3(),
|
|
|
|
protected m_ArmP2: Vector3 = new Vector3(),
|
|
|
|
protected m_TextRotation: number = undefined,
|
|
|
|
protected m_TextRotation: number = undefined,
|
|
|
|
//是否默认显示引线
|
|
|
|
//是否显示引线
|
|
|
|
protected m_LeadOutVisible: boolean = false,
|
|
|
|
protected m_LeadOutVisible: boolean = true,
|
|
|
|
)
|
|
|
|
)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
super();
|
|
|
|
super();
|
|
|
@ -112,6 +116,39 @@ export class AlignedDimension extends Entity
|
|
|
|
this.Update();
|
|
|
|
this.Update();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//创建以arm1,arm2为x轴 position在foot1的坐标系 用于定位引线
|
|
|
|
|
|
|
|
get DalUcs()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
let dalUcs = new Matrix4();
|
|
|
|
|
|
|
|
if (!equaln(this.m_ArmP1.distanceTo(this.m_ArmP2), 0))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
let vx = this.m_ArmP2.clone().sub(this.m_ArmP1);
|
|
|
|
|
|
|
|
if (this.m_ArmP1.x < this.m_ArmP2.x)
|
|
|
|
|
|
|
|
vx.negate();
|
|
|
|
|
|
|
|
let vy = vx.clone().cross(ZAxis);
|
|
|
|
|
|
|
|
dalUcs = new Matrix4().makeBasis(vx.normalize(), vy.normalize(), ZAxis.clone().normalize());
|
|
|
|
|
|
|
|
dalUcs.setPosition(this.m_FootP1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return dalUcs;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
RaiseFooters(num: number)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
let dalucs = this.DalUcs;
|
|
|
|
|
|
|
|
let dalUcsInv = new Matrix4().getInverse(dalucs);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let p = new Vector3(0, num, 0);
|
|
|
|
|
|
|
|
let f1 = this.m_FootP1.clone().applyMatrix4(dalucs);
|
|
|
|
|
|
|
|
let f2 = this.m_FootP2.clone().applyMatrix4(dalucs);
|
|
|
|
|
|
|
|
let a1 = this.m_ArmP1.clone().applyMatrix4(dalucs);
|
|
|
|
|
|
|
|
if (a1.y < f1.y)
|
|
|
|
|
|
|
|
p.negate();
|
|
|
|
|
|
|
|
this.m_FootP1 = f1.add(p).applyMatrix4(dalUcsInv);
|
|
|
|
|
|
|
|
this.m_FootP2 = f2.add(p).applyMatrix4(dalUcsInv);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this.Update();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
set TextRotation(angle: number)
|
|
|
|
set TextRotation(angle: number)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
this.m_TextRotation = angle;
|
|
|
|
this.m_TextRotation = angle;
|
|
|
@ -145,28 +182,27 @@ export class AlignedDimension extends Entity
|
|
|
|
|
|
|
|
|
|
|
|
set LeadOutVisible(visible: boolean)
|
|
|
|
set LeadOutVisible(visible: boolean)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
this.WriteAllObjectRecord();
|
|
|
|
this.m_LeadOutVisible = visible;
|
|
|
|
this.m_LeadOutVisible = visible;
|
|
|
|
this.Update();
|
|
|
|
this.Update();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//引线朝右视为未翻转
|
|
|
|
set LeadOutFlipped(isFlipped: boolean)
|
|
|
|
set LeadOutFlipped(isFlipped: boolean)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
this.WriteAllObjectRecord();
|
|
|
|
this._LeadOutIsFlipped = isFlipped;
|
|
|
|
this._LeadOutIsFlipped = isFlipped;
|
|
|
|
this.Update();
|
|
|
|
this.Update();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
toggleLeadOutVisible()
|
|
|
|
toggleLeadOutVisible()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
this.WriteAllObjectRecord();
|
|
|
|
this.LeadOutVisible = !this.m_LeadOutVisible;
|
|
|
|
this.m_LeadOutVisible = !this.m_LeadOutVisible;
|
|
|
|
|
|
|
|
this.Update();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
toggleLeadOutFlipped()
|
|
|
|
toggleLeadOutFlipped()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
this.WriteAllObjectRecord();
|
|
|
|
this.LeadOutFlipped = !this._LeadOutIsFlipped;
|
|
|
|
this._LeadOutIsFlipped = !this._LeadOutIsFlipped;
|
|
|
|
|
|
|
|
this.Update();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
set LeadOutOffsetY(size: number)
|
|
|
|
set LeadOutOffsetY(size: number)
|
|
|
@ -181,11 +217,23 @@ export class AlignedDimension extends Entity
|
|
|
|
this.Update();
|
|
|
|
this.Update();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
set DefaultValue(val: DefaultValue)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
this._DefaultVal = val;
|
|
|
|
|
|
|
|
this._LeadOutOffsetX = val.offset.x;
|
|
|
|
|
|
|
|
this._LeadOutOffsetY = val.offset.y;
|
|
|
|
|
|
|
|
this.LeadOutFlipped = val.isFlipped;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
get DefaultValue()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return this._DefaultVal;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
set TextSize(size: number)
|
|
|
|
set TextSize(size: number)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
this.WriteAllObjectRecord();
|
|
|
|
this.WriteAllObjectRecord();
|
|
|
|
this._Text.Height = size;
|
|
|
|
this._Text.Height = size;
|
|
|
|
this.UpdateNeedLeadOut(size);
|
|
|
|
|
|
|
|
this.Update();
|
|
|
|
this.Update();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -193,26 +241,23 @@ export class AlignedDimension extends Entity
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return this._Text.Height;
|
|
|
|
return this._Text.Height;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
UpdateNeedLeadOut(eachTextSize?: number)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
let eachTextWidth = eachTextSize ? ~~(Math.abs(eachTextSize) / 2) : ~~(Math.abs(this.TextSize) / 2);
|
|
|
|
|
|
|
|
let distanceStr = FixedNotZero(this.m_ArmP1.distanceTo(this.m_ArmP2), 2);
|
|
|
|
|
|
|
|
let textWidth = new Vector3(distanceStr.length * (eachTextWidth));
|
|
|
|
|
|
|
|
this.needLeadOut = safeEval(distanceStr) < distanceStr.length * (eachTextWidth);
|
|
|
|
|
|
|
|
return textWidth;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Explode()
|
|
|
|
Explode()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
this.UpdateText();
|
|
|
|
this.UpdateText(this._Text.Position);
|
|
|
|
return [
|
|
|
|
let res =
|
|
|
|
|
|
|
|
[
|
|
|
|
new Line(this.m_FootP1.clone(), this.m_ArmP1.clone()),
|
|
|
|
new Line(this.m_FootP1.clone(), this.m_ArmP1.clone()),
|
|
|
|
new Line(this.m_ArmP2.clone(), this.m_ArmP1.clone()),
|
|
|
|
new Line(this.m_ArmP2.clone(), this.m_ArmP1.clone()),
|
|
|
|
new Line(this.m_ArmP2.clone(), this.m_FootP2.clone()),
|
|
|
|
new Line(this.m_ArmP2.clone(), this.m_FootP2.clone()),
|
|
|
|
new Line(midPoint(this.m_ArmP1, this.m_ArmP2), this._LeadOutPts.dragPt.clone()),
|
|
|
|
|
|
|
|
new Line(this._LeadOutPts.dragPt.clone(), this._LeadOutPts.endPt.clone()),
|
|
|
|
|
|
|
|
this._Text.Clone()
|
|
|
|
this._Text.Clone()
|
|
|
|
].map(en => en.ApplyMatrix(this.OCS));
|
|
|
|
];
|
|
|
|
|
|
|
|
if (!equalv3(this._LeadOutPts.dragPt, midPoint(this.m_ArmP1, this.m_ArmP2)))
|
|
|
|
|
|
|
|
res.push(
|
|
|
|
|
|
|
|
new Line(midPoint(this.m_ArmP1, this.m_ArmP2), this._LeadOutPts.dragPt.clone()),
|
|
|
|
|
|
|
|
new Line(this._LeadOutPts.dragPt.clone(), this._LeadOutPts.endPt.clone())
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
return res.map(en => en.ApplyMatrix(this.OCS));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Clone(): this
|
|
|
|
Clone(): this
|
|
|
@ -307,69 +352,55 @@ export class AlignedDimension extends Entity
|
|
|
|
this.isDragLeadOutPt = false;
|
|
|
|
this.isDragLeadOutPt = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* 更新引线并返回textPosition
|
|
|
|
|
|
|
|
* @returns textPosition(Vector3)
|
|
|
|
|
|
|
|
* @memberof AlignedDimension
|
|
|
|
|
|
|
|
*/
|
|
|
|
UpdateLeadOutLine(): Vector3
|
|
|
|
UpdateLeadOutLine(): Vector3
|
|
|
|
{
|
|
|
|
{
|
|
|
|
let textPosition: Vector3 = midPoint(this.m_ArmP1, this.m_ArmP2);
|
|
|
|
let textPosition: Vector3 = midPoint(this.m_ArmP1, this.m_ArmP2);
|
|
|
|
if (this.m_LeadOutVisible) //引线可见
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
let textWidth = this.UpdateNeedLeadOut();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (this.needLeadOut) //需要引线
|
|
|
|
let distance = this.m_ArmP1.distanceTo(this.m_ArmP2);
|
|
|
|
{
|
|
|
|
let distanceStr = FixedNotZero(distance, 2);
|
|
|
|
//确定引线方向(确定引线所有点的位置)
|
|
|
|
let strWidth = distanceStr.length * (~~(Math.abs(this.TextSize) / 2));//文字总宽度
|
|
|
|
if (this._LeadOutIsFlipped) //引线已翻转(朝左)
|
|
|
|
let needLeadOut = (safeEval(distanceStr) < strWidth + 1e-6) && !(equaln(distance, 0));//文字宽度是否比托盘更宽 是 则需要引线
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (this.m_LeadOutVisible && needLeadOut) //引线可见且需要引线
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (this.isDragLeadOutPt) //是否由拖拽更新dragPt
|
|
|
|
let dalUcs = this.DalUcs;
|
|
|
|
if (this._LeadOutPts.dragPt.x < textPosition.x)//已经拖过中线 改变endPt 改变朝向值
|
|
|
|
let dalUcsInv = new Matrix4().getInverse(dalUcs);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let textWidthVec = new Vector3(strWidth);
|
|
|
|
|
|
|
|
let isLeft = (v) => { return v.x < midPoint(this.m_ArmP1, this.m_ArmP2).applyMatrix4(dalUcs).x; };
|
|
|
|
|
|
|
|
//确定引线的点的位置
|
|
|
|
|
|
|
|
if (this.isDragLeadOutPt)//是否拖拽了dragPt(拖拽dragPt需要更新endPt)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
this._LeadOutPts.endPt = this._LeadOutPts.dragPt.clone().sub(textWidth);
|
|
|
|
let dragPtInDalUcs = this._LeadOutPts.dragPt.clone().applyMatrix4(dalUcs);
|
|
|
|
this._LeadOutIsFlipped = false;
|
|
|
|
let isleft = isLeft(dragPtInDalUcs.clone());
|
|
|
|
}
|
|
|
|
if (isleft)//已经拖过中线 更新endPt 改变IsFlipped
|
|
|
|
|
|
|
|
this._LeadOutPts.endPt = dragPtInDalUcs.clone().sub(textWidthVec);
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
this._LeadOutPts.endPt = dragPtInDalUcs.clone().add(textWidthVec);
|
|
|
|
this._LeadOutPts.endPt = this._LeadOutPts.dragPt.clone().add(textWidth);
|
|
|
|
this._LeadOutIsFlipped = !isleft;
|
|
|
|
this._LeadOutIsFlipped = true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else //非拖拽
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
this._LeadOutPts.dragPt = textPosition.clone().add(new Vector3(this._LeadOutOffsetX, -this._LeadOutOffsetY));
|
|
|
|
|
|
|
|
this._LeadOutPts.endPt = this._LeadOutPts.dragPt.clone().add(textWidth);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else //引线未翻转(朝右)
|
|
|
|
else //没有拖拽
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (this.isDragLeadOutPt)//是否由拖拽更新dragPt
|
|
|
|
this._LeadOutPts.dragPt = textPosition.clone().applyMatrix4(dalUcs).add(new Vector3(this._LeadOutIsFlipped ? this._LeadOutOffsetX : -this._LeadOutOffsetX, this._LeadOutOffsetY));
|
|
|
|
if (this._LeadOutPts.dragPt.x > textPosition.x)//已经拖过中线 改变endPt 改变朝向值
|
|
|
|
if (isLeft(this._LeadOutPts.dragPt))
|
|
|
|
{
|
|
|
|
this._LeadOutPts.endPt = this._LeadOutPts.dragPt.clone().sub(textWidthVec);
|
|
|
|
this._LeadOutPts.endPt = this._LeadOutPts.dragPt.clone().add(textWidth);
|
|
|
|
|
|
|
|
this._LeadOutIsFlipped = true;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
else
|
|
|
|
{
|
|
|
|
this._LeadOutPts.endPt = this._LeadOutPts.dragPt.clone().add(textWidthVec);
|
|
|
|
this._LeadOutPts.endPt = this._LeadOutPts.dragPt.clone().sub(textWidth);
|
|
|
|
this._LeadOutPts.dragPt.applyMatrix4(dalUcsInv);
|
|
|
|
this._LeadOutIsFlipped = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else //非拖拽
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
this._LeadOutPts.dragPt = textPosition.clone().sub(new Vector3(this._LeadOutOffsetX, this._LeadOutOffsetY));
|
|
|
|
|
|
|
|
this._LeadOutPts.endPt = this._LeadOutPts.dragPt.clone().sub(textWidth);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this._LeadOutPts.endPt.applyMatrix4(dalUcsInv);
|
|
|
|
this._LeadOutLine.geometry = BufferGeometryUtils.CreateFromPts([textPosition, this._LeadOutPts.dragPt, this._LeadOutPts.endPt]);
|
|
|
|
this._LeadOutLine.geometry = BufferGeometryUtils.CreateFromPts([textPosition, this._LeadOutPts.dragPt, this._LeadOutPts.endPt]);
|
|
|
|
this._LeadOutLine.material = ColorMaterial.GetLineMaterial(this.ColorIndex);
|
|
|
|
this._LeadOutLine.material = ColorMaterial.GetLineMaterial(this.ColorIndex);
|
|
|
|
this._LeadOutLine.visible = true;
|
|
|
|
this._LeadOutLine.visible = true;
|
|
|
|
textPosition = midPoint(this._LeadOutPts.dragPt, this._LeadOutPts.endPt);
|
|
|
|
textPosition = midPoint(this._LeadOutPts.dragPt, this._LeadOutPts.endPt);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else //不需要引线
|
|
|
|
else //引线不可见或不需要引线
|
|
|
|
{
|
|
|
|
|
|
|
|
//使引线不可见 并将dragPt隐藏于托盘中点
|
|
|
|
|
|
|
|
this._LeadOutPts.dragPt = midPoint(this.m_ArmP1, this.m_ArmP2);
|
|
|
|
|
|
|
|
this._LeadOutLine.geometry = BufferGeometryUtils.CreateFromPts([]);
|
|
|
|
|
|
|
|
this._LeadOutLine.visible = false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else //引线不可见
|
|
|
|
|
|
|
|
{
|
|
|
|
{
|
|
|
|
//使引线不可见 并将dragPt隐藏于托盘中点
|
|
|
|
//使引线不可见 并将dragPt隐藏于托盘中点
|
|
|
|
this._LeadOutPts.dragPt = midPoint(this.m_ArmP1, this.m_ArmP2);
|
|
|
|
this._LeadOutPts.dragPt = midPoint(this.m_ArmP1, this.m_ArmP2);
|
|
|
@ -432,12 +463,13 @@ export class AlignedDimension extends Entity
|
|
|
|
{
|
|
|
|
{
|
|
|
|
if (i === 5)
|
|
|
|
if (i === 5)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
//开始拖拽引线夹点(_LeadOutPts.dragPt)
|
|
|
|
let dalucs = this.DalUcs;
|
|
|
|
|
|
|
|
//开始拖拽引线dragPt
|
|
|
|
this.isDragLeadOutPt = true;
|
|
|
|
this.isDragLeadOutPt = true;
|
|
|
|
vec = vec.clone().applyMatrix4(this.OCSInv.clone().setPosition(ZeroVec));
|
|
|
|
vec = vec.clone().applyMatrix4(this.OCSInv.clone().setPosition(ZeroVec));
|
|
|
|
this._LeadOutPts.dragPt.add(vec);
|
|
|
|
this._LeadOutPts.dragPt.add(vec);
|
|
|
|
let calcV = this._LeadOutPts.dragPt.clone().sub(midPoint(this.m_ArmP1, this.m_ArmP2));
|
|
|
|
let calcV = this._LeadOutPts.dragPt.clone().applyMatrix4(dalucs).sub(midPoint(this.m_ArmP1, this.m_ArmP2).applyMatrix4(dalucs));
|
|
|
|
this._LeadOutOffsetY = calcV.y * -1;
|
|
|
|
this._LeadOutOffsetY = calcV.y;
|
|
|
|
this._LeadOutOffsetX = Math.abs(calcV.x);
|
|
|
|
this._LeadOutOffsetX = Math.abs(calcV.x);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (i >= 2)
|
|
|
|
else if (i >= 2)
|
|
|
@ -519,12 +551,14 @@ export class AlignedDimension extends Entity
|
|
|
|
this._LeadOutOffsetY = file.Read();
|
|
|
|
this._LeadOutOffsetY = file.Read();
|
|
|
|
this._LeadOutOffsetX = file.Read();
|
|
|
|
this._LeadOutOffsetX = file.Read();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ver > 4)
|
|
|
|
|
|
|
|
this.TextSize = file.Read();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//对象将自身数据写入到文件.
|
|
|
|
//对象将自身数据写入到文件.
|
|
|
|
WriteFile(file: CADFiler)
|
|
|
|
WriteFile(file: CADFiler)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
super.WriteFile(file);
|
|
|
|
super.WriteFile(file);
|
|
|
|
file.Write(4);
|
|
|
|
file.Write(5);
|
|
|
|
file.Write(this.m_ArmP1.toArray());
|
|
|
|
file.Write(this.m_ArmP1.toArray());
|
|
|
|
file.Write(this.m_ArmP2.toArray());
|
|
|
|
file.Write(this.m_ArmP2.toArray());
|
|
|
|
file.Write(this.m_FootP1.toArray());
|
|
|
|
file.Write(this.m_FootP1.toArray());
|
|
|
@ -537,6 +571,8 @@ export class AlignedDimension extends Entity
|
|
|
|
file.Write(this._LeadOutPts.dragPt.toArray());
|
|
|
|
file.Write(this._LeadOutPts.dragPt.toArray());
|
|
|
|
file.Write(this._LeadOutOffsetY);
|
|
|
|
file.Write(this._LeadOutOffsetY);
|
|
|
|
file.Write(this._LeadOutOffsetX);
|
|
|
|
file.Write(this._LeadOutOffsetX);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
file.Write(this.TextSize);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//#endregion
|
|
|
|
//#endregion
|
|
|
|
}
|
|
|
|
}
|
|
|
|