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

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

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

Loading…
Cancel
Save