!1049 优化:椭圆转圆弧

pull/1049/MERGE
ZoeLeeFZ 4 years ago committed by ChenX
parent f30df1b260
commit 0efb763ded

@ -1,6 +1,6 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`丢失线段板件 1`] = `554052.5007766776`;
exports[`丢失线段板件 1`] = `554052.5007766777`;
exports[`丢失线段板件 2`] = `398758.8789695821`;
@ -10,7 +10,7 @@ exports[`常规板件,常规坐标系 2`] = `711624`;
exports[`常规板件,常规坐标系 3`] = `712816`;
exports[`异型板件,常规坐标系 1`] = `2709777.7883832157`;
exports[`异型板件,常规坐标系 1`] = `2709777.788383215`;
exports[`异型板件,常规坐标系 2`] = `2682243.404899421`;
@ -26,6 +26,6 @@ exports[`异型板件,非常规坐标系 2`] = `75863286.03232269`;
exports[`异型板件,非常规坐标系 3`] = `75694680.60847883`;
exports[`异型板件,非相切圆弧 1`] = `635612.2751433643`;
exports[`异型板件,非相切圆弧 1`] = `635612.2751433642`;
exports[`异型板件,非相切圆弧 2`] = `626242.2196800549`;

@ -121,15 +121,15 @@ Array [
]
`;
exports[`完整椭圆 几何数据 1`] = `1150.6559640322623`;
exports[`完整椭圆 几何数据 1`] = `1150.6406157603783`;
exports[`完整椭圆 几何数据 2`] = `78539.81633974482`;
exports[`非完整椭圆 GetParamAtDist 1`] = `242.30725311615984`;
exports[`非完整椭圆 GetParamAtDist 1`] = `242.30690135013103`;
exports[`非完整椭圆 GetParamAtDist 2`] = `605.7681327903996`;
exports[`非完整椭圆 GetParamAtDist 2`] = `605.7672533753275`;
exports[`非完整椭圆 GetParamAtDist 3`] = `969.2290124646394`;
exports[`非完整椭圆 GetParamAtDist 3`] = `969.2276054005241`;
exports[`非完整椭圆 GetPointAtParam 1`] = `
Vector3 {
@ -307,10 +307,10 @@ Array [
]
`;
exports[`非完整椭圆 几何参数 1`] = `885.1880105792319`;
exports[`非完整椭圆 几何参数 1`] = `885.1762033087015`;
exports[`非完整椭圆 几何参数 2`] = `72828.18768552072`;
exports[`非完整椭圆 几何参数 3`] = `1211.5362655807992`;
exports[`非完整椭圆 几何参数 3`] = `1211.534506750655`;
exports[`非完整椭圆 几何参数 4`] = `72828.18768552072`;

@ -23,9 +23,9 @@ describe('完整椭圆', () =>
test("几何数据", () =>
{
expect(el.Length).toMatchSnapshot();
expect(el.Length).toBeCloseTo(1150.66);
expect(el.Length).toBeCloseTo(1150, -1);
expect(el.Area).toMatchSnapshot();
expect(el.Area).toBeCloseTo(78539.82);
expect(el.Area).toBeCloseTo(78539.82, -1);
});
test("PtOnCurve", () =>
{

@ -50,7 +50,7 @@ exports[`圆弧如果连接就自交,需要补圆弧才能解决 2`] = `"948.214
exports[`圆弧连接后逆向 1`] = `1`;
exports[`圆弧连接后逆向 2`] = `"4159.59627"`;
exports[`圆弧连接后逆向 2`] = `"4159.59626"`;
exports[`圆弧连接成圆 1`] = `7`;
@ -84,19 +84,19 @@ exports[`圆弧错误连接 1`] = `1`;
exports[`圆弧错误连接 2`] = `"3624.05703"`;
exports[`圆求交错误导致的线丢失 1`] = `4148.6552754623435`;
exports[`圆求交错误导致的线丢失 1`] = `4148.655275462344`;
exports[`圆求交错误导致的线丢失 2`] = `4425.280774659386`;
exports[`圆求交错误导致的线丢失 3`] = `4021.9003150863045`;
exports[`圆求交错误导致的线丢失 4`] = `4581.224228650713`;
exports[`圆求交错误导致的线丢失 4`] = `4581.2242286507135`;
exports[`圆求交错误导致的线丢失 5`] = `3900.607880862771`;
exports[`圆求交错误导致的线丢失 6`] = `4757.468532252452`;
exports[`圆求交错误导致的线丢失 7`] = `3783.748625630569`;
exports[`圆求交错误导致的线丢失 7`] = `3783.7486256305697`;
exports[`圆求交错误导致的线丢失 8`] = `4972.0124797019525`;
@ -110,7 +110,7 @@ exports[`圆求交错误导致的线丢失 12`] = `6051.226636287796`;
exports[`圆求交错误导致的线丢失 13`] = `722.4732418587959`;
exports[`圆求交错误导致的线丢失 14`] = `6316.980880964775`;
exports[`圆求交错误导致的线丢失 14`] = `6316.980880964776`;
exports[`复杂圆盘选点 1`] = `1`;
@ -180,7 +180,7 @@ exports[`简单图形因为点在线内算法错误导致的丢失 1`] = `8.6751
exports[`简单图形因为点在线内算法错误导致的丢失 2`] = `8.252841733482935`;
exports[`简单图形因为点在线内算法错误导致的丢失 3`] = `7.1494048498542835`;
exports[`简单图形因为点在线内算法错误导致的丢失 3`] = `7.149404849854285`;
exports[`简单图形因为点在线内算法错误导致的丢失 4`] = `6.693604273021889`;
@ -224,7 +224,7 @@ exports[`纯圆生成的多段线偏移 3`] = `1`;
exports[`纯圆生成的多段线偏移 4`] = `"6328.57819"`;
exports[`补充bug测试 1`] = `7385.1233916443525`;
exports[`补充bug测试 1`] = `7385.123391644352`;
exports[`补充bug测试 2`] = `7455.861403941375`;

@ -4,21 +4,21 @@ exports[`补充bug测试#IKWGF 1`] = `0.4457395323075094`;
exports[`补充bug测试#IKWGF 2`] = `10.732981364094256`;
exports[`补充bug测试#IKWGF 3`] = `1.1376403544773555`;
exports[`补充bug测试#IKWGF 3`] = `1.1376403544773557`;
exports[`补充bug测试#IKWGF 4`] = `12.786911814880929`;
exports[`补充bug测试#IKWGF 4`] = `12.786911814880932`;
exports[`补充bug测试#IKWGF 5`] = `10.58669384113781`;
exports[`补充bug测试#IKWGF 5`] = `10.586573062117633`;
exports[`补充bug测试#IKWGF 6`] = `0.6246933440840138`;
exports[`补充bug测试#IKWGF 6`] = `0.624693344084014`;
exports[`补充bug测试#IKWGF 7`] = `14.067113755971711`;
exports[`补充bug测试#IKWGF 8`] = `11.891017922899254`;
exports[`补充bug测试#IKWGF 8`] = `11.89101792289923`;
exports[`补充bug测试#IKWGF 9`] = `2.168984971098264`;
exports[`补充bug测试#IKWGF 10`] = `0.39474593983901424`;
exports[`补充bug测试#IKWGF 10`] = `0.394745939839015`;
exports[`补充bug测试#IKWGF 11`] = `10.69886845125427`;

@ -109,3 +109,12 @@ test('方向判断错误', () =>
let cus = pl.GetOffsetCurves(-6);
expect(cus.length).toBe(0);
});
test('椭圆弧', () =>
{
let plD = { "file": [1, "Polyline", 8, 2, 102, false, 1, 7, 0, [0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1, 0, 1289.9346364607509, 332.5030722578549, 0, 1], 0, 0, true, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 820.1803525743126, 581.2659525093524, 0, 1], 0, 2, 29, [432.0460356435176, 403.46037661698426], 0.021580076459698706, [463.92416271981983, 504.9908627206493], 0.023385317556476135, [485.74158736249274, 604.8737255606712], 0.027571231622566708, [496.47815104357187, 698.4385534824789], 0.03563178898710651, [495.63182397816263, 781.3103591222867], 0.050842162235323375, [483.2421794792187, 849.6141489537733], 0.07910092533357932, [459.88854355341005, 900.1561136786283], 0.12063838591401563, [426.6629062609251, 930.5729671996768], 0.13545567593018473, [385.11886147391715, 939.4424512521792], 0.09932499578553051, [337.19896255373715, 926.3498386195639], 0.06291985365077717, [285.14389071475034, 891.9073253171384], 0.04203344039554631, [231.38768326109079, 837.72540498682], 0.030968741370535888, [178.4439207075584, 766.3375640043748], 0.025115858156859405, [128.78819454839015, 681.0818184722556], 0.022236616398650932, [84.74235135041363, 585.9446322965887], 0.02136646021764985, [48.36592578812645, 485.3745145655607], 0.022236616398651377, [21.359839091328695, 384.07401220861504], 0.025115858156859405, [4.986865858853321, 286.77982412854294], 0.030968741370536998, [0.012588121797818985, 198.0413184252447], 0.04203344039554542, [6.669597578634011, 122.00780899964019], 0.06291985365077939, [24.646619865895417, 62.234538247294836], 0.09932499578553959, [53.103069401454434, 21.51643787536966], 0.13545567593018348, [90.70835423210053, 1.7574410023376004], 0.1206383859140207, [135.70409303442523, 3.881456361433834], 0.0791009253335779, [185.98633507120292, 27.78916735514042], 0.05084216223532371, [239.20393858949257, 72.36267598890424], 0.03563178898710676, [292.868507595897, 135.5177745389069], 0.027571231622567013, [344.47074648756154, 214.30140078880106], 0.023385317556475747, [391.5977919256808, 305.02971993685304], 0.021580076459698203, true], "basePt": { "x": 350.35357093768766, "y": 332.503072257855, "z": 0 }, "ucs": [0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1] };
let f = new CADFiler(plD.file);
f.Read();
let pl = f.ReadObject() as Polyline;
let cus = pl.GetOffsetCurves(1);
expect(cus.length).toBe(1);
});

