!815 优化:造型尺寸小于刀半径的走刀结果 fixes #I13LS1

pull/815/MERGE
ZoeLeeFZ 5 years ago committed by ChenX
parent 287b22a4c8
commit 91ab25be65

File diff suppressed because one or more lines are too long

@ -64,43 +64,51 @@ exports[`复杂极限刀半径: 走刀数量 1`] = `5`;
exports[`复杂造型01: 曲线长度 1`] = `3600`;
exports[`复杂造型01: 曲线长度 2`] = `59609.750635032455`;
exports[`复杂造型01: 曲线长度 2`] = `45851.27982948799`;
exports[`复杂造型01: 曲线长度 3`] = `1482.4552077856665`;
exports[`复杂造型01: 曲线长度 3`] = `9328.396540734857`;
exports[`复杂造型01: 曲线长度 4`] = `838.7907023816642`;
exports[`复杂造型01: 曲线长度 4`] = `4417.523956828297`;
exports[`复杂造型01: 曲线长度 5`] = `119.2450237058813`;
exports[`复杂造型01: 曲线长度 5`] = `1482.4552077856665`;
exports[`复杂造型01: 曲线长度 6`] = `920.6205527518313`;
exports[`复杂造型01: 曲线长度 6`] = `838.7907023816642`;
exports[`复杂造型01: 曲线长度 7`] = `136.38881122495832`;
exports[`复杂造型01: 曲线长度 7`] = `25.328937185896002`;
exports[`复杂造型01: 曲线长度 8`] = `40.76338989846492`;
exports[`复杂造型01: 曲线长度 8`] = `25.328939247232213`;
exports[`复杂造型01: 曲线长度 9`] = `3.2524680966497335`;
exports[`复杂造型01: 曲线长度 9`] = `676.6930479102875`;
exports[`复杂造型01: 曲线长度 10`] = `301.66992978702626`;
exports[`复杂造型01: 曲线长度 10`] = `227.6085817490802`;
exports[`复杂造型01: 曲线长度 11`] = `1749.8631881230117`;
exports[`复杂造型01: 曲线长度 11`] = `136.38881122495832`;
exports[`复杂造型01: 曲线长度 12`] = `7.8285491298056655`;
exports[`复杂造型01: 曲线长度 12`] = `40.76338989846492`;
exports[`复杂造型01: 曲线长度 13`] = `2.5692483033658107`;
exports[`复杂造型01: 曲线长度 13`] = `3.2524680966497335`;
exports[`复杂造型01: 曲线长度 14`] = `4316.136010511218`;
exports[`复杂造型01: 曲线长度 14`] = `301.66992978702626`;
exports[`复杂造型01: 曲线长度 15`] = `60.75516885168303`;
exports[`复杂造型01: 曲线长度 15`] = `1749.8631881230117`;
exports[`复杂造型01: 曲线长度 16`] = `270.97161059159566`;
exports[`复杂造型01: 曲线长度 16`] = `7.8285491298056655`;
exports[`复杂造型01: 曲线长度 17`] = `282.82481905047365`;
exports[`复杂造型01: 曲线长度 17`] = `2.5692483033658107`;
exports[`复杂造型01: 曲线长度 18`] = `819.9411466147131`;
exports[`复杂造型01: 曲线长度 18`] = `4316.136010511218`;
exports[`复杂造型01: 曲线长度 19`] = `1463.6056529693449`;
exports[`复杂造型01: 曲线长度 19`] = `60.75516885168303`;
exports[`复杂造型01: 走刀数量 1`] = `12`;
exports[`复杂造型01: 曲线长度 20`] = `270.97161059159566`;
exports[`复杂造型01: 曲线长度 21`] = `282.82481905047365`;
exports[`复杂造型01: 曲线长度 22`] = `819.9411466147131`;
exports[`复杂造型01: 曲线长度 23`] = `1463.6056529693449`;
exports[`复杂造型01: 走刀数量 1`] = `16`;
exports[`复杂造型测试: 曲线长度 1`] = `2402.511185283596`;

@ -32,8 +32,9 @@ export class FeedingToolPath extends Singleton
*/
private HandleShape(shape: Shape, knifRadius: number, isOut = true): Curve[]
{
let outline = shape.Outline.Curve.Clone();
let outline = shape.Outline.Curve;
if (isOut)
outline = outline.Clone();
let isBulge = (outline instanceof Polyline) && outline.IsBulge;
let dir = GetCurveToInDir(outline);
@ -72,7 +73,9 @@ export class FeedingToolPath extends Singleton
offsetDist += knifRadius;
let retCus: Curve[] = [];
retCus.push(...GetOffsetCurves(outline, offsetDist * dir));
let tempOffsetCus = GetOffsetCurves(outline, offsetDist * dir);
retCus.push(...tempOffsetCus);
//最后一次内偏移如果是凸多边形,需在偏移一个刀半径避免没切到中心
if (retCus.length === 0 && isBulge)
@ -110,6 +113,8 @@ export class FeedingToolPath extends Singleton
shapeMg.BoolOper(holesMg, BoolOpeartionType.Subtract);
for (let s of shapeMg.ShapeList)
{
if (isOut && tempOffsetCus.length > 1)
s.Outline.Curve.TempData = { isOut: true };
s.Outline.Curve.ColorIndex = outline.ColorIndex;
offsetCus.push(...this.HandleShape(s, knifRadius, false));
}

@ -6,7 +6,7 @@ import { Curve } from "../../DatabaseServices/Entity/Curve";
import { Line } from "../../DatabaseServices/Entity/Line";
import { Polyline } from "../../DatabaseServices/Entity/Polyline";
import { Shape } from "../../DatabaseServices/Shape";
import { AsVector2, AsVector3, comparePoint } from "../../Geometry/GeUtils";
import { AsVector2, AsVector3, comparePoint, equalv3 } from "../../Geometry/GeUtils";
/**
* ,线
@ -93,10 +93,14 @@ export function OptimizeToolPath(offsetCus: Curve[], originShape: Shape, rad: nu
for (let i = 1; i < plList.length; i++)
{
let ePt = firstPl.EndPoint;
let isDisVail: boolean;
if (plList[i].TempData?.isOut && !equalv3(ePt, plList[i].StartPoint))
isDisVail = true;
else
{
let refLine = new Line(ePt, plList[i].StartPoint);
let isDisVail = cantIntCur.some(c => c.IntersectWith(refLine, 0).length > 1);
isDisVail = cantIntCur.some(c => c.IntersectWith(refLine, 0).length > 1);
}
if (isDisVail)
{

Loading…
Cancel
Save