修复:矩形板拆单的时候,忽略板件轮廓,重新生成矩形轮廓 pm 596

pull/2338/head
ChenX 1 year ago
parent 9bfbedcc6c
commit a9badefd46

@ -137,7 +137,7 @@ Array [
1, 1,
0, 0,
0, 0,
12, 13,
0, 0,
"晨丰顶板", "晨丰顶板",
"未命名", "未命名",
@ -181,6 +181,7 @@ Array [
0, 0,
null, null,
0, 0,
0,
] ]
`; `;
@ -345,7 +346,7 @@ Array [
0, 0,
0, 0,
0, 0,
12, 13,
0, 0,
"辅助条(上收口)", "辅助条(上收口)",
"", "",
@ -393,5 +394,6 @@ Array [
0, 0,
null, null,
0, 0,
0,
] ]
`; `;

@ -24,13 +24,13 @@ exports[`切割残留一个小于封边厚度的凸角的板件封边 3`] = `"30
exports[`切割残留一个小于封边厚度的凸角的板件封边 4`] = `"1273.00000"`; exports[`切割残留一个小于封边厚度的凸角的板件封边 4`] = `"1273.00000"`;
exports[`封边编辑错误 1`] = `"4007.99985"`; exports[`封边编辑错误 1`] = `"4007.99995"`;
exports[`封边错误板件 1`] = `"130118.41213"`; exports[`封边错误板件 1`] = `"130118.41213"`;
exports[`封边错误板件2 1`] = `"779770.96110"`; exports[`封边错误板件2 1`] = `"779770.96110"`;
exports[`封边错误板件3 1`] = `"359947.95128"`; exports[`封边错误板件3 1`] = `"359948.03004"`;
exports[`封边错误板件4 1`] = `"30748.99860"`; exports[`封边错误板件4 1`] = `"30748.99860"`;

@ -30,6 +30,6 @@ exports[`只有一个封边,并且失败的案例(展示这个改进的缺陷的
exports[`只有一个封边,并且失败的案例(展示这个改进的缺陷的地方) 2`] = `"2440.00000"`; exports[`只有一个封边,并且失败的案例(展示这个改进的缺陷的地方) 2`] = `"2440.00000"`;
exports[`矩形板解析封边错误 1`] = `"610545.00000"`; exports[`矩形板解析封边错误 1`] = `"610545.13281"`;
exports[`矩形板解析封边错误 2`] = `"3836.00000"`; exports[`矩形板解析封边错误 2`] = `"3836.00066"`;

@ -32,13 +32,13 @@ exports[`封边 5`] = `"8.00000"`;
exports[`小圆弧封边 1`] = `"284040.62619"`; exports[`小圆弧封边 1`] = `"284040.62619"`;
exports[`小圆弧封边 2`] = `"286176.63189"`; exports[`小圆弧封边 2`] = `"286176.68554"`;
exports[`小圆弧封边 3`] = `"4"`; exports[`小圆弧封边 3`] = `"4"`;
exports[`小圆弧封边 4`] = `"5"`; exports[`小圆弧封边 4`] = `"4"`;
exports[`小圆弧封边 5`] = `"5"`; exports[`小圆弧封边 5`] = `"4"`;
exports[`无法计算封边 1`] = `"4166.00000"`; exports[`无法计算封边 1`] = `"4166.00000"`;
@ -136,6 +136,79 @@ Object {
} }
`; `;
exports[`每段封边对应 5`] = `
Object {
"buls": Array [
0,
0,
0,
0,
0,
0.41421356237309503,
0,
],
"pts": Array [
Vector2 {
"x": 597,
"y": 1.1368683772161603e-13,
},
Vector2 {
"x": 597.0000000000001,
"y": 1066.1313131313123,
},
Vector2 {
"x": 275.28282828282823,
"y": 1066.1313131313123,
},
Vector2 {
"x": 275.2828282828282,
"y": 1198,
},
Vector2 {
"x": 2.1316282072803006e-13,
"y": 1198,
},
Vector2 {
"x": 0,
"y": 239.74048459379708,
},
Vector2 {
"x": 239.74048459379694,
"y": 2.842170943040401e-14,
},
],
}
`;
exports[`每段封边对应 6`] = `
Object {
"buls": Array [
-0,
0.5761636686505207,
-0,
-0,
],
"pts": Array [
Vector2 {
"x": 0,
"y": 5.684341886080802e-14,
},
Vector2 {
"x": 196.74752165480933,
"y": 0,
},
Vector2 {
"x": 196.74752165480942,
"y": 348.00000000000006,
},
Vector2 {
"x": 0,
"y": 348.00000000000006,
},
],
}
`;
exports[`特殊链接 圆弧间 1`] = `"187815.39618"`; exports[`特殊链接 圆弧间 1`] = `"187815.39618"`;
exports[`特殊链接 圆弧间 2`] = `"190259.30510"`; exports[`特殊链接 圆弧间 2`] = `"190259.30510"`;
@ -145,3 +218,32 @@ exports[`特殊链接 圆弧间 3`] = `"6"`;
exports[`特殊链接 圆弧间 4`] = `"6"`; exports[`特殊链接 圆弧间 4`] = `"6"`;
exports[`特殊链接 圆弧间 5`] = `"6"`; exports[`特殊链接 圆弧间 5`] = `"6"`;
exports[`矩形板拆单的时候,给一个原始矩形轮廓 1`] = `
Object {
"buls": Array [
0,
0,
0,
0,
],
"pts": Array [
Vector2 {
"x": 0,
"y": 0,
},
Vector2 {
"x": 317.5,
"y": 0,
},
Vector2 {
"x": 317.5,
"y": 1830,
},
Vector2 {
"x": 0,
"y": 1830,
},
],
}
`;

