@tscircuit/3d-viewer 0.0.461 → 0.0.463
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.d.ts +2 -0
- package/dist/index.js +299 -179
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -75,6 +75,8 @@ interface ManifoldGeoms {
|
|
|
75
75
|
interface ManifoldTextures {
|
|
76
76
|
topTrace?: THREE.CanvasTexture | null;
|
|
77
77
|
bottomTrace?: THREE.CanvasTexture | null;
|
|
78
|
+
topTraceWithMask?: THREE.CanvasTexture | null;
|
|
79
|
+
bottomTraceWithMask?: THREE.CanvasTexture | null;
|
|
78
80
|
topSilkscreen?: THREE.CanvasTexture | null;
|
|
79
81
|
bottomSilkscreen?: THREE.CanvasTexture | null;
|
|
80
82
|
topSoldermask?: THREE.CanvasTexture | null;
|
package/dist/index.js
CHANGED
|
@@ -1129,13 +1129,13 @@ var require_squaredLength = __commonJS({
|
|
|
1129
1129
|
var require_subtract = __commonJS({
|
|
1130
1130
|
"node_modules/@jscad/modeling/src/maths/vec3/subtract.js"(exports, module) {
|
|
1131
1131
|
"use strict";
|
|
1132
|
-
var
|
|
1132
|
+
var subtract7 = (out, a, b) => {
|
|
1133
1133
|
out[0] = a[0] - b[0];
|
|
1134
1134
|
out[1] = a[1] - b[1];
|
|
1135
1135
|
out[2] = a[2] - b[2];
|
|
1136
1136
|
return out;
|
|
1137
1137
|
};
|
|
1138
|
-
module.exports =
|
|
1138
|
+
module.exports = subtract7;
|
|
1139
1139
|
}
|
|
1140
1140
|
});
|
|
1141
1141
|
|
|
@@ -1676,7 +1676,7 @@ var require_scale2 = __commonJS({
|
|
|
1676
1676
|
var require_subtract2 = __commonJS({
|
|
1677
1677
|
"node_modules/@jscad/modeling/src/maths/mat4/subtract.js"(exports, module) {
|
|
1678
1678
|
"use strict";
|
|
1679
|
-
var
|
|
1679
|
+
var subtract7 = (out, a, b) => {
|
|
1680
1680
|
out[0] = a[0] - b[0];
|
|
1681
1681
|
out[1] = a[1] - b[1];
|
|
1682
1682
|
out[2] = a[2] - b[2];
|
|
@@ -1695,7 +1695,7 @@ var require_subtract2 = __commonJS({
|
|
|
1695
1695
|
out[15] = a[15] - b[15];
|
|
1696
1696
|
return out;
|
|
1697
1697
|
};
|
|
1698
|
-
module.exports =
|
|
1698
|
+
module.exports = subtract7;
|
|
1699
1699
|
}
|
|
1700
1700
|
});
|
|
1701
1701
|
|
|
@@ -1712,7 +1712,7 @@ var require_toString2 = __commonJS({
|
|
|
1712
1712
|
var require_translate = __commonJS({
|
|
1713
1713
|
"node_modules/@jscad/modeling/src/maths/mat4/translate.js"(exports, module) {
|
|
1714
1714
|
"use strict";
|
|
1715
|
-
var
|
|
1715
|
+
var translate11 = (out, matrix, offsets) => {
|
|
1716
1716
|
const x = offsets[0];
|
|
1717
1717
|
const y = offsets[1];
|
|
1718
1718
|
const z135 = offsets[2];
|
|
@@ -1765,7 +1765,7 @@ var require_translate = __commonJS({
|
|
|
1765
1765
|
}
|
|
1766
1766
|
return out;
|
|
1767
1767
|
};
|
|
1768
|
-
module.exports =
|
|
1768
|
+
module.exports = translate11;
|
|
1769
1769
|
}
|
|
1770
1770
|
});
|
|
1771
1771
|
|
|
@@ -2205,12 +2205,12 @@ var require_squaredLength2 = __commonJS({
|
|
|
2205
2205
|
var require_subtract3 = __commonJS({
|
|
2206
2206
|
"node_modules/@jscad/modeling/src/maths/vec2/subtract.js"(exports, module) {
|
|
2207
2207
|
"use strict";
|
|
2208
|
-
var
|
|
2208
|
+
var subtract7 = (out, a, b) => {
|
|
2209
2209
|
out[0] = a[0] - b[0];
|
|
2210
2210
|
out[1] = a[1] - b[1];
|
|
2211
2211
|
return out;
|
|
2212
2212
|
};
|
|
2213
|
-
module.exports =
|
|
2213
|
+
module.exports = subtract7;
|
|
2214
2214
|
}
|
|
2215
2215
|
});
|
|
2216
2216
|
|
|
@@ -2671,14 +2671,14 @@ var require_point_line_distance = __commonJS({
|
|
|
2671
2671
|
"node_modules/@jscad/modeling/src/operations/hulls/quickhull/point-line-distance.js"(exports, module) {
|
|
2672
2672
|
"use strict";
|
|
2673
2673
|
var cross = require_cross();
|
|
2674
|
-
var
|
|
2674
|
+
var subtract7 = require_subtract();
|
|
2675
2675
|
var squaredLength = require_squaredLength();
|
|
2676
2676
|
var distanceSquared = (p, a, b) => {
|
|
2677
2677
|
const ab = [];
|
|
2678
2678
|
const ap = [];
|
|
2679
2679
|
const cr = [];
|
|
2680
|
-
|
|
2681
|
-
|
|
2680
|
+
subtract7(ab, b, a);
|
|
2681
|
+
subtract7(ap, p, a);
|
|
2682
2682
|
const area = squaredLength(cross(cr, ap, ab));
|
|
2683
2683
|
const s = squaredLength(ab);
|
|
2684
2684
|
if (s === 0) {
|
|
@@ -2697,11 +2697,11 @@ var require_get_plane_normal = __commonJS({
|
|
|
2697
2697
|
"use strict";
|
|
2698
2698
|
var cross = require_cross();
|
|
2699
2699
|
var normalize = require_normalize();
|
|
2700
|
-
var
|
|
2700
|
+
var subtract7 = require_subtract();
|
|
2701
2701
|
var planeNormal = (out, point1, point2, point32) => {
|
|
2702
2702
|
const tmp = [0, 0, 0];
|
|
2703
|
-
|
|
2704
|
-
|
|
2703
|
+
subtract7(out, point1, point2);
|
|
2704
|
+
subtract7(tmp, point2, point32);
|
|
2705
2705
|
cross(out, out, tmp);
|
|
2706
2706
|
return normalize(out, out);
|
|
2707
2707
|
};
|
|
@@ -2915,7 +2915,7 @@ var require_Face = __commonJS({
|
|
|
2915
2915
|
var length2 = require_length();
|
|
2916
2916
|
var normalize = require_normalize();
|
|
2917
2917
|
var scale3 = require_scale();
|
|
2918
|
-
var
|
|
2918
|
+
var subtract7 = require_subtract();
|
|
2919
2919
|
var HalfEdge = require_HalfEdge();
|
|
2920
2920
|
var VISIBLE = 0;
|
|
2921
2921
|
var NON_CONVEX = 1;
|
|
@@ -2949,14 +2949,14 @@ var require_Face = __commonJS({
|
|
|
2949
2949
|
const e0 = this.edge;
|
|
2950
2950
|
const e1 = e0.next;
|
|
2951
2951
|
let e2 = e1.next;
|
|
2952
|
-
const v2 =
|
|
2952
|
+
const v2 = subtract7([], e1.head().point, e0.head().point);
|
|
2953
2953
|
const t = [];
|
|
2954
2954
|
const v1 = [];
|
|
2955
2955
|
this.nVertices = 2;
|
|
2956
2956
|
this.normal = [0, 0, 0];
|
|
2957
2957
|
while (e2 !== e0) {
|
|
2958
2958
|
copy(v1, v2);
|
|
2959
|
-
|
|
2959
|
+
subtract7(v2, e2.head().point, e0.head().point);
|
|
2960
2960
|
add(this.normal, this.normal, cross(t, v1, v2));
|
|
2961
2961
|
e2 = e2.next;
|
|
2962
2962
|
this.nVertices += 1;
|
|
@@ -2980,7 +2980,7 @@ var require_Face = __commonJS({
|
|
|
2980
2980
|
} while (edge !== this.edge);
|
|
2981
2981
|
const p1 = maxEdge.tail().point;
|
|
2982
2982
|
const p2 = maxEdge.head().point;
|
|
2983
|
-
const maxVector =
|
|
2983
|
+
const maxVector = subtract7([], p2, p1);
|
|
2984
2984
|
const maxLength = Math.sqrt(maxSquaredLength);
|
|
2985
2985
|
scale3(maxVector, maxVector, 1 / maxLength);
|
|
2986
2986
|
const maxProjection = dot(this.normal, maxVector);
|
|
@@ -7745,7 +7745,7 @@ var require_cylinder = __commonJS({
|
|
|
7745
7745
|
var geom3 = require_geom3();
|
|
7746
7746
|
var cylinderElliptic = require_cylinderElliptic();
|
|
7747
7747
|
var { isGTE } = require_commonChecks();
|
|
7748
|
-
var
|
|
7748
|
+
var cylinder5 = (options) => {
|
|
7749
7749
|
const defaults = {
|
|
7750
7750
|
center: [0, 0, 0],
|
|
7751
7751
|
height: 2,
|
|
@@ -7764,7 +7764,7 @@ var require_cylinder = __commonJS({
|
|
|
7764
7764
|
};
|
|
7765
7765
|
return cylinderElliptic(newoptions);
|
|
7766
7766
|
};
|
|
7767
|
-
module.exports =
|
|
7767
|
+
module.exports = cylinder5;
|
|
7768
7768
|
}
|
|
7769
7769
|
});
|
|
7770
7770
|
|
|
@@ -8285,7 +8285,7 @@ var require_roundedCylinder = __commonJS({
|
|
|
8285
8285
|
var poly3 = require_poly3();
|
|
8286
8286
|
var { sin: sin2, cos: cos2 } = require_trigonometry();
|
|
8287
8287
|
var { isGTE, isNumberArray } = require_commonChecks();
|
|
8288
|
-
var
|
|
8288
|
+
var cylinder5 = require_cylinder();
|
|
8289
8289
|
var roundedCylinder = (options) => {
|
|
8290
8290
|
const defaults = {
|
|
8291
8291
|
center: [0, 0, 0],
|
|
@@ -8302,7 +8302,7 @@ var require_roundedCylinder = __commonJS({
|
|
|
8302
8302
|
if (roundRadius > radius) throw new Error("roundRadius must be smaller than the radius");
|
|
8303
8303
|
if (!isGTE(segments, 4)) throw new Error("segments must be four or more");
|
|
8304
8304
|
if (height10 === 0 || radius === 0) return geom3.create();
|
|
8305
|
-
if (roundRadius === 0) return
|
|
8305
|
+
if (roundRadius === 0) return cylinder5({ center, height: height10, radius });
|
|
8306
8306
|
const start = [0, 0, -(height10 / 2)];
|
|
8307
8307
|
const end = [0, 0, height10 / 2];
|
|
8308
8308
|
const direction = vec3.subtract(vec3.create(), end, start);
|
|
@@ -9746,7 +9746,7 @@ var require_translate2 = __commonJS({
|
|
|
9746
9746
|
var geom2 = require_geom2();
|
|
9747
9747
|
var geom3 = require_geom3();
|
|
9748
9748
|
var path2 = require_path2();
|
|
9749
|
-
var
|
|
9749
|
+
var translate11 = (offset4, ...objects) => {
|
|
9750
9750
|
if (!Array.isArray(offset4)) throw new Error("offset must be an array");
|
|
9751
9751
|
objects = flatten(objects);
|
|
9752
9752
|
if (objects.length === 0) throw new Error("wrong number of arguments");
|
|
@@ -9761,11 +9761,11 @@ var require_translate2 = __commonJS({
|
|
|
9761
9761
|
});
|
|
9762
9762
|
return results.length === 1 ? results[0] : results;
|
|
9763
9763
|
};
|
|
9764
|
-
var translateX = (offset4, ...objects) =>
|
|
9765
|
-
var translateY = (offset4, ...objects) =>
|
|
9766
|
-
var translateZ = (offset4, ...objects) =>
|
|
9764
|
+
var translateX = (offset4, ...objects) => translate11([offset4, 0, 0], objects);
|
|
9765
|
+
var translateY = (offset4, ...objects) => translate11([0, offset4, 0], objects);
|
|
9766
|
+
var translateZ = (offset4, ...objects) => translate11([0, 0, offset4], objects);
|
|
9767
9767
|
module.exports = {
|
|
9768
|
-
translate:
|
|
9768
|
+
translate: translate11,
|
|
9769
9769
|
translateX,
|
|
9770
9770
|
translateY,
|
|
9771
9771
|
translateZ
|
|
@@ -9780,7 +9780,7 @@ var require_torus = __commonJS({
|
|
|
9780
9780
|
var { TAU } = require_constants();
|
|
9781
9781
|
var extrudeRotate = require_extrudeRotate();
|
|
9782
9782
|
var { rotate: rotate3 } = require_rotate3();
|
|
9783
|
-
var { translate:
|
|
9783
|
+
var { translate: translate11 } = require_translate2();
|
|
9784
9784
|
var circle2 = require_circle();
|
|
9785
9785
|
var { isGT, isGTE } = require_commonChecks();
|
|
9786
9786
|
var torus = (options) => {
|
|
@@ -9805,7 +9805,7 @@ var require_torus = __commonJS({
|
|
|
9805
9805
|
if (innerRotation !== 0) {
|
|
9806
9806
|
innerCircle = rotate3([0, 0, innerRotation], innerCircle);
|
|
9807
9807
|
}
|
|
9808
|
-
innerCircle =
|
|
9808
|
+
innerCircle = translate11([outerRadius, 0], innerCircle);
|
|
9809
9809
|
const extrudeOptions = {
|
|
9810
9810
|
startAngle,
|
|
9811
9811
|
angle: outerRotation,
|
|
@@ -11612,7 +11612,7 @@ var require_subtractGeom3 = __commonJS({
|
|
|
11612
11612
|
var flatten = require_flatten();
|
|
11613
11613
|
var retessellate = require_retessellate();
|
|
11614
11614
|
var subtractSub = require_subtractGeom3Sub();
|
|
11615
|
-
var
|
|
11615
|
+
var subtract7 = (...geometries) => {
|
|
11616
11616
|
geometries = flatten(geometries);
|
|
11617
11617
|
let newgeometry = geometries.shift();
|
|
11618
11618
|
geometries.forEach((geometry) => {
|
|
@@ -11621,7 +11621,7 @@ var require_subtractGeom3 = __commonJS({
|
|
|
11621
11621
|
newgeometry = retessellate(newgeometry);
|
|
11622
11622
|
return newgeometry;
|
|
11623
11623
|
};
|
|
11624
|
-
module.exports =
|
|
11624
|
+
module.exports = subtract7;
|
|
11625
11625
|
}
|
|
11626
11626
|
});
|
|
11627
11627
|
|
|
@@ -11635,14 +11635,14 @@ var require_subtractGeom2 = __commonJS({
|
|
|
11635
11635
|
var fromFakePolygons = require_fromFakePolygons();
|
|
11636
11636
|
var to3DWalls = require_to3DWalls();
|
|
11637
11637
|
var subtractGeom3 = require_subtractGeom3();
|
|
11638
|
-
var
|
|
11638
|
+
var subtract7 = (...geometries) => {
|
|
11639
11639
|
geometries = flatten(geometries);
|
|
11640
11640
|
const newgeometries = geometries.map((geometry) => to3DWalls({ z0: -1, z1: 1 }, geometry));
|
|
11641
11641
|
const newgeom3 = subtractGeom3(newgeometries);
|
|
11642
11642
|
const epsilon = measureEpsilon(newgeom3);
|
|
11643
11643
|
return fromFakePolygons(epsilon, geom3.toPolygons(newgeom3));
|
|
11644
11644
|
};
|
|
11645
|
-
module.exports =
|
|
11645
|
+
module.exports = subtract7;
|
|
11646
11646
|
}
|
|
11647
11647
|
});
|
|
11648
11648
|
|
|
@@ -11656,7 +11656,7 @@ var require_subtract4 = __commonJS({
|
|
|
11656
11656
|
var geom3 = require_geom3();
|
|
11657
11657
|
var subtractGeom2 = require_subtractGeom2();
|
|
11658
11658
|
var subtractGeom3 = require_subtractGeom3();
|
|
11659
|
-
var
|
|
11659
|
+
var subtract7 = (...geometries) => {
|
|
11660
11660
|
geometries = flatten(geometries);
|
|
11661
11661
|
if (geometries.length === 0) throw new Error("wrong number of arguments");
|
|
11662
11662
|
if (!areAllShapesTheSameType(geometries)) {
|
|
@@ -11667,7 +11667,7 @@ var require_subtract4 = __commonJS({
|
|
|
11667
11667
|
if (geom3.isA(geometry)) return subtractGeom3(geometries);
|
|
11668
11668
|
return geometry;
|
|
11669
11669
|
};
|
|
11670
|
-
module.exports =
|
|
11670
|
+
module.exports = subtract7;
|
|
11671
11671
|
}
|
|
11672
11672
|
});
|
|
11673
11673
|
|
|
@@ -11709,7 +11709,7 @@ var require_unionGeom3 = __commonJS({
|
|
|
11709
11709
|
var flatten = require_flatten();
|
|
11710
11710
|
var retessellate = require_retessellate();
|
|
11711
11711
|
var unionSub = require_unionGeom3Sub();
|
|
11712
|
-
var
|
|
11712
|
+
var union6 = (...geometries) => {
|
|
11713
11713
|
geometries = flatten(geometries);
|
|
11714
11714
|
let i;
|
|
11715
11715
|
for (i = 1; i < geometries.length; i += 2) {
|
|
@@ -11719,7 +11719,7 @@ var require_unionGeom3 = __commonJS({
|
|
|
11719
11719
|
newgeometry = retessellate(newgeometry);
|
|
11720
11720
|
return newgeometry;
|
|
11721
11721
|
};
|
|
11722
|
-
module.exports =
|
|
11722
|
+
module.exports = union6;
|
|
11723
11723
|
}
|
|
11724
11724
|
});
|
|
11725
11725
|
|
|
@@ -11733,14 +11733,14 @@ var require_unionGeom2 = __commonJS({
|
|
|
11733
11733
|
var fromFakePolygons = require_fromFakePolygons();
|
|
11734
11734
|
var to3DWalls = require_to3DWalls();
|
|
11735
11735
|
var unionGeom3 = require_unionGeom3();
|
|
11736
|
-
var
|
|
11736
|
+
var union6 = (...geometries) => {
|
|
11737
11737
|
geometries = flatten(geometries);
|
|
11738
11738
|
const newgeometries = geometries.map((geometry) => to3DWalls({ z0: -1, z1: 1 }, geometry));
|
|
11739
11739
|
const newgeom3 = unionGeom3(newgeometries);
|
|
11740
11740
|
const epsilon = measureEpsilon(newgeom3);
|
|
11741
11741
|
return fromFakePolygons(epsilon, geom3.toPolygons(newgeom3));
|
|
11742
11742
|
};
|
|
11743
|
-
module.exports =
|
|
11743
|
+
module.exports = union6;
|
|
11744
11744
|
}
|
|
11745
11745
|
});
|
|
11746
11746
|
|
|
@@ -11754,7 +11754,7 @@ var require_union = __commonJS({
|
|
|
11754
11754
|
var geom3 = require_geom3();
|
|
11755
11755
|
var unionGeom2 = require_unionGeom2();
|
|
11756
11756
|
var unionGeom3 = require_unionGeom3();
|
|
11757
|
-
var
|
|
11757
|
+
var union6 = (...geometries) => {
|
|
11758
11758
|
geometries = flatten(geometries);
|
|
11759
11759
|
if (geometries.length === 0) throw new Error("wrong number of arguments");
|
|
11760
11760
|
if (!areAllShapesTheSameType(geometries)) {
|
|
@@ -11765,7 +11765,7 @@ var require_union = __commonJS({
|
|
|
11765
11765
|
if (geom3.isA(geometry)) return unionGeom3(geometries);
|
|
11766
11766
|
return geometry;
|
|
11767
11767
|
};
|
|
11768
|
-
module.exports =
|
|
11768
|
+
module.exports = union6;
|
|
11769
11769
|
}
|
|
11770
11770
|
});
|
|
11771
11771
|
|
|
@@ -12110,8 +12110,8 @@ var require_expandShell = __commonJS({
|
|
|
12110
12110
|
endfacevertices.reverse();
|
|
12111
12111
|
polygons2.push(poly3.create(startfacevertices));
|
|
12112
12112
|
polygons2.push(poly3.create(endfacevertices));
|
|
12113
|
-
const
|
|
12114
|
-
result = unionGeom3Sub(result,
|
|
12113
|
+
const cylinder5 = geom3.create(polygons2);
|
|
12114
|
+
result = unionGeom3Sub(result, cylinder5);
|
|
12115
12115
|
});
|
|
12116
12116
|
vertices2planes.forEach((item) => {
|
|
12117
12117
|
const vertex = item[0];
|
|
@@ -12155,7 +12155,7 @@ var require_expandGeom3 = __commonJS({
|
|
|
12155
12155
|
"node_modules/@jscad/modeling/src/operations/expansions/expandGeom3.js"(exports, module) {
|
|
12156
12156
|
"use strict";
|
|
12157
12157
|
var geom3 = require_geom3();
|
|
12158
|
-
var
|
|
12158
|
+
var union6 = require_union();
|
|
12159
12159
|
var expandShell = require_expandShell();
|
|
12160
12160
|
var expandGeom3 = (options, geometry) => {
|
|
12161
12161
|
const defaults = {
|
|
@@ -12171,7 +12171,7 @@ var require_expandGeom3 = __commonJS({
|
|
|
12171
12171
|
if (polygons.length === 0) throw new Error("the given geometry cannot be empty");
|
|
12172
12172
|
options = { delta, corners, segments };
|
|
12173
12173
|
const expanded = expandShell(options, geometry);
|
|
12174
|
-
return
|
|
12174
|
+
return union6(geometry, expanded);
|
|
12175
12175
|
};
|
|
12176
12176
|
module.exports = expandGeom3;
|
|
12177
12177
|
}
|
|
@@ -12886,7 +12886,7 @@ var require_hullChain = __commonJS({
|
|
|
12886
12886
|
"node_modules/@jscad/modeling/src/operations/hulls/hullChain.js"(exports, module) {
|
|
12887
12887
|
"use strict";
|
|
12888
12888
|
var flatten = require_flatten();
|
|
12889
|
-
var
|
|
12889
|
+
var union6 = require_union();
|
|
12890
12890
|
var hull = require_hull();
|
|
12891
12891
|
var hullChain = (...geometries) => {
|
|
12892
12892
|
geometries = flatten(geometries);
|
|
@@ -12895,7 +12895,7 @@ var require_hullChain = __commonJS({
|
|
|
12895
12895
|
for (let i = 1; i < geometries.length; i++) {
|
|
12896
12896
|
hulls.push(hull(geometries[i - 1], geometries[i]));
|
|
12897
12897
|
}
|
|
12898
|
-
return
|
|
12898
|
+
return union6(hulls);
|
|
12899
12899
|
};
|
|
12900
12900
|
module.exports = hullChain;
|
|
12901
12901
|
}
|
|
@@ -13528,7 +13528,7 @@ var require_align = __commonJS({
|
|
|
13528
13528
|
var flatten = require_flatten();
|
|
13529
13529
|
var padArrayToLength = require_padArrayToLength();
|
|
13530
13530
|
var measureAggregateBoundingBox = require_measureAggregateBoundingBox();
|
|
13531
|
-
var { translate:
|
|
13531
|
+
var { translate: translate11 } = require_translate2();
|
|
13532
13532
|
var validateOptions = (options) => {
|
|
13533
13533
|
if (!Array.isArray(options.modes) || options.modes.length > 3) throw new Error("align(): modes must be an array of length <= 3");
|
|
13534
13534
|
options.modes = padArrayToLength(options.modes, "none", 3);
|
|
@@ -13565,7 +13565,7 @@ var require_align = __commonJS({
|
|
|
13565
13565
|
translation[i] = relativeTo[i] - bounds[0][i];
|
|
13566
13566
|
}
|
|
13567
13567
|
}
|
|
13568
|
-
return
|
|
13568
|
+
return translate11(translation, geometry);
|
|
13569
13569
|
};
|
|
13570
13570
|
var align = (options, ...geometries) => {
|
|
13571
13571
|
const defaults = {
|
|
@@ -13602,7 +13602,7 @@ var require_center = __commonJS({
|
|
|
13602
13602
|
var geom3 = require_geom3();
|
|
13603
13603
|
var path2 = require_path2();
|
|
13604
13604
|
var measureBoundingBox = require_measureBoundingBox2();
|
|
13605
|
-
var { translate:
|
|
13605
|
+
var { translate: translate11 } = require_translate2();
|
|
13606
13606
|
var centerGeometry = (options, object) => {
|
|
13607
13607
|
const defaults = {
|
|
13608
13608
|
axes: [true, true, true],
|
|
@@ -13614,7 +13614,7 @@ var require_center = __commonJS({
|
|
|
13614
13614
|
if (axes[0]) offset4[0] = relativeTo[0] - (bounds[0][0] + (bounds[1][0] - bounds[0][0]) / 2);
|
|
13615
13615
|
if (axes[1]) offset4[1] = relativeTo[1] - (bounds[0][1] + (bounds[1][1] - bounds[0][1]) / 2);
|
|
13616
13616
|
if (axes[2]) offset4[2] = relativeTo[2] - (bounds[0][2] + (bounds[1][2] - bounds[0][2]) / 2);
|
|
13617
|
-
return
|
|
13617
|
+
return translate11(offset4, object);
|
|
13618
13618
|
};
|
|
13619
13619
|
var center = (options, ...objects) => {
|
|
13620
13620
|
const defaults = {
|
|
@@ -24526,7 +24526,7 @@ var m2host = (raw_params) => {
|
|
|
24526
24526
|
}
|
|
24527
24527
|
const centerX = (minX + maxX) / 2;
|
|
24528
24528
|
const centerY = (minY + maxY) / 2;
|
|
24529
|
-
const
|
|
24529
|
+
const translate11 = (el) => {
|
|
24530
24530
|
if (typeof el.x === "number") el.x -= centerX;
|
|
24531
24531
|
if (typeof el.y === "number") el.y -= centerY;
|
|
24532
24532
|
if (el.center) {
|
|
@@ -24540,9 +24540,9 @@ var m2host = (raw_params) => {
|
|
|
24540
24540
|
}));
|
|
24541
24541
|
}
|
|
24542
24542
|
};
|
|
24543
|
-
for (const pad2 of pads)
|
|
24544
|
-
|
|
24545
|
-
|
|
24543
|
+
for (const pad2 of pads) translate11(pad2);
|
|
24544
|
+
translate11(cutout);
|
|
24545
|
+
translate11(pin1Marker);
|
|
24546
24546
|
return {
|
|
24547
24547
|
circuitJson: [
|
|
24548
24548
|
...pads,
|
|
@@ -28509,7 +28509,7 @@ import * as THREE15 from "three";
|
|
|
28509
28509
|
// package.json
|
|
28510
28510
|
var package_default = {
|
|
28511
28511
|
name: "@tscircuit/3d-viewer",
|
|
28512
|
-
version: "0.0.
|
|
28512
|
+
version: "0.0.462",
|
|
28513
28513
|
main: "./dist/index.js",
|
|
28514
28514
|
module: "./dist/index.js",
|
|
28515
28515
|
type: "module",
|
|
@@ -29716,22 +29716,29 @@ var BOARD_SURFACE_OFFSET = {
|
|
|
29716
29716
|
};
|
|
29717
29717
|
var colors = {
|
|
29718
29718
|
copper: [0.9, 0.6, 0.2],
|
|
29719
|
-
|
|
29720
|
-
|
|
29721
|
-
|
|
29722
|
-
|
|
29719
|
+
fr4Tan: [0.6, 0.43, 0.28],
|
|
29720
|
+
fr4SolderMaskGreen: [0.02, 0.1, 0.04],
|
|
29721
|
+
fr4TracesWithMaskGreen: [0, 0.5, 0.25],
|
|
29722
|
+
fr4TracesWithoutMaskTan: [0.6, 0.43, 0.28],
|
|
29723
|
+
fr1Tan: [0.8, 0.4, 0.2],
|
|
29724
|
+
fr1TracesWithMaskCopper: [0.9, 0.6, 0.2],
|
|
29725
|
+
fr1SolderMaskGreen: [0.02, 0.1, 0.04]
|
|
29723
29726
|
};
|
|
29724
29727
|
var MANIFOLD_Z_OFFSET = 1e-3;
|
|
29725
29728
|
var SMOOTH_CIRCLE_SEGMENTS = 32;
|
|
29726
29729
|
var DEFAULT_SMT_PAD_THICKNESS = 0.035;
|
|
29727
29730
|
var TRACE_TEXTURE_RESOLUTION = 50;
|
|
29728
29731
|
var boardMaterialColors = {
|
|
29729
|
-
fr1: colors.
|
|
29730
|
-
fr4: colors.
|
|
29732
|
+
fr1: colors.fr1Tan,
|
|
29733
|
+
fr4: colors.fr4Tan
|
|
29731
29734
|
};
|
|
29732
29735
|
var tracesMaterialColors = {
|
|
29733
|
-
fr1: colors.
|
|
29734
|
-
fr4: colors.
|
|
29736
|
+
fr1: colors.fr1TracesWithMaskCopper,
|
|
29737
|
+
fr4: colors.fr4TracesWithoutMaskTan
|
|
29738
|
+
};
|
|
29739
|
+
var soldermaskColors = {
|
|
29740
|
+
fr1: colors.fr1SolderMaskGreen,
|
|
29741
|
+
fr4: colors.fr4SolderMaskGreen
|
|
29735
29742
|
};
|
|
29736
29743
|
|
|
29737
29744
|
// src/geoms/create-board-with-outline.ts
|
|
@@ -29800,7 +29807,7 @@ var createSimplifiedBoardGeom = (circuitJson) => {
|
|
|
29800
29807
|
center: [boardOrPanel.center.x, boardOrPanel.center.y, 0]
|
|
29801
29808
|
});
|
|
29802
29809
|
}
|
|
29803
|
-
const material = boardMaterialColors["material" in boardOrPanel ? boardOrPanel.material ?? "fr4" : "fr4"] ?? colors.
|
|
29810
|
+
const material = boardMaterialColors["material" in boardOrPanel ? boardOrPanel.material ?? "fr4" : "fr4"] ?? colors.fr4Tan;
|
|
29804
29811
|
return [(0, import_colors.colorize)(material, boardGeom)];
|
|
29805
29812
|
};
|
|
29806
29813
|
var createBoardGeomFromCircuitJson = (circuitJson, opts = {}) => {
|
|
@@ -29814,10 +29821,10 @@ var createBoardGeomFromCircuitJson = (circuitJson, opts = {}) => {
|
|
|
29814
29821
|
};
|
|
29815
29822
|
|
|
29816
29823
|
// src/BoardGeomBuilder.ts
|
|
29817
|
-
var
|
|
29818
|
-
var
|
|
29824
|
+
var import_transforms10 = __toESM(require_transforms(), 1);
|
|
29825
|
+
var import_primitives11 = __toESM(require_primitives(), 1);
|
|
29819
29826
|
var import_colors7 = __toESM(require_colors(), 1);
|
|
29820
|
-
var
|
|
29827
|
+
var import_booleans7 = __toESM(require_booleans(), 1);
|
|
29821
29828
|
import { su as su3 } from "@tscircuit/circuit-json-util";
|
|
29822
29829
|
|
|
29823
29830
|
// src/geoms/plated-hole.ts
|
|
@@ -30974,6 +30981,75 @@ function createGeom2FromBRep(brep, arcSegments = 16) {
|
|
|
30974
30981
|
return (0, import_booleans5.subtract)(outerGeom, innerGeoms);
|
|
30975
30982
|
}
|
|
30976
30983
|
|
|
30984
|
+
// src/geoms/via-geoms.ts
|
|
30985
|
+
var import_booleans6 = __toESM(require_booleans(), 1);
|
|
30986
|
+
var import_transforms9 = __toESM(require_transforms(), 1);
|
|
30987
|
+
var import_primitives10 = __toESM(require_primitives(), 1);
|
|
30988
|
+
function createViaCopper({
|
|
30989
|
+
x,
|
|
30990
|
+
y,
|
|
30991
|
+
outerDiameter,
|
|
30992
|
+
holeDiameter,
|
|
30993
|
+
thickness
|
|
30994
|
+
}) {
|
|
30995
|
+
if (outerDiameter <= holeDiameter) {
|
|
30996
|
+
throw new Error(
|
|
30997
|
+
`Invalid via geometry: outerDiameter (${outerDiameter}) must be > holeDiameter (${holeDiameter})`
|
|
30998
|
+
);
|
|
30999
|
+
}
|
|
31000
|
+
const padThickness = M;
|
|
31001
|
+
const platingThickness = M;
|
|
31002
|
+
const barrelRadius = Math.min(
|
|
31003
|
+
outerDiameter / 2,
|
|
31004
|
+
holeDiameter / 2 + platingThickness
|
|
31005
|
+
);
|
|
31006
|
+
const barrel = (0, import_primitives10.cylinder)({
|
|
31007
|
+
center: [0, 0, 0],
|
|
31008
|
+
radius: barrelRadius,
|
|
31009
|
+
height: thickness,
|
|
31010
|
+
segments: SMOOTH_CIRCLE_SEGMENTS
|
|
31011
|
+
});
|
|
31012
|
+
const topPad = (0, import_primitives10.cylinder)({
|
|
31013
|
+
center: [0, 0, thickness / 2],
|
|
31014
|
+
radius: outerDiameter / 2,
|
|
31015
|
+
height: padThickness,
|
|
31016
|
+
segments: SMOOTH_CIRCLE_SEGMENTS
|
|
31017
|
+
});
|
|
31018
|
+
const bottomPad = (0, import_primitives10.cylinder)({
|
|
31019
|
+
center: [0, 0, -thickness / 2],
|
|
31020
|
+
radius: outerDiameter / 2,
|
|
31021
|
+
height: padThickness,
|
|
31022
|
+
segments: SMOOTH_CIRCLE_SEGMENTS
|
|
31023
|
+
});
|
|
31024
|
+
const viaSolid = (0, import_booleans6.union)([barrel, topPad, bottomPad]);
|
|
31025
|
+
const drillHeight = thickness + padThickness * 2;
|
|
31026
|
+
const drill = (0, import_primitives10.cylinder)({
|
|
31027
|
+
center: [0, 0, 0],
|
|
31028
|
+
radius: holeDiameter / 2,
|
|
31029
|
+
height: drillHeight,
|
|
31030
|
+
segments: SMOOTH_CIRCLE_SEGMENTS
|
|
31031
|
+
});
|
|
31032
|
+
const finalViaCopper = (0, import_booleans6.subtract)(viaSolid, drill);
|
|
31033
|
+
const positionedVia = (0, import_transforms9.translate)([x, y, 0], finalViaCopper);
|
|
31034
|
+
return positionedVia;
|
|
31035
|
+
}
|
|
31036
|
+
function createViaBoardDrill({
|
|
31037
|
+
x,
|
|
31038
|
+
y,
|
|
31039
|
+
holeDiameter,
|
|
31040
|
+
thickness
|
|
31041
|
+
}) {
|
|
31042
|
+
const drillHeight = thickness * 1.5;
|
|
31043
|
+
const drillRadius = holeDiameter / 2 + M;
|
|
31044
|
+
const drill = (0, import_primitives10.cylinder)({
|
|
31045
|
+
center: [x, y, 0],
|
|
31046
|
+
radius: drillRadius,
|
|
31047
|
+
height: drillHeight,
|
|
31048
|
+
segments: SMOOTH_CIRCLE_SEGMENTS
|
|
31049
|
+
});
|
|
31050
|
+
return drill;
|
|
31051
|
+
}
|
|
31052
|
+
|
|
30977
31053
|
// src/BoardGeomBuilder.ts
|
|
30978
31054
|
var PAD_ROUNDED_SEGMENTS = 64;
|
|
30979
31055
|
var BOARD_CLIP_Z_MARGIN = 1;
|
|
@@ -30981,15 +31057,15 @@ var BOARD_CLIP_XY_OUTSET = 0.05;
|
|
|
30981
31057
|
var createCenteredRectPadGeom = (width10, height10, thickness, rectBorderRadius) => {
|
|
30982
31058
|
const clampedRadius = clampRectBorderRadius(width10, height10, rectBorderRadius);
|
|
30983
31059
|
if (clampedRadius <= 0) {
|
|
30984
|
-
return (0,
|
|
31060
|
+
return (0, import_primitives11.cuboid)({ center: [0, 0, 0], size: [width10, height10, thickness] });
|
|
30985
31061
|
}
|
|
30986
|
-
const rect2d = (0,
|
|
31062
|
+
const rect2d = (0, import_primitives11.roundedRectangle)({
|
|
30987
31063
|
size: [width10, height10],
|
|
30988
31064
|
roundRadius: clampedRadius,
|
|
30989
31065
|
segments: PAD_ROUNDED_SEGMENTS
|
|
30990
31066
|
});
|
|
30991
31067
|
const extruded = (0, import_extrusions8.extrudeLinear)({ height: thickness }, rect2d);
|
|
30992
|
-
return (0,
|
|
31068
|
+
return (0, import_transforms10.translate)([0, 0, -thickness / 2], extruded);
|
|
30993
31069
|
};
|
|
30994
31070
|
var buildStateOrder = [
|
|
30995
31071
|
"initializing",
|
|
@@ -31025,8 +31101,6 @@ var BoardGeomBuilder = class {
|
|
|
31025
31101
|
pcb_copper_pours;
|
|
31026
31102
|
boardGeom = null;
|
|
31027
31103
|
platedHoleGeoms = [];
|
|
31028
|
-
holeGeoms = [];
|
|
31029
|
-
// Currently only used for subtraction
|
|
31030
31104
|
padGeoms = [];
|
|
31031
31105
|
traceGeoms = [];
|
|
31032
31106
|
viaGeoms = [];
|
|
@@ -31116,11 +31190,11 @@ var BoardGeomBuilder = class {
|
|
|
31116
31190
|
{ xyOutset: BOARD_CLIP_XY_OUTSET }
|
|
31117
31191
|
);
|
|
31118
31192
|
} else {
|
|
31119
|
-
this.boardGeom = (0,
|
|
31193
|
+
this.boardGeom = (0, import_primitives11.cuboid)({
|
|
31120
31194
|
size: [this.board.width, this.board.height, this.ctx.pcbThickness],
|
|
31121
31195
|
center: [this.board.center.x, this.board.center.y, 0]
|
|
31122
31196
|
});
|
|
31123
|
-
this.boardClipGeom = (0,
|
|
31197
|
+
this.boardClipGeom = (0, import_primitives11.cuboid)({
|
|
31124
31198
|
size: [
|
|
31125
31199
|
this.board.width + 2 * BOARD_CLIP_XY_OUTSET,
|
|
31126
31200
|
this.board.height + 2 * BOARD_CLIP_XY_OUTSET,
|
|
@@ -31255,47 +31329,48 @@ var BoardGeomBuilder = class {
|
|
|
31255
31329
|
let cutoutGeom = null;
|
|
31256
31330
|
const cutoutHeight = this.ctx.pcbThickness * 1.5;
|
|
31257
31331
|
switch (cutout.shape) {
|
|
31258
|
-
case "rect":
|
|
31332
|
+
case "rect": {
|
|
31259
31333
|
const rectCornerRadius = clampRectBorderRadius(
|
|
31260
31334
|
cutout.width,
|
|
31261
31335
|
cutout.height,
|
|
31262
31336
|
extractRectBorderRadius(cutout)
|
|
31263
31337
|
);
|
|
31264
31338
|
if (rectCornerRadius > 0) {
|
|
31265
|
-
const rect2d = (0,
|
|
31339
|
+
const rect2d = (0, import_primitives11.roundedRectangle)({
|
|
31266
31340
|
size: [cutout.width, cutout.height],
|
|
31267
31341
|
roundRadius: rectCornerRadius,
|
|
31268
31342
|
segments: PAD_ROUNDED_SEGMENTS
|
|
31269
31343
|
});
|
|
31270
31344
|
cutoutGeom = (0, import_extrusions8.extrudeLinear)({ height: cutoutHeight }, rect2d);
|
|
31271
|
-
cutoutGeom = (0,
|
|
31272
|
-
cutoutGeom = (0,
|
|
31345
|
+
cutoutGeom = (0, import_transforms10.translate)([0, 0, -cutoutHeight / 2], cutoutGeom);
|
|
31346
|
+
cutoutGeom = (0, import_transforms10.translate)(
|
|
31273
31347
|
[cutout.center.x, cutout.center.y, 0],
|
|
31274
31348
|
cutoutGeom
|
|
31275
31349
|
);
|
|
31276
31350
|
} else {
|
|
31277
|
-
const baseCutoutGeom = (0,
|
|
31351
|
+
const baseCutoutGeom = (0, import_primitives11.cuboid)({
|
|
31278
31352
|
center: [0, 0, 0],
|
|
31279
31353
|
size: [cutout.width, cutout.height, cutoutHeight]
|
|
31280
31354
|
});
|
|
31281
|
-
cutoutGeom = (0,
|
|
31355
|
+
cutoutGeom = (0, import_transforms10.translate)(
|
|
31282
31356
|
[cutout.center.x, cutout.center.y, 0],
|
|
31283
31357
|
baseCutoutGeom
|
|
31284
31358
|
);
|
|
31285
31359
|
}
|
|
31286
31360
|
if (cutout.rotation) {
|
|
31287
31361
|
const rotationRadians = cutout.rotation * Math.PI / 180;
|
|
31288
|
-
cutoutGeom = (0,
|
|
31362
|
+
cutoutGeom = (0, import_transforms10.rotateZ)(rotationRadians, cutoutGeom);
|
|
31289
31363
|
}
|
|
31290
31364
|
break;
|
|
31365
|
+
}
|
|
31291
31366
|
case "circle":
|
|
31292
|
-
cutoutGeom = (0,
|
|
31367
|
+
cutoutGeom = (0, import_primitives11.cylinder)({
|
|
31293
31368
|
center: [cutout.center.x, cutout.center.y, 0],
|
|
31294
31369
|
radius: cutout.radius,
|
|
31295
31370
|
height: cutoutHeight
|
|
31296
31371
|
});
|
|
31297
31372
|
break;
|
|
31298
|
-
case "polygon":
|
|
31373
|
+
case "polygon": {
|
|
31299
31374
|
let pointsVec2 = cutout.points.map((p) => [p.x, p.y]);
|
|
31300
31375
|
if (pointsVec2.length < 3) {
|
|
31301
31376
|
console.warn(
|
|
@@ -31306,13 +31381,14 @@ var BoardGeomBuilder = class {
|
|
|
31306
31381
|
if (arePointsClockwise(pointsVec2)) {
|
|
31307
31382
|
pointsVec2 = pointsVec2.reverse();
|
|
31308
31383
|
}
|
|
31309
|
-
const polygon2d = (0,
|
|
31384
|
+
const polygon2d = (0, import_primitives11.polygon)({ points: pointsVec2 });
|
|
31310
31385
|
cutoutGeom = (0, import_extrusions8.extrudeLinear)({ height: cutoutHeight }, polygon2d);
|
|
31311
|
-
cutoutGeom = (0,
|
|
31386
|
+
cutoutGeom = (0, import_transforms10.translate)([0, 0, -cutoutHeight / 2], cutoutGeom);
|
|
31312
31387
|
break;
|
|
31388
|
+
}
|
|
31313
31389
|
}
|
|
31314
31390
|
if (cutoutGeom) {
|
|
31315
|
-
this.boardGeom = (0,
|
|
31391
|
+
this.boardGeom = (0, import_booleans7.subtract)(this.boardGeom, cutoutGeom);
|
|
31316
31392
|
}
|
|
31317
31393
|
}
|
|
31318
31394
|
processCopperPour(pour) {
|
|
@@ -31320,22 +31396,22 @@ var BoardGeomBuilder = class {
|
|
|
31320
31396
|
const zPos = layerSign * this.ctx.pcbThickness / 2 + layerSign * BOARD_SURFACE_OFFSET.copper;
|
|
31321
31397
|
let pourGeom = null;
|
|
31322
31398
|
if (pour.shape === "rect") {
|
|
31323
|
-
let baseGeom = (0,
|
|
31399
|
+
let baseGeom = (0, import_primitives11.cuboid)({
|
|
31324
31400
|
center: [0, 0, 0],
|
|
31325
31401
|
// Create at origin for rotation
|
|
31326
31402
|
size: [pour.width, pour.height, M]
|
|
31327
31403
|
});
|
|
31328
31404
|
if ("rotation" in pour && pour.rotation) {
|
|
31329
31405
|
const rotationRadians = pour.rotation * Math.PI / 180;
|
|
31330
|
-
baseGeom = (0,
|
|
31406
|
+
baseGeom = (0, import_transforms10.rotateZ)(rotationRadians, baseGeom);
|
|
31331
31407
|
}
|
|
31332
|
-
pourGeom = (0,
|
|
31408
|
+
pourGeom = (0, import_transforms10.translate)([pour.center.x, pour.center.y, zPos], baseGeom);
|
|
31333
31409
|
} else if (pour.shape === "brep") {
|
|
31334
31410
|
const brepShape = pour.brep_shape;
|
|
31335
|
-
if (brepShape
|
|
31411
|
+
if (brepShape?.outer_ring) {
|
|
31336
31412
|
const pourGeom2 = createGeom2FromBRep(brepShape);
|
|
31337
31413
|
pourGeom = (0, import_extrusions8.extrudeLinear)({ height: M }, pourGeom2);
|
|
31338
|
-
pourGeom = (0,
|
|
31414
|
+
pourGeom = (0, import_transforms10.translate)([0, 0, zPos], pourGeom);
|
|
31339
31415
|
}
|
|
31340
31416
|
} else if (pour.shape === "polygon") {
|
|
31341
31417
|
let pointsVec2 = pour.points.map((p) => [p.x, p.y]);
|
|
@@ -31348,16 +31424,16 @@ var BoardGeomBuilder = class {
|
|
|
31348
31424
|
if (arePointsClockwise(pointsVec2)) {
|
|
31349
31425
|
pointsVec2 = pointsVec2.reverse();
|
|
31350
31426
|
}
|
|
31351
|
-
const polygon2d = (0,
|
|
31427
|
+
const polygon2d = (0, import_primitives11.polygon)({ points: pointsVec2 });
|
|
31352
31428
|
pourGeom = (0, import_extrusions8.extrudeLinear)({ height: M }, polygon2d);
|
|
31353
|
-
pourGeom = (0,
|
|
31429
|
+
pourGeom = (0, import_transforms10.translate)([0, 0, zPos], pourGeom);
|
|
31354
31430
|
}
|
|
31355
31431
|
if (pourGeom) {
|
|
31356
31432
|
if (this.boardClipGeom) {
|
|
31357
|
-
pourGeom = (0,
|
|
31433
|
+
pourGeom = (0, import_booleans7.intersect)(this.boardClipGeom, pourGeom);
|
|
31358
31434
|
}
|
|
31359
31435
|
const covered = pour.covered_with_solder_mask !== false;
|
|
31360
|
-
const pourMaterialColor = covered ? tracesMaterialColors[this.board.material] ?? colors.
|
|
31436
|
+
const pourMaterialColor = covered ? tracesMaterialColors[this.board.material] ?? colors.fr4TracesWithoutMaskTan : colors.copper;
|
|
31361
31437
|
const coloredPourGeom = (0, import_colors7.colorize)(pourMaterialColor, pourGeom);
|
|
31362
31438
|
this.copperPourGeoms.push(coloredPourGeom);
|
|
31363
31439
|
}
|
|
@@ -31367,7 +31443,7 @@ var BoardGeomBuilder = class {
|
|
|
31367
31443
|
if (ph.shape === "circle" || ph.shape === "circular_hole_with_rect_pad") {
|
|
31368
31444
|
let cyGeom = null;
|
|
31369
31445
|
if (ph.shape === "circular_hole_with_rect_pad") {
|
|
31370
|
-
cyGeom = (0,
|
|
31446
|
+
cyGeom = (0, import_primitives11.cylinder)({
|
|
31371
31447
|
center: [
|
|
31372
31448
|
ph.x + (ph.hole_offset_x || 0),
|
|
31373
31449
|
ph.y + (ph.hole_offset_y || 0),
|
|
@@ -31379,7 +31455,7 @@ var BoardGeomBuilder = class {
|
|
|
31379
31455
|
// Ensure it cuts through
|
|
31380
31456
|
});
|
|
31381
31457
|
} else {
|
|
31382
|
-
cyGeom = (0,
|
|
31458
|
+
cyGeom = (0, import_primitives11.cylinder)({
|
|
31383
31459
|
center: [ph.x, ph.y, 0],
|
|
31384
31460
|
radius: ph.hole_diameter / 2 + M,
|
|
31385
31461
|
// Add margin for subtraction
|
|
@@ -31388,10 +31464,10 @@ var BoardGeomBuilder = class {
|
|
|
31388
31464
|
});
|
|
31389
31465
|
}
|
|
31390
31466
|
if (!opts.dontCutBoard) {
|
|
31391
|
-
this.boardGeom = (0,
|
|
31467
|
+
this.boardGeom = (0, import_booleans7.subtract)(this.boardGeom, cyGeom);
|
|
31392
31468
|
}
|
|
31393
31469
|
this.padGeoms = this.padGeoms.map(
|
|
31394
|
-
(pg) => (0, import_colors7.colorize)(colors.copper, (0,
|
|
31470
|
+
(pg) => (0, import_colors7.colorize)(colors.copper, (0, import_booleans7.subtract)(pg, cyGeom))
|
|
31395
31471
|
);
|
|
31396
31472
|
const platedHoleGeom = platedHole(ph, this.ctx, {
|
|
31397
31473
|
clipGeom: this.boardClipGeom
|
|
@@ -31404,17 +31480,17 @@ var BoardGeomBuilder = class {
|
|
|
31404
31480
|
const holeRadius = holeHeight / 2;
|
|
31405
31481
|
const rectLength = Math.abs(holeWidth - holeHeight);
|
|
31406
31482
|
let pillHole;
|
|
31407
|
-
pillHole = (0,
|
|
31408
|
-
(0,
|
|
31483
|
+
pillHole = (0, import_booleans7.union)(
|
|
31484
|
+
(0, import_primitives11.cuboid)({
|
|
31409
31485
|
center: [ph.x, ph.y, 0],
|
|
31410
31486
|
size: shouldRotate ? [holeHeight, rectLength, this.ctx.pcbThickness * 1.5] : [rectLength, holeHeight, this.ctx.pcbThickness * 1.5]
|
|
31411
31487
|
}),
|
|
31412
|
-
(0,
|
|
31488
|
+
(0, import_primitives11.cylinder)({
|
|
31413
31489
|
center: shouldRotate ? [ph.x, ph.y - rectLength / 2, 0] : [ph.x - rectLength / 2, ph.y, 0],
|
|
31414
31490
|
radius: holeRadius,
|
|
31415
31491
|
height: this.ctx.pcbThickness * 1.5
|
|
31416
31492
|
}),
|
|
31417
|
-
(0,
|
|
31493
|
+
(0, import_primitives11.cylinder)({
|
|
31418
31494
|
center: shouldRotate ? [ph.x, ph.y + rectLength / 2, 0] : [ph.x + rectLength / 2, ph.y, 0],
|
|
31419
31495
|
radius: holeRadius,
|
|
31420
31496
|
height: this.ctx.pcbThickness * 1.5
|
|
@@ -31422,16 +31498,16 @@ var BoardGeomBuilder = class {
|
|
|
31422
31498
|
);
|
|
31423
31499
|
if (ph.ccw_rotation) {
|
|
31424
31500
|
const rotationRadians = ph.ccw_rotation * Math.PI / 180;
|
|
31425
|
-
pillHole = (0,
|
|
31501
|
+
pillHole = (0, import_transforms10.translate)(
|
|
31426
31502
|
[ph.x, ph.y, 0],
|
|
31427
|
-
(0,
|
|
31503
|
+
(0, import_transforms10.rotateZ)(rotationRadians, (0, import_transforms10.translate)([-ph.x, -ph.y, 0], pillHole))
|
|
31428
31504
|
);
|
|
31429
31505
|
}
|
|
31430
31506
|
if (!opts.dontCutBoard) {
|
|
31431
|
-
this.boardGeom = (0,
|
|
31507
|
+
this.boardGeom = (0, import_booleans7.subtract)(this.boardGeom, pillHole);
|
|
31432
31508
|
}
|
|
31433
31509
|
this.padGeoms = this.padGeoms.map(
|
|
31434
|
-
(pg) => (0, import_colors7.colorize)(colors.copper, (0,
|
|
31510
|
+
(pg) => (0, import_colors7.colorize)(colors.copper, (0, import_booleans7.subtract)(pg, pillHole))
|
|
31435
31511
|
);
|
|
31436
31512
|
const platedHoleGeom = platedHole(ph, this.ctx, {
|
|
31437
31513
|
clipGeom: this.boardClipGeom
|
|
@@ -31444,8 +31520,8 @@ var BoardGeomBuilder = class {
|
|
|
31444
31520
|
const holeRadius = holeHeight / 2;
|
|
31445
31521
|
const rectLength = Math.abs(holeWidth - holeHeight);
|
|
31446
31522
|
let pillHole;
|
|
31447
|
-
pillHole = (0,
|
|
31448
|
-
(0,
|
|
31523
|
+
pillHole = (0, import_booleans7.union)(
|
|
31524
|
+
(0, import_primitives11.cuboid)({
|
|
31449
31525
|
center: [
|
|
31450
31526
|
ph.x + (ph.hole_offset_x || 0),
|
|
31451
31527
|
ph.y + (ph.hole_offset_y || 0),
|
|
@@ -31453,7 +31529,7 @@ var BoardGeomBuilder = class {
|
|
|
31453
31529
|
],
|
|
31454
31530
|
size: shouldRotate ? [holeHeight, rectLength, this.ctx.pcbThickness * 1.5] : [rectLength, holeHeight, this.ctx.pcbThickness * 1.5]
|
|
31455
31531
|
}),
|
|
31456
|
-
(0,
|
|
31532
|
+
(0, import_primitives11.cylinder)({
|
|
31457
31533
|
center: shouldRotate ? [
|
|
31458
31534
|
ph.x + (ph.hole_offset_x || 0),
|
|
31459
31535
|
ph.y + (ph.hole_offset_y || 0) - rectLength / 2,
|
|
@@ -31466,7 +31542,7 @@ var BoardGeomBuilder = class {
|
|
|
31466
31542
|
radius: holeRadius,
|
|
31467
31543
|
height: this.ctx.pcbThickness * 1.5
|
|
31468
31544
|
}),
|
|
31469
|
-
(0,
|
|
31545
|
+
(0, import_primitives11.cylinder)({
|
|
31470
31546
|
center: shouldRotate ? [
|
|
31471
31547
|
ph.x + (ph.hole_offset_x || 0),
|
|
31472
31548
|
ph.y + (ph.hole_offset_y || 0) + rectLength / 2,
|
|
@@ -31494,13 +31570,13 @@ var BoardGeomBuilder = class {
|
|
|
31494
31570
|
});
|
|
31495
31571
|
if (!boardHole || !copperHole) return;
|
|
31496
31572
|
if (!opts.dontCutBoard) {
|
|
31497
|
-
this.boardGeom = (0,
|
|
31573
|
+
this.boardGeom = (0, import_booleans7.subtract)(this.boardGeom, boardHole);
|
|
31498
31574
|
}
|
|
31499
31575
|
this.padGeoms = this.padGeoms.map(
|
|
31500
|
-
(pg) => (0, import_colors7.colorize)(colors.copper, (0,
|
|
31576
|
+
(pg) => (0, import_colors7.colorize)(colors.copper, (0, import_booleans7.subtract)(pg, boardHole))
|
|
31501
31577
|
);
|
|
31502
31578
|
this.platedHoleGeoms = this.platedHoleGeoms.map(
|
|
31503
|
-
(phg) => (0, import_colors7.colorize)(colors.copper, (0,
|
|
31579
|
+
(phg) => (0, import_colors7.colorize)(colors.copper, (0, import_booleans7.subtract)(phg, copperHole))
|
|
31504
31580
|
);
|
|
31505
31581
|
const platedHoleGeom = platedHole(ph, this.ctx, {
|
|
31506
31582
|
clipGeom: this.boardClipGeom
|
|
@@ -31513,22 +31589,22 @@ var BoardGeomBuilder = class {
|
|
|
31513
31589
|
const holeDepth = this.ctx.pcbThickness * 1.5;
|
|
31514
31590
|
const copperInset = 0.02;
|
|
31515
31591
|
if (hole.hole_shape === "round" || hole.hole_shape === "circle") {
|
|
31516
|
-
const cyGeom = (0,
|
|
31592
|
+
const cyGeom = (0, import_primitives11.cylinder)({
|
|
31517
31593
|
center: [hole.x, hole.y, 0],
|
|
31518
31594
|
radius: hole.hole_diameter / 2 + M,
|
|
31519
31595
|
height: holeDepth
|
|
31520
31596
|
});
|
|
31521
|
-
this.boardGeom = (0,
|
|
31597
|
+
this.boardGeom = (0, import_booleans7.subtract)(this.boardGeom, cyGeom);
|
|
31522
31598
|
this.padGeoms = this.padGeoms.map(
|
|
31523
|
-
(pg) => (0, import_colors7.colorize)(colors.copper, (0,
|
|
31599
|
+
(pg) => (0, import_colors7.colorize)(colors.copper, (0, import_booleans7.subtract)(pg, cyGeom))
|
|
31524
31600
|
);
|
|
31525
|
-
const copperCut = (0,
|
|
31601
|
+
const copperCut = (0, import_primitives11.cylinder)({
|
|
31526
31602
|
center: [hole.x, hole.y, 0],
|
|
31527
31603
|
radius: hole.hole_diameter / 2 + M / 2,
|
|
31528
31604
|
height: holeDepth
|
|
31529
31605
|
});
|
|
31530
31606
|
this.platedHoleGeoms = this.platedHoleGeoms.map(
|
|
31531
|
-
(phg) => (0, import_colors7.colorize)(colors.copper, (0,
|
|
31607
|
+
(phg) => (0, import_colors7.colorize)(colors.copper, (0, import_booleans7.subtract)(phg, copperCut))
|
|
31532
31608
|
);
|
|
31533
31609
|
} else if (hole.hole_shape === "pill" || hole.hole_shape === "rotated_pill") {
|
|
31534
31610
|
const holeWidth = hole.hole_width;
|
|
@@ -31538,34 +31614,34 @@ var BoardGeomBuilder = class {
|
|
|
31538
31614
|
const isRotated = hole.hole_shape === "rotated_pill";
|
|
31539
31615
|
let pillHole;
|
|
31540
31616
|
if (holeWidth > holeHeight) {
|
|
31541
|
-
pillHole = (0,
|
|
31542
|
-
(0,
|
|
31617
|
+
pillHole = (0, import_booleans7.union)(
|
|
31618
|
+
(0, import_primitives11.cuboid)({
|
|
31543
31619
|
center: [hole.x, hole.y, 0],
|
|
31544
31620
|
size: [rectLength, holeHeight, holeDepth]
|
|
31545
31621
|
}),
|
|
31546
|
-
(0,
|
|
31622
|
+
(0, import_primitives11.cylinder)({
|
|
31547
31623
|
center: [hole.x - rectLength / 2, hole.y, 0],
|
|
31548
31624
|
radius: holeRadius,
|
|
31549
31625
|
height: holeDepth
|
|
31550
31626
|
}),
|
|
31551
|
-
(0,
|
|
31627
|
+
(0, import_primitives11.cylinder)({
|
|
31552
31628
|
center: [hole.x + rectLength / 2, hole.y, 0],
|
|
31553
31629
|
radius: holeRadius,
|
|
31554
31630
|
height: holeDepth
|
|
31555
31631
|
})
|
|
31556
31632
|
);
|
|
31557
31633
|
} else {
|
|
31558
|
-
pillHole = (0,
|
|
31559
|
-
(0,
|
|
31634
|
+
pillHole = (0, import_booleans7.union)(
|
|
31635
|
+
(0, import_primitives11.cuboid)({
|
|
31560
31636
|
center: [hole.x, hole.y, 0],
|
|
31561
31637
|
size: [holeWidth, rectLength, holeDepth]
|
|
31562
31638
|
}),
|
|
31563
|
-
(0,
|
|
31639
|
+
(0, import_primitives11.cylinder)({
|
|
31564
31640
|
center: [hole.x, hole.y - rectLength / 2, 0],
|
|
31565
31641
|
radius: holeRadius,
|
|
31566
31642
|
height: holeDepth
|
|
31567
31643
|
}),
|
|
31568
|
-
(0,
|
|
31644
|
+
(0, import_primitives11.cylinder)({
|
|
31569
31645
|
center: [hole.x, hole.y + rectLength / 2, 0],
|
|
31570
31646
|
radius: holeRadius,
|
|
31571
31647
|
height: holeDepth
|
|
@@ -31574,15 +31650,15 @@ var BoardGeomBuilder = class {
|
|
|
31574
31650
|
}
|
|
31575
31651
|
if (isRotated) {
|
|
31576
31652
|
const rotationRadians = hole.ccw_rotation * Math.PI / 180;
|
|
31577
|
-
pillHole = (0,
|
|
31653
|
+
pillHole = (0, import_transforms10.rotateZ)(rotationRadians, pillHole);
|
|
31578
31654
|
}
|
|
31579
|
-
this.boardGeom = (0,
|
|
31655
|
+
this.boardGeom = (0, import_booleans7.subtract)(this.boardGeom, pillHole);
|
|
31580
31656
|
this.padGeoms = this.padGeoms.map(
|
|
31581
|
-
(pg) => (0, import_colors7.colorize)(colors.copper, (0,
|
|
31657
|
+
(pg) => (0, import_colors7.colorize)(colors.copper, (0, import_booleans7.subtract)(pg, pillHole))
|
|
31582
31658
|
);
|
|
31583
31659
|
const copperPill = (0, import_expansions4.expand)({ delta: -copperInset }, pillHole);
|
|
31584
31660
|
this.platedHoleGeoms = this.platedHoleGeoms.map(
|
|
31585
|
-
(phg) => (0, import_colors7.colorize)(colors.copper, (0,
|
|
31661
|
+
(phg) => (0, import_colors7.colorize)(colors.copper, (0, import_booleans7.subtract)(phg, copperPill))
|
|
31586
31662
|
);
|
|
31587
31663
|
}
|
|
31588
31664
|
}
|
|
@@ -31597,10 +31673,10 @@ var BoardGeomBuilder = class {
|
|
|
31597
31673
|
M,
|
|
31598
31674
|
rectBorderRadius
|
|
31599
31675
|
);
|
|
31600
|
-
const positionedPadGeom = (0,
|
|
31676
|
+
const positionedPadGeom = (0, import_transforms10.translate)([pad2.x, pad2.y, zPos], basePadGeom);
|
|
31601
31677
|
let finalPadGeom = positionedPadGeom;
|
|
31602
31678
|
if (this.boardClipGeom) {
|
|
31603
|
-
finalPadGeom = (0,
|
|
31679
|
+
finalPadGeom = (0, import_booleans7.intersect)(this.boardClipGeom, finalPadGeom);
|
|
31604
31680
|
}
|
|
31605
31681
|
finalPadGeom = (0, import_colors7.colorize)(colors.copper, finalPadGeom);
|
|
31606
31682
|
this.padGeoms.push(finalPadGeom);
|
|
@@ -31612,22 +31688,22 @@ var BoardGeomBuilder = class {
|
|
|
31612
31688
|
rectBorderRadius
|
|
31613
31689
|
);
|
|
31614
31690
|
const rotationRadians = pad2.ccw_rotation * Math.PI / 180;
|
|
31615
|
-
basePadGeom = (0,
|
|
31616
|
-
const positionedPadGeom = (0,
|
|
31691
|
+
basePadGeom = (0, import_transforms10.rotateZ)(rotationRadians, basePadGeom);
|
|
31692
|
+
const positionedPadGeom = (0, import_transforms10.translate)([pad2.x, pad2.y, zPos], basePadGeom);
|
|
31617
31693
|
let finalPadGeom = positionedPadGeom;
|
|
31618
31694
|
if (this.boardClipGeom) {
|
|
31619
|
-
finalPadGeom = (0,
|
|
31695
|
+
finalPadGeom = (0, import_booleans7.intersect)(this.boardClipGeom, finalPadGeom);
|
|
31620
31696
|
}
|
|
31621
31697
|
finalPadGeom = (0, import_colors7.colorize)(colors.copper, finalPadGeom);
|
|
31622
31698
|
this.padGeoms.push(finalPadGeom);
|
|
31623
31699
|
} else if (pad2.shape === "circle") {
|
|
31624
|
-
let padGeom = (0,
|
|
31700
|
+
let padGeom = (0, import_primitives11.cylinder)({
|
|
31625
31701
|
center: [pad2.x, pad2.y, zPos],
|
|
31626
31702
|
radius: pad2.radius,
|
|
31627
31703
|
height: M
|
|
31628
31704
|
});
|
|
31629
31705
|
if (this.boardClipGeom) {
|
|
31630
|
-
padGeom = (0,
|
|
31706
|
+
padGeom = (0, import_booleans7.intersect)(this.boardClipGeom, padGeom);
|
|
31631
31707
|
}
|
|
31632
31708
|
padGeom = (0, import_colors7.colorize)(colors.copper, padGeom);
|
|
31633
31709
|
this.padGeoms.push(padGeom);
|
|
@@ -31643,12 +31719,12 @@ var BoardGeomBuilder = class {
|
|
|
31643
31719
|
if (currentSegmentPoints.length >= 2 && currentLayer) {
|
|
31644
31720
|
const layerSign = currentLayer === "bottom" ? -1 : 1;
|
|
31645
31721
|
const zCenter = layerSign * this.ctx.pcbThickness / 2 + layerSign * BOARD_SURFACE_OFFSET.traces;
|
|
31646
|
-
const linePath = (0,
|
|
31722
|
+
const linePath = (0, import_primitives11.line)(currentSegmentPoints);
|
|
31647
31723
|
const expandedPath = (0, import_expansions4.expand)(
|
|
31648
31724
|
{ delta: currentWidth / 2, corners: "round" },
|
|
31649
31725
|
linePath
|
|
31650
31726
|
);
|
|
31651
|
-
let traceGeom = (0,
|
|
31727
|
+
let traceGeom = (0, import_transforms10.translate)(
|
|
31652
31728
|
[0, 0, zCenter - M / 2],
|
|
31653
31729
|
(0, import_extrusions8.extrudeLinear)({ height: M }, expandedPath)
|
|
31654
31730
|
);
|
|
@@ -31659,25 +31735,25 @@ var BoardGeomBuilder = class {
|
|
|
31659
31735
|
startPointCoords[1]
|
|
31660
31736
|
);
|
|
31661
31737
|
if (startHole) {
|
|
31662
|
-
const cuttingCylinder = (0,
|
|
31738
|
+
const cuttingCylinder = (0, import_primitives11.cylinder)({
|
|
31663
31739
|
center: [startPointCoords[0], startPointCoords[1], zCenter],
|
|
31664
31740
|
radius: startHole.diameter / 2 + M,
|
|
31665
31741
|
height: M
|
|
31666
31742
|
});
|
|
31667
|
-
traceGeom = (0,
|
|
31743
|
+
traceGeom = (0, import_booleans7.subtract)(traceGeom, cuttingCylinder);
|
|
31668
31744
|
}
|
|
31669
31745
|
const endHole = this.getHoleToCut(endPointCoords[0], endPointCoords[1]);
|
|
31670
31746
|
if (endHole) {
|
|
31671
|
-
const cuttingCylinder = (0,
|
|
31747
|
+
const cuttingCylinder = (0, import_primitives11.cylinder)({
|
|
31672
31748
|
center: [endPointCoords[0], endPointCoords[1], zCenter],
|
|
31673
31749
|
radius: endHole.diameter / 2 + M,
|
|
31674
31750
|
height: M
|
|
31675
31751
|
});
|
|
31676
|
-
traceGeom = (0,
|
|
31752
|
+
traceGeom = (0, import_booleans7.subtract)(traceGeom, cuttingCylinder);
|
|
31677
31753
|
}
|
|
31678
|
-
const tracesMaterialColor = tracesMaterialColors[this.board.material] ?? colors.
|
|
31754
|
+
const tracesMaterialColor = tracesMaterialColors[this.board.material] ?? colors.fr4TracesWithoutMaskTan;
|
|
31679
31755
|
if (this.boardClipGeom) {
|
|
31680
|
-
traceGeom = (0,
|
|
31756
|
+
traceGeom = (0, import_booleans7.intersect)(this.boardClipGeom, traceGeom);
|
|
31681
31757
|
}
|
|
31682
31758
|
traceGeom = (0, import_colors7.colorize)(tracesMaterialColor, traceGeom);
|
|
31683
31759
|
this.traceGeoms.push(traceGeom);
|
|
@@ -31720,24 +31796,34 @@ var BoardGeomBuilder = class {
|
|
|
31720
31796
|
finishSegment();
|
|
31721
31797
|
}
|
|
31722
31798
|
processVia(via) {
|
|
31723
|
-
this.
|
|
31724
|
-
|
|
31799
|
+
if (!this.boardGeom) return;
|
|
31800
|
+
if (typeof via.outer_diameter === "number" && typeof via.hole_diameter === "number") {
|
|
31801
|
+
const viaCopperGeom = createViaCopper({
|
|
31725
31802
|
x: via.x,
|
|
31726
31803
|
y: via.y,
|
|
31727
|
-
|
|
31728
|
-
|
|
31729
|
-
|
|
31730
|
-
|
|
31731
|
-
|
|
31732
|
-
|
|
31733
|
-
|
|
31734
|
-
|
|
31735
|
-
},
|
|
31736
|
-
{
|
|
31737
|
-
dontCutBoard: true
|
|
31738
|
-
// Board cut should happen via trace logic or dedicated via cut
|
|
31804
|
+
outerDiameter: via.outer_diameter,
|
|
31805
|
+
holeDiameter: via.hole_diameter,
|
|
31806
|
+
thickness: this.ctx.pcbThickness
|
|
31807
|
+
});
|
|
31808
|
+
let finalViaGeom = viaCopperGeom;
|
|
31809
|
+
if (this.boardClipGeom) {
|
|
31810
|
+
finalViaGeom = (0, import_booleans7.intersect)(this.boardClipGeom, viaCopperGeom);
|
|
31811
|
+
finalViaGeom = (0, import_colors7.colorize)(colors.copper, finalViaGeom);
|
|
31739
31812
|
}
|
|
31740
|
-
|
|
31813
|
+
this.viaGeoms.push(finalViaGeom);
|
|
31814
|
+
}
|
|
31815
|
+
if (typeof via.hole_diameter === "number") {
|
|
31816
|
+
const viaDrill = createViaBoardDrill({
|
|
31817
|
+
x: via.x,
|
|
31818
|
+
y: via.y,
|
|
31819
|
+
holeDiameter: via.hole_diameter,
|
|
31820
|
+
thickness: this.ctx.pcbThickness
|
|
31821
|
+
});
|
|
31822
|
+
this.boardGeom = (0, import_booleans7.subtract)(this.boardGeom, viaDrill);
|
|
31823
|
+
this.padGeoms = this.padGeoms.map(
|
|
31824
|
+
(pg) => (0, import_colors7.colorize)(colors.copper, (0, import_booleans7.subtract)(pg, viaDrill))
|
|
31825
|
+
);
|
|
31826
|
+
}
|
|
31741
31827
|
}
|
|
31742
31828
|
processSilkscreenText(st) {
|
|
31743
31829
|
const { textOutlines, xOffset, yOffset } = createSilkscreenTextGeoms(st);
|
|
@@ -31746,7 +31832,7 @@ var BoardGeomBuilder = class {
|
|
|
31746
31832
|
point2[0] + xOffset + st.anchor_position.x,
|
|
31747
31833
|
point2[1] + yOffset + st.anchor_position.y
|
|
31748
31834
|
]);
|
|
31749
|
-
const textPath = (0,
|
|
31835
|
+
const textPath = (0, import_primitives11.line)(alignedOutline);
|
|
31750
31836
|
const fontSize = st.font_size || 0.25;
|
|
31751
31837
|
const expansionDelta = Math.min(
|
|
31752
31838
|
Math.max(0.01, fontSize * 0.1),
|
|
@@ -31758,13 +31844,13 @@ var BoardGeomBuilder = class {
|
|
|
31758
31844
|
);
|
|
31759
31845
|
let textGeom;
|
|
31760
31846
|
if (st.layer === "bottom") {
|
|
31761
|
-
textGeom = (0,
|
|
31847
|
+
textGeom = (0, import_transforms10.translate)(
|
|
31762
31848
|
[0, 0, -this.ctx.pcbThickness / 2 - M],
|
|
31763
31849
|
// Position above board
|
|
31764
31850
|
(0, import_extrusions8.extrudeLinear)({ height: 0.012 }, expandedPath)
|
|
31765
31851
|
);
|
|
31766
31852
|
} else {
|
|
31767
|
-
textGeom = (0,
|
|
31853
|
+
textGeom = (0, import_transforms10.translate)(
|
|
31768
31854
|
[0, 0, this.ctx.pcbThickness / 2 + M],
|
|
31769
31855
|
// Position above board
|
|
31770
31856
|
(0, import_extrusions8.extrudeLinear)({ height: 0.012 }, expandedPath)
|
|
@@ -31800,7 +31886,7 @@ var BoardGeomBuilder = class {
|
|
|
31800
31886
|
}
|
|
31801
31887
|
finalize() {
|
|
31802
31888
|
if (!this.boardGeom) return;
|
|
31803
|
-
const boardMaterialColor = boardMaterialColors[this.board.material] ?? colors.
|
|
31889
|
+
const boardMaterialColor = boardMaterialColors[this.board.material] ?? colors.fr4Tan;
|
|
31804
31890
|
this.boardGeom = (0, import_colors7.colorize)(boardMaterialColor, this.boardGeom);
|
|
31805
31891
|
this.finalGeoms = [
|
|
31806
31892
|
this.boardGeom,
|
|
@@ -32605,7 +32691,7 @@ function processCopperPoursForManifold(Manifold, CrossSection, circuitJson, pcbT
|
|
|
32605
32691
|
pourOp = clipped;
|
|
32606
32692
|
}
|
|
32607
32693
|
const covered = pour.covered_with_solder_mask !== false;
|
|
32608
|
-
const pourColorArr = covered ? tracesMaterialColors[boardMaterial] ?? colors.
|
|
32694
|
+
const pourColorArr = covered ? tracesMaterialColors[boardMaterial] ?? colors.fr4TracesWithoutMaskTan : colors.copper;
|
|
32609
32695
|
const pourColor = new THREE19.Color(...pourColorArr);
|
|
32610
32696
|
const threeGeom = manifoldMeshToThreeGeometry(pourOp.getMesh());
|
|
32611
32697
|
copperPourGeoms.push({
|
|
@@ -33546,7 +33632,7 @@ import { su as su11 } from "@tscircuit/circuit-json-util";
|
|
|
33546
33632
|
import * as THREE22 from "three";
|
|
33547
33633
|
|
|
33548
33634
|
// src/utils/via-geoms.ts
|
|
33549
|
-
function
|
|
33635
|
+
function createViaCopper2({
|
|
33550
33636
|
Manifold,
|
|
33551
33637
|
x,
|
|
33552
33638
|
y,
|
|
@@ -33616,7 +33702,7 @@ function processViasForManifold(Manifold, circuitJson, pcbThickness, manifoldIns
|
|
|
33616
33702
|
viaBoardDrills.push(translatedDrill);
|
|
33617
33703
|
}
|
|
33618
33704
|
if (typeof via.outer_diameter === "number" && typeof via.hole_diameter === "number") {
|
|
33619
|
-
const translatedViaCopper =
|
|
33705
|
+
const translatedViaCopper = createViaCopper2({
|
|
33620
33706
|
Manifold,
|
|
33621
33707
|
x: via.x,
|
|
33622
33708
|
y: via.y,
|
|
@@ -34803,7 +34889,7 @@ var useManifoldBoardBuilder = (manifoldJSModule, circuitJson) => {
|
|
|
34803
34889
|
if (boardManifold) {
|
|
34804
34890
|
const boardThreeMesh = boardManifold.getMesh();
|
|
34805
34891
|
const finalBoardGeom = manifoldMeshToThreeGeometry(boardThreeMesh);
|
|
34806
|
-
const matColorArray = boardMaterialColors[boardData.material] ?? colors.
|
|
34892
|
+
const matColorArray = boardMaterialColors[boardData.material] ?? colors.fr4Tan;
|
|
34807
34893
|
currentGeoms.board = {
|
|
34808
34894
|
geometry: finalBoardGeom,
|
|
34809
34895
|
color: new THREE26.Color(
|
|
@@ -34836,20 +34922,36 @@ var useManifoldBoardBuilder = (manifoldJSModule, circuitJson) => {
|
|
|
34836
34922
|
);
|
|
34837
34923
|
currentGeoms.copperPours = copperPourGeoms;
|
|
34838
34924
|
setGeoms(currentGeoms);
|
|
34839
|
-
const
|
|
34840
|
-
const
|
|
34925
|
+
const traceColorWithoutMaskArr = colors.fr4TracesWithoutMaskTan;
|
|
34926
|
+
const traceColorWithoutMask = `rgb(${Math.round(traceColorWithoutMaskArr[0] * 255)}, ${Math.round(traceColorWithoutMaskArr[1] * 255)}, ${Math.round(traceColorWithoutMaskArr[2] * 255)})`;
|
|
34841
34927
|
currentTextures.topTrace = createTraceTextureForLayer({
|
|
34842
34928
|
layer: "top",
|
|
34843
34929
|
circuitJson,
|
|
34844
34930
|
boardData,
|
|
34845
|
-
traceColor,
|
|
34931
|
+
traceColor: traceColorWithoutMask,
|
|
34846
34932
|
traceTextureResolution: TRACE_TEXTURE_RESOLUTION
|
|
34847
34933
|
});
|
|
34848
34934
|
currentTextures.bottomTrace = createTraceTextureForLayer({
|
|
34849
34935
|
layer: "bottom",
|
|
34850
34936
|
circuitJson,
|
|
34851
34937
|
boardData,
|
|
34852
|
-
traceColor,
|
|
34938
|
+
traceColor: traceColorWithoutMask,
|
|
34939
|
+
traceTextureResolution: TRACE_TEXTURE_RESOLUTION
|
|
34940
|
+
});
|
|
34941
|
+
const traceColorWithMaskArr = colors.fr4TracesWithMaskGreen;
|
|
34942
|
+
const traceColorWithMask = `rgb(${Math.round(traceColorWithMaskArr[0] * 255)}, ${Math.round(traceColorWithMaskArr[1] * 255)}, ${Math.round(traceColorWithMaskArr[2] * 255)})`;
|
|
34943
|
+
currentTextures.topTraceWithMask = createTraceTextureForLayer({
|
|
34944
|
+
layer: "top",
|
|
34945
|
+
circuitJson,
|
|
34946
|
+
boardData,
|
|
34947
|
+
traceColor: traceColorWithMask,
|
|
34948
|
+
traceTextureResolution: TRACE_TEXTURE_RESOLUTION
|
|
34949
|
+
});
|
|
34950
|
+
currentTextures.bottomTraceWithMask = createTraceTextureForLayer({
|
|
34951
|
+
layer: "bottom",
|
|
34952
|
+
circuitJson,
|
|
34953
|
+
boardData,
|
|
34954
|
+
traceColor: traceColorWithMask,
|
|
34853
34955
|
traceTextureResolution: TRACE_TEXTURE_RESOLUTION
|
|
34854
34956
|
});
|
|
34855
34957
|
const silkscreenColor = "rgb(255,255,255)";
|
|
@@ -34867,7 +34969,7 @@ var useManifoldBoardBuilder = (manifoldJSModule, circuitJson) => {
|
|
|
34867
34969
|
silkscreenColor,
|
|
34868
34970
|
traceTextureResolution: TRACE_TEXTURE_RESOLUTION
|
|
34869
34971
|
});
|
|
34870
|
-
const soldermaskColorArr =
|
|
34972
|
+
const soldermaskColorArr = soldermaskColors[boardData.material] ?? colors.fr4SolderMaskGreen;
|
|
34871
34973
|
const soldermaskColor = `rgb(${Math.round(soldermaskColorArr[0] * 255)}, ${Math.round(soldermaskColorArr[1] * 255)}, ${Math.round(soldermaskColorArr[2] * 255)})`;
|
|
34872
34974
|
currentTextures.topSoldermask = createSoldermaskTextureForLayer({
|
|
34873
34975
|
layer: "top",
|
|
@@ -35026,6 +35128,13 @@ function createTextureMeshes(textures, boardData, pcbThickness) {
|
|
|
35026
35128
|
"trace"
|
|
35027
35129
|
);
|
|
35028
35130
|
if (topTraceMesh) meshes.push(topTraceMesh);
|
|
35131
|
+
const topTraceWithMaskMesh = createTexturePlane(
|
|
35132
|
+
textures.topTraceWithMask,
|
|
35133
|
+
pcbThickness / 2 + BOARD_SURFACE_OFFSET.traces,
|
|
35134
|
+
false,
|
|
35135
|
+
"trace-with-mask"
|
|
35136
|
+
);
|
|
35137
|
+
if (topTraceWithMaskMesh) meshes.push(topTraceWithMaskMesh);
|
|
35029
35138
|
const topSilkscreenMesh = createTexturePlane(
|
|
35030
35139
|
textures.topSilkscreen,
|
|
35031
35140
|
pcbThickness / 2 + 0.017,
|
|
@@ -35042,6 +35151,13 @@ function createTextureMeshes(textures, boardData, pcbThickness) {
|
|
|
35042
35151
|
"trace"
|
|
35043
35152
|
);
|
|
35044
35153
|
if (bottomTraceMesh) meshes.push(bottomTraceMesh);
|
|
35154
|
+
const bottomTraceWithMaskMesh = createTexturePlane(
|
|
35155
|
+
textures.bottomTraceWithMask,
|
|
35156
|
+
-pcbThickness / 2 - BOARD_SURFACE_OFFSET.traces,
|
|
35157
|
+
true,
|
|
35158
|
+
"trace-with-mask"
|
|
35159
|
+
);
|
|
35160
|
+
if (bottomTraceWithMaskMesh) meshes.push(bottomTraceWithMaskMesh);
|
|
35045
35161
|
const bottomSilkscreenMesh = createTexturePlane(
|
|
35046
35162
|
textures.bottomSilkscreen,
|
|
35047
35163
|
-pcbThickness / 2 - 0.017,
|
|
@@ -35105,10 +35221,14 @@ var BoardMeshes = ({
|
|
|
35105
35221
|
});
|
|
35106
35222
|
textureMeshes.forEach((mesh) => {
|
|
35107
35223
|
let shouldShow = true;
|
|
35108
|
-
if (mesh.name.includes("top-trace")) {
|
|
35109
|
-
shouldShow = visibility.topCopper;
|
|
35110
|
-
} else if (mesh.name.includes("
|
|
35111
|
-
shouldShow = visibility.
|
|
35224
|
+
if (mesh.name.includes("top-trace-texture-plane") && !mesh.name.includes("with-mask")) {
|
|
35225
|
+
shouldShow = visibility.topCopper && !visibility.topMask;
|
|
35226
|
+
} else if (mesh.name.includes("top-trace-with-mask")) {
|
|
35227
|
+
shouldShow = visibility.topCopper && visibility.topMask;
|
|
35228
|
+
} else if (mesh.name.includes("bottom-trace-texture-plane") && !mesh.name.includes("with-mask")) {
|
|
35229
|
+
shouldShow = visibility.bottomCopper && !visibility.bottomMask;
|
|
35230
|
+
} else if (mesh.name.includes("bottom-trace-with-mask")) {
|
|
35231
|
+
shouldShow = visibility.bottomCopper && visibility.bottomMask;
|
|
35112
35232
|
} else if (mesh.name.includes("top-silkscreen")) {
|
|
35113
35233
|
shouldShow = visibility.topSilkscreen;
|
|
35114
35234
|
} else if (mesh.name.includes("bottom-silkscreen")) {
|