修复:余料分析结果错误

pull/3096/MERGE
ChenX 3 weeks ago
parent 47b9532db7
commit ed03219058

@ -23,18 +23,21 @@ const CanPutPaths = [
*/
export function ParseOddments(container: Container, binPath: Path, knifeRadius: number = 3.5, squarePath: Path = SquarePath, canPutPaths: Path[] = CanPutPaths): Path[]
{
//构建轮廓数据
let partPaths: ClipInput[] = container.PlacedParts.map(part =>
let partPaths: ClipInput[] = [];
for (let part of container.PlacedParts)
{
//直接在这里偏移,而不缓存,应该没有性能问题
let newPts = clipperCpp.lib.offsetToPaths({
//外偏移一个刀半径
let offsetPathArray = clipperCpp.lib.offsetToPaths({
delta: knifeRadius * 1e4,
offsetInputs: [{ data: part.State.Contour.BigIntPoints, joinType: JoinType.Miter, endType: EndType.ClosedPolygon }]
})[0];
});
let path = PathTranslate(newPts, { x: part.PlacePosition.x - 5e3, y: part.PlacePosition.y - 5e3 });//因为移动了0.5,0.5,所以这里也要移动0.5
return { data: path };
});
for (let path of offsetPathArray)
{
let movePath = PathTranslate(path, { x: part.PlacePosition.x - 5e3, y: part.PlacePosition.y - 5e3 });//因为移动了0.5,0.5,所以这里也要移动0.5
partPaths.push({ data: movePath });
}
}
//所有的余料(使用布尔差集)
let oddmentsPolygon = clipperCpp.lib.clipToPolyTree({

Loading…
Cancel
Save