|
|
|
@ -502,76 +502,86 @@ export class BoardConfigModal extends React.Component<BoardConfigProps, {}>{
|
|
|
|
|
|
|
|
|
|
if (path)
|
|
|
|
|
{
|
|
|
|
|
//获取真实刀半径
|
|
|
|
|
let id = cd.items[0].knife.id;
|
|
|
|
|
//从刀库获取新的刀具(id有标识时) 否则使用缓存刀具轮廓 解决不同店铺编辑保存二维刀路时鉴权失败问题
|
|
|
|
|
let useNewKnife = false;
|
|
|
|
|
|
|
|
|
|
if (id.startsWith("_"))
|
|
|
|
|
//同颜色不同偏移 有多个刀具
|
|
|
|
|
for (let i = 0; i < cd.items.length; i++)
|
|
|
|
|
{
|
|
|
|
|
id = id.replace("_", "");
|
|
|
|
|
useNewKnife = true;
|
|
|
|
|
}
|
|
|
|
|
//获取真实刀半径
|
|
|
|
|
let id = cd.items[i].knife.id;
|
|
|
|
|
//从刀库获取新的刀具(id有标识时) 否则使用缓存刀具轮廓 解决不同店铺编辑保存二维刀路时鉴权失败问题
|
|
|
|
|
let useNewKnife = false;
|
|
|
|
|
|
|
|
|
|
let halfWidth = knifeSizeMap.get(id);
|
|
|
|
|
if (!halfWidth)
|
|
|
|
|
{
|
|
|
|
|
//从刀库获取新的刀具 否则使用缓存刀具轮廓 解决不同店铺编辑保存二维刀路时鉴权失败问题
|
|
|
|
|
let polyline = useNewKnife ? await this.getToplinesDetailPolyline(id) : br.KnifePolylineMap.get(id) ?? await this.getToplinesDetailPolyline(id);
|
|
|
|
|
if (cd.items[i].offset)
|
|
|
|
|
path = path.Clone().GetOffsetCurves(cd.items[i].offset)[0];
|
|
|
|
|
|
|
|
|
|
//二维刀路时鉴权失败时 保存路径后退出
|
|
|
|
|
if (!polyline)
|
|
|
|
|
if (id.startsWith("_"))
|
|
|
|
|
{
|
|
|
|
|
path.ColorIndex = c.ColorIndex;
|
|
|
|
|
if (!pathMap.has(c.ColorIndex))
|
|
|
|
|
pathMap.set(c.ColorIndex, [path]);
|
|
|
|
|
else
|
|
|
|
|
pathMap.get(c.ColorIndex).push(path);
|
|
|
|
|
break;
|
|
|
|
|
id = id.replace("_", "");
|
|
|
|
|
useNewKnife = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
halfWidth = polyline.BoundingBox.getSize(new Vector3).x / 2;
|
|
|
|
|
knifeSizeMap.set(id, halfWidth);
|
|
|
|
|
knifeMap.set(id, polyline);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//提示与板没有交集的刀路
|
|
|
|
|
if (brCurveBox.intersectsBox(path.BoundingBox, halfWidth))
|
|
|
|
|
{
|
|
|
|
|
//异型板情况
|
|
|
|
|
if (!brCurve.IntersectWith(path, IntersectOption.ExtendNone).length)
|
|
|
|
|
let halfWidth = knifeSizeMap.get(id);
|
|
|
|
|
if (!halfWidth)
|
|
|
|
|
{
|
|
|
|
|
//如果头尾不在误差轮廓内 就忽略
|
|
|
|
|
let pl = brCurve as Polyline;
|
|
|
|
|
let offsetPolyine = pl.GetOffsetCurves(halfWidth * (pl.IsClockWise ? -1 : 1));
|
|
|
|
|
//从刀库获取新的刀具 否则使用缓存刀具轮廓 解决不同店铺编辑保存二维刀路时鉴权失败问题
|
|
|
|
|
let polyline = useNewKnife ? await this.getToplinesDetailPolyline(id) : br.KnifePolylineMap.get(id) ?? await this.getToplinesDetailPolyline(id);
|
|
|
|
|
|
|
|
|
|
let isInt = offsetPolyine.some(pl => pl.IntersectWith(path, IntersectOption.ExtendNone).length > 0 || pl.PtInCurve(path.StartPoint));
|
|
|
|
|
if (!isInt)
|
|
|
|
|
//二维刀路时鉴权失败时 保存路径后退出
|
|
|
|
|
if (!polyline && i === 0)
|
|
|
|
|
{
|
|
|
|
|
AppToaster.show({
|
|
|
|
|
message: "检测到刀路在板外,可能无法切割到板!",
|
|
|
|
|
timeout: 5000,
|
|
|
|
|
intent: Intent.WARNING,
|
|
|
|
|
});
|
|
|
|
|
path.ColorIndex = c.ColorIndex;
|
|
|
|
|
if (!pathMap.has(c.ColorIndex))
|
|
|
|
|
pathMap.set(c.ColorIndex, [path]);
|
|
|
|
|
else
|
|
|
|
|
pathMap.get(c.ColorIndex).push(path);
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
halfWidth = polyline.BoundingBox.getSize(new Vector3).x / 2;
|
|
|
|
|
knifeSizeMap.set(id, halfWidth);
|
|
|
|
|
knifeMap.set(id, polyline);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//提示与板没有交集的刀路
|
|
|
|
|
if (brCurveBox.intersectsBox(path.BoundingBox, halfWidth))
|
|
|
|
|
{
|
|
|
|
|
//异型板情况
|
|
|
|
|
if (!brCurve.IntersectWith(path, IntersectOption.ExtendNone).length)
|
|
|
|
|
{
|
|
|
|
|
//如果头尾不在误差轮廓内 就忽略
|
|
|
|
|
let pl = brCurve as Polyline;
|
|
|
|
|
let offsetPolyine = pl.GetOffsetCurves(halfWidth * (pl.IsClockWise ? -1 : 1));
|
|
|
|
|
|
|
|
|
|
let isInt = offsetPolyine.some(pl => pl.IntersectWith(path, IntersectOption.ExtendNone).length > 0 || pl.PtInCurve(path.StartPoint));
|
|
|
|
|
if (!isInt)
|
|
|
|
|
{
|
|
|
|
|
AppToaster.show({
|
|
|
|
|
message: "检测到刀路在板外,可能无法切割到板!",
|
|
|
|
|
timeout: 5000,
|
|
|
|
|
intent: Intent.WARNING,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
AppToaster.show({
|
|
|
|
|
message: "检测到刀路在板外,可能无法切割到板!(刀路包围盒没有交集)",
|
|
|
|
|
timeout: 5000,
|
|
|
|
|
intent: Intent.WARNING,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
AppToaster.show({
|
|
|
|
|
message: "检测到刀路在板外,可能无法切割到板!(刀路包围盒没有交集)",
|
|
|
|
|
timeout: 5000,
|
|
|
|
|
intent: Intent.WARNING,
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
path.ColorIndex = c.ColorIndex;
|
|
|
|
|
if (!pathMap.has(c.ColorIndex))
|
|
|
|
|
pathMap.set(c.ColorIndex, [path]);
|
|
|
|
|
else
|
|
|
|
|
pathMap.get(c.ColorIndex).push(path);
|
|
|
|
|
//不记录偏移的路径
|
|
|
|
|
if (i > 0) continue;
|
|
|
|
|
|
|
|
|
|
break;//
|
|
|
|
|
path.ColorIndex = c.ColorIndex;
|
|
|
|
|
if (!pathMap.has(c.ColorIndex))
|
|
|
|
|
pathMap.set(c.ColorIndex, [path]);
|
|
|
|
|
else
|
|
|
|
|
pathMap.get(c.ColorIndex).push(path);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|