@tscircuit/core 0.0.55 → 0.0.57

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 CHANGED
@@ -789,6 +789,7 @@ declare class SmtPad extends PrimitiveComponent<typeof smtPadProps> {
789
789
  height: number;
790
790
  };
791
791
  doInitialPortMatching(): void;
792
+ getAvailablePcbLayers(): string[];
792
793
  doInitialPcbPrimitiveRender(): void;
793
794
  doInitialPcbPortAttachment(): void;
794
795
  _getPcbCircuitJsonBounds(): {
@@ -3837,6 +3838,7 @@ declare class PlatedHole extends PrimitiveComponent<typeof platedHoleProps> {
3837
3838
  portHints?: (string | number)[] | undefined;
3838
3839
  }>]>;
3839
3840
  };
3841
+ getAvailablePcbLayers(): string[];
3840
3842
  getPcbSize(): {
3841
3843
  width: number;
3842
3844
  height: number;
package/dist/index.js CHANGED
@@ -879,7 +879,7 @@ var Port = class extends PrimitiveComponent {
879
879
  if ("_getPcbCircuitJsonBounds" in pcbMatch) {
880
880
  const pcb_port = db.pcb_port.insert({
881
881
  pcb_component_id: this.parent?.pcb_component_id,
882
- layers: ["top"],
882
+ layers: this.getAvailablePcbLayers(),
883
883
  ...pcbMatch._getPcbCircuitJsonBounds().center,
884
884
  source_port_id: this.source_port_id
885
885
  });
@@ -1129,6 +1129,9 @@ var SmtPad = class extends PrimitiveComponent {
1129
1129
  }
1130
1130
  }
1131
1131
  }
1132
+ getAvailablePcbLayers() {
1133
+ return this.props.layer ? [this.props.layer] : [];
1134
+ }
1132
1135
  doInitialPcbPrimitiveRender() {
1133
1136
  const { db } = this.root;
1134
1137
  const { _parsedProps: props } = this;
@@ -1269,6 +1272,9 @@ var PlatedHole = class extends PrimitiveComponent {
1269
1272
  zodProps: platedHoleProps
1270
1273
  };
1271
1274
  }
1275
+ getAvailablePcbLayers() {
1276
+ return ["top", "inner1", "inner2", "bottom"];
1277
+ }
1272
1278
  getPcbSize() {
1273
1279
  const { _parsedProps: props } = this;
1274
1280
  if (props.shape === "circle") {
@@ -2385,6 +2391,9 @@ searched component ${targetComponent.getString()}, which has ports: ${targetComp
2385
2391
  const { db } = this.root;
2386
2392
  const { _parsedProps: props, parent } = this;
2387
2393
  if (!parent) throw new Error("Trace has no parent");
2394
+ if (this.getSubcircuit()._parsedProps.routingDisabled) {
2395
+ return;
2396
+ }
2388
2397
  const { allPortsFound, ports } = this._findConnectedPorts();
2389
2398
  const portsConnectedOnPcbViaNet = [];
2390
2399
  if (!allPortsFound) return;
@@ -14,6 +14,11 @@ export class PlatedHole extends PrimitiveComponent<typeof platedHoleProps> {
14
14
  }
15
15
  }
16
16
 
17
+ getAvailablePcbLayers(): string[] {
18
+ // TODO use project layerCount
19
+ return ["top", "inner1", "inner2", "bottom"]
20
+ }
21
+
17
22
  getPcbSize(): { width: number; height: number } {
18
23
  const { _parsedProps: props } = this
19
24
  if (props.shape === "circle") {
@@ -189,7 +189,7 @@ export class Port extends PrimitiveComponent<typeof portProps> {
189
189
  if ("_getPcbCircuitJsonBounds" in pcbMatch) {
190
190
  const pcb_port = db.pcb_port.insert({
191
191
  pcb_component_id: this.parent?.pcb_component_id!,
192
- layers: ["top"],
192
+ layers: this.getAvailablePcbLayers(),
193
193
 
194
194
  ...pcbMatch._getPcbCircuitJsonBounds().center,
195
195
 
@@ -2,7 +2,7 @@ import { PrimitiveComponent } from "../base-components/PrimitiveComponent"
2
2
  import { smtPadProps } from "@tscircuit/props"
3
3
  import type { Port } from "./Port"
4
4
  import type { RenderPhaseFn } from "../base-components/Renderable"
5
- import type { PCBSMTPad } from "@tscircuit/soup"
5
+ import type { LayerRef, PCBSMTPad } from "@tscircuit/soup"
6
6
  import { decomposeTSR } from "transformation-matrix"
7
7
 
8
8
  export class SmtPad extends PrimitiveComponent<typeof smtPadProps> {
@@ -49,6 +49,10 @@ export class SmtPad extends PrimitiveComponent<typeof smtPadProps> {
49
49
  }
50
50
  }
51
51
 
52
+ getAvailablePcbLayers(): string[] {
53
+ return this.props.layer ? [this.props.layer as LayerRef] : []
54
+ }
55
+
52
56
  doInitialPcbPrimitiveRender(): void {
53
57
  const { db } = this.root!
54
58
  const { _parsedProps: props } = this
@@ -251,6 +251,10 @@ export class Trace extends PrimitiveComponent<typeof traceProps> {
251
251
 
252
252
  if (!parent) throw new Error("Trace has no parent")
253
253
 
254
+ if (this.getSubcircuit()._parsedProps.routingDisabled) {
255
+ return
256
+ }
257
+
254
258
  const { allPortsFound, ports } = this._findConnectedPorts()
255
259
  const portsConnectedOnPcbViaNet: Port[] = []
256
260
 
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@tscircuit/core",
3
3
  "module": "index.ts",
4
4
  "type": "module",
5
- "version": "0.0.55",
5
+ "version": "0.0.57",
6
6
  "types": "dist/index.d.ts",
7
7
  "main": "dist/index.js",
8
8
  "files": [