@tscircuit/3d-viewer 0.0.438 → 0.0.439

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.
Files changed (2) hide show
  1. package/dist/index.js +49 -14
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -16957,7 +16957,8 @@ var pcb_cutout_rect = pcb_cutout_base.extend({
16957
16957
  center: point,
16958
16958
  width: length,
16959
16959
  height: length,
16960
- rotation: rotation.optional()
16960
+ rotation: rotation.optional(),
16961
+ corner_radius: length.optional()
16961
16962
  });
16962
16963
  expectTypesMatch(true);
16963
16964
  var pcb_cutout_circle = pcb_cutout_base.extend({
@@ -28287,7 +28288,7 @@ import * as THREE15 from "three";
28287
28288
  // package.json
28288
28289
  var package_default = {
28289
28290
  name: "@tscircuit/3d-viewer",
28290
- version: "0.0.437",
28291
+ version: "0.0.438",
28291
28292
  main: "./dist/index.js",
28292
28293
  module: "./dist/index.js",
28293
28294
  type: "module",
@@ -28348,7 +28349,7 @@ var package_default = {
28348
28349
  "@vitejs/plugin-react": "^4.3.4",
28349
28350
  "bun-match-svg": "^0.0.9",
28350
28351
  "bun-types": "1.2.1",
28351
- "circuit-json": "0.0.316",
28352
+ "circuit-json": "0.0.317",
28352
28353
  "circuit-to-svg": "^0.0.179",
28353
28354
  debug: "^4.4.0",
28354
28355
  "jscad-electronics": "^0.0.89",
@@ -30986,10 +30987,33 @@ var BoardGeomBuilder = class {
30986
30987
  const cutoutHeight = this.ctx.pcbThickness * 1.5;
30987
30988
  switch (cutout.shape) {
30988
30989
  case "rect":
30989
- cutoutGeom = (0, import_primitives10.cuboid)({
30990
- center: [cutout.center.x, cutout.center.y, 0],
30991
- size: [cutout.width, cutout.height, cutoutHeight]
30992
- });
30990
+ const rectCornerRadius = clampRectBorderRadius(
30991
+ cutout.width,
30992
+ cutout.height,
30993
+ extractRectBorderRadius(cutout)
30994
+ );
30995
+ if (rectCornerRadius > 0) {
30996
+ const rect2d = (0, import_primitives10.roundedRectangle)({
30997
+ size: [cutout.width, cutout.height],
30998
+ roundRadius: rectCornerRadius,
30999
+ segments: PAD_ROUNDED_SEGMENTS
31000
+ });
31001
+ cutoutGeom = (0, import_extrusions8.extrudeLinear)({ height: cutoutHeight }, rect2d);
31002
+ cutoutGeom = (0, import_transforms8.translate)([0, 0, -cutoutHeight / 2], cutoutGeom);
31003
+ cutoutGeom = (0, import_transforms8.translate)(
31004
+ [cutout.center.x, cutout.center.y, 0],
31005
+ cutoutGeom
31006
+ );
31007
+ } else {
31008
+ const baseCutoutGeom = (0, import_primitives10.cuboid)({
31009
+ center: [0, 0, 0],
31010
+ size: [cutout.width, cutout.height, cutoutHeight]
31011
+ });
31012
+ cutoutGeom = (0, import_transforms8.translate)(
31013
+ [cutout.center.x, cutout.center.y, 0],
31014
+ baseCutoutGeom
31015
+ );
31016
+ }
30993
31017
  if (cutout.rotation) {
30994
31018
  const rotationRadians = cutout.rotation * Math.PI / 180;
30995
31019
  cutoutGeom = (0, import_transforms8.rotateZ)(rotationRadians, cutoutGeom);
@@ -33492,15 +33516,25 @@ function processCutoutsForManifold(Manifold, CrossSection, circuitJson, pcbThick
33492
33516
  let cutoutOp;
33493
33517
  const cutoutHeight = pcbThickness * 1.5;
33494
33518
  switch (cutout.shape) {
33495
- case "rect":
33496
- cutoutOp = Manifold.cube(
33497
- [cutout.width, cutout.height, cutoutHeight],
33498
- true
33499
- // centered
33500
- );
33519
+ case "rect": {
33520
+ const rectCornerRadius = extractRectBorderRadius(cutout);
33521
+ if (typeof rectCornerRadius === "number" && rectCornerRadius > 0) {
33522
+ cutoutOp = createRoundedRectPrism({
33523
+ Manifold,
33524
+ width: cutout.width,
33525
+ height: cutout.height,
33526
+ thickness: cutoutHeight,
33527
+ borderRadius: rectCornerRadius
33528
+ });
33529
+ } else {
33530
+ cutoutOp = Manifold.cube(
33531
+ [cutout.width, cutout.height, cutoutHeight],
33532
+ true
33533
+ // centered
33534
+ );
33535
+ }
33501
33536
  manifoldInstancesForCleanup.push(cutoutOp);
33502
33537
  if (cutout.rotation) {
33503
- const rotationRadians = cutout.rotation * Math.PI / 180;
33504
33538
  const rotatedOp = cutoutOp.rotate([0, 0, cutout.rotation]);
33505
33539
  manifoldInstancesForCleanup.push(rotatedOp);
33506
33540
  cutoutOp = rotatedOp;
@@ -33513,6 +33547,7 @@ function processCutoutsForManifold(Manifold, CrossSection, circuitJson, pcbThick
33513
33547
  ]);
33514
33548
  manifoldInstancesForCleanup.push(cutoutOp);
33515
33549
  break;
33550
+ }
33516
33551
  case "circle":
33517
33552
  cutoutOp = Manifold.cylinder(
33518
33553
  cutoutHeight,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/3d-viewer",
3
- "version": "0.0.438",
3
+ "version": "0.0.439",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "type": "module",
@@ -61,7 +61,7 @@
61
61
  "@vitejs/plugin-react": "^4.3.4",
62
62
  "bun-match-svg": "^0.0.9",
63
63
  "bun-types": "1.2.1",
64
- "circuit-json": "0.0.316",
64
+ "circuit-json": "0.0.317",
65
65
  "circuit-to-svg": "^0.0.179",
66
66
  "debug": "^4.4.0",
67
67
  "jscad-electronics": "^0.0.89",