优化:过滤位置不正确的洞

pull/1916/MERGE
ChenX 2 years ago
parent 4e5d968d97
commit 0b72b9bfa8

@ -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);

Loading…
Cancel
Save