From 1d8c470778bbac56ac9259f54142b569341ae4c8 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 09:38:14 +0000 Subject: [PATCH] =?UTF-8?q?!2329=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 | 14 +- .../Board2CADViewer.test.ts.snap | 185 ++++++++++++++++++ 2 files changed, 198 insertions(+), 1 deletion(-) diff --git a/__test__/DTO/Board2CADViewer.test.ts b/__test__/DTO/Board2CADViewer.test.ts index 5d1c5c8e4..49e045033 100644 --- a/__test__/DTO/Board2CADViewer.test.ts +++ b/__test__/DTO/Board2CADViewer.test.ts @@ -1,5 +1,5 @@ -import { LoadBoardsFromFileData } from "../Utils/LoadEntity.util"; import { ErpParseData } from "../../src/Add-on/Erp/ParseData"; +import { LoadBoardsFromFileData } from "../Utils/LoadEntity.util"; test('板件到CADViewer', () => { @@ -12,3 +12,15 @@ test('板件到CADViewer', () => expect(u.GetModelData(br)).toMatchSnapshot(); } }); + +test('板件到CADViewer2', () => +{ + let d = + { "file": [1, "Board", 10, 2, 100, 0, 1, 3, 71, [1, 0, 0, 0, 0, 0, 1, 0, 0, -1, 0, 0, 114.69072164948449, 18, 24.484536082696298, 1], 0, 0, 1, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 114.69072164948449, 18, 24.484536082696298, 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, -1481.8755754107606, -34.104148461507194, 1.1102230246251565e-13, 1], 0, 0, 1, 2, 4, [0, -500], 0, [500, -500], 0, [500, 0], 0, [0, 0], 0, true, 1, 3, 320.0000000000001, 263.1024484536083, 10, true, "Polyline", 10, 2, 0, 0, 0, 7, 71, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 263.1024484536083, 320.00000000000006, 0, 1], 0, 0, 1, [1, 0, 0, 0, 0, 0, -1, 0, 0, 1, 0, 0, -1628.7731269571523, -105.78156824470297, 0, 1], 0, 0, 1, 2, 4, [-263.1024484536083, 5.684341886080802e-14], 0, [-263.1024484536083, -320], 0, [0, -320.00000000000006], 0, [0, 0], 0, true, 1, 3, 300, 300, 10, true, "Polyline", 10, 2, 0, 0, 0, 7, 71, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 300, 0, 1], 0, 0, 1, [1, 0, 0, 0, 0, 0, -1, 0, 0, 1, 0, 0, -1581.8755754107606, -115.78156824470302, 0, 1], 0, 0, 1, 2, 4, [56.897551546391725, -300], 0, [300, -300], 0, [300, 0], 0, [56.897551546391725, 0], 0, true, 0, 3, 0, 0, 0, 0, 0, [1, 0, 0, 0, 0, 0, 1, 0, 0, -1, 0, 0, 214.6907216494845, 9.99999999999989, 106.16195586589212, 1], 3, 0, 0, 0, 0, 0, [1, 0, 0, 0, 0, 0, 1, 0, 0, -1, 0, 0, 261.5882731958762, 9.99999999999989, 96.16195586589207, 1], 3, 0, 0, 0, 0, 0, 12, 2, "背板", "", "", "", "", "", 0, 0, "三合一", 2, 0, "1", "1", "1", "1", "", "", "", 4, "三合一", "三合一", "三合一", "三合一", true, true, 0, 0, 0, 0, 0, 0, 0, 0, true, 0, 0, null, 0], "basePt": { "x": 114.69072164948449, "y": 0, "z": 24.484536082696298 }, "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 3f0ded079..eb5b4c3ca 100644 --- a/__test__/DTO/__snapshots__/Board2CADViewer.test.ts.snap +++ b/__test__/DTO/__snapshots__/Board2CADViewer.test.ts.snap @@ -1197,3 +1197,188 @@ CADDbBoard { }, } `; + +exports[`板件到CADViewer2 1`] = ` +CADDbBoard { + "BasePoint": Vector3 { + "x": 114.69072164948449, + "y": 0, + "z": 24.484536082696298, + }, + "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": 261.5882731958762, + "y": -1.1013412404281553e-13, + "z": 96.16195586589207, + }, + "BoardName": "", + "Buls": Array [ + 0, + 0, + 0, + 0, + 0, + ], + "CabName": "", + "Drillings": null, + "Grain": 0, + "H": 10, + "L": 320.0000000000001, + "Pts": Array [ + Vector2 { + "x": 0, + "y": 320.0000000000001, + }, + Vector2 { + "x": 0, + "y": 5.684341886080802e-14, + }, + Vector2 { + "x": 263.1024484536083, + "y": 0, + }, + Vector2 { + "x": 263.1024484536083, + "y": 320.00000000000006, + }, + Vector2 { + "x": 0, + "y": 320.0000000000001, + }, + ], + "SubBoardAssoc": null, + "SubBoardLocal": Array [ + CADDbBoard { + "BasePoint": Vector3 { + "x": 214.6907216494845, + "y": -1.1013412404281553e-13, + "z": 106.16195586589212, + }, + "BoardName": "", + "Buls": Array [ + 0, + 0, + 0, + 0, + 0, + ], + "CabName": "", + "Drillings": null, + "Grain": 0, + "H": 10, + "L": 300, + "Pts": Array [ + Vector2 { + "x": 56.897551546391725, + "y": 0, + }, + Vector2 { + "x": 300, + "y": 0, + }, + Vector2 { + "x": 300, + "y": 300, + }, + Vector2 { + "x": 56.897551546391725, + "y": 300, + }, + Vector2 { + "x": 56.897551546391725, + "y": 0, + }, + ], + "SubBoardAssoc": null, + "SubBoardLocal": Array [], + "W": 300, + "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": 263.1024484536083, + "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, + }, +} +`;