From 4eeb645350ceb00368814d41ed8190debc6e9a72 Mon Sep 17 00:00:00 2001 From: ZoeLeeFZ Date: Fri, 1 Nov 2019 15:03:30 +0800 Subject: [PATCH] =?UTF-8?q?!567=20=E5=B0=81=E8=BE=B9=E8=BD=AC=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../FeedingToolPath.test.ts.snap | 302 +++++++++--------- src/Add-on/testEntity/test.ts | 9 +- src/GraphicsSystem/CalcEdgeSealing.ts | 88 +++++ 3 files changed, 246 insertions(+), 153 deletions(-) diff --git a/__test__/FeedingToolPath/__snapshots__/FeedingToolPath.test.ts.snap b/__test__/FeedingToolPath/__snapshots__/FeedingToolPath.test.ts.snap index 6517d2b06..5ac8672a8 100644 --- a/__test__/FeedingToolPath/__snapshots__/FeedingToolPath.test.ts.snap +++ b/__test__/FeedingToolPath/__snapshots__/FeedingToolPath.test.ts.snap @@ -1,14 +1,14 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`#IYX1P: 曲线长度 1`] = `1346.3292345344717`; +exports[`#IYX1P: 曲线长度 1`] = `3600`; -exports[`#IYX1P: 曲线长度 2`] = `8468.604267178238`; +exports[`#IYX1P: 曲线长度 2`] = `1346.3292345344717`; -exports[`#IYX1P: 曲线长度 3`] = `10.71238898038469`; +exports[`#IYX1P: 曲线长度 3`] = `8468.604267178238`; exports[`#IYX1P: 曲线长度 4`] = `10.71238898038469`; -exports[`#IYX1P: 曲线长度 5`] = `3600`; +exports[`#IYX1P: 曲线长度 5`] = `10.71238898038469`; exports[`#IYX1P: 曲线长度 6`] = `1483.4533999999999`; @@ -16,25 +16,25 @@ exports[`#IYX1P: 曲线长度 7`] = `1324.9044565737036`; exports[`#IYX1P: 走刀数量 1`] = `4`; -exports[`刀切到外轮廓情况: 曲线长度 1`] = `22596.75011038598`; +exports[`刀切到外轮廓情况: 曲线长度 1`] = `3600`; -exports[`刀切到外轮廓情况: 曲线长度 2`] = `6355.243980782019`; +exports[`刀切到外轮廓情况: 曲线长度 2`] = `22596.75011038598`; -exports[`刀切到外轮廓情况: 曲线长度 3`] = `3600`; +exports[`刀切到外轮廓情况: 曲线长度 3`] = `6355.243980782019`; exports[`刀切到外轮廓情况: 曲线长度 4`] = `1478.9393851461323`; exports[`刀切到外轮廓情况: 曲线长度 5`] = `729.5688477133849`; -exports[`刀切到外轮廓情况: 曲线长度 6`] = `7687.426120259669`; +exports[`刀切到外轮廓情况: 曲线长度 6`] = `3600`; -exports[`刀切到外轮廓情况: 曲线长度 7`] = `7785.184372611363`; +exports[`刀切到外轮廓情况: 曲线长度 7`] = `7687.426120259669`; -exports[`刀切到外轮廓情况: 曲线长度 8`] = `7687.426120259668`; +exports[`刀切到外轮廓情况: 曲线长度 8`] = `7785.184372611363`; -exports[`刀切到外轮廓情况: 曲线长度 9`] = `7785.184372611338`; +exports[`刀切到外轮廓情况: 曲线长度 9`] = `7687.426120259668`; -exports[`刀切到外轮廓情况: 曲线长度 10`] = `3600`; +exports[`刀切到外轮廓情况: 曲线长度 10`] = `7785.184372611338`; exports[`刀切到外轮廓情况: 曲线长度 11`] = `2683.281572999748`; @@ -44,17 +44,17 @@ exports[`刀切到外轮廓情况: 走刀数量 1`] = `2`; exports[`刀切到外轮廓情况: 走刀数量 2`] = `4`; -exports[`复杂极限刀半径: 曲线长度 1`] = `232.80420650475034`; +exports[`复杂极限刀半径: 曲线长度 1`] = `4356.840832388074`; -exports[`复杂极限刀半径: 曲线长度 2`] = `806.2513545258738`; +exports[`复杂极限刀半径: 曲线长度 2`] = `232.80420650475034`; -exports[`复杂极限刀半径: 曲线长度 3`] = `31170.805670163638`; +exports[`复杂极限刀半径: 曲线长度 3`] = `806.2513545258738`; -exports[`复杂极限刀半径: 曲线长度 4`] = `2917.48021978714`; +exports[`复杂极限刀半径: 曲线长度 4`] = `31170.805670163638`; -exports[`复杂极限刀半径: 曲线长度 5`] = `4147.455051522354`; +exports[`复杂极限刀半径: 曲线长度 5`] = `2917.48021978714`; -exports[`复杂极限刀半径: 曲线长度 6`] = `4356.840832388074`; +exports[`复杂极限刀半径: 曲线长度 6`] = `4147.455051522354`; exports[`复杂极限刀半径: 曲线长度 7`] = `951.5402172137751`; @@ -62,31 +62,31 @@ exports[`复杂极限刀半径: 曲线长度 8`] = `3278.9179349887763`; exports[`复杂极限刀半径: 走刀数量 1`] = `5`; -exports[`复杂造型01: 曲线长度 1`] = `59609.750635032455`; +exports[`复杂造型01: 曲线长度 1`] = `3600`; -exports[`复杂造型01: 曲线长度 2`] = `1482.4552077856665`; +exports[`复杂造型01: 曲线长度 2`] = `59609.750635032455`; -exports[`复杂造型01: 曲线长度 3`] = `838.7907023816642`; +exports[`复杂造型01: 曲线长度 3`] = `1482.4552077856665`; -exports[`复杂造型01: 曲线长度 4`] = `119.2450237058813`; +exports[`复杂造型01: 曲线长度 4`] = `838.7907023816642`; -exports[`复杂造型01: 曲线长度 5`] = `920.6205527518313`; +exports[`复杂造型01: 曲线长度 5`] = `119.2450237058813`; -exports[`复杂造型01: 曲线长度 6`] = `136.38881122495832`; +exports[`复杂造型01: 曲线长度 6`] = `920.6205527518313`; -exports[`复杂造型01: 曲线长度 7`] = `40.76338989846492`; +exports[`复杂造型01: 曲线长度 7`] = `136.38881122495832`; -exports[`复杂造型01: 曲线长度 8`] = `3.2524680966497335`; +exports[`复杂造型01: 曲线长度 8`] = `40.76338989846492`; -exports[`复杂造型01: 曲线长度 9`] = `301.66992978702626`; +exports[`复杂造型01: 曲线长度 9`] = `3.2524680966497335`; -exports[`复杂造型01: 曲线长度 10`] = `1749.8631881230112`; +exports[`复杂造型01: 曲线长度 10`] = `301.66992978702626`; -exports[`复杂造型01: 曲线长度 11`] = `7.8285491298056655`; +exports[`复杂造型01: 曲线长度 11`] = `1749.8631881230112`; -exports[`复杂造型01: 曲线长度 12`] = `2.5692483033658107`; +exports[`复杂造型01: 曲线长度 12`] = `7.8285491298056655`; -exports[`复杂造型01: 曲线长度 13`] = `3600`; +exports[`复杂造型01: 曲线长度 13`] = `2.5692483033658107`; exports[`复杂造型01: 曲线长度 14`] = `4316.136010511218`; @@ -102,33 +102,33 @@ exports[`复杂造型01: 曲线长度 19`] = `1463.6056529693449`; exports[`复杂造型01: 走刀数量 1`] = `12`; -exports[`复杂造型测试: 曲线长度 1`] = `13653.90128815112`; +exports[`复杂造型测试: 曲线长度 1`] = `2402.511185283596`; -exports[`复杂造型测试: 曲线长度 2`] = `2368.4150990997623`; +exports[`复杂造型测试: 曲线长度 2`] = `13653.90128815112`; -exports[`复杂造型测试: 曲线长度 3`] = `1335.5629222865505`; +exports[`复杂造型测试: 曲线长度 3`] = `2368.4150990997623`; -exports[`复杂造型测试: 曲线长度 4`] = `1265.9777684790147`; +exports[`复杂造型测试: 曲线长度 4`] = `1335.5629222865505`; -exports[`复杂造型测试: 曲线长度 5`] = `2261.915055343594`; +exports[`复杂造型测试: 曲线长度 5`] = `1265.9777684790147`; -exports[`复杂造型测试: 曲线长度 6`] = `8.0486334855557`; +exports[`复杂造型测试: 曲线长度 6`] = `2261.915055343594`; -exports[`复杂造型测试: 曲线长度 7`] = `875.5142132396979`; +exports[`复杂造型测试: 曲线长度 7`] = `8.0486334855557`; -exports[`复杂造型测试: 曲线长度 8`] = `1565.1472656712765`; +exports[`复杂造型测试: 曲线长度 8`] = `875.5142132396979`; -exports[`复杂造型测试: 曲线长度 9`] = `692.0908822142659`; +exports[`复杂造型测试: 曲线长度 9`] = `1565.1472656712765`; -exports[`复杂造型测试: 曲线长度 10`] = `227.8342135021163`; +exports[`复杂造型测试: 曲线长度 10`] = `692.0908822142659`; -exports[`复杂造型测试: 曲线长度 11`] = `16.405200898113836`; +exports[`复杂造型测试: 曲线长度 11`] = `227.8342135021163`; -exports[`复杂造型测试: 曲线长度 12`] = `696.1986486992679`; +exports[`复杂造型测试: 曲线长度 12`] = `16.405200898113836`; -exports[`复杂造型测试: 曲线长度 13`] = `639.7910377879329`; +exports[`复杂造型测试: 曲线长度 13`] = `696.1986486992679`; -exports[`复杂造型测试: 曲线长度 14`] = `2402.511185283596`; +exports[`复杂造型测试: 曲线长度 14`] = `639.7910377879329`; exports[`复杂造型测试: 曲线长度 15`] = `1715.2225461089636`; @@ -154,13 +154,13 @@ exports[`复杂造型测试: 曲线长度 25`] = `169.22283273433305`; exports[`复杂造型测试: 曲线长度 26`] = `162.171881370416`; -exports[`复杂造型测试: 曲线长度 27`] = `66231.52634930135`; +exports[`复杂造型测试: 曲线长度 27`] = `3600`; -exports[`复杂造型测试: 曲线长度 28`] = `2279.1571138841996`; +exports[`复杂造型测试: 曲线长度 28`] = `66231.52634930135`; -exports[`复杂造型测试: 曲线长度 29`] = `5545.665343214347`; +exports[`复杂造型测试: 曲线长度 29`] = `2279.1571138841996`; -exports[`复杂造型测试: 曲线长度 30`] = `3600`; +exports[`复杂造型测试: 曲线长度 30`] = `5545.665343214347`; exports[`复杂造型测试: 曲线长度 31`] = `2581.0848141151123`; @@ -172,21 +172,21 @@ exports[`复杂造型测试: 走刀数量 1`] = `13`; exports[`复杂造型测试: 走刀数量 2`] = `3`; -exports[`带孔造型板件: 曲线长度 1`] = `31091.461443717064`; +exports[`带孔造型板件: 曲线长度 1`] = `3600`; -exports[`带孔造型板件: 曲线长度 2`] = `2808.760562622602`; +exports[`带孔造型板件: 曲线长度 2`] = `31091.461443717064`; -exports[`带孔造型板件: 曲线长度 3`] = `3600`; +exports[`带孔造型板件: 曲线长度 3`] = `2808.760562622602`; exports[`带孔造型板件: 曲线长度 4`] = `2195.9741153279983`; exports[`带孔造型板件: 曲线长度 5`] = `1209.6929369796912`; -exports[`带孔造型板件: 曲线长度 6`] = `31091.461443717064`; +exports[`带孔造型板件: 曲线长度 6`] = `3600`; -exports[`带孔造型板件: 曲线长度 7`] = `2808.760562622602`; +exports[`带孔造型板件: 曲线长度 7`] = `31091.461443717064`; -exports[`带孔造型板件: 曲线长度 8`] = `3600`; +exports[`带孔造型板件: 曲线长度 8`] = `2808.760562622602`; exports[`带孔造型板件: 曲线长度 9`] = `2195.9741153279983`; @@ -196,25 +196,25 @@ exports[`带孔造型板件: 走刀数量 1`] = `2`; exports[`带孔造型板件: 走刀数量 2`] = `2`; -exports[`极限刀半径#I11UDE: 曲线长度 1`] = `2589.4683707776608`; +exports[`极限刀半径#I11UDE: 曲线长度 1`] = `4992.8497433755965`; -exports[`极限刀半径#I11UDE: 曲线长度 2`] = `10.71238898038469`; +exports[`极限刀半径#I11UDE: 曲线长度 2`] = `2589.4683707776608`; exports[`极限刀半径#I11UDE: 曲线长度 3`] = `10.71238898038469`; -exports[`极限刀半径#I11UDE: 曲线长度 4`] = `10.71238898038521`; +exports[`极限刀半径#I11UDE: 曲线长度 4`] = `10.71238898038469`; -exports[`极限刀半径#I11UDE: 曲线长度 5`] = `10.712388980384734`; +exports[`极限刀半径#I11UDE: 曲线长度 5`] = `10.71238898038521`; -exports[`极限刀半径#I11UDE: 曲线长度 6`] = `10.71238898038408`; +exports[`极限刀半径#I11UDE: 曲线长度 6`] = `10.712388980384734`; -exports[`极限刀半径#I11UDE: 曲线长度 7`] = `10.7123889803843`; +exports[`极限刀半径#I11UDE: 曲线长度 7`] = `10.71238898038408`; -exports[`极限刀半径#I11UDE: 曲线长度 8`] = `10.712388980384993`; +exports[`极限刀半径#I11UDE: 曲线长度 8`] = `10.7123889803843`; -exports[`极限刀半径#I11UDE: 曲线长度 9`] = `10.71238898038469`; +exports[`极限刀半径#I11UDE: 曲线长度 9`] = `10.712388980384993`; -exports[`极限刀半径#I11UDE: 曲线长度 10`] = `4992.8497433755965`; +exports[`极限刀半径#I11UDE: 曲线长度 10`] = `10.71238898038469`; exports[`极限刀半径#I11UDE: 曲线长度 11`] = `2450.188718291298`; @@ -222,39 +222,39 @@ exports[`极限刀半径#I11UDE: 曲线长度 12`] = `2419.4772979202935`; exports[`极限刀半径#I11UDE: 走刀数量 1`] = `9`; -exports[`极限刀半径: 曲线长度 1`] = `1314.2477796076937`; +exports[`极限刀半径: 曲线长度 1`] = `3600`; -exports[`极限刀半径: 曲线长度 2`] = `3600`; +exports[`极限刀半径: 曲线长度 2`] = `1314.2477796076937`; exports[`极限刀半径: 曲线长度 3`] = `1740`; -exports[`极限刀半径: 曲线长度 4`] = `716.1675009811012`; +exports[`极限刀半径: 曲线长度 4`] = `3600`; -exports[`极限刀半径: 曲线长度 5`] = `3600`; +exports[`极限刀半径: 曲线长度 5`] = `716.1675009811012`; exports[`极限刀半径: 曲线长度 6`] = `1552.3359576397822`; -exports[`极限刀半径: 曲线长度 7`] = `1638.9591725161224`; +exports[`极限刀半径: 曲线长度 7`] = `3600`; -exports[`极限刀半径: 曲线长度 8`] = `47.12388980384689`; +exports[`极限刀半径: 曲线长度 8`] = `1638.9591725161224`; exports[`极限刀半径: 曲线长度 9`] = `47.12388980384689`; -exports[`极限刀半径: 曲线长度 10`] = `3600`; +exports[`极限刀半径: 曲线长度 10`] = `47.12388980384689`; exports[`极限刀半径: 曲线长度 11`] = `3517.9183450322453`; -exports[`极限刀半径: 曲线长度 12`] = `617.1238898038469`; +exports[`极限刀半径: 曲线长度 12`] = `3600`; -exports[`极限刀半径: 曲线长度 13`] = `3600`; +exports[`极限刀半径: 曲线长度 13`] = `617.1238898038469`; exports[`极限刀半径: 曲线长度 14`] = `1040`; -exports[`极限刀半径: 曲线长度 15`] = `390`; +exports[`极限刀半径: 曲线长度 15`] = `3600`; -exports[`极限刀半径: 曲线长度 16`] = `23.56194490192345`; +exports[`极限刀半径: 曲线长度 16`] = `390`; -exports[`极限刀半径: 曲线长度 17`] = `3600`; +exports[`极限刀半径: 曲线长度 17`] = `23.56194490192345`; exports[`极限刀半径: 曲线长度 18`] = `900`; @@ -268,141 +268,141 @@ exports[`极限刀半径: 走刀数量 4`] = `1`; exports[`极限刀半径: 走刀数量 5`] = `2`; -exports[`超级复杂造型01: 曲线长度 1`] = `23310.391778382174`; +exports[`超级复杂造型01: 曲线长度 1`] = `5230.469840585598`; -exports[`超级复杂造型01: 曲线长度 2`] = `11849.91310995222`; +exports[`超级复杂造型01: 曲线长度 2`] = `23310.391778382174`; -exports[`超级复杂造型01: 曲线长度 3`] = `9.894843040787247`; +exports[`超级复杂造型01: 曲线长度 3`] = `11849.91310995222`; -exports[`超级复杂造型01: 曲线长度 4`] = `2.686492242389678`; +exports[`超级复杂造型01: 曲线长度 4`] = `9.894843040787247`; -exports[`超级复杂造型01: 曲线长度 5`] = `15.558634753572182`; +exports[`超级复杂造型01: 曲线长度 5`] = `2.686492242389678`; -exports[`超级复杂造型01: 曲线长度 6`] = `1.5023362215203946`; +exports[`超级复杂造型01: 曲线长度 6`] = `15.558634753572182`; -exports[`超级复杂造型01: 曲线长度 7`] = `36.738926324214475`; +exports[`超级复杂造型01: 曲线长度 7`] = `1.5023362215203946`; -exports[`超级复杂造型01: 曲线长度 8`] = `2.345373451530522`; +exports[`超级复杂造型01: 曲线长度 8`] = `36.738926324214475`; -exports[`超级复杂造型01: 曲线长度 9`] = `23.179252903171008`; +exports[`超级复杂造型01: 曲线长度 9`] = `2.345373451530522`; -exports[`超级复杂造型01: 曲线长度 10`] = `34.11040843800545`; +exports[`超级复杂造型01: 曲线长度 10`] = `23.179252903171008`; -exports[`超级复杂造型01: 曲线长度 11`] = `3.00516024046907`; +exports[`超级复杂造型01: 曲线长度 11`] = `34.11040843800545`; -exports[`超级复杂造型01: 曲线长度 12`] = `3.005160240466534`; +exports[`超级复杂造型01: 曲线长度 12`] = `3.00516024046907`; -exports[`超级复杂造型01: 曲线长度 13`] = `3.0051602404694115`; +exports[`超级复杂造型01: 曲线长度 13`] = `3.005160240466534`; -exports[`超级复杂造型01: 曲线长度 14`] = `3.0051642696018828`; +exports[`超级复杂造型01: 曲线长度 14`] = `3.0051602404694115`; -exports[`超级复杂造型01: 曲线长度 15`] = `23.17925136224735`; +exports[`超级复杂造型01: 曲线长度 15`] = `3.0051642696018828`; -exports[`超级复杂造型01: 曲线长度 16`] = `2.3453734515378883`; +exports[`超级复杂造型01: 曲线长度 16`] = `23.17925136224735`; -exports[`超级复杂造型01: 曲线长度 17`] = `36.73892632422056`; +exports[`超级复杂造型01: 曲线长度 17`] = `2.3453734515378883`; -exports[`超级复杂造型01: 曲线长度 18`] = `34.11040843800589`; +exports[`超级复杂造型01: 曲线长度 18`] = `36.73892632422056`; -exports[`超级复杂造型01: 曲线长度 19`] = `9.894843040789354`; +exports[`超级复杂造型01: 曲线长度 19`] = `34.11040843800589`; -exports[`超级复杂造型01: 曲线长度 20`] = `2.2726434483396147`; +exports[`超级复杂造型01: 曲线长度 20`] = `9.894843040789354`; -exports[`超级复杂造型01: 曲线长度 21`] = `2.6864922423941437`; +exports[`超级复杂造型01: 曲线长度 21`] = `2.2726434483396147`; -exports[`超级复杂造型01: 曲线长度 22`] = `15.558634753573351`; +exports[`超级复杂造型01: 曲线长度 22`] = `2.6864922423941437`; -exports[`超级复杂造型01: 曲线长度 23`] = `1.5023362215224114`; +exports[`超级复杂造型01: 曲线长度 23`] = `15.558634753573351`; -exports[`超级复杂造型01: 曲线长度 24`] = `23.17925136224733`; +exports[`超级复杂造型01: 曲线长度 24`] = `1.5023362215224114`; -exports[`超级复杂造型01: 曲线长度 25`] = `2.345373451535995`; +exports[`超级复杂造型01: 曲线长度 25`] = `23.17925136224733`; -exports[`超级复杂造型01: 曲线长度 26`] = `36.73892632421837`; +exports[`超级复杂造型01: 曲线长度 26`] = `2.345373451535995`; -exports[`超级复杂造型01: 曲线长度 27`] = `34.110408438008804`; +exports[`超级复杂造型01: 曲线长度 27`] = `36.73892632421837`; -exports[`超级复杂造型01: 曲线长度 28`] = `3.005160240470314`; +exports[`超级复杂造型01: 曲线长度 28`] = `34.110408438008804`; -exports[`超级复杂造型01: 曲线长度 29`] = `3.0051602404691264`; +exports[`超级复杂造型01: 曲线长度 29`] = `3.005160240470314`; -exports[`超级复杂造型01: 曲线长度 30`] = `2.686492242389917`; +exports[`超级复杂造型01: 曲线长度 30`] = `3.0051602404691264`; -exports[`超级复杂造型01: 曲线长度 31`] = `15.558634753574319`; +exports[`超级复杂造型01: 曲线长度 31`] = `2.686492242389917`; -exports[`超级复杂造型01: 曲线长度 32`] = `1.5023362215216194`; +exports[`超级复杂造型01: 曲线长度 32`] = `15.558634753574319`; -exports[`超级复杂造型01: 曲线长度 33`] = `9.894843040786107`; +exports[`超级复杂造型01: 曲线长度 33`] = `1.5023362215216194`; -exports[`超级复杂造型01: 曲线长度 34`] = `2.272644014939738`; +exports[`超级复杂造型01: 曲线长度 34`] = `9.894843040786107`; -exports[`超级复杂造型01: 曲线长度 35`] = `23.179252903170394`; +exports[`超级复杂造型01: 曲线长度 35`] = `2.272644014939738`; -exports[`超级复杂造型01: 曲线长度 36`] = `2.3453734515314206`; +exports[`超级复杂造型01: 曲线长度 36`] = `23.179252903170394`; -exports[`超级复杂造型01: 曲线长度 37`] = `36.73892632421504`; +exports[`超级复杂造型01: 曲线长度 37`] = `2.3453734515314206`; -exports[`超级复杂造型01: 曲线长度 38`] = `34.11040843800676`; +exports[`超级复杂造型01: 曲线长度 38`] = `36.73892632421504`; -exports[`超级复杂造型01: 曲线长度 39`] = `3.0051602404685336`; +exports[`超级复杂造型01: 曲线长度 39`] = `34.11040843800676`; -exports[`超级复杂造型01: 曲线长度 40`] = `3.0051630894960395`; +exports[`超级复杂造型01: 曲线长度 40`] = `3.0051602404685336`; -exports[`超级复杂造型01: 曲线长度 41`] = `2.6864922423866937`; +exports[`超级复杂造型01: 曲线长度 41`] = `3.0051630894960395`; -exports[`超级复杂造型01: 曲线长度 42`] = `15.558634753573163`; +exports[`超级复杂造型01: 曲线长度 42`] = `2.6864922423866937`; -exports[`超级复杂造型01: 曲线长度 43`] = `1.5023362215210545`; +exports[`超级复杂造型01: 曲线长度 43`] = `15.558634753573163`; -exports[`超级复杂造型01: 曲线长度 44`] = `9.894843040790184`; +exports[`超级复杂造型01: 曲线长度 44`] = `1.5023362215210545`; -exports[`超级复杂造型01: 曲线长度 45`] = `2.27264424963326`; +exports[`超级复杂造型01: 曲线长度 45`] = `9.894843040790184`; -exports[`超级复杂造型01: 曲线长度 46`] = `23.179252903170124`; +exports[`超级复杂造型01: 曲线长度 46`] = `2.27264424963326`; -exports[`超级复杂造型01: 曲线长度 47`] = `2.345373451550585`; +exports[`超级复杂造型01: 曲线长度 47`] = `23.179252903170124`; -exports[`超级复杂造型01: 曲线长度 48`] = `36.738926324216564`; +exports[`超级复杂造型01: 曲线长度 48`] = `2.345373451550585`; -exports[`超级复杂造型01: 曲线长度 49`] = `34.11040843800687`; +exports[`超级复杂造型01: 曲线长度 49`] = `36.738926324216564`; -exports[`超级复杂造型01: 曲线长度 50`] = `3.005160240469785`; +exports[`超级复杂造型01: 曲线长度 50`] = `34.11040843800687`; -exports[`超级复杂造型01: 曲线长度 51`] = `3.005164269599573`; +exports[`超级复杂造型01: 曲线长度 51`] = `3.005160240469785`; -exports[`超级复杂造型01: 曲线长度 52`] = `2.686492242390355`; +exports[`超级复杂造型01: 曲线长度 52`] = `3.005164269599573`; -exports[`超级复杂造型01: 曲线长度 53`] = `15.558634753572672`; +exports[`超级复杂造型01: 曲线长度 53`] = `2.686492242390355`; -exports[`超级复杂造型01: 曲线长度 54`] = `1.5023362215214884`; +exports[`超级复杂造型01: 曲线长度 54`] = `15.558634753572672`; -exports[`超级复杂造型01: 曲线长度 55`] = `9.894843040792889`; +exports[`超级复杂造型01: 曲线长度 55`] = `1.5023362215214884`; -exports[`超级复杂造型01: 曲线长度 56`] = `2.272643448340335`; +exports[`超级复杂造型01: 曲线长度 56`] = `9.894843040792889`; -exports[`超级复杂造型01: 曲线长度 57`] = `23.17925136224723`; +exports[`超级复杂造型01: 曲线长度 57`] = `2.272643448340335`; -exports[`超级复杂造型01: 曲线长度 58`] = `2.345373451548128`; +exports[`超级复杂造型01: 曲线长度 58`] = `23.17925136224723`; -exports[`超级复杂造型01: 曲线长度 59`] = `36.73892632422722`; +exports[`超级复杂造型01: 曲线长度 59`] = `2.345373451548128`; -exports[`超级复杂造型01: 曲线长度 60`] = `34.11040843800603`; +exports[`超级复杂造型01: 曲线长度 60`] = `36.73892632422722`; -exports[`超级复杂造型01: 曲线长度 61`] = `3.0051602404692153`; +exports[`超级复杂造型01: 曲线长度 61`] = `34.11040843800603`; -exports[`超级复杂造型01: 曲线长度 62`] = `3.0051602404670064`; +exports[`超级复杂造型01: 曲线长度 62`] = `3.0051602404692153`; -exports[`超级复杂造型01: 曲线长度 63`] = `2.686492242390764`; +exports[`超级复杂造型01: 曲线长度 63`] = `3.0051602404670064`; -exports[`超级复杂造型01: 曲线长度 64`] = `15.558634753570397`; +exports[`超级复杂造型01: 曲线长度 64`] = `2.686492242390764`; -exports[`超级复杂造型01: 曲线长度 65`] = `1.5023362215189802`; +exports[`超级复杂造型01: 曲线长度 65`] = `15.558634753570397`; -exports[`超级复杂造型01: 曲线长度 66`] = `9.894843040791566`; +exports[`超级复杂造型01: 曲线长度 66`] = `1.5023362215189802`; -exports[`超级复杂造型01: 曲线长度 67`] = `2.2726440149400053`; +exports[`超级复杂造型01: 曲线长度 67`] = `9.894843040791566`; -exports[`超级复杂造型01: 曲线长度 68`] = `5230.469840585598`; +exports[`超级复杂造型01: 曲线长度 68`] = `2.2726440149400053`; exports[`超级复杂造型01: 曲线长度 69`] = `11906.411531839705`; @@ -422,9 +422,9 @@ exports[`超级复杂造型01: 曲线长度 76`] = `9277.910642188759`; exports[`超级复杂造型01: 走刀数量 1`] = `67`; -exports[`通孔造型测试: 曲线长度 1`] = `1872.616834159402`; +exports[`通孔造型测试: 曲线长度 1`] = `3600`; -exports[`通孔造型测试: 曲线长度 2`] = `3600`; +exports[`通孔造型测试: 曲线长度 2`] = `1872.616834159402`; exports[`通孔造型测试: 曲线长度 3`] = `1896.616834159402`; @@ -434,15 +434,15 @@ exports[`造型的外框和内框厚度小于刀半径厚度: 曲线长度 1`] = exports[`造型的外框和内框厚度小于刀半径厚度: 走刀数量 1`] = `0`; -exports[`造型的外框和内框厚度等于刀直径: 曲线长度 1`] = `1468.0153449019233`; +exports[`造型的外框和内框厚度等于刀直径: 曲线长度 1`] = `3600`; -exports[`造型的外框和内框厚度等于刀直径: 曲线长度 2`] = `10.71238898038469`; +exports[`造型的外框和内框厚度等于刀直径: 曲线长度 2`] = `1468.0153449019233`; -exports[`造型的外框和内框厚度等于刀直径: 曲线长度 3`] = `10.712388980384869`; +exports[`造型的外框和内框厚度等于刀直径: 曲线长度 3`] = `10.71238898038469`; -exports[`造型的外框和内框厚度等于刀直径: 曲线长度 4`] = `10.71238898038469`; +exports[`造型的外框和内框厚度等于刀直径: 曲线长度 4`] = `10.712388980384869`; -exports[`造型的外框和内框厚度等于刀直径: 曲线长度 5`] = `3600`; +exports[`造型的外框和内框厚度等于刀直径: 曲线长度 5`] = `10.71238898038469`; exports[`造型的外框和内框厚度等于刀直径: 曲线长度 6`] = `1483.4533999999999`; diff --git a/src/Add-on/testEntity/test.ts b/src/Add-on/testEntity/test.ts index 824324ca8..2a67f1004 100644 --- a/src/Add-on/testEntity/test.ts +++ b/src/Add-on/testEntity/test.ts @@ -6,6 +6,9 @@ import { Board } from "../../DatabaseServices/Entity/Board"; import { Production } from "../../Production/Product"; import { Polyline } from "../../DatabaseServices/Entity/Polyline"; import { Matrix4 } from "three"; +import { ParagraphSealinglist } from "../../GraphicsSystem/CalcEdgeSealing"; +import { Curve } from "../../DatabaseServices/Entity/Curve"; +import { IHighSealedItem } from "../../UI/Store/BoardInterface"; @HotCMD export class Test implements Command @@ -16,11 +19,13 @@ export class Test implements Command if (enRes.Status === PromptStatus.OK) { - let en = enRes.SelectSet.SelectEntityList as Polyline[]; + let en = enRes.SelectSet.SelectEntityList as Board[]; + let highSeals: IHighSealedItem[] = [{ size: 1 }, { size: 1 }, { size: 1 }, { size: 2 }, { size: 3 }, { size: 4 }, { size: 5 }, { size: 6 }, { size: 7 }]; for (let e of en) { - if (e.IsClockWise) e.ColorIndex = 1; + // if (e.IsClockWise) e.ColorIndex = 1; + console.log(ParagraphSealinglist(highSeals, e.ContourCurve.Explode() as Curve[])); } } } diff --git a/src/GraphicsSystem/CalcEdgeSealing.ts b/src/GraphicsSystem/CalcEdgeSealing.ts index 953948ef7..ad902b9ab 100644 --- a/src/GraphicsSystem/CalcEdgeSealing.ts +++ b/src/GraphicsSystem/CalcEdgeSealing.ts @@ -8,6 +8,7 @@ import { Line } from "../DatabaseServices/Entity/Line"; import { Polyline, TempPolyline } from "../DatabaseServices/Entity/Polyline"; import { angle, equaln, equalv3, isParallelTo, SelectNearP } from "../Geometry/GeUtils"; import { IntersectOption } from "./IntersectWith"; +import { IHighSealedItem } from "../UI/Store/BoardInterface"; /** *曲线列表分段 @@ -223,3 +224,90 @@ export function GetSealedBoardContour(br: Board): Polyline | Circle pl.Join(c); return pl; } + + +export function ParagraphSealinglist(hightSeal: IHighSealedItem[], cus: Curve[]) +{ + if (hightSeal.length !== cus.length) return hightSeal; + + let usedCu: WeakSet = new WeakSet(); + let newHighSeal: IHighSealedItem[] = []; + + //归类曲线,返回归类是否成功 + const paragraph = (cu: Curve, originCu: Curve, isBack: boolean) => + { + const cuIsLine = cu instanceof Line; + const originCuIsLine = originCu instanceof Line; + + if (usedCu.has(cu)) + return false; + + if (originCuIsLine !== cuIsLine) + { + if (originCuIsLine && + !isParallelTo(originCu.GetFistDeriv(0), cu.GetFistDeriv(0)) + && !isParallelTo(originCu.GetFistDeriv(0), cu.GetFistDeriv(1)) + ) + { + return false; + } + + if (cuIsLine + && !isParallelTo(originCu.GetFistDeriv(1), cu.GetFistDeriv(0)) + && !isParallelTo(originCu.GetFistDeriv(0), cu.GetFistDeriv(0) + )) + { + return false; + } + } + else if (cuIsLine) + { + //共线且相连的直线分为一组 #I11T1Z + if (!isParallelTo(cu.GetFistDeriv(0).normalize(), originCu.GetFistDeriv(0).normalize())) + return false; + let pts = [originCu.StartPoint, originCu.EndPoint]; + let pts2 = [cu.StartPoint, cu.EndPoint]; + if (pts.every(p => pts2.every(p2 => !equalv3(p, p2, 1e-6)))) + return false; + } + if (isBack) + hightSeal.shift(); + else + hightSeal.pop(); + usedCu.add(cu); + return true; + }; + let caclCus = cus.slice(); + + while (caclCus.length > 0) + { + let originCu = caclCus.shift(); + if (usedCu.has(originCu)) + continue; + let oldCu = originCu; + let originSeal = hightSeal.shift(); + newHighSeal.push(originSeal); + usedCu.add(originCu); + //往后搜索 + for (let i = 0; i < caclCus.length; i++) + { + if (!paragraph(caclCus[i], originCu, true)) + break; + originCu = caclCus[i]; + } + //只有第一条才需要往前搜索 + if (caclCus.length === cus.length - 1) + { + originCu = oldCu; + //往前搜索 + for (let i = caclCus.length - 1; i >= 0; i--) + { + if (!paragraph(caclCus[i], originCu, false)) + break; + originCu = caclCus[i]; + } + } + } + + return newHighSeal; +}