!2793 修复: 板件的干涉问题

pull/2790/MERGE
张子涵 4 months ago committed by ChenX
parent c873d40b57
commit 4cc019b634

@ -127,4 +127,11 @@ describe("干涉测试", () =>
{ "file": [3, "Board", 10, 2, 358, 0, 1, 2, 71, [0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1, 0, 3730.7096330325576, 2724.3225088479735, 0, 1], 0, 0, 1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 3730.7096330325576, 2724.3225088479735, 0, 1], 0, 0, 1, 3, 800, 500, 18, false, "Polyline", 10, 2, 0, 0, 0, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, 1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, 1, 2, 5, [0, 0], 0, [292.0662700106652, 0], 0.41421356237309503, [500, 207.93372998933478], 0, [500, 800], 0, [0, 800], 0, true, 0, 3, 0, 0, 0, 0, 0, 19, 0, "层板", "", "", "", "", "", 0, 0, "三合一", 2, 3, 0, 0, 0, "0", "0", "0", "0", "", "", "", 5, "三合一", "三合一", "三合一", "三合一", "三合一", true, true, 1, "1", "1", 2, 359, 5, 4, 361, 362, 363, 364, 4, 365, 366, 367, 368, 3, 371, 372, 373, 3, 374, 375, 376, 3, 377, 378, 379, 360, 4, 3, 383, 384, 385, 3, 386, 387, 388, 4, 391, 392, 393, 394, 4, 395, 396, 397, 398, 0, 0, 0, 0, 0, 0, true, 0, 0, null, 0, 0, "", "", "", "", 3, { "description": "" }, { "description": "" }, { "description": "" }, false, 0, "", "Board", 10, 2, 359, 0, 1, 2, 71, [0.8479983040050879, -0.52999894000318, 0, 0, 0, 0, 1, 0, -0.52999894000318, -0.8479983040050879, 0, 0, 2930.7096330325576, 3224.3225088479735, 3.0809133022557944e-11, 1], 0, 0, 1, [0.8479983040050879, -0.52999894000318, 0, 0, 0, 0, 1, 0, -0.52999894000318, -0.8479983040050879, 0, 0, 2930.7096330325576, 3224.3225088479735, 3.0809133022557944e-11, 1], 0, 0, 1, 3, 1200, 1336, 18, true, "Polyline", 10, 2, 0, 0, 0, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, 1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, 1, 2, 4, [0, 0], 0, [1336, 0], 0, [1336, 1200], 0, [0, 1200], 0, true, 0, 3, 0, 0, 0, 0, 0, 19, 0, "圆弧板", "", "", "", "", "", 0, 0, "三合一", 2, 0, "1", "1", "1", "1", "", "", "", 4, "三合一", "三合一", "三合一", "三合一", true, true, 0, 1, 358, 5, 4, 361, 362, 363, 364, 4, 365, 366, 367, 368, 3, 371, 372, 373, 3, 374, 375, 376, 3, 377, 378, 379, 0, 0, 0, 0, 0, 0, true, 0, 0, null, 0, 0, "", "", "", "", 0, false, 0, "Polyline", 10, 2, 0, 0, 0, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, 1, [0.8479983040050879, -0.52999894000318, 0, 0, -0.52999894000318, -0.8479983040050879, 0, 0, 0, 0, -1, 0, -1443.3438319990282, 583.0261051057685, 781.3702416451415, 1], 0, 0, 1, 2, 3, [0, -5.684341886080802e-14], 0, [264.9994700015901, 423.9991520025436], 0, [943.3981132056601, 0], 0, false, 0, 0, true, 1, -1, 0, 6, 6, 2, 0, 0, 0, 3, 0, "Board", 10, 2, 360, 0, 1, 2, 71, [-0.8479983040050879, 0.5299989400031802, 0, 0, 0, 0, 1, 0, 0.5299989400031802, 0.8479983040050879, 0, 0, 3730.7096298449096, 2724.3225088479735, 3.0809133022557944e-11, 1], 0, 0, 1, [-0.8479983040050879, 0.5299989400031802, 0, 0, 0, 0, 1, 0, 0.5299989400031802, 0.8479983040050879, 0, 0, 3730.7096298449096, 2724.3225088479735, 3.0809133022557944e-11, 1], 0, 0, 1, 3, 1200, 1239.02841, 18, true, "Polyline", 10, 2, 0, 0, 0, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, 1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, 1, 2, 4, [0, 0], 0, [1239.02841, 0], 0, [1239.02841, 1200], 0, [0, 1200], 0, true, 0, 3, 0, 0, 0, 0, 0, 19, 0, "圆弧板", "", "", "", "", "", 0, 0, "三合一", 2, 0, "1", "1", "1", "1", "", "", "", 4, "三合一", "三合一", "三合一", "三合一", true, true, 0, 1, 358, 4, 3, 383, 384, 385, 3, 386, 387, 388, 4, 391, 392, 393, 394, 4, 395, 396, 397, 398, 0, 0, 0, 0, 0, 0, true, 0, 0, null, 0, 0, "", "", "", "", 0, false, 0, "Polyline", 10, 2, 0, 0, 0, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, 1, [-0.8479983040050879, 0.5299989400031802, 0, 0, 0.5299989400031802, 0.8479983040050879, 0, 0, 0, 0, -1, 0, 1913.9665411401543, -1266.7111130584567, 781.3702416451415, 1], 0, 0, 1, 2, 4, [0, 0], 0, [154.7948135163351, 247.6717016261362], -0.41421356237309503, [441.32692037799757, 313.79449551728925], 0, [943.3981132056606, -5.684341886080802e-14], 0, false, 0, 0, true, 2, -1, 0, 6, 6, 2, 0, 0, 0, 3, 0, 1, 354.89587, 6, 6, 2, 0, 0, 0, 3, 0], "basePt": { "x": 2679.9006452701487, "y": 2338.682052343912, "z": 0 }, "ucs": [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1] };
await Check(d, 0);
});
test('圆弧板干涉检查#I2DXNO', async () =>
{
let d =
{ "file": [2, "Board", 10, 2, 236, 0, 1, 2, 71, [0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1, 0, 3582, 402, 2101.3333333333335, 1], 234, 0, 1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1254, 380, 1417.9999999999998, 1], 0, 0, 1, 3, 1903.5460465116278, 306, 18, false, "Polyline", 10, 2, 0, 0, 0, 7, 71, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 2328, 0, 1], 0, 0, 1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 0, 0, 1, 2, 12, [0, -2328], 0, [306, -2328], 0, [306, -1560.6666666666665], 0, [143, -1560.6666666666665], 0, [143, -1542.6666666666665], 0, [306, -1542.6666666666665], 0, [306, -785.3333333333335], 0, [143, -785.3333333333335], 0, [143, -767.3333333333335], 0, [306, -767.3333333333337], 0, [306, -424.45395348837224], 0, [0, -424.45395348837224], 0, true, 1, 3, 12, 1903.5460465116275, 12, true, "Polyline", 10, 2, 0, 0, 0, 7, 71, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -1201.8223828368555, -394.6622800510993, 0, 1], 0, 0, 1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -1201.8223828368555, -394.6622800510993, 0, 1], 0, 0, 1, 2, 4, [1201.8223828368555, 394.6622800510993], 0, [3105.368429348483, 394.6622800510993], 0, [3105.368429348483, 406.6622800510993], 0, [1201.8223828368555, 406.6622800510993], 0, true, 0, 4.5, 0, 0, 0, 0, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 1678.4539534883725, 549.75, 2101.3333333333335, 1], 3, 0, 0, 0, 0, 0, 19, 0, "层板", "餐边柜", "餐边柜", "", "", "", 0, 1, "**多种**", 2, 12, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, "1", "1", "1", "1", "", "", "", 12, "木得易", "木得易", "不排", "不排", "不排", "木得易", "不排", "不排", "不排", "木得易", "木得易", "木得易", true, true, 0, 0, 0, 0, 0, 0, 2, 5241, 5683, 0, true, 0, 0, null, 0, 0, "", "", "", "", 12, { "description": "" }, { "description": "" }, { "description": "" }, { "description": "" }, { "description": "" }, { "description": "" }, { "description": "" }, { "description": "" }, { "description": "" }, { "description": "" }, { "description": "" }, { "description": "" }, false, 0, "", "Board", 10, 2, 5725, 0, 1, 11, 71, [0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 2021.3333333333335, 402, 1882.665121365555, 1], 287, 0, 1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 2021.3333333333335, 402, 1417.9999999999998, 1], 0, 0, 1, 3, 569.334878634445, 306, 18, false, "Polyline", 10, 2, 0, 0, 0, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, -464.66512136555525, 0, 1], 0, 0, 1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, -464.66512136555525, 0, 1], 0, 0, 1, 2, 8, [0, 464.66512136555525], 0, [306, 464.66512136555525], 0, [306, 1034.0000000000002], 0, [0, 1034.0000000000002], 0, [0, 701.3333333333335], 0, [153, 701.3333333333335], 0, [153, 683.3333333333335], 0, [0, 683.3333333333335], 0, true, 0, 3, 0, 0, 0, 0, 0, 19, 1, "立板", "餐边柜", "餐边柜", "", "", "", 0, 0, "**多种**", 2, 8, 1, 1, 1, 1, 1, 1, 1, 1, "1", "1", "1", "1", "", "", "", 8, "木得易", "木得易", "不排", "木得易", "木得易", "不排", "木得易", "木得易", true, true, 0, 0, 0, 0, 0, 0, 0, 0, true, 0, 0, null, 0, 0, "", "", "", "", 8, { "description": "" }, { "description": "" }, { "description": "" }, { "description": "" }, { "description": "" }, { "description": "" }, { "description": "" }, { "description": "" }, false, 0, ""], "basePt": { "x": 1678.4539534883722, "y": 402, "z": 1882.665121365555 }, "ucs": [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1] };
await Check(d, 0);
});
});

@ -133,35 +133,35 @@ export class CheckInterfereTool
if (!obb1.intersectsOBB(obb2))
continue;
// function EntityTypeCode(ext: Entity): 0 | 1 | 2
// {
// //在target不为圆弧板是才做Subtract因为圆弧板的板件切割存在问题(板厚被改成了一个很小的值导致圆弧板build错误)
// if (ext instanceof Board && ext.IsArcBoard)
// return 0;
// if (ext instanceof ExtrudeSolid)
// return 1;
// else if (ext instanceof ExtrudeHole)
// return 2;
// else
// return 0;
// }
// let t1 = EntityTypeCode(e1);
// let t2 = EntityTypeCode(e2);
// //#I2DXNO
// if (t1 > 0 && t2 > 0)
// {
// let [b1, b2] = [t1 === 1 ? <ExtrudeSolid>e1.Clone() : (<ExtrudeHole>e1).Convert2ExtrudeSolid(),
// t2 === 1 ? <ExtrudeSolid>e2.Clone() : (<ExtrudeHole>e2).Convert2ExtrudeSolid()];
// b1.ClearDraw();
// b2.ClearDraw();
// if (!b1.Subtract([b2], []) && !b1.IsErase
// && !b2.Subtract([b1], []) && !b2.IsErase)
// continue;
// }
function EntityTypeCode(ext: Entity): 0 | 1 | 2
{
//在target不为圆弧板是才做Subtract因为圆弧板的板件切割存在问题(板厚被改成了一个很小的值导致圆弧板build错误)
if (ext instanceof Board && ext.IsArcBoard)
return 0;
if (ext instanceof ExtrudeSolid)
return 1;
else if (ext instanceof ExtrudeHole)
return 2;
else
return 0;
}
let t1 = EntityTypeCode(e1);
let t2 = EntityTypeCode(e2);
//#I2DXNO
if (t1 > 0 && t2 > 0)
{
let [b1, b2] = [t1 === 1 ? <ExtrudeSolid>e1.Clone() : (<ExtrudeHole>e1).Convert2ExtrudeSolid(),
t2 === 1 ? <ExtrudeSolid>e2.Clone() : (<ExtrudeHole>e2).Convert2ExtrudeSolid()];
b1.ClearDraw();
b2.ClearDraw();
if (!b1.Subtract([b2], []) && !b1.IsErase
&& !b2.Subtract([b1], []) && !b2.IsErase)
continue;
}
let csg1 = this.GetCSG(e1);
let csg2 = this.GetCSG(e2);

Loading…
Cancel
Save