circuit-json-to-gltf 0.0.25 → 0.0.26
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 +44 -2
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -14715,11 +14715,53 @@ var createHoleGeoms = (boardCenter, thickness, holes = [], platedHoles = []) =>
|
|
|
14715
14715
|
const holeGeoms = [];
|
|
14716
14716
|
for (const hole of holes) {
|
|
14717
14717
|
const holeRecord = hole;
|
|
14718
|
+
const relX = hole.x - boardCenter.x;
|
|
14719
|
+
const relY = -(hole.y - boardCenter.y);
|
|
14720
|
+
const holeShape = holeRecord.hole_shape;
|
|
14721
|
+
if (holeShape === "pill") {
|
|
14722
|
+
const holeWidth = getNumberProperty(holeRecord, "hole_width");
|
|
14723
|
+
const holeHeight = getNumberProperty(holeRecord, "hole_height");
|
|
14724
|
+
if (!holeWidth || !holeHeight) continue;
|
|
14725
|
+
const rotate = holeHeight > holeWidth;
|
|
14726
|
+
const width = rotate ? holeHeight : holeWidth;
|
|
14727
|
+
const height = rotate ? holeWidth : holeHeight;
|
|
14728
|
+
const pillHole = createPillHole(
|
|
14729
|
+
relX,
|
|
14730
|
+
relY,
|
|
14731
|
+
width,
|
|
14732
|
+
height,
|
|
14733
|
+
thickness,
|
|
14734
|
+
rotate
|
|
14735
|
+
);
|
|
14736
|
+
holeGeoms.push(pillHole);
|
|
14737
|
+
continue;
|
|
14738
|
+
}
|
|
14739
|
+
if (holeShape === "rotated_pill") {
|
|
14740
|
+
const holeWidth = getNumberProperty(holeRecord, "hole_width");
|
|
14741
|
+
const holeHeight = getNumberProperty(holeRecord, "hole_height");
|
|
14742
|
+
if (!holeWidth || !holeHeight) continue;
|
|
14743
|
+
const rotation = getNumberProperty(holeRecord, "ccw_rotation") ?? 0;
|
|
14744
|
+
const rotationRad = -(rotation * Math.PI) / 180;
|
|
14745
|
+
const minDimension = Math.min(holeWidth, holeHeight);
|
|
14746
|
+
const maxAllowedRadius = Math.max(0, minDimension / 2 - RADIUS_EPSILON);
|
|
14747
|
+
const roundRadius = maxAllowedRadius <= 0 ? 0 : Math.min(holeHeight / 2, maxAllowedRadius);
|
|
14748
|
+
const hole2d = (0, import_primitives.roundedRectangle)({
|
|
14749
|
+
size: [holeWidth, holeHeight],
|
|
14750
|
+
roundRadius,
|
|
14751
|
+
segments: DEFAULT_SEGMENTS
|
|
14752
|
+
});
|
|
14753
|
+
let hole3d = (0, import_extrusions.extrudeLinear)({ height: thickness + 1 }, hole2d);
|
|
14754
|
+
hole3d = (0, import_transforms.translate)([0, 0, -(thickness + 1) / 2], hole3d);
|
|
14755
|
+
if (rotationRad !== 0) {
|
|
14756
|
+
hole3d = (0, import_transforms.rotateZ)(rotationRad, hole3d);
|
|
14757
|
+
}
|
|
14758
|
+
hole3d = (0, import_transforms.translate)([relX, relY, 0], hole3d);
|
|
14759
|
+
holeGeoms.push(hole3d);
|
|
14760
|
+
continue;
|
|
14761
|
+
}
|
|
14718
14762
|
const diameter = getNumberProperty(holeRecord, "hole_diameter") ?? getNumberProperty(holeRecord, "diameter");
|
|
14719
14763
|
if (!diameter) continue;
|
|
14720
14764
|
const radius = diameter / 2;
|
|
14721
|
-
const relX = hole.x - boardCenter.x;
|
|
14722
|
-
const relY = -(hole.y - boardCenter.y);
|
|
14723
14765
|
holeGeoms.push(createCircularHole(relX, relY, radius, thickness));
|
|
14724
14766
|
}
|
|
14725
14767
|
for (const plated of platedHoles) {
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "circuit-json-to-gltf",
|
|
3
3
|
"main": "dist/index.js",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"version": "0.0.
|
|
5
|
+
"version": "0.0.26",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"test": "bun test tests/",
|
|
8
8
|
"format": "biome format --write .",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"@vitejs/plugin-react": "^5.0.0",
|
|
32
32
|
"bun-match-svg": "^0.0.12",
|
|
33
33
|
"circuit-json": "^0.0.278",
|
|
34
|
-
"circuit-to-svg": "^0.0.
|
|
34
|
+
"circuit-to-svg": "^0.0.240",
|
|
35
35
|
"graphics-debug": "^0.0.65",
|
|
36
36
|
"looks-same": "^9.0.1",
|
|
37
37
|
"poppygl": "^0.0.16",
|