From 0b72b9bfa87de26afddfd871c5ce9324b7a6b3b5 Mon Sep 17 00:00:00 2001 From: ChenX Date: Fri, 20 May 2022 10:43:56 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96:=E8=BF=87=E6=BB=A4=E4=BD=8D?= =?UTF-8?q?=E7=BD=AE=E4=B8=8D=E6=AD=A3=E7=A1=AE=E7=9A=84=E6=B4=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Production/Product.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/Production/Product.ts b/src/Production/Product.ts index 761a25cc8..37cfeec97 100644 --- a/src/Production/Product.ts +++ b/src/Production/Product.ts @@ -7,6 +7,7 @@ import { EBoardKeyList } from "../Common/BoardKeyList"; import { MergeCurvelist } from "../Common/CurveUtils"; import { IsDev } from "../Common/Deving"; import { ParseExpr, safeEval } from "../Common/eval"; +import { Log } from "../Common/Log"; import { Vector2ApplyMatrix4 } from "../Common/Matrix4Utils"; import { SendReport } from "../Common/Report"; import { ShowSelectObjects } from "../Common/ShowSelectObjects"; @@ -883,7 +884,11 @@ export namespace Production let z1 = Math.max(sp.z, ep.z); let p = sp.clone().setZ(0).sub(offsetTanslation); - if (Math.max(z0, 0) < Math.min(z1, br.Thickness) - CanDrawHoleFuzz && outline.PtInCurve(p) && groovesOutlines.every(g => !g.PtInCurve(p))) + if (Math.max(z0, 0) < (Math.min(z1, br.Thickness) - CanDrawHoleFuzz) //区间有交集 + && (z0 < CanDrawHoleFuzz || z1 > (br.Thickness - CanDrawHoleFuzz))//禁止在中间挖洞 + && outline.PtInCurve(p) //在轮廓内 + && groovesOutlines.every(g => !g.PtInCurve(p)) //不在洞内 + ) { let depth = z0 < CanDrawHoleFuzz ? z1 : br.Thickness - z0; let angle = angleTo(XAxis, x); @@ -899,6 +904,10 @@ export namespace Production angle: angle, }); } + else + { + Log(`警告:板:{${br.Name}}的孔位置不正确,已经跳过!`); + } } else { @@ -919,7 +928,7 @@ export namespace Production let pt = outline.IntersectWith(line, 0)[0]; if (!pt) { - console.error("排钻嵌在板件内部"); + Log(`警告:板:${br.Name}的排钻嵌在板件内部,已经跳过!`); return; } let position = pt.clone().setZ(oldZ);