@ -1,11 +1,10 @@
import { Matrix4, Vector3 } from "three";
import { Vector3 } from "three";
import { app } from "../ApplicationServices/Application";
import { Command } from "../Editor/CommandMachine";
import { JigUtils } from "../Editor/JigUtils";
import { PromptStatus } from "../Editor/PromptResult";
import { MoveMatrix } from "../Geometry/GeUtils";
import { GetMirrorMat } from "../Common/Matrix4Utils";
import { Curve } from "../DatabaseServices/Entity/Curve";
import { MirrorEntitys } from "../Common/BoardUtil";
export class MirrorCommand implements Command
@ -38,16 +37,7 @@ export class MirrorCommand implements Command
Callback: (v) =>
{
JigUtils.Restore();
let rot = new Matrix4().makeRotationAxis(nor, Math.PI / 2);
let vec = v.clone().sub(p1).applyMatrix4(rot).normalize();
let newMat = GetMirrorMat(vec);
for (let en of cloneEns)
{
en.ApplyMatrix(MoveMatrix(p1.clone().negate()))
.ApplyMatrix(newMat)
.ApplyMatrix(MoveMatrix(p1));
}
MirrorEntitys(cloneEns, p1, v, nor);
}
});
if (ptRes.Status === PromptStatus.Cancel)

@ -1,5 +1,8 @@
import { Board } from "../DatabaseServices/Entity/Board";
import { Matrix4, Box3 } from "three";
import { Matrix4, Box3, Vector3 } from "three";
import { Entity } from "../DatabaseServices/Entity/Entity";
import { GetMirrorMat } from "./Matrix4Utils";
import { MoveMatrix } from "../Geometry/GeUtils";
/**分析不同柜体 */
export function ParseBoardList(borads: Board[], ocsInv?: Matrix4)
@ -46,3 +49,17 @@ export function ParseBoardList(borads: Board[], ocsInv?: Matrix4)
}
return boardMap;
}
export function MirrorEntitys(ens: Entity[], p1: Vector3, v: Vector3, nor: Vector3)
{
let rot = new Matrix4().makeRotationAxis(nor, Math.PI / 2);
let vec = v.clone().sub(p1).applyMatrix4(rot).normalize();
let newMat = GetMirrorMat(vec);
for (let en of ens)
{
en.ApplyMatrix(MoveMatrix(p1.clone().negate()))
.ApplyMatrix(newMat)
.ApplyMatrix(MoveMatrix(p1));
}
}

@ -8,14 +8,15 @@ import { Polyline } from '../DatabaseServices/Entity/Polyline';
import { IsPointInBowArc } from '../DatabaseServices/PointInPolyline';
import { Count } from '../Geometry/Count';
import { CurveMap, Vertice } from '../Geometry/CurveMap';
import { AsVector2, AsVector3, equaln, equalv2, equalv3, isParallelTo, ZeroVec } from '../Geometry/GeUtils';
import { AsVector2, AsVector3, equaln, equalv2, equalv3, isParallelTo, ZeroVec, ZAxis } from '../Geometry/GeUtils';
import { Orbit } from '../Geometry/Orbit';
import { PlaneExt } from '../Geometry/Plane';
import { IntersectOption, IntersectResult } from '../GraphicsSystem/IntersectWith';
import { IntersectOption, IntersectResult, IntersectLineAndEllipseFor2D } from '../GraphicsSystem/IntersectWith';
import { OffsetPolyline } from '../GraphicsSystem/OffsetPolyline';
import { arrayLast, changeArrayStartIndex, equalArray } from './ArrayExt';
import { Status } from './Status';
import { FixIndex } from './Utils';
import { MirrorEntitys } from './BoardUtil';
//3点获取圆心
export function getCircleCenter(pt1: Vector3, pt2: Vector3, pt3: Vector3)
@ -650,3 +651,122 @@ export function ComputerCurvesNormalOCS(curves: Curve[], allowAutoCalc: boolean
}
return new Matrix4().makeBasis(x, y, normal).setPosition(curves[0].StartPoint);
}
export function Ellipse2Polyline(el: Ellipse)
{
let ocs = el.OCS;
el = el.Clone().ApplyMatrix(el.OCSInv);
let a1: Vector3;
let b1: Vector3;
let d: Vector3;
let roMat = new Matrix4();
if (el.RadX > el.RadY)
{
a1 = new Vector3(el.RadX);
b1 = new Vector3(0, el.RadY);
d = new Vector3(el.RadX, el.RadY);
}
else
{
a1 = new Vector3(el.RadY);
b1 = new Vector3(0, el.RadX);
d = new Vector3(el.RadY, el.RadX);
roMat.makeRotationZ(Math.PI / 2);
}
let tmpMat4 = new Matrix4().makeRotationZ(el.Rotation);
let mtx = el.OCS.multiply(tmpMat4).multiply(new Matrix4().getInverse(roMat));
let bl = new Line(b1, new Vector3);
let al = new Line(new Vector3, a1);
let ab = new Line(a1, b1);
let abd = ab.GetClosestAtPoint(d, true).closestPt;
let dc1 = new Line(d, abd);
let C1 = dc1.IntersectWith(bl, IntersectOption.ExtendBoth)[0];
if (!C1) return;
let C2 = dc1.IntersectWith(al, IntersectOption.ExtendBoth)[0];
if (!C2) return;
let r = a1.distanceTo(C2);
let cir2 = new Circle(C2, r);
let e = new Vector3(0, b1.y - 2 * r);
let r2 = C1.distanceTo(e);
let cir1 = new Circle(C1, r2);
let pts = cir1.IntersectWith(cir2, 0);
if (pts.length !== 2) return;
let close1 = bl.GetClosestPointTo(pts[0], true);
let close2 = bl.GetClosestPointTo(pts[1], true);
let c3: Vector3;
if (close1.distanceTo(pts[0]) < close2.distanceTo(pts[1]))
{
c3 = pts[0];
}
else
c3 = pts[1];
let cl = new Line(C1, c3);
let cl2 = new Line(c3, C2);
[cl, cl2].forEach(l => l.ApplyMatrix(mtx));
let res = IntersectLineAndEllipseFor2D(cl, el);
if (res.length === 0) return;
res.sort((r1, r2) => r2.thisParam - r1.thisParam);
let A1 = res[0].pt;
let par1 = res[0].argParam;
res = IntersectLineAndEllipseFor2D(cl2, el);
if (res.length === 0) return;
res.sort((r1, r2) => r2.thisParam - r1.thisParam);
let A2 = res[0].pt;
let par2 = res[0].argParam;
let AA1 = el.GetPointAtParam(par1 + 0.05);
let AA2 = el.GetPointAtParam(par2 - 0.01);
let A3 = el.GetPointAtParam(par2 + 0.05);
[a1, b1].forEach(p =>
{
p.applyMatrix4(mtx);
});
let arc1 = new Arc();
let arc2 = new Arc();
let arc3 = new Arc();
arc1.FromThreePoint(A1, AA1, b1);
arc2.FromThreePoint(A2, A3, A1);
arc3.FromThreePoint(a1, AA2, A2);
let center = el.Center;
let pl1 = Polyline.Combine([arc3, arc2, arc1]);
let pl2 = pl1.Clone();
MirrorEntitys([pl2], b1, center, ZAxis);
pl1.Join(pl2);
pl2 = pl1.Clone();
MirrorEntitys([pl2], a1, center, ZAxis);
pl1.Join(pl2);
pl1.CloseMark = true;
return pl1.ApplyMatrix(ocs);
}

@ -8,3 +8,7 @@ export function Log(message?: any, ...optionalParams: any[]): void
for (let f of _LogInjectFunctions)
f(message, ...optionalParams);
}
export const LogEnable = {
Display: false
};

@ -1,10 +1,10 @@
import { Box3, BufferGeometry, Matrix3, Matrix4, Object3D, Shape, Vector3, Line as TLine } from 'three';
import { arrayLast, arrayRemoveDuplicateBySort } from '../../Common/ArrayExt';
import { ColorMaterial } from '../../Common/ColorPalette';
import { getDeterminantFor2V, getArcOrCirNearPts, getTanPtsOnEllipse } from '../../Common/CurveUtils';
import { getDeterminantFor2V, getArcOrCirNearPts, getTanPtsOnEllipse, Ellipse2Polyline } from '../../Common/CurveUtils';
import { Status } from '../../Common/Status';
import { ObjectSnapMode } from '../../Editor/ObjectSnapMode';
import { angle, equaln, equalv3, MoveMatrix, rotatePoint, angleTo, AsVector2 } from '../../Geometry/GeUtils';
import { angle, equaln, equalv3, MoveMatrix, rotatePoint, angleTo, AsVector2, AsVector3 } from '../../Geometry/GeUtils';
import { IntersectEllipse, IntersectEllipseAndCircleOrArc, IntersectEllipseAndLine, IntersectOption, IntersectPolylineAndCurve, reverseIntersectOption } from '../../GraphicsSystem/IntersectWith';
import { RenderType } from '../../GraphicsSystem/RenderType';
import { Arc } from './Arc';
@ -15,6 +15,7 @@ import { Curve } from './Curve';
import { Line } from './Line';
import { Polyline } from './Polyline';
import { SwapParam } from './../../Common/CurveUtils';
import { FixIndex } from '../../Nest/Common/Util';
@Factory
export class Ellipse extends Curve
@ -124,12 +125,9 @@ export class Ellipse extends Curve
}
get Length()
{
let q = this._radX + this._radY;
let h = ((this._radX - this._radY) / (this._radX + this._radY)) ** 2;
let m = 22 / 7 * Math.PI - 1;
let n = Math.pow(((this._radX - this._radY) / this._radX), 33.697);
let len = Math.PI * q * (1 + 3 * h / (10 + Math.sqrt(4 - 3 * h))) * (1 + m * n);
return len * this.TotalAngle / Math.PI * 0.5;
let a = this._radX;
let b = this._radY;
return Math.PI * Math.abs(3 * (a + b) - Math.sqrt((3 * a + b) * (a + 3 * b))) * this.TotalAngle / Math.PI * 0.5;
}
get Area()
{
@ -554,13 +552,20 @@ export class Ellipse extends Curve
}
}
}
Convert2Polyline(count = 10)
Convert2Polyline()
{
let pts = this.Shape.getPoints(this.Length / 50);
let pl = new Polyline(pts.map(p =>
let pts = this.Shape.getPoints(29);
pts.pop();
let pl = new Polyline();
for (let i = 0; i < pts.length; i += 2)
{
return { pt: p, bul: 0 };
})).ApplyMatrix(this.OCS);
let p1 = AsVector3(pts[i]);
let p2 = AsVector3(pts[FixIndex(i + 1, pts.length)]);
let p3 = AsVector3(pts[FixIndex(i + 2, pts.length)]);
let arc = new Arc().FromThreePoint(p1, p2, p3);
pl.Join(arc);
}
pl.ApplyMatrix(this.OCS);
pl.CloseMark = true;
return pl;
}

@ -847,52 +847,88 @@ export class Polyline extends Curve
}
else
{
enum LinkType
{
None = 0,
SpSp = 1,
SpEp = 2,
EpSp = 3,
EpEp = 4,
};
let spspDisSq = cuSp.distanceToSquared(sp);
let spepDisSq = cuSp.distanceToSquared(ep);
let epspDisSq = cuEp.distanceToSquared(sp);
let epepDisSq = cuEp.distanceToSquared(ep);
let minDis = tolerance * tolerance;
let linkType = LinkType.None;
if (spspDisSq < minDis)
{
linkType = LinkType.SpSp;
minDis = spspDisSq;
}
if (spepDisSq < minDis)
{
linkType = LinkType.SpEp;
minDis = spepDisSq;
}
if (epspDisSq < minDis)
{
linkType = LinkType.EpSp;
minDis = epspDisSq;
}
if (epepDisSq < minDis)
linkType = LinkType.EpEp;
if (linkType === LinkType.None)
return Status.False;
if (cu instanceof Line)
{
if (equalv3(cuSp, sp, tolerance))
if (linkType === LinkType.SpSp)
{
this._LineData.unshift({ pt: cuEp2, bul: 0 });
}
else if (equalv3(cuSp, ep, tolerance))
else if (linkType === LinkType.SpEp)
{
this._LineData.push({ pt: cuEp2, bul: 0 });
}
else if (equalv3(cuEp, sp, tolerance))
else if (linkType === LinkType.EpSp)
{
this._LineData.unshift({ pt: cuSp2, bul: 0 });
}
else if (equalv3(cuEp, ep, tolerance))
else if (linkType === LinkType.EpEp)
{
this._LineData.push({ pt: cuSp2, bul: 0 });
}
else
return Status.False;
}
else if (cu instanceof Arc)
{
let dir = equalv3(this.Normal, cu.Normal.negate()) ? -1 : 1;
let bul = cu.Bul * dir;
if (equalv3(cuSp, sp, tolerance))
if (linkType === LinkType.SpSp)
{
this._LineData.unshift({ pt: cuEp2, bul: -bul });
}
else if (equalv3(cuSp, ep, tolerance))
else if (linkType === LinkType.SpEp)
{
arrayLast(this._LineData).bul = bul;
this._LineData.push({ pt: cuEp2, bul: 0 });
}
else if (equalv3(cuEp, sp, tolerance))
else if (linkType === LinkType.EpSp)
{
this._LineData.unshift({ pt: cuSp2, bul: bul });
}
else if (equalv3(cuEp, ep, tolerance))
else if (linkType === LinkType.EpEp)
{
arrayLast(this._LineData).bul = -bul;
this._LineData.push({ pt: cuSp2, bul: 0 });
}
else
return Status.False;
}
else if (cu instanceof Polyline)
{
@ -900,7 +936,7 @@ export class Polyline extends Curve
let { pts, buls } = this.PtsBuls;
if (equalv3(cuSp, sp, tolerance))
if (linkType === LinkType.SpSp)
{
cu.Reverse();
let cuPtsBul = cu.MatrixAlignTo2(this.OCS);
@ -909,7 +945,7 @@ export class Polyline extends Curve
pts = cuPtsBul.pts.concat(pts);
buls = cuPtsBul.buls.concat(buls);
}
else if (equalv3(cuSp, ep, tolerance))
else if (linkType === LinkType.SpEp)
{
pts.pop();
buls.pop();
@ -918,7 +954,7 @@ export class Polyline extends Curve
pts = pts.concat(cuPtsBul.pts);
buls = buls.concat(cuPtsBul.buls);
}
else if (equalv3(cuEp, sp, tolerance))
else if (linkType === LinkType.EpSp)
{
let cuPtsBul = cu.MatrixAlignTo2(this.OCS);
cuPtsBul.pts.pop();
@ -926,7 +962,7 @@ export class Polyline extends Curve
pts = cuPtsBul.pts.concat(pts);
buls = cuPtsBul.buls.concat(buls);
}
else if (equalv3(cuEp, ep, tolerance))
else if (linkType === LinkType.EpEp)
{
pts.pop();
buls.pop();
@ -936,8 +972,6 @@ export class Polyline extends Curve
pts = pts.concat(cuPtsBul.pts);
buls = buls.concat(cuPtsBul.buls);
}
else
return Status.False;
this._LineData.length = 0;
for (let i = 0; i < pts.length; i++)

@ -1,3 +1,4 @@
import { LogEnable } from '../Common/Log';
import { CommandState } from '../Editor/CommandState';
import { Factory } from './CADFactory';
import { CADFiler } from './CADFiler';
@ -69,7 +70,8 @@ export class HistoricManage extends CADObject
if (!this.IsNow)
{
this.StartCmd("");
console.warn("未标记命令!");
if (LogEnable.Display)
console.warn("未标记命令!");
}
if (this._SignalCommandHistory && CommandState.CommandIng)

@ -638,7 +638,7 @@ export class OffsetPolyline
{
used.add(minR.curve);
preP = minR.e;
let status = pl.Join(minR.curve, false, 1e-3);
let status = pl.Join(minR.curve, false, 1e-2);
if (status !== Status.True)
console.warn("连接失败");
return minR.to;

@ -1,5 +1,6 @@
import { Matrix4, Vector3 } from "three";
import { equalCurve, IsRect } from "../../Common/CurveUtils";
import { LogEnable } from "../../Common/Log";
import { Singleton } from "../../Common/Singleton";
import { ExtrudeHole } from "../../DatabaseServices/3DSolid/ExtrudeHole";
import { Contour } from "../../DatabaseServices/Contour";
@ -14,11 +15,11 @@ import { Route } from "../../Geometry/CurveMap";
import { GetSideFaceMtx } from "../../Geometry/DrillParse/BoardGetFace";
import { angleTo, isParallelTo, MoveMatrix, XAxis } from "../../Geometry/GeUtils";
import { RegionParse } from "../../Geometry/RegionParse";
import { FixIndex } from "../../Nest/Common/Util";
import { FaceDirection } from "../../UI/Store/BoardInterface";
import { BoolOpeartionType, isTargetCurInOrOnSourceCur } from "../BoolOperateUtils";
import { GetSealedBoardContour } from "../CalcEdgeSealing";
import { GetCurveToInDir, GetOffsetCurves, OptimizeToolPath } from "./OptimizeToolPath";
import { FixIndex } from "../../Nest/Common/Util";
/**
*
@ -383,7 +384,8 @@ export class FeedingToolPath extends Singleton
let intPts = backLine.IntersectWith(cs[0], 3);
if (intPts.length === 0)
{
console.error("未知错误情况");
if (LogEnable.Display)
console.error("未知错误情况");
return;
}

@ -1,6 +1,7 @@
import { Intent } from '@blueprintjs/core';
import { Cache, Layers, Object3D } from 'three';
import { ErrorMonitoring } from './Common/ErrorMonitoring';
import { LogEnable } from './Common/Log';
import { copyTextToClipboard } from './Common/Utils';
import { AppToaster } from './UI/Components/Toaster';
import './UI/Css/blue.less';
@ -120,6 +121,8 @@ window.onload = function ()
Layers.prototype.test = (layers) => true;
new ErrorMonitoring();
LogEnable.Display = true;
new WebCAD();
};

Loading…
Cancel
Save