@ -102,3 +102,18 @@ test('每段封边对应', () =>
expect(data.outline).toMatchSnapshot(); expect(data.outline).toMatchSnapshot();
} }
}); });
test('矩形板拆单的时候,给一个原始矩形轮廓', () =>
{
let d =
{ "file": [1, "Board", 10, 2, 153, 0, 1, 3, 71, [0, 1, 0, 0, -0.9999999999999998, 0, 0, 0, 0, 0, 0.9999999999999998, 0, 2800.751781447019, 331.64302452420816, 2239.9999999999995, 1], 155, 0, 1, [0.9999999999999999, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0.9999999999999999, 0, 950.7517814470189, 679.1430245242082, 0, 1], 0, 0, 1, 3, 1832, 319.5, 18, true, "Polyline", 10, 2, 0, 0, 0, 7, 71, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 347.5, 668, 0, 1], 0, 0, 1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 347.5, 668, 0, 1], 0, 0, 1, 2, 4, [-28, -668], 0, [-347.5, -668], 0, [-347.5, 1164], 0, [-28, 1164], 0, true, 0, 3, 0, 0, 0, 0, 0, 13, 0, "顶板", "2", "客厅储物柜", "印第安银超长板O", "欧松板", "印第安银超长板", 0, 0, "三合一", 2, 4, 1, 1, 1, 1, "1", "1", "1", "1", "", "", "", 4, "三合一", "三合一", "三合一", "三合一", true, true, 0, 2, 156, 2, 3, 157, 159, 140, 3, 144, 141, 142, 154, 2, 3, 148, 145, 146, 3, 152, 149, 150, 0, 0, 0, 0, 0, 0, true, 0, 0, null, 0, 0], "basePt": { "x": 968.7517814470193, "y": 331.64302452420816, "z": 2239.9999999999995 }, "ucs": [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1] };
let brs = LoadEntityFromFileData(d) as Board[];
for (let br of brs)
{
br.objectId = new ObjectId(101);//创造101
let data = Production.GetBoardSplitOrderData(br);
expect(data.outline).toMatchSnapshot();
}
});

@ -227,17 +227,21 @@ export function GetBoardSealingCurves(br: Board, offsetInside = false): Curve[]
if (brContour instanceof Circle) if (brContour instanceof Circle)
return [brContour.Clone()]; return [brContour.Clone()];
if (br.IsRect)
brContour = new Polyline().Rectangle(br.Width, br.Height);
if (offsetInside) if (offsetInside)
{ {
let dir = Math.sign(brContour.Area2); let dir = Math.sign(brContour.Area2);
let offsetedCurve = brContour.GetOffsetCurves(-1 * dir)[0] as Polyline; let offsetedCurve = brContour.GetOffsetCurves(-1 * dir)[0] as Polyline;
if (OffsetOutlineSpNotChange(brContour, offsetedCurve)) if (br.IsSpecialShape && OffsetOutlineSpNotChange(brContour, offsetedCurve))
brContour = offsetedCurve; brContour = offsetedCurve;
} }
//避免共线导致的侧面数据对应错误 //避免共线导致的侧面数据对应错误
let curves = brContour.Explode(); let curves = brContour.Explode();
MergeCurvelist(curves); if (br.IsSpecialShape)
MergeCurvelist(curves);
if (curves.length === 1 && curves[0] instanceof Circle)//变成一个圆 if (curves.length === 1 && curves[0] instanceof Circle)//变成一个圆
return curves; return curves;

Loading…
Cancel
Save