@tscircuit/3d-viewer 0.0.480 → 0.0.482
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 +2 -102
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -14730,9 +14730,7 @@ function GltfModel({
|
|
|
14730
14730
|
envMap: material.envMap ?? null,
|
|
14731
14731
|
envMapIntensity: material.envMapIntensity ?? 1
|
|
14732
14732
|
});
|
|
14733
|
-
|
|
14734
|
-
material.envMap = environmentMap;
|
|
14735
|
-
}
|
|
14733
|
+
material.envMap = environmentMap;
|
|
14736
14734
|
if (typeof material.envMapIntensity !== "number" || material.envMapIntensity < DEFAULT_ENV_MAP_INTENSITY) {
|
|
14737
14735
|
material.envMapIntensity = DEFAULT_ENV_MAP_INTENSITY;
|
|
14738
14736
|
}
|
|
@@ -29492,7 +29490,7 @@ import * as THREE16 from "three";
|
|
|
29492
29490
|
// package.json
|
|
29493
29491
|
var package_default = {
|
|
29494
29492
|
name: "@tscircuit/3d-viewer",
|
|
29495
|
-
version: "0.0.
|
|
29493
|
+
version: "0.0.481",
|
|
29496
29494
|
main: "./dist/index.js",
|
|
29497
29495
|
module: "./dist/index.js",
|
|
29498
29496
|
type: "module",
|
|
@@ -31552,7 +31550,6 @@ var buildStateOrder = [
|
|
|
31552
31550
|
"processing_plated_holes",
|
|
31553
31551
|
"processing_holes",
|
|
31554
31552
|
"processing_cutouts",
|
|
31555
|
-
"processing_traces",
|
|
31556
31553
|
"processing_vias",
|
|
31557
31554
|
"finalizing",
|
|
31558
31555
|
"done"
|
|
@@ -31570,7 +31567,6 @@ var BoardGeomBuilder = class {
|
|
|
31570
31567
|
boardGeom = null;
|
|
31571
31568
|
platedHoleGeoms = [];
|
|
31572
31569
|
padGeoms = [];
|
|
31573
|
-
traceGeoms = [];
|
|
31574
31570
|
viaGeoms = [];
|
|
31575
31571
|
// Combined with platedHoleGeoms
|
|
31576
31572
|
copperPourGeoms = [];
|
|
@@ -31702,14 +31698,6 @@ var BoardGeomBuilder = class {
|
|
|
31702
31698
|
this.goToNextState();
|
|
31703
31699
|
}
|
|
31704
31700
|
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
31701
|
case "processing_vias":
|
|
31714
31702
|
if (this.currentIndex < this.pcb_vias.length) {
|
|
31715
31703
|
this.processVia(this.pcb_vias[this.currentIndex]);
|
|
@@ -32133,93 +32121,6 @@ var BoardGeomBuilder = class {
|
|
|
32133
32121
|
this.padGeoms.push(padGeom);
|
|
32134
32122
|
}
|
|
32135
32123
|
}
|
|
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
32124
|
processVia(via) {
|
|
32224
32125
|
if (!this.boardGeom) return;
|
|
32225
32126
|
if (typeof via.outer_diameter === "number" && typeof via.hole_diameter === "number") {
|
|
@@ -32258,7 +32159,6 @@ var BoardGeomBuilder = class {
|
|
|
32258
32159
|
this.boardGeom,
|
|
32259
32160
|
...this.platedHoleGeoms,
|
|
32260
32161
|
...this.padGeoms,
|
|
32261
|
-
...this.traceGeoms,
|
|
32262
32162
|
...this.viaGeoms,
|
|
32263
32163
|
...this.copperPourGeoms
|
|
32264
32164
|
];
|