From fc256a97159142484d4b59656860f0469b8f7910 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9E=97=E4=B8=89?= <940119273@qq.com> Date: Tue, 25 Jul 2023 10:18:23 +0000 Subject: [PATCH] =?UTF-8?q?!2330=20=E5=BC=80=E5=8F=91:=E5=A2=9E=E5=8A=A0Er?= =?UTF-8?q?p=E8=A7=A3=E6=9E=90=E6=9D=BF=E4=BB=B6=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E7=94=A8=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- __test__/DTO/Board2CADViewer.test.ts | 12 ++ .../Board2CADViewer.test.ts.snap | 124 ++++++++++++++++++ 2 files changed, 136 insertions(+) diff --git a/__test__/DTO/Board2CADViewer.test.ts b/__test__/DTO/Board2CADViewer.test.ts index 49e045033..9fa2a55c1 100644 --- a/__test__/DTO/Board2CADViewer.test.ts +++ b/__test__/DTO/Board2CADViewer.test.ts @@ -24,3 +24,15 @@ test('板件到CADViewer2', () => expect(u.GetModelData(br)).toMatchSnapshot(); } }); + +test('板件到CADViewer3', () => +{ + let d = + { "file": [1, "Board", 10, 2, 100, 0, 1, 3, 71, [1, 0, 0, 0, 0, 0, 1, 0, 0, -1, 0, 0, 99.22680412371145, 0, 9.0206185569231, 1], 0, 0, 1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 99.22680412371145, 0, 9.0206185569231, 1], 0, 0, 1, 3, 500, 500, 18, true, "Polyline", 10, 2, 0, 0, 0, 7, 71, [1, 0, 0, 0, 0, 1, -2.220446049250313e-16, 0, 0, 2.220446049250313e-16, 1, 0, 0, 500, 0, 1], 0, 0, 1, [1, 0, 0, 0, 0, 0, -1, 0, 0, 1, 0, 0, -848.5824742268046, -20.618556701474947, 1.1102230246251565e-13, 1], 0, 0, 1, 2, 4, [0, -500], 0, [500, -500], 0, [500, 0], 0, [0, 0], 0, true, 1, 3, 154.639175257732, 231.95876288659804, 18, true, "Polyline", 10, 2, 0, 0, 0, 7, 71, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 154.639175257732, 0, 1], 0, 0, 1, [1, 0, 0, 0, 0, 0, -1, 0, 0, 1, 0, 0, -983.8917525773198, -162.37113402106266, 0, 1], 0, 0, 1, 2, 4, [-88.65979381443285, -154.639175257732], 0, [231.95876288659804, -154.639175257732], 0, [231.95876288659804, 0], 0, [-88.65979381443285, 0], 0, true, 0, 3, 0, 0, 0, 0, 0, [1, 0, 0, 0, 0, 0, 1, 0, 0, -1, 0, 0, 234.53608247422667, -1.1102230246251565e-13, 150.7731958765108, 1], 3, 0, 0, 0, 0, 0, 11, 2, "背板", "", "", "", "", "", 0, 0, "三合一", 2, 0, "1", "1", "1", "1", "", "", "", 4, "三合一", "三合一", "三合一", "三合一", true, true, 0, 0, 0, 0, 0, 0, 0, 0, true, 0, 0, null], "basePt": { "x": 99.22680412371145, "y": -18, "z": 9.0206185569231 }, "ucs": [1, 0, 0, 0, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1] }; + let brs = LoadBoardsFromFileData(d); + let u = new ErpParseData(); + for (let br of brs) + { + expect(u.GetModelData(br)).toMatchSnapshot(); + } +}); diff --git a/__test__/DTO/__snapshots__/Board2CADViewer.test.ts.snap b/__test__/DTO/__snapshots__/Board2CADViewer.test.ts.snap index eb5b4c3ca..21ce79610 100644 --- a/__test__/DTO/__snapshots__/Board2CADViewer.test.ts.snap +++ b/__test__/DTO/__snapshots__/Board2CADViewer.test.ts.snap @@ -1382,3 +1382,127 @@ CADDbBoard { }, } `; + +exports[`板件到CADViewer3 1`] = ` +CADDbBoard { + "BasePoint": Vector3 { + "x": 99.22680412371145, + "y": -18, + "z": 9.0206185569231, + }, + "BoardName": "背板", + "Buls": Array [ + 0, + 0, + 0, + 0, + 0, + ], + "CabName": "", + "Drillings": null, + "Grain": 0, + "H": 18, + "L": 500, + "Pts": Array [ + Vector2 { + "x": 0, + "y": 0, + }, + Vector2 { + "x": 500, + "y": 0, + }, + Vector2 { + "x": 500, + "y": 500, + }, + Vector2 { + "x": 0, + "y": 500, + }, + Vector2 { + "x": 0, + "y": 0, + }, + ], + "SubBoardAssoc": null, + "SubBoardLocal": Array [ + CADDbBoard { + "BasePoint": Vector3 { + "x": 234.53608247422667, + "y": -18.00000000000011, + "z": 150.7731958765108, + }, + "BoardName": "", + "Buls": Array [ + 0, + 0, + 0, + 0, + 0, + ], + "CabName": "", + "Drillings": null, + "Grain": 0, + "H": 18, + "L": 154.639175257732, + "Pts": Array [ + Vector2 { + "x": -88.65979381443285, + "y": 0, + }, + Vector2 { + "x": 231.95876288659804, + "y": 0, + }, + Vector2 { + "x": 231.95876288659804, + "y": 154.639175257732, + }, + Vector2 { + "x": -88.65979381443285, + "y": 154.639175257732, + }, + Vector2 { + "x": -88.65979381443285, + "y": 0, + }, + ], + "SubBoardAssoc": null, + "SubBoardLocal": Array [], + "W": 231.95876288659804, + "XVec": Vector3 { + "x": 1, + "y": 0, + "z": 0, + }, + "YVec": Vector3 { + "x": 0, + "y": 0, + "z": 1, + }, + "ZVec": Vector3 { + "x": 0, + "y": -1, + "z": 0, + }, + }, + ], + "W": 500, + "XVec": Vector3 { + "x": 1, + "y": 0, + "z": 0, + }, + "YVec": Vector3 { + "x": 0, + "y": 0, + "z": 1, + }, + "ZVec": Vector3 { + "x": 0, + "y": -1, + "z": 0, + }, +} +`;