开发:修复错误

This commit is contained in:
ChenX 2023-11-01 17:07:20 +08:00
parent e02890783b
commit 6014fc40a2
9 changed files with 111 additions and 105 deletions

View File

@ -370,31 +370,31 @@ function Object3DRemoveAll(obj) {
return obj;
}
var Status;
exports.Status = void 0;
(function (Status) {
Status[Status["False"] = 0] = "False";
Status[Status["True"] = 1] = "True";
Status[Status["Canel"] = -1] = "Canel";
Status[Status["ConverToCircle"] = 101] = "ConverToCircle";
Status[Status["DuplicateRecordName"] = 102] = "DuplicateRecordName";
})(Status || (Status = {}));
var UpdateDraw;
})(exports.Status || (exports.Status = {}));
exports.UpdateDraw = void 0;
(function (UpdateDraw) {
UpdateDraw[UpdateDraw["None"] = 0] = "None";
UpdateDraw[UpdateDraw["Matrix"] = 1] = "Matrix";
UpdateDraw[UpdateDraw["Geometry"] = 2] = "Geometry";
UpdateDraw[UpdateDraw["Material"] = 4] = "Material";
UpdateDraw[UpdateDraw["All"] = 63] = "All";
})(UpdateDraw || (UpdateDraw = {}));
})(exports.UpdateDraw || (exports.UpdateDraw = {}));
/**
* WblockClne时,遇到重复记录的操作方式
*/
var DuplicateRecordCloning;
exports.DuplicateRecordCloning = void 0;
(function (DuplicateRecordCloning) {
DuplicateRecordCloning[DuplicateRecordCloning["Ignore"] = 1] = "Ignore";
DuplicateRecordCloning[DuplicateRecordCloning["Replace"] = 2] = "Replace";
DuplicateRecordCloning[DuplicateRecordCloning["Rename"] = 3] = "Rename";
})(DuplicateRecordCloning || (DuplicateRecordCloning = {}));
})(exports.DuplicateRecordCloning || (exports.DuplicateRecordCloning = {}));
/**
* 盒子的切割类型
@ -1065,7 +1065,7 @@ class SymbolTableRecord extends CADObject {
this.name = name;
}
Add(obj, isCheckObjectCleanly = true) {
return Status.False;
return exports.Status.False;
}
WriteFile(file) {
super.WriteFile(file);
@ -1536,7 +1536,7 @@ let Entity = Entity_1 = class Entity extends CADObject {
* 当AutoUpdate为false时,记录需要更新的标志.
* 以便延迟更新时找到相应的更新标志.
*/
this.NeedUpdateFlag = UpdateDraw.None;
this.NeedUpdateFlag = exports.UpdateDraw.None;
this.AutoUpdate = true;
this._drawObject = undefined;
//实体绘制更新版本号
@ -1563,7 +1563,7 @@ let Entity = Entity_1 = class Entity extends CADObject {
return;
this.WriteAllObjectRecord();
this._Freeze = f;
this.Update(UpdateDraw.Material);
this.Update(exports.UpdateDraw.Material);
}
get VisibleInRender() { return this._VisibleInRender; }
set VisibleInRender(v) {
@ -1602,7 +1602,7 @@ let Entity = Entity_1 = class Entity extends CADObject {
undoRec.WriteObjectHistoryPath(this, hisRec);
}
this._Color = color;
this.Update(UpdateDraw.Material);
this.Update(exports.UpdateDraw.Material);
}
}
get ColorIndex() {
@ -1632,7 +1632,7 @@ let Entity = Entity_1 = class Entity extends CADObject {
if (isClearDraw) {
for (let [, obj] of this._CacheDrawObject)
obj.matrix = this._Matrix; //因为使用了备份的矩阵,导致此时这个矩形是错误的,这里还原它
this.Update(UpdateDraw.Matrix); //保证盒子是正确的
this.Update(exports.UpdateDraw.Matrix); //保证盒子是正确的
}
return new Box3Ext().copy(box);
}
@ -1834,7 +1834,7 @@ let Entity = Entity_1 = class Entity extends CADObject {
/**
* 当实体数据改变时,绘制的实体必须做出改变.供框架调用
*/
Update(mode = UpdateDraw.All) {
Update(mode = exports.UpdateDraw.All) {
this.__UpdateVersion__++;
this.NeedUpdateFlag |= mode;
if (this.AutoUpdate) {
@ -1851,14 +1851,14 @@ let Entity = Entity_1 = class Entity extends CADObject {
let mode = this.NeedUpdateFlag;
if (mode === 0)
return;
if (mode & UpdateDraw.Geometry && this._CacheDrawObject.size > 0)
if (mode & exports.UpdateDraw.Geometry && this._CacheDrawObject.size > 0)
this.UpdateDrawGeometry();
this.UpdateVisible();
let isJigIng = this._CacheDrawObject.has(RenderType.Jig);
for (let [type, obj] of this._CacheDrawObject) {
if (isJigIng && type !== RenderType.Jig)
continue;
if (mode & UpdateDraw.Geometry) {
if (mode & exports.UpdateDraw.Geometry) {
if (obj.userData.IsClone) {
let parent = obj.parent;
DisposeThreeObj(obj);
@ -1873,15 +1873,15 @@ let Entity = Entity_1 = class Entity extends CADObject {
else
this.UpdateDrawObject(type, obj);
}
if (mode & UpdateDraw.Material)
if (mode & exports.UpdateDraw.Material)
this.UpdateDrawObjectMaterial(type, obj);
if (mode & UpdateDraw.Matrix || mode & UpdateDraw.Geometry) {
if (mode & exports.UpdateDraw.Matrix || mode & exports.UpdateDraw.Geometry) {
obj.updateMatrixWorld(true);
// if (this.Id)//如果这个是Jig实体,那么我们更新这个盒子球似乎也没有意义 (虽然这在某些情况能改进性能,但是在绘制圆弧的时候,因为没有更新圆弧的盒子,导致绘制出来的圆弧无法被选中)
obj.traverse(UpdateBoundingSphere);
}
}
this.NeedUpdateFlag = UpdateDraw.None;
this.NeedUpdateFlag = exports.UpdateDraw.None;
}
/**
* 当实体需要更新时,需要重载该方法,实现实体更新
@ -1961,7 +1961,7 @@ let Entity = Entity_1 = class Entity extends CADObject {
}
else
this.ApplyScaleMatrix(m);
this.Update(UpdateDraw.Matrix);
this.Update(exports.UpdateDraw.Matrix);
return this;
}
ApplyScaleMatrix(m) {
@ -2018,7 +2018,7 @@ let Entity = Entity_1 = class Entity extends CADObject {
newObj.userData.IsClone = true;
this._CacheDrawObject.set(type, newObj);
}
this.NeedUpdateFlag = UpdateDraw.None;
this.NeedUpdateFlag = exports.UpdateDraw.None;
}
get ReadFileIng() {
return this.__ReadFileIng__ || Entity_1.__ReadFileIng__;
@ -3564,7 +3564,7 @@ let Curve = class Curve extends Entity {
* @returns {boolean} 连接成功
* @memberof Curve
*/
Join(cu, allowGap = false, tolerance = 1e-4) { return Status.False; }
Join(cu, allowGap = false, tolerance = 1e-4) { return exports.Status.False; }
//翻转曲线.首尾调换.
Reverse() { return this; }
//点在曲线上
@ -3997,15 +3997,15 @@ exports.Line = Line_1 = class Line extends Curve {
if (cu instanceof Line_1 || cu.constructor.name === "RoomWallLine") {
//平行
if (!isParallelTo(this.GetFirstDeriv(0).normalize(), cu.GetFirstDeriv(0).normalize()))
return Status.False;
return exports.Status.False;
let sp = cu.StartPoint;
let { closestPt: cp1, param: param1 } = this.GetClosestAtPoint(sp, true);
if (!equalv3(sp, cp1, tolerance)) //点在曲线上,允许较低的精度
return Status.False;
return exports.Status.False;
let ep = cu.EndPoint;
let { closestPt: cp2, param: param2 } = this.GetClosestAtPoint(ep, true);
if (!equalv3(ep, cp2, tolerance))
return Status.False;
return exports.Status.False;
if (param1 > param2) {
[param1, param2] = [param2, param1];
[sp, ep] = [ep, sp];
@ -4016,10 +4016,10 @@ exports.Line = Line_1 = class Line extends Curve {
this.StartPoint = sp;
if (param2 > 1)
this.EndPoint = ep;
return Status.True;
return exports.Status.True;
}
}
return Status.False;
return exports.Status.False;
}
Reverse() {
this.WriteAllObjectRecord();
@ -4388,17 +4388,17 @@ let Ellipse = Ellipse_1 = class Ellipse extends Curve {
}
Join(el) {
if (this.IsClose || el.IsClose || !this.IsCoplaneTo(el) || !equalv3(el.Center, this.Center))
return Status.False;
let status = Status.False;
return exports.Status.False;
let status = exports.Status.False;
if (equaln$1(this._endAngle, this._startAngle)) {
this.EndAngle = this._endAngle;
status = Status.True;
status = exports.Status.True;
}
else if (equaln$1(this._startAngle, el._endAngle)) {
this.StartAngle = el._startAngle;
status = Status.True;
status = exports.Status.True;
}
if (status === Status.True && !this.IsClose && equaln$1(this._startAngle, this._endAngle)) {
if (status === exports.Status.True && !this.IsClose && equaln$1(this._startAngle, this._endAngle)) {
this.StartAngle = 0;
this.EndAngle = Math.PI * 2;
}
@ -6223,11 +6223,11 @@ class Contour {
let nextI = FixIndex$1(i + 1, g);
let c2 = g[nextI];
let status = c1.Join(c2);
if (status === Status.True) {
if (status === exports.Status.True) {
g.splice(nextI, 1);
i--;
}
else if (status === Status.ConverToCircle) {
else if (status === exports.Status.ConverToCircle) {
g.length = 0;
let a = c1;
g.push(new exports.Circle(a.Center, a.Radius));
@ -6532,7 +6532,7 @@ class Contour {
if (cache$1.has(g))
return cache$1.get(g);
let gclone = g.map(c => c.Clone());
arrayRemoveDuplicateBySort(gclone, (cu1, cu2) => cu1.Join(cu2, false, tolerance) === Status.True);
arrayRemoveDuplicateBySort(gclone, (cu1, cu2) => cu1.Join(cu2, false, tolerance) === exports.Status.True);
if (gclone.length > 1 && gclone[0].Join(arrayLast(gclone), false, tolerance))
gclone.pop();
let pl = exports.Polyline.Combine(gclone, tolerance);
@ -7079,14 +7079,14 @@ class OffsetPolyline {
if (n2.used)
continue;
let status = n.curve.Join(n2.curve);
if (status === Status.ConverToCircle) {
if (status === exports.Status.ConverToCircle) {
n.used = true;
n2.used = true;
let circle = new exports.Circle(n.curve.Center, n.curve.Radius);
n.curve = circle;
this._RetCurves.push(ConverCircleToPolyline$1(circle).ApplyMatrix(this._CacheOCS));
}
else if (status === Status.True) {
else if (status === exports.Status.True) {
if (equalv3(sp, n.curve.StartPoint))
n2.used = true;
else {
@ -8097,7 +8097,7 @@ exports.Polyline = Polyline_1 = class Polyline extends Curve {
Join(cu, allowGap = false, tolerance = 1e-4) {
this.WriteAllObjectRecord();
if (this._ClosedMark)
return Status.False;
return exports.Status.False;
let [sp, ep, cuSp, cuEp] = [this.StartPoint, this.EndPoint, cu.StartPoint, cu.EndPoint];
let ocsInv = this.OCSInv;
let [cuSp2, cuEp2] = [cuSp, cuEp].map(p => AsVector2(p.clone().applyMatrix4(ocsInv)));
@ -8121,7 +8121,7 @@ exports.Polyline = Polyline_1 = class Polyline extends Curve {
this.ReadFile(f);
}
else
return Status.False;
return exports.Status.False;
}
else {
let LinkType;
@ -8155,7 +8155,7 @@ exports.Polyline = Polyline_1 = class Polyline extends Curve {
minDis = spepDisSq;
}
if (linkType === LinkType.None)
return Status.False;
return exports.Status.False;
if (cu instanceof exports.Line) {
if (linkType === LinkType.SpSp) {
this._LineData.unshift({ pt: cuEp2, bul: 0 });
@ -8193,7 +8193,7 @@ exports.Polyline = Polyline_1 = class Polyline extends Curve {
}
else if (cu instanceof Polyline_1) {
if (cu.CloseMark)
return Status.False;
return exports.Status.False;
let { pts, buls } = this.PtsBuls;
if (linkType === LinkType.SpSp) {
cu.Reverse();
@ -8231,11 +8231,11 @@ exports.Polyline = Polyline_1 = class Polyline extends Curve {
}
}
else
return Status.False;
return exports.Status.False;
}
//在上面的其他分支已经返回了假 所以这里直接返回真.
this.Update();
return Status.True;
return exports.Status.True;
}
/**
* 将曲线数组组合成多段线
@ -9653,7 +9653,7 @@ exports.Arc = Arc_1 = class Arc extends Curve {
if (cu instanceof Arc_1) {
//非常小的圆弧直接结束
if (cu.AllAngle < 5e-6)
return Status.False;
return exports.Status.False;
if (equalv3(cu.Center, this.Center) && equaln$1(cu._Radius, this._Radius)) {
this.WriteAllObjectRecord();
let [sa, ea] = [cu.StartAngle, cu.EndAngle];
@ -9666,40 +9666,40 @@ exports.Arc = Arc_1 = class Arc extends Curve {
{
if (eaAllan > allAn)
this.EndAngle = ea;
return Status.True;
return exports.Status.True;
}
else if (equaln$1(sa, this._EndAngle)) //this终点对起点
{
if (eaAllan < allAn || equaln$1(ea, this._StartAngle))
return Status.ConverToCircle;
return exports.Status.ConverToCircle;
else
this.EndAngle = ea;
return Status.True;
return exports.Status.True;
}
else if (equaln$1(ea, this.StartAngle)) //this起点对终点
{
if (saAllan < allAn)
return Status.ConverToCircle;
return exports.Status.ConverToCircle;
else
this.StartAngle = sa;
return Status.True;
return exports.Status.True;
}
else if (equaln$1(ea, this._EndAngle)) //this终点对终点
{
if (saAllan > allAn)
this.StartAngle = sa;
return Status.True;
return exports.Status.True;
}
else if (this.ParamOnCurve(this.GetParamAtAngle(sa))) {
if (eaAllan < saAllan)
return Status.ConverToCircle;
return exports.Status.ConverToCircle;
else if (eaAllan > allAn)
this.EndAngle = ea;
return Status.True;
return exports.Status.True;
}
else if (this.ParamOnCurve(this.GetParamAtAngle(ea))) {
this.StartAngle = sa;
return Status.True;
return exports.Status.True;
}
//使用按负方向去计算它的参数
let saParam;
@ -9719,11 +9719,11 @@ exports.Arc = Arc_1 = class Arc extends Curve {
this.StartAngle = sa;
if (eaParam > 1)
this.EndAngle = ea;
return Status.True;
return exports.Status.True;
}
}
}
return Status.False;
return exports.Status.False;
}
Reverse() {
this.WriteAllObjectRecord();
@ -10355,12 +10355,12 @@ function MergeCurvelist(cus) {
if (cir)
return true;
let status = c1.Join(c2, false, LINK_FUZZ);
if (status === Status.ConverToCircle) {
if (status === exports.Status.ConverToCircle) {
let arc = c1;
cir = new exports.Circle(arc.Center, arc.Radius);
return true;
}
return status === Status.True;
return status === exports.Status.True;
});
if (cir) {
cus.length = 0;
@ -11191,13 +11191,13 @@ let Region = Region_1 = class Region extends Entity {
let m = new three.Matrix4().setPosition(moveX, moveY, moveZ);
for (let s of this.ShapeManager.ShapeList)
s.ApplyMatrix(m);
this.Update(UpdateDraw.Matrix);
this.Update(exports.UpdateDraw.Matrix);
}
ApplyScaleMatrix(m) {
this.WriteAllObjectRecord();
for (let s of this._ShapeManager.ShapeList)
s.ApplyScaleMatrix(m);
this.Update(UpdateDraw.Geometry);
this.Update(exports.UpdateDraw.Geometry);
return this;
}
//Z轴归0
@ -14502,7 +14502,7 @@ let SweepSolid = SweepSolid_1 = class SweepSolid extends Entity {
else {
this._Matrix.multiplyMatrices(m, this._Matrix);
this._SpaceOCS.multiplyMatrices(m, this._SpaceOCS);
this.Update(UpdateDraw.Matrix);
this.Update(exports.UpdateDraw.Matrix);
}
}
else {
@ -14524,7 +14524,7 @@ let SweepSolid = SweepSolid_1 = class SweepSolid extends Entity {
}
else
this._PathCurve.ApplyMatrix(this.OCSNoClone).ApplyMatrix(m).ApplyMatrix(ocsInv);
this.Update(UpdateDraw.Geometry);
this.Update(exports.UpdateDraw.Geometry);
return this;
}
_ReadFile(file) {
@ -15342,7 +15342,7 @@ class EdgeGeometryBuild {
pl.ColorIndex = g[0].ColorIndex;
pl.OCS = ComputerCurvesNormalOCS(g);
for (let cu of g) {
if (pl.Join(cu, false, 0.1) === Status.True)
if (pl.Join(cu, false, 0.1) === exports.Status.True)
cu.Erase();
}
pl.CloseMark = true;
@ -16339,7 +16339,7 @@ let ExtrudeSolid = ExtrudeSolid_1 = class ExtrudeSolid extends Entity {
let scaleYSq = te[4] * te[4] + te[5] * te[5] + te[6] * te[6];
let scaleZSq = te[8] * te[8] + te[9] * te[9] + te[10] * te[10];
if (!equaln$1(scaleXSq, 1, 1e-4) || !equaln$1(scaleYSq, 1, 1e-4) || !equaln$1(scaleZSq, 1, 1e-4))
this.Update(UpdateDraw.Geometry);
this.Update(exports.UpdateDraw.Geometry);
else if (this.AutoUpdate)
this.DeferUpdate();
return this;
@ -16392,7 +16392,7 @@ let ExtrudeSolid = ExtrudeSolid_1 = class ExtrudeSolid extends Entity {
this.SetContourCurve(curve);
}
if (this.grooves.length)
this.Update(UpdateDraw.Geometry);
this.Update(exports.UpdateDraw.Geometry);
return this;
}
get Width() {
@ -16421,7 +16421,7 @@ let ExtrudeSolid = ExtrudeSolid_1 = class ExtrudeSolid extends Entity {
}
}
this.thickness = thickness;
this.Update(UpdateDraw.Geometry);
this.Update(exports.UpdateDraw.Geometry);
}
}
//修复#I7CBHO的过程中 直接修改了这个属性
@ -16578,7 +16578,7 @@ let ExtrudeSolid = ExtrudeSolid_1 = class ExtrudeSolid extends Entity {
Join(target) {
let [n, tn] = [this.Normal, target.Normal];
if (!isParallelTo(n, tn))
return Status.False;
return exports.Status.False;
let isEqualNorm = equalv3(n, tn);
let targetZMin = target.Position.applyMatrix4(this.OCSInv).z;
let targetZMax = targetZMin + target.Thickness * (isEqualNorm ? 1 : -1);
@ -16626,12 +16626,12 @@ let ExtrudeSolid = ExtrudeSolid_1 = class ExtrudeSolid extends Entity {
MergeRelevance();
this.GrooveCheckMerge();
this.Update();
return Status.True;
return exports.Status.True;
}
}
else {
if (!isIntersect(0, this.thickness, targetZMin, targetZMax, 1e-5))
return Status.False;
return exports.Status.False;
let matrixToLocal = this.OCSInv.multiply(target.OCS);
let thisCurve = this.ContourCurve;
let targetCurve = target.ContourCurve.Clone().ApplyMatrix(matrixToLocal);
@ -16645,10 +16645,10 @@ let ExtrudeSolid = ExtrudeSolid_1 = class ExtrudeSolid extends Entity {
MergeRelevance();
this.GrooveCheckMerge();
this.Update();
return Status.True;
return exports.Status.True;
}
}
return Status.False;
return exports.Status.False;
}
get Volume() {
let sum = this.ContourCurve.Area * this.thickness;
@ -16929,7 +16929,7 @@ let ExtrudeSolid = ExtrudeSolid_1 = class ExtrudeSolid extends Entity {
*/
GrooveCheckPosition(target) {
if (target.Width < 1e-1 || target.Height < 1e-1 || target.Thickness < 1e-1)
return Status.False;
return exports.Status.False;
let tp = target.Position.applyMatrix4(this.OCSInv);
let minZ = tp.z;
let maxZ = tp.z + target.thickness;
@ -16942,10 +16942,10 @@ let ExtrudeSolid = ExtrudeSolid_1 = class ExtrudeSolid extends Entity {
else if (maxZ >= (this.thickness - 1e-2) && minZ > 0) //正面
target.Thickness = this.thickness - minZ;
else
return Status.False;
return exports.Status.False;
if (equaln$1(target.thickness, this.thickness, 1e-2))
target.thickness = this.thickness;
return target.thickness > 1e-2 ? Status.True : Status.False;
return target.thickness > 1e-2 ? exports.Status.True : exports.Status.False;
}
/**
* (步骤3)
@ -16985,7 +16985,7 @@ let ExtrudeSolid = ExtrudeSolid_1 = class ExtrudeSolid extends Entity {
}));
for (let id of ids) {
let ng = this.grooves[id];
if (equaln$1(startG.knifeRadius, ng.knifeRadius, 1e-3) && startG.Join(ng) === Status.True) {
if (equaln$1(startG.knifeRadius, ng.knifeRadius, 1e-3) && startG.Join(ng) === exports.Status.True) {
ng.TempData.used = true;
stack.push(ng);
}
@ -17125,7 +17125,7 @@ let ExtrudeSolid = ExtrudeSolid_1 = class ExtrudeSolid extends Entity {
this.WriteAllObjectRecord();
//校验Z轴位置
arrayRemoveIf(this.grooves, g => {
return this.GrooveCheckPosition(g) === Status.False;
return this.GrooveCheckPosition(g) === exports.Status.False;
});
//清除全深洞的子槽
for (let g of this.grooves) {
@ -17344,7 +17344,7 @@ let ExtrudeSolid = ExtrudeSolid_1 = class ExtrudeSolid extends Entity {
*/
get SplitExtrudes() {
if (this.NeedUpdateRelevanceGroove)
this.Update(UpdateDraw.Geometry); //我们先直接更新绘制
this.Update(exports.UpdateDraw.Geometry); //我们先直接更新绘制
if (this.NeedUpdateRelevanceGroove) //如果更新失败,那么我们更新这个槽(似乎也证明了我们没有绘制实体)
this.CalcRelevanceGroove(); //注意,这也将更新绘制的实体(EdgeGeo,MeshGeo)(如果拆单也用这个,可能会带来性能损耗)
if (this.__CacheSplitExtrudes)
@ -17521,10 +17521,10 @@ let ExtrudeSolid = ExtrudeSolid_1 = class ExtrudeSolid extends Entity {
}
}
DeferUpdate() {
if (this.NeedUpdateFlag & UpdateDraw.Matrix) {
if (this.NeedUpdateFlag & exports.UpdateDraw.Matrix) {
//如果是Jig实体,那么就算它有关联切割,我们也不更新实体(因为似乎没必要?)
if (this.Id && this.RelevanceKnifs.some(id => !id.IsErase))
this.NeedUpdateFlag |= UpdateDraw.Geometry;
this.NeedUpdateFlag |= exports.UpdateDraw.Geometry;
}
super.DeferUpdate();
}
@ -17904,11 +17904,11 @@ let CompositeEntity = CompositeEntity_1 = class CompositeEntity extends Entity {
newObj.userData.IsClone = true;
this._CacheDrawObject.set(type, newObj);
}
this.NeedUpdateFlag = UpdateDraw.None;
this.NeedUpdateFlag = exports.UpdateDraw.None;
}
ApplyMirrorMatrix(m) {
if (this.Id)
this.Update(UpdateDraw.Geometry);
this.Update(exports.UpdateDraw.Geometry);
return this;
}
//#endregion
@ -19460,7 +19460,7 @@ let Board = Board_1 = class Board extends ExtrudeSolid {
if (!this.__ReadFileIng__) //看起来使用 this.ReadFileIng 似乎也是没问题的
{
if (key === EBoardKeyList.Lines)
this.Update(UpdateDraw.Geometry);
this.Update(exports.UpdateDraw.Geometry);
else if (key === EBoardKeyList.ComposingFace) {
let obj = this.CacheDrawObject.get(RenderType.PlaceFace);
if (obj) {
@ -19505,7 +19505,7 @@ let Board = Board_1 = class Board extends ExtrudeSolid {
this._BoardProcessOption.drillType = type;
this._BoardProcessOption.highDrill = Array(4).fill(type);
this.ConverToRectSolid(width, length, thickness);
this.Update(UpdateDraw.Geometry);
this.Update(exports.UpdateDraw.Geometry);
}
static CreateBoard(length, width, thickness, boardType = BoardType.Layer) {
let board = new Board_1();
@ -19715,7 +19715,7 @@ let Board = Board_1 = class Board extends ExtrudeSolid {
this.WriteAllObjectRecord();
this._2DModelingList = ms;
this.Clear2DPathCache();
this.Update(UpdateDraw.Geometry);
this.Update(exports.UpdateDraw.Geometry);
}
get Modeling3D() {
return [...this._3DModelingList];
@ -19724,7 +19724,7 @@ let Board = Board_1 = class Board extends ExtrudeSolid {
this.WriteAllObjectRecord();
this.Clear3DPathCache();
this._3DModelingList = ms;
this.Update(UpdateDraw.Geometry);
this.Update(exports.UpdateDraw.Geometry);
}
ClearModeling2DList() {
if (this._2DModelingList.length === 0)
@ -19732,7 +19732,7 @@ let Board = Board_1 = class Board extends ExtrudeSolid {
this.WriteAllObjectRecord();
this._2DModelingList.length = 0;
this.Clear2DPathCache();
this.Update(UpdateDraw.Geometry);
this.Update(exports.UpdateDraw.Geometry);
}
ClearModeling3DList() {
if (this._3DModelingList.length === 0)
@ -19740,7 +19740,7 @@ let Board = Board_1 = class Board extends ExtrudeSolid {
this.WriteAllObjectRecord();
this._3DModelingList.length = 0;
this.Clear3DPathCache();
this.Update(UpdateDraw.Geometry);
this.Update(exports.UpdateDraw.Geometry);
}
get IsChaiDan() {
return this._IsChaiDan;
@ -19749,7 +19749,7 @@ let Board = Board_1 = class Board extends ExtrudeSolid {
if (this._IsChaiDan !== v) {
this.WriteAllObjectRecord();
this._IsChaiDan = v;
this.Update(UpdateDraw.Geometry);
this.Update(exports.UpdateDraw.Geometry);
}
}
get OpenDir() {
@ -19760,7 +19760,7 @@ let Board = Board_1 = class Board extends ExtrudeSolid {
this.WriteAllObjectRecord();
this._OpenDir = v;
//开门方向改变更新
this.Update(UpdateDraw.Geometry);
this.Update(exports.UpdateDraw.Geometry);
}
}
ClearBoardModeling() {
@ -19768,7 +19768,7 @@ let Board = Board_1 = class Board extends ExtrudeSolid {
return;
this.WriteAllObjectRecord();
this.grooves.length = 0;
this.Update(UpdateDraw.Geometry);
this.Update(exports.UpdateDraw.Geometry);
}
/**
* 注意传入的排钻列表,避免指针被引用
@ -20533,7 +20533,7 @@ let Board = Board_1 = class Board extends ExtrudeSolid {
}
this.Clear2DPathCache();
this.Clear3DPathCache();
this.Update(UpdateDraw.Geometry);
this.Update(exports.UpdateDraw.Geometry);
}
GetObjectSnapPoints(snapMode, pickPoint, lastPoint, viewXform, frustum) {
let pts = super.GetObjectSnapPoints(snapMode, pickPoint, lastPoint, viewXform, frustum);
@ -20572,9 +20572,9 @@ let Board = Board_1 = class Board extends ExtrudeSolid {
return pts;
}
DeferUpdate() {
if (this.NeedUpdateFlag & UpdateDraw.Matrix) {
if (this.NeedUpdateFlag & exports.UpdateDraw.Matrix) {
if (this.RelativeHardware.some(id => !id.IsErase))
this.NeedUpdateFlag |= UpdateDraw.Geometry;
this.NeedUpdateFlag |= exports.UpdateDraw.Geometry;
}
super.DeferUpdate();
}
@ -22949,22 +22949,26 @@ function Polyline2Points(pl, outside, knifeRadius) {
*/
function PolylineFilletMinArc(pl, radius = 30) {
let ocsInv = pl.OCSInv;
for (let i = 0; i < pl.LineData.length; i++) {
for (let i = 0; i < pl.EndParam; i++) {
let bul = pl.LineData[i].bul;
if (equaln(bul, BUL_IS_LINE_FUZZ))
continue;
let arc = pl.GetCurveAtIndex(i);
if (arc.Radius > radius)
continue;
let preCurve = pl.GetCurveAtIndex(FixIndex(i - 1, pl.LineData));
let preCurve = pl.GetCurveAtIndex(FixIndex(i - 1, pl.EndParam));
if (!(preCurve instanceof exports.Line))
continue;
let nextCurve = pl.GetCurveAtIndex(FixIndex(i + 1, pl.LineData));
let nextCurve = pl.GetCurveAtIndex(FixIndex(i + 1, pl.EndParam));
if (!(nextCurve instanceof exports.Line))
continue;
if (preCurve.IntersectWith2(arc, IntersectOption.ExtendThis).length === 2)
continue;
let ipt = nextCurve.IntersectWith(preCurve, IntersectOption.ExtendBoth)[0];
if (!ipt)
continue;
if (ipt.distanceTo(arc.Midpoint) > 50)
continue;
pl.LineData.splice(i, 1);
pl.SetPointAt(i, ipt.applyMatrix4(ocsInv));
}

File diff suppressed because one or more lines are too long

View File

@ -22940,26 +22940,30 @@ function Polyline2Points(pl, outside, knifeRadius) {
*/
function PolylineFilletMinArc(pl, radius = 30) {
let ocsInv = pl.OCSInv;
for (let i = 0; i < pl.LineData.length; i++) {
for (let i = 0; i < pl.EndParam; i++) {
let bul = pl.LineData[i].bul;
if (equaln(bul, BUL_IS_LINE_FUZZ))
continue;
let arc = pl.GetCurveAtIndex(i);
if (arc.Radius > radius)
continue;
let preCurve = pl.GetCurveAtIndex(FixIndex(i - 1, pl.LineData));
let preCurve = pl.GetCurveAtIndex(FixIndex(i - 1, pl.EndParam));
if (!(preCurve instanceof Line))
continue;
let nextCurve = pl.GetCurveAtIndex(FixIndex(i + 1, pl.LineData));
let nextCurve = pl.GetCurveAtIndex(FixIndex(i + 1, pl.EndParam));
if (!(nextCurve instanceof Line))
continue;
if (preCurve.IntersectWith2(arc, IntersectOption.ExtendThis).length === 2)
continue;
let ipt = nextCurve.IntersectWith(preCurve, IntersectOption.ExtendBoth)[0];
if (!ipt)
continue;
if (ipt.distanceTo(arc.Midpoint) > 50)
continue;
pl.LineData.splice(i, 1);
pl.SetPointAt(i, ipt.applyMatrix4(ocsInv));
}
}
export { Arc, BUL_IS_LINE_FUZZ, BoolOpeartionType, CADFiler, Circle, Circle2Points, ComputeBiarc, Contour, ConverToPolylineAndSplitArc, CurveContainerCurve, Curves2Points, FeedingToolPath, IsPtsAllOutOrOnReg, IsRect, Line, ParseRegionTextPos, PointsSimplify2PolylineAndParseArc, Polyline, Polyline2Points, PolylineFilletMinArc, Production, Shape, ShapeManager, SmartPointsSimply2Polyline, SmartPolylineSimply2Polyline, SplineConver2Polyline, TEXT_BOX, TempPolyline, VData2Curve, VKnifToolPath, fastCurveInCurve2, isTargetCurInOrOnSourceCur };
export { Arc, BUL_IS_LINE_FUZZ, BoolOpeartionType, CADFiler, Circle, Circle2Points, ComputeBiarc, Contour, ConverToPolylineAndSplitArc, CurveContainerCurve, Curves2Points, DuplicateRecordCloning, FeedingToolPath, IsPtsAllOutOrOnReg, IsRect, Line, ParseRegionTextPos, PointsSimplify2PolylineAndParseArc, Polyline, Polyline2Points, PolylineFilletMinArc, Production, Shape, ShapeManager, SmartPointsSimply2Polyline, SmartPolylineSimply2Polyline, SplineConver2Polyline, Status, TEXT_BOX, TempPolyline, UpdateDraw, VData2Curve, VKnifToolPath, fastCurveInCurve2, isTargetCurInOrOnSourceCur };
//# sourceMappingURL=api.esm.js.map

File diff suppressed because one or more lines are too long

View File

@ -168,9 +168,6 @@ export declare class Board extends ExtrudeSolid {
private _async2DPathIng;
GoodBye(): void;
HandleSpliteEntitys(splitEntitys: this[]): void;
InitDrawObject(renderType?: RenderType): Object3D;
UpdateDrawObject(renderType: RenderType, obj: Object3D): Object3D;
private DrawAsyncText;
private get PlaceColor();
private GetPlaceFace;
private GetBigHoleFace;

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
{"version":3,"file":"Curves2Points.d.ts","sourceRoot":"","sources":["../../../../src/Nest/Converter/Curves2Points.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,sCAAsC,CAAC;AAE9D,OAAO,EAAoB,QAAQ,EAAE,MAAM,wCAAwC,CAAC;AAIpF,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAIxC,aAAa;AACb,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,SAAK,EAAE,OAAO,UAAQ,GAAG,KAAK,EAAE,CAiB1G;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,GAAG,CAAC,CAAC,MAAM,GAAG,QAAQ,CAAC,EAAE,KAAK,EAAE,CAAC,CAM1H;AAED,wBAAgB,eAAe,CAAC,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,GAAG,CAAC,QAAQ,EAAE,KAAK,EAAE,CAAC,CAqDxG;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,QAAQ,EAAE,MAAM,SAAK,QAyB7D"}
{"version":3,"file":"Curves2Points.d.ts","sourceRoot":"","sources":["../../../../src/Nest/Converter/Curves2Points.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,sCAAsC,CAAC;AAE9D,OAAO,EAAoB,QAAQ,EAAE,MAAM,wCAAwC,CAAC;AAIpF,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAIxC,aAAa;AACb,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,SAAK,EAAE,OAAO,UAAQ,GAAG,KAAK,EAAE,CAiB1G;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,GAAG,CAAC,CAAC,MAAM,GAAG,QAAQ,CAAC,EAAE,KAAK,EAAE,CAAC,CAM1H;AAED,wBAAgB,eAAe,CAAC,EAAE,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,GAAG,CAAC,QAAQ,EAAE,KAAK,EAAE,CAAC,CAqDxG;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,QAAQ,EAAE,MAAM,SAAK,QA6B7D"}

1
types/api.d.ts vendored
View File

@ -15,4 +15,5 @@ export * from "./DatabaseServices/Contour";
export * from "./DatabaseServices/Shape";
export * from "./DatabaseServices/ShapeManager";
export * from "./Nest/Converter/Curves2Points";
export * from "./Common/Status";
//# sourceMappingURL=api.d.ts.map

View File

@ -1 +1 @@
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/api.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,kCAAkC,CAAC;AACjD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oCAAoC,CAAC;AACnD,cAAc,0CAA0C,CAAC;AACzD,cAAc,mCAAmC,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,2CAA2C,CAAC;AAC5E,cAAc,yCAAyC,CAAC;AACxD,cAAc,sBAAsB,CAAC;AACrC,cAAc,wCAAwC,CAAC;AACvD,cAAc,yDAAyD,CAAC;AACxE,cAAc,4BAA4B,CAAC;AAC3C,cAAc,0BAA0B,CAAC;AACzC,cAAc,iCAAiC,CAAC;AAGhD,cAAc,gCAAgC,CAAC"}
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/api.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,kCAAkC,CAAC;AACjD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oCAAoC,CAAC;AACnD,cAAc,0CAA0C,CAAC;AACzD,cAAc,mCAAmC,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,2CAA2C,CAAC;AAC5E,cAAc,yCAAyC,CAAC;AACxD,cAAc,sBAAsB,CAAC;AACrC,cAAc,wCAAwC,CAAC;AACvD,cAAc,yDAAyD,CAAC;AACxE,cAAc,4BAA4B,CAAC;AAC3C,cAAc,0BAA0B,CAAC;AACzC,cAAc,iCAAiC,CAAC;AAGhD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,iBAAiB,CAAC"}