优化:排料捕获曲线转零件错误

pull/1186/head
ChenX 4 years ago
parent 260fa8a5ac
commit add2584c17

@ -1,13 +1,14 @@
import { EndType, JoinType } from "js-angusj-clipper/web";
import { Box3, Vector3 } from "three";
import { app } from "../../ApplicationServices/Application";
import { Circle } from "../../DatabaseServices/Entity/Circle";
import { Curve } from "../../DatabaseServices/Entity/Curve";
import { Polyline } from "../../DatabaseServices/Entity/Polyline";
import { polar } from "../../Geometry/GeUtils";
import { clipperCpp } from "../Common/ClipperCpp";
import { Point } from "../Common/Point";
import { Part } from "../Core/Part";
import { Path, PathScale } from "../Core/Path";
import { Point } from "../Common/Point";
import { Polylin2Points } from "./ConverBoard2Part";
import { Path2Polyline } from "./Path2Polyline";
import { IOffset, SimplifyDouglasPeucker } from "./Simplify2";
@ -178,18 +179,25 @@ export function Curves2Parts(curves: (Polyline | Circle)[], binPath: Path, KnifR
}
}
let part = new Part();
let curves: Curve[] = [w.Curve];
let path = new Path(w.GetOutsidePoints());
for (let h of w.Holes)
try
{
let part = new Part();
let curves: Curve[] = [w.Curve];
let path = new Path(w.GetOutsidePoints());
for (let h of w.Holes)
{
let path2 = new Path(h.GetInsidePoints());
part.AppendHole(path2);
curves.push(h.Curve);
}
part.Init(path, binPath, 12);
part.UserData = curves;
parts.push(part);
}
catch (error)
{
let path2 = new Path(h.GetInsidePoints());
part.AppendHole(path2);
curves.push(h.Curve);
app.Editor.Prompt("曲线转零件失败!");
}
part.Init(path, binPath, 12);
part.UserData = curves;
parts.push(part);
}
return parts;
}

Loading…
Cancel
Save