fix #IWBW8 修正切割无法分裂成多个的问题

pull/295/MERGE
ChenX 5 years ago
parent 5aa42f632c
commit b0645ebd19

@ -0,0 +1,35 @@
import { LoadBoardsFromFileData } from "../Utils/LoadEntity.util";
import { Board } from "../../src/DatabaseServices/Board";
function CuttingBoard(orgBoard: Board, cutBoards: Board[])
{
for (let br of cutBoards)
{
let gs = orgBoard.ConverToLocalGroove(br.Clone());
for (let g of gs)
orgBoard.AppendGroove(g);
}
let splitBoard: Board[] = [];
orgBoard.GrooveCheckAll(splitBoard);
return splitBoard;
}
test('板件与板件切割_分裂成多个', () =>
{
let d =
[3, "Board", 3, 2, 101, false, 1, 11, 0, [0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, -331.4882673815591, 22.964750159997493, 0, 1], 2, 1200, 600, 18, true, "Polyline", 3, 2, 0, false, 0, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [0, 0], 0, [600, 0], 0, [600, 1200], 0, [0, 1200], 0, true, 1, 2, 560.6466, 189.21820000000014, 18, false, "Polyline", 3, 2, 0, false, 0, 1, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -1827.9668979500452, -289.76232632197764, 0, 1], 2, 4, [1827.9668979500452, 755.7998263219777], 0, [1827.9668979500452, 289.76232632197764], 0, [2017.1850979500452, 289.76232632197764], 0, [2017.1850979500452, 755.7998263219777], 0.9999999999999999, true, 0, 3, 0, 0, 0, [0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, -331.4882673815591, 240.21531912679802, 487.0617703059633, 1], 3, 0, 0, 0, 2, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -331.4882673815591, 22.964750159997493, 0, 1], 1, "左侧板", "{\"roomName\":\"\",\"cabinetName\":\"\",\"boardName\":\"\",\"material\":\"\",\"color\":\"\",\"lines\":0,\"bigHoleDir\":0,\"drillType\":\"three\",\"composingFace\":2,\"highSealed\":[],\"sealedUp\":\"1\",\"sealedDown\":\"1\",\"sealedLeft\":\"1\",\"sealedRight\":\"1\",\"spliteHeight\":\"\",\"spliteWidth\":\"\",\"spliteThickness\":\"\",\"highDrill\":[\"three\",\"three\",\"three\",\"three\",\"three\",\"three\"]}", 0, 0, "Board", 3, 2, 103, false, 1, 2, 0, [0, 0.7071067811865476, 0.7071067811865475, 0, -1, 0, 0, 0, 0, -0.7071067811865475, 0.7071067811865476, 0, 150.8430102636048, -52.19811424968327, 170.47952541755785, 1], 2, 783.3533043634961, 1175.1597867537462, 18, true, "Polyline", 3, 2, 0, false, 0, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 376.7045899568675, -325.59238647697345, 0, 1], 2, 4, [-376.7045899568675, 325.59238647697345], 0, [798.4551967968786, 325.59238647697345], 0, [798.4551967968786, 1108.9456908404695], 0, [-376.7045899568675, 1108.9456908404695], 0, true, 0, 3, 0, 0, 0, 2, [1, 0, 0, 0, 0, 0.7071067811865476, 0.7071067811865475, 0, 0, -0.7071067811865475, 0.7071067811865476, 0, 476.43539674057826, 214.17225581291558, 436.84989548015665, 1], 0, "层板", "{\"roomName\":\"\",\"cabinetName\":\"\",\"boardName\":\"\",\"material\":\"\",\"color\":\"\",\"lines\":0,\"bigHoleDir\":0,\"drillType\":\"three\",\"composingFace\":2,\"highSealed\":[],\"sealedUp\":\"1\",\"sealedDown\":\"1\",\"sealedLeft\":\"1\",\"sealedRight\":\"1\",\"spliteHeight\":\"\",\"spliteWidth\":\"\",\"spliteThickness\":\"\",\"highDrill\":[]}", 0, 0, "Board", 3, 2, 105, false, 1, 2, 0, [0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1, 0, 150.8430102636048, -84.04268340053818, 746.0908003894185, 1], 2, 1200, 1446.4691198791304, 18, true, "Polyline", 3, 2, 0, false, 0, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1], 2, 4, [0, 0], 0, [1446.4691198791304, 0], 0, [1446.4691198791304, 1200], 0, [0, 1200], 0, true, 0, 3, 0, 0, 0, 2, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 150.8430102636048, -84.04268340053818, 746.0908003894185, 1], 0, "", "{\"roomName\":\"\",\"cabinetName\":\"\",\"boardName\":\"\",\"material\":\"\",\"color\":\"\",\"lines\":0,\"bigHoleDir\":0,\"drillType\":\"three\",\"composingFace\":2,\"highSealed\":[],\"sealedUp\":\"1\",\"sealedDown\":\"1\",\"sealedLeft\":\"1\",\"sealedRight\":\"1\",\"spliteHeight\":\"\",\"spliteWidth\":\"\",\"spliteThickness\":\"\",\"highDrill\":[]}", 0, 0];
let brs = LoadBoardsFromFileData(d);
let br = brs.shift()
let splitBrs = CuttingBoard(br, brs);
splitBrs.push(br);
for (let b of splitBrs)
{
expect(b.Width).toMatchSnapshot();
expect(b.Height).toMatchSnapshot();
expect(b.Thickness).toMatchSnapshot();
}
});

@ -0,0 +1,25 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`板件与板件切割_分裂成多个 1`] = `600.0000000000049`;
exports[`板件与板件切割_分裂成多个 2`] = `435.9091996105815`;
exports[`板件与板件切割_分裂成多个 3`] = `18`;
exports[`板件与板件切割_分裂成多个 4`] = `217.25056896680059`;
exports[`板件与板件切割_分裂成多个 5`] = `474.99256643946615`;
exports[`板件与板件切割_分裂成多个 6`] = `18`;
exports[`板件与板件切割_分裂成多个 7`] = `81.55158943782021`;
exports[`板件与板件切割_分裂成多个 8`] = `81.5515894378201`;
exports[`板件与板件切割_分裂成多个 9`] = `18`;
exports[`板件与板件切割_分裂成多个 10`] = `600`;
exports[`板件与板件切割_分裂成多个 11`] = `746.0908003894186`;
exports[`板件与板件切割_分裂成多个 12`] = `18`;

@ -695,13 +695,12 @@ export class ExtureSolid extends Entity
p.applyMatrix4(mi); p.applyMatrix4(mi);
let box = new Box3().setFromPoints(pts); let box = new Box3().setFromPoints(pts);
let size = box.getSize(new Vector3()); let size = box.getSize(new Vector3());
m.setPosition(box.min.applyMatrix4(m));
let ext = useClone ? target.Clone() : new ExtureSolid(); let ext = useClone ? target.Clone() : new ExtureSolid();
if (useClone) if (useClone)
ext.grooves.length = 0; ext.grooves.length = 0;
ext.ConverToRectSolid(size.x, size.y, size.z); ext.ConverToRectSolid(size.x, size.y, size.z);
ext.OCS = m; ext.OCS = m.clone().setPosition(box.min.applyMatrix4(m));
grooves.push(ext); grooves.push(ext);
} }

Loading…
Cancel
Save