diff --git a/__test__/EdgeSealing/__snapshots__/seal.test.ts.snap b/__test__/EdgeSealing/__snapshots__/seal.test.ts.snap index abbb9c502..1584fa1df 100644 --- a/__test__/EdgeSealing/__snapshots__/seal.test.ts.snap +++ b/__test__/EdgeSealing/__snapshots__/seal.test.ts.snap @@ -243,3 +243,93 @@ Object { ], } `; + +exports[`镜像保证封边结果正确性 1`] = ` +Array [ + "1", + "4", + "3", + "2", + Array [ + "二合一", + "三合一", + "轨道引孔", + "木销", + ], +] +`; + +exports[`镜像保证封边结果正确性 2`] = ` +Object { + "oout": Object { + "buls": Array [ + 0, + 0, + 0, + 0, + ], + "pts": Array [ + Vector2 { + "x": 1174.0000000000002, + "y": 0, + }, + Vector2 { + "x": 1174.0000000000002, + "y": 1894, + }, + Vector2 { + "x": 0, + "y": 1894, + }, + Vector2 { + "x": 0, + "y": 0, + }, + ], + }, + "out": Object { + "buls": Array [ + 0, + 0, + 0, + 0, + ], + "pts": Array [ + Vector2 { + "x": 1169.0000000000002, + "y": 0, + }, + Vector2 { + "x": 1169.0000000000002, + "y": 1889, + }, + Vector2 { + "x": 0, + "y": 1889, + }, + Vector2 { + "x": 0, + "y": 0, + }, + ], + }, + "seal": Array [ + Object { + "length": 1894, + "size": 2, + }, + Object { + "length": 1174.0000000000002, + "size": 1, + }, + Object { + "length": 1894, + "size": 3, + }, + Object { + "length": 1174.0000000000002, + "size": 4, + }, + ], +} +`; diff --git a/__test__/EdgeSealing/seal.test.ts b/__test__/EdgeSealing/seal.test.ts index 0c72b3743..019948abf 100644 --- a/__test__/EdgeSealing/seal.test.ts +++ b/__test__/EdgeSealing/seal.test.ts @@ -1,3 +1,5 @@ +import { Vector3 } from "three"; +import { MakeMirrorMtx } from "../../src/Common/Matrix4Utils"; import { Board } from "../../src/DatabaseServices/Entity/Board"; import { ObjectId } from "../../src/DatabaseServices/ObjectId"; import { GetSealedBoardContour } from "../../src/GraphicsSystem/CalcEdgeSealing"; @@ -132,3 +134,35 @@ test('补圆错误导致的局部偏移错误', () => expect(data.outline).toMatchSnapshot(); } }); + +test('镜像保证封边结果正确性', () => +{ + let d = + { "file": [1, "Board", 10, 2, 258, 0, 1, 3, 71, [1, 0, 0, 0, 0, 0, 1, 0, 0, -1, 0, 0, -2118.6390501812843, 545.8590308370044, 93, 1], 257, 0, 1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, -2113.6390501812843, -34.14096916299558, 98, 1], 0, 0, 1, 3, 1894, 1174.0000000000002, 9, true, "Polyline", 10, 2, 0, 0, 0, 7, 71, [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, [1174.0000000000002, 0], 0, [1174.0000000000002, 1894], 0, [0, 1894], 0, true, 0, 3, 0, 0, 0, 4, 101, 102, 104, 105, 0, 13, 2, "背板", "主卧", "下柜", "", "", "", 0, 1, "**多种**", 2, 4, 4, 3, 1, 2, "1", "4", "2", "3", "", "", "", 4, "木销", "轨道引孔", "三合一", "二合一", false, true, 0, 0, 0, 0, 0, 0, 0, 0, true, 0, 0, null, 0, 0], "basePt": { "x": -2118.6390501812843, "y": 536.8590308370044, "z": 93 }, "ucs": [1, 0, 0, 0, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1] }; + + let brs = LoadEntityFromFileData(d) as Board[]; + + for (let br of brs) + { + br.objectId = new ObjectId(101);//创造101 + + let mtx = MakeMirrorMtx(new Vector3(1, 0, 0), new Vector3(-700, 0, 0)); + + br.ApplyMatrix(mtx); + + let data = Production.GetBoardSplitOrderData(br); + expect([ + br.BoardProcessOption.sealedUp, + br.BoardProcessOption.sealedDown, + br.BoardProcessOption.sealedLeft, + br.BoardProcessOption.sealedRight, + br.BoardProcessOption.highDrill + ]).toMatchSnapshot(); + + expect({ + oout: data.originOutlin, + out: data.outline, + seal: data.sealing, + }).toMatchSnapshot(); + } +});