@tscircuit/3d-viewer 0.0.480 → 0.0.481
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 +1 -99
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -29492,7 +29492,7 @@ import * as THREE16 from "three";
|
|
|
29492
29492
|
// package.json
|
|
29493
29493
|
var package_default = {
|
|
29494
29494
|
name: "@tscircuit/3d-viewer",
|
|
29495
|
-
version: "0.0.
|
|
29495
|
+
version: "0.0.480",
|
|
29496
29496
|
main: "./dist/index.js",
|
|
29497
29497
|
module: "./dist/index.js",
|
|
29498
29498
|
type: "module",
|
|
@@ -31552,7 +31552,6 @@ var buildStateOrder = [
|
|
|
31552
31552
|
"processing_plated_holes",
|
|
31553
31553
|
"processing_holes",
|
|
31554
31554
|
"processing_cutouts",
|
|
31555
|
-
"processing_traces",
|
|
31556
31555
|
"processing_vias",
|
|
31557
31556
|
"finalizing",
|
|
31558
31557
|
"done"
|
|
@@ -31570,7 +31569,6 @@ var BoardGeomBuilder = class {
|
|
|
31570
31569
|
boardGeom = null;
|
|
31571
31570
|
platedHoleGeoms = [];
|
|
31572
31571
|
padGeoms = [];
|
|
31573
|
-
traceGeoms = [];
|
|
31574
31572
|
viaGeoms = [];
|
|
31575
31573
|
// Combined with platedHoleGeoms
|
|
31576
31574
|
copperPourGeoms = [];
|
|
@@ -31702,14 +31700,6 @@ var BoardGeomBuilder = class {
|
|
|
31702
31700
|
this.goToNextState();
|
|
31703
31701
|
}
|
|
31704
31702
|
break;
|
|
31705
|
-
case "processing_traces":
|
|
31706
|
-
if (this.currentIndex < this.traces.length) {
|
|
31707
|
-
this.processTrace(this.traces[this.currentIndex]);
|
|
31708
|
-
this.currentIndex++;
|
|
31709
|
-
} else {
|
|
31710
|
-
this.goToNextState();
|
|
31711
|
-
}
|
|
31712
|
-
break;
|
|
31713
31703
|
case "processing_vias":
|
|
31714
31704
|
if (this.currentIndex < this.pcb_vias.length) {
|
|
31715
31705
|
this.processVia(this.pcb_vias[this.currentIndex]);
|
|
@@ -32133,93 +32123,6 @@ var BoardGeomBuilder = class {
|
|
|
32133
32123
|
this.padGeoms.push(padGeom);
|
|
32134
32124
|
}
|
|
32135
32125
|
}
|
|
32136
|
-
processTrace(trace) {
|
|
32137
|
-
const { route: mixedRoute } = trace;
|
|
32138
|
-
if (mixedRoute.length < 2) return;
|
|
32139
|
-
let currentSegmentPoints = [];
|
|
32140
|
-
let currentLayer = null;
|
|
32141
|
-
let currentWidth = 0.1;
|
|
32142
|
-
const finishSegment = () => {
|
|
32143
|
-
if (currentSegmentPoints.length >= 2 && currentLayer) {
|
|
32144
|
-
const layerSign = currentLayer === "bottom" ? -1 : 1;
|
|
32145
|
-
const traceOffset = BOARD_SURFACE_OFFSET.traces - 2e-3;
|
|
32146
|
-
const zCenter = layerSign * this.ctx.pcbThickness / 2 + layerSign * traceOffset;
|
|
32147
|
-
const linePath = (0, import_primitives7.line)(currentSegmentPoints);
|
|
32148
|
-
const expandedPath = (0, import_expansions2.expand)(
|
|
32149
|
-
{ delta: currentWidth / 2, corners: "round" },
|
|
32150
|
-
linePath
|
|
32151
|
-
);
|
|
32152
|
-
let traceGeom = (0, import_transforms6.translate)(
|
|
32153
|
-
[0, 0, zCenter - M / 2],
|
|
32154
|
-
(0, import_extrusions4.extrudeLinear)({ height: M }, expandedPath)
|
|
32155
|
-
);
|
|
32156
|
-
const startPointCoords = currentSegmentPoints[0];
|
|
32157
|
-
const endPointCoords = currentSegmentPoints[currentSegmentPoints.length - 1];
|
|
32158
|
-
const startHole = this.getHoleToCut(
|
|
32159
|
-
startPointCoords[0],
|
|
32160
|
-
startPointCoords[1]
|
|
32161
|
-
);
|
|
32162
|
-
if (startHole) {
|
|
32163
|
-
const cuttingCylinder = (0, import_primitives7.cylinder)({
|
|
32164
|
-
center: [startPointCoords[0], startPointCoords[1], zCenter],
|
|
32165
|
-
radius: startHole.diameter / 2 + M,
|
|
32166
|
-
height: M
|
|
32167
|
-
});
|
|
32168
|
-
traceGeom = (0, import_booleans5.subtract)(traceGeom, cuttingCylinder);
|
|
32169
|
-
}
|
|
32170
|
-
const endHole = this.getHoleToCut(endPointCoords[0], endPointCoords[1]);
|
|
32171
|
-
if (endHole) {
|
|
32172
|
-
const cuttingCylinder = (0, import_primitives7.cylinder)({
|
|
32173
|
-
center: [endPointCoords[0], endPointCoords[1], zCenter],
|
|
32174
|
-
radius: endHole.diameter / 2 + M,
|
|
32175
|
-
height: M
|
|
32176
|
-
});
|
|
32177
|
-
traceGeom = (0, import_booleans5.subtract)(traceGeom, cuttingCylinder);
|
|
32178
|
-
}
|
|
32179
|
-
const tracesMaterialColor = tracesMaterialColors[this.board.material] ?? colors.fr4TracesWithoutMaskTan;
|
|
32180
|
-
if (this.boardClipGeom) {
|
|
32181
|
-
traceGeom = (0, import_booleans5.intersect)(this.boardClipGeom, traceGeom);
|
|
32182
|
-
}
|
|
32183
|
-
traceGeom = (0, import_colors3.colorize)(tracesMaterialColor, traceGeom);
|
|
32184
|
-
this.traceGeoms.push(traceGeom);
|
|
32185
|
-
}
|
|
32186
|
-
currentSegmentPoints = [];
|
|
32187
|
-
currentLayer = null;
|
|
32188
|
-
};
|
|
32189
|
-
for (let i = 0; i < mixedRoute.length; i++) {
|
|
32190
|
-
const point2 = mixedRoute[i];
|
|
32191
|
-
if (point2.route_type === "wire") {
|
|
32192
|
-
if (currentLayer === null) {
|
|
32193
|
-
currentLayer = point2.layer;
|
|
32194
|
-
currentWidth = point2.width;
|
|
32195
|
-
currentSegmentPoints.push([point2.x, point2.y]);
|
|
32196
|
-
} else if (point2.layer === currentLayer) {
|
|
32197
|
-
currentSegmentPoints.push([point2.x, point2.y]);
|
|
32198
|
-
} else {
|
|
32199
|
-
currentSegmentPoints.push([point2.x, point2.y]);
|
|
32200
|
-
finishSegment();
|
|
32201
|
-
currentLayer = point2.layer;
|
|
32202
|
-
currentWidth = point2.width;
|
|
32203
|
-
const prevPoint = mixedRoute[i - 1];
|
|
32204
|
-
if (prevPoint) {
|
|
32205
|
-
currentSegmentPoints.push([point2.x, point2.y]);
|
|
32206
|
-
} else {
|
|
32207
|
-
currentSegmentPoints.push([point2.x, point2.y]);
|
|
32208
|
-
}
|
|
32209
|
-
}
|
|
32210
|
-
} else if (point2.route_type === "via") {
|
|
32211
|
-
currentSegmentPoints.push([point2.x, point2.y]);
|
|
32212
|
-
finishSegment();
|
|
32213
|
-
const nextPoint = mixedRoute[i + 1];
|
|
32214
|
-
if (nextPoint && nextPoint.route_type === "wire") {
|
|
32215
|
-
currentLayer = nextPoint.layer;
|
|
32216
|
-
currentWidth = nextPoint.width;
|
|
32217
|
-
currentSegmentPoints.push([point2.x, point2.y]);
|
|
32218
|
-
}
|
|
32219
|
-
}
|
|
32220
|
-
}
|
|
32221
|
-
finishSegment();
|
|
32222
|
-
}
|
|
32223
32126
|
processVia(via) {
|
|
32224
32127
|
if (!this.boardGeom) return;
|
|
32225
32128
|
if (typeof via.outer_diameter === "number" && typeof via.hole_diameter === "number") {
|
|
@@ -32258,7 +32161,6 @@ var BoardGeomBuilder = class {
|
|
|
32258
32161
|
this.boardGeom,
|
|
32259
32162
|
...this.platedHoleGeoms,
|
|
32260
32163
|
...this.padGeoms,
|
|
32261
|
-
...this.traceGeoms,
|
|
32262
32164
|
...this.viaGeoms,
|
|
32263
32165
|
...this.copperPourGeoms
|
|
32264
32166
|
];
|