@tscircuit/core 0.0.1163 → 0.0.1165

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 +78 -21
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -6985,26 +6985,54 @@ var PlatedHole = class extends PrimitiveComponent2 {
6985
6985
  });
6986
6986
  this.pcb_plated_hole_id = pcb_plated_hole.pcb_plated_hole_id;
6987
6987
  } else if (props.shape === "pill_hole_with_rect_pad") {
6988
- const pcb_plated_hole = db.pcb_plated_hole.insert({
6989
- pcb_component_id,
6990
- pcb_port_id: this.matchedPort?.pcb_port_id,
6991
- hole_width: props.holeWidth,
6992
- hole_height: props.holeHeight,
6993
- rect_pad_width: props.rectPadWidth,
6994
- rect_pad_height: props.rectPadHeight,
6995
- hole_offset_x: props.holeOffsetX,
6996
- hole_offset_y: props.holeOffsetY,
6997
- shape: "pill_hole_with_rect_pad",
6998
- port_hints: this.getNameAndAliases(),
6999
- x: position.x,
7000
- y: position.y,
7001
- layers: ["top", "bottom"],
7002
- soldermask_margin: soldermaskMargin,
7003
- is_covered_with_solder_mask: isCoveredWithSolderMask,
7004
- subcircuit_id: subcircuit?.subcircuit_id ?? void 0,
7005
- pcb_group_id: this.getGroup()?.pcb_group_id ?? void 0
7006
- });
7007
- this.pcb_plated_hole_id = pcb_plated_hole.pcb_plated_hole_id;
6988
+ if (props.pcbRotation && props.pcbRotation !== 0) {
6989
+ const pcb_plated_hole = db.pcb_plated_hole.insert({
6990
+ pcb_component_id,
6991
+ pcb_port_id: this.matchedPort?.pcb_port_id,
6992
+ hole_width: props.holeWidth,
6993
+ hole_height: props.holeHeight,
6994
+ rect_pad_width: props.rectPadWidth,
6995
+ rect_pad_height: props.rectPadHeight,
6996
+ hole_offset_x: props.holeOffsetX,
6997
+ hole_offset_y: props.holeOffsetY,
6998
+ shape: "rotated_pill_hole_with_rect_pad",
6999
+ type: "pcb_plated_hole",
7000
+ hole_shape: "rotated_pill",
7001
+ pad_shape: "rect",
7002
+ hole_ccw_rotation: props.pcbRotation,
7003
+ rect_ccw_rotation: props.pcbRotation,
7004
+ port_hints: this.getNameAndAliases(),
7005
+ x: position.x,
7006
+ y: position.y,
7007
+ layers: ["top", "bottom"],
7008
+ soldermask_margin: soldermaskMargin,
7009
+ is_covered_with_solder_mask: isCoveredWithSolderMask,
7010
+ subcircuit_id: subcircuit?.subcircuit_id ?? void 0,
7011
+ pcb_group_id: this.getGroup()?.pcb_group_id ?? void 0
7012
+ });
7013
+ this.pcb_plated_hole_id = pcb_plated_hole.pcb_plated_hole_id;
7014
+ } else {
7015
+ const pcb_plated_hole = db.pcb_plated_hole.insert({
7016
+ pcb_component_id,
7017
+ pcb_port_id: this.matchedPort?.pcb_port_id,
7018
+ hole_width: props.holeWidth,
7019
+ hole_height: props.holeHeight,
7020
+ rect_pad_width: props.rectPadWidth,
7021
+ rect_pad_height: props.rectPadHeight,
7022
+ hole_offset_x: props.holeOffsetX,
7023
+ hole_offset_y: props.holeOffsetY,
7024
+ shape: "pill_hole_with_rect_pad",
7025
+ port_hints: this.getNameAndAliases(),
7026
+ x: position.x,
7027
+ y: position.y,
7028
+ layers: ["top", "bottom"],
7029
+ soldermask_margin: soldermaskMargin,
7030
+ is_covered_with_solder_mask: isCoveredWithSolderMask,
7031
+ subcircuit_id: subcircuit?.subcircuit_id ?? void 0,
7032
+ pcb_group_id: this.getGroup()?.pcb_group_id ?? void 0
7033
+ });
7034
+ this.pcb_plated_hole_id = pcb_plated_hole.pcb_plated_hole_id;
7035
+ }
7008
7036
  } else if (props.shape === "hole_with_polygon_pad") {
7009
7037
  const padOutline = (props.padOutline || []).map((point6) => {
7010
7038
  const x = typeof point6.x === "number" ? point6.x : parseFloat(String(point6.x));
@@ -8091,6 +8119,24 @@ var createComponentsFromCircuitJson = ({
8091
8119
  holeOffsetY: elm.hole_offset_y
8092
8120
  })
8093
8121
  );
8122
+ } else if (elm.shape === "rotated_pill_hole_with_rect_pad") {
8123
+ components.push(
8124
+ new PlatedHole({
8125
+ pcbX: elm.x,
8126
+ pcbY: elm.y,
8127
+ shape: "pill_hole_with_rect_pad",
8128
+ holeShape: "pill",
8129
+ padShape: "rect",
8130
+ holeWidth: elm.hole_width,
8131
+ holeHeight: elm.hole_height,
8132
+ rectPadWidth: elm.rect_pad_width,
8133
+ rectPadHeight: elm.rect_pad_height,
8134
+ portHints: elm.port_hints,
8135
+ holeOffsetX: elm.hole_offset_x,
8136
+ holeOffsetY: elm.hole_offset_y,
8137
+ pcbRotation: elm.hole_ccw_rotation
8138
+ })
8139
+ );
8094
8140
  } else if (elm.shape === "hole_with_polygon_pad") {
8095
8141
  components.push(
8096
8142
  new PlatedHole({
@@ -16196,6 +16242,17 @@ function Group_doInitialSchematicLayoutMatchPack(group) {
16196
16242
  `_${rotateDirection(schematicSymbolDirection[1], placement.ccwRotationDegrees)}`
16197
16243
  );
16198
16244
  }
16245
+ const schematicSymbolOrientation = schematicComponent.symbol_name.match(/_(horz|vert)$/);
16246
+ if (schematicSymbolOrientation) {
16247
+ const normalizedRotation2 = (placement.ccwRotationDegrees % 360 + 360) % 360;
16248
+ const shouldSwapOrientation = normalizedRotation2 === 90 || normalizedRotation2 === 270;
16249
+ if (shouldSwapOrientation) {
16250
+ schematicComponent.symbol_name = schematicComponent.symbol_name.replace(
16251
+ schematicSymbolOrientation[0],
16252
+ schematicSymbolOrientation[1] === "horz" ? "_vert" : "_horz"
16253
+ );
16254
+ }
16255
+ }
16199
16256
  }
16200
16257
  }
16201
16258
  }
@@ -19552,7 +19609,7 @@ import { identity as identity5 } from "transformation-matrix";
19552
19609
  var package_default = {
19553
19610
  name: "@tscircuit/core",
19554
19611
  type: "module",
19555
- version: "0.0.1162",
19612
+ version: "0.0.1164",
19556
19613
  types: "dist/index.d.ts",
19557
19614
  main: "dist/index.js",
19558
19615
  module: "dist/index.js",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tscircuit/core",
3
3
  "type": "module",
4
- "version": "0.0.1163",
4
+ "version": "0.0.1165",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",