From f30df1b260cad5605ccfdd6ed384607b37fff71f Mon Sep 17 00:00:00 2001 From: ZoeLeeFZ Date: Sun, 28 Jun 2020 09:18:35 +0800 Subject: [PATCH] =?UTF-8?q?!1122=20=E4=BF=AE=E5=A4=8D:=E7=9B=B8=E4=BA=A4?= =?UTF-8?q?=E7=B2=BE=E5=BA=A6=E5=AF=BC=E8=87=B4=E7=9A=84=E8=B5=B0=E5=88=80?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../__snapshots__/FeedingToolPath.test.ts.snap | 2 +- __test__/Geometry/intersect.test.ts | 8 ++++++++ __test__/Polyline/__snapshots__/offset.test.ts.snap | 8 ++++---- src/Add-on/DrawDrilling/DrillingReactor.ts | 1 + src/GraphicsSystem/IntersectWith.ts | 2 +- 5 files changed, 15 insertions(+), 6 deletions(-) diff --git a/__test__/FeedingToolPath/__snapshots__/FeedingToolPath.test.ts.snap b/__test__/FeedingToolPath/__snapshots__/FeedingToolPath.test.ts.snap index 57dbe951a..2c0f17443 100644 --- a/__test__/FeedingToolPath/__snapshots__/FeedingToolPath.test.ts.snap +++ b/__test__/FeedingToolPath/__snapshots__/FeedingToolPath.test.ts.snap @@ -250,7 +250,7 @@ exports[`超级复杂造型01 1`] = `"5230.46984"`; exports[`超级复杂造型01 2`] = `"23338.03268"`; -exports[`超级复杂造型01 3`] = `"11855.39980"`; +exports[`超级复杂造型01 3`] = `"11855.39979"`; exports[`超级复杂造型01 4`] = `"9.89484"`; diff --git a/__test__/Geometry/intersect.test.ts b/__test__/Geometry/intersect.test.ts index 1889abdcb..73703781a 100644 --- a/__test__/Geometry/intersect.test.ts +++ b/__test__/Geometry/intersect.test.ts @@ -148,3 +148,11 @@ test('直线和圆相切', () => let pts = cus[0].IntersectWith(cus[1], 0); expect(pts).toMatchSnapshot(); }); + +test("圆弧相交精度调整", () => +{ + let data = { "file": [2, "Arc", 8, 2, 134, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -30.303763742321802, 350.79539874943686, 0, 1], 0, 0, true, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -30.303763742321802, 350.79539874943686, 0, 1], 0, 2, 3.0000000000000084, 0, 1.686785963338877, false, "Arc", 8, 2, 135, false, 1, 2, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -14.303763742321621, 213.47228144573236, 0, 1], 0, 0, true, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -14.303763742321621, 213.47228144573236, 0, 1], 0, 2, 141.25208333333353, 1.6629607907756918, 2.5287104082377034, false], "basePt": { "x": -129.84704567597646, "y": 294.72436477906575, "z": 0 }, "ucs": [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1] }; + let cus = LoadEntityFromFileData(data) as Array; + let pts = cus[0].IntersectWith(cus[1], 0); + expect(pts.length).toBe(2); +}); diff --git a/__test__/Polyline/__snapshots__/offset.test.ts.snap b/__test__/Polyline/__snapshots__/offset.test.ts.snap index 9dcd95710..17fd0c83a 100644 --- a/__test__/Polyline/__snapshots__/offset.test.ts.snap +++ b/__test__/Polyline/__snapshots__/offset.test.ts.snap @@ -88,7 +88,7 @@ exports[`圆求交错误导致的线丢失 1`] = `4148.6552754623435`; exports[`圆求交错误导致的线丢失 2`] = `4425.280774659386`; -exports[`圆求交错误导致的线丢失 3`] = `4021.90031602838`; +exports[`圆求交错误导致的线丢失 3`] = `4021.9003150863045`; exports[`圆求交错误导致的线丢失 4`] = `4581.224228650713`; @@ -96,7 +96,7 @@ exports[`圆求交错误导致的线丢失 5`] = `3900.607880862771`; exports[`圆求交错误导致的线丢失 6`] = `4757.468532252452`; -exports[`圆求交错误导致的线丢失 7`] = `3783.748626939053`; +exports[`圆求交错误导致的线丢失 7`] = `3783.748625630569`; exports[`圆求交错误导致的线丢失 8`] = `4972.0124797019525`; @@ -200,11 +200,11 @@ exports[`精度过高导致直连失败 2`] = `"32040.01360"`; exports[`精度过高导致直连失败 3`] = `1`; -exports[`精度过高导致直连失败 4`] = `"32045.24858"`; +exports[`精度过高导致直连失败 4`] = `"32045.24888"`; exports[`精度过高导致连接失败 1`] = `1`; -exports[`精度过高导致连接失败 2`] = `"75154.17850"`; +exports[`精度过高导致连接失败 2`] = `"75154.17849"`; exports[`精度过高导致连接失败 3`] = `1`; diff --git a/src/Add-on/DrawDrilling/DrillingReactor.ts b/src/Add-on/DrawDrilling/DrillingReactor.ts index 117b36934..933c18b2c 100644 --- a/src/Add-on/DrawDrilling/DrillingReactor.ts +++ b/src/Add-on/DrawDrilling/DrillingReactor.ts @@ -10,6 +10,7 @@ import { CommandNames } from "../../Common/CommandNames"; //禁止触发反应的命令 const ForbidReactorCmd = new Set([ CommandNames.DeleteHole, CommandNames.Hole, CommandNames.LookOverBoardInfos, + CommandNames.ChangeColorByMaterial, CommandNames.RestoreColor, 'PZ', 'ENT', 'BBS', CommandNames.Show, CommandNames.HideSelect, CommandNames.HideUnSelect]); diff --git a/src/GraphicsSystem/IntersectWith.ts b/src/GraphicsSystem/IntersectWith.ts index 7baa8bb5c..90c79fe7f 100644 --- a/src/GraphicsSystem/IntersectWith.ts +++ b/src/GraphicsSystem/IntersectWith.ts @@ -89,7 +89,7 @@ export function IntersectCircleAndCircle(cu1: Circle | Arc, cu2: Circle | Arc): let pts: IntersectResult[] = []; let dist = center2.distanceTo(center1); - if (dist < Math.abs(radius1 - radius2) + if (dist < Math.abs(radius1 - radius2) - 1e-3 || dist > (radius1 + radius2 + 1e-3)) return pts; if (equaln(dist, 0, 1e-6)) return pts;