@tscircuit/3d-viewer 0.0.552 → 0.0.554
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +4 -24
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -31985,7 +31985,7 @@ import * as THREE20 from "three";
|
|
|
31985
31985
|
// package.json
|
|
31986
31986
|
var package_default = {
|
|
31987
31987
|
name: "@tscircuit/3d-viewer",
|
|
31988
|
-
version: "0.0.
|
|
31988
|
+
version: "0.0.553",
|
|
31989
31989
|
main: "./dist/index.js",
|
|
31990
31990
|
module: "./dist/index.js",
|
|
31991
31991
|
type: "module",
|
|
@@ -33984,11 +33984,9 @@ var buildStateOrder = [
|
|
|
33984
33984
|
"done"
|
|
33985
33985
|
];
|
|
33986
33986
|
var BoardGeomBuilder = class {
|
|
33987
|
-
circuitJson;
|
|
33988
33987
|
board;
|
|
33989
33988
|
plated_holes;
|
|
33990
33989
|
holes;
|
|
33991
|
-
traces;
|
|
33992
33990
|
pcb_vias;
|
|
33993
33991
|
pcb_cutouts;
|
|
33994
33992
|
boardGeom = null;
|
|
@@ -34002,23 +34000,7 @@ var BoardGeomBuilder = class {
|
|
|
34002
34000
|
ctx;
|
|
34003
34001
|
onCompleteCallback;
|
|
34004
34002
|
finalGeoms = [];
|
|
34005
|
-
getHoleToCut(x, y) {
|
|
34006
|
-
const epsilon = M / 10;
|
|
34007
|
-
for (const via of this.pcb_vias) {
|
|
34008
|
-
if (Math.abs(via.x - x) < epsilon && Math.abs(via.y - y) < epsilon && via.hole_diameter) {
|
|
34009
|
-
return { diameter: via.hole_diameter };
|
|
34010
|
-
}
|
|
34011
|
-
}
|
|
34012
|
-
for (const ph of this.plated_holes) {
|
|
34013
|
-
if (ph.shape !== "circle") continue;
|
|
34014
|
-
if (Math.abs(ph.x - x) < epsilon && Math.abs(ph.y - y) < epsilon && ph.hole_diameter) {
|
|
34015
|
-
return { diameter: ph.hole_diameter };
|
|
34016
|
-
}
|
|
34017
|
-
}
|
|
34018
|
-
return null;
|
|
34019
|
-
}
|
|
34020
34003
|
constructor(circuitJson, onComplete) {
|
|
34021
|
-
this.circuitJson = circuitJson;
|
|
34022
34004
|
this.onCompleteCallback = onComplete;
|
|
34023
34005
|
const panels = circuitJson.filter(
|
|
34024
34006
|
(e) => e.type === "pcb_panel"
|
|
@@ -34045,7 +34027,6 @@ var BoardGeomBuilder = class {
|
|
|
34045
34027
|
}
|
|
34046
34028
|
this.plated_holes = su4(circuitJson).pcb_plated_hole.list();
|
|
34047
34029
|
this.holes = su4(circuitJson).pcb_hole.list();
|
|
34048
|
-
this.traces = su4(circuitJson).pcb_trace.list();
|
|
34049
34030
|
this.pcb_vias = su4(circuitJson).pcb_via.list();
|
|
34050
34031
|
this.pcb_cutouts = su4(circuitJson).pcb_cutout.list();
|
|
34051
34032
|
this.ctx = { pcbThickness: this.board.thickness ?? 1.2 };
|
|
@@ -34399,7 +34380,6 @@ var BoardGeomBuilder = class {
|
|
|
34399
34380
|
processHole(hole) {
|
|
34400
34381
|
if (!this.boardGeom) return;
|
|
34401
34382
|
const holeDepth = this.ctx.pcbThickness * 1.5;
|
|
34402
|
-
const copperInset = 0.02;
|
|
34403
34383
|
if (hole.hole_shape === "circle") {
|
|
34404
34384
|
const cyGeom = (0, import_primitives6.cylinder)({
|
|
34405
34385
|
center: [hole.x, hole.y, 0],
|
|
@@ -34419,7 +34399,7 @@ var BoardGeomBuilder = class {
|
|
|
34419
34399
|
const holeWidth = hole.hole_width ?? hole.hole_diameter;
|
|
34420
34400
|
const holeHeight = hole.hole_height ?? hole.hole_diameter;
|
|
34421
34401
|
const rotation = hole.ccw_rotation ?? hole.rotation ?? 0;
|
|
34422
|
-
const
|
|
34402
|
+
const copperInset = 0.02;
|
|
34423
34403
|
const createHoleGeom = (w, h2, depth, isOval) => {
|
|
34424
34404
|
if (w <= 0 || h2 <= 0) return null;
|
|
34425
34405
|
if (isOval) {
|
|
@@ -34453,8 +34433,8 @@ var BoardGeomBuilder = class {
|
|
|
34453
34433
|
hole.hole_shape === "oval"
|
|
34454
34434
|
);
|
|
34455
34435
|
let copperCut = createHoleGeom(
|
|
34456
|
-
holeWidth - 2 *
|
|
34457
|
-
holeHeight - 2 *
|
|
34436
|
+
holeWidth - 2 * copperInset,
|
|
34437
|
+
holeHeight - 2 * copperInset,
|
|
34458
34438
|
holeDepth,
|
|
34459
34439
|
hole.hole_shape === "oval"
|
|
34460
34440
|
);
|