@tscircuit/cli 0.1.1485 → 0.1.1486

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/cli/main.js CHANGED
@@ -100763,7 +100763,7 @@ var import_perfect_cli = __toESM2(require_dist2(), 1);
100763
100763
  // lib/getVersion.ts
100764
100764
  import { createRequire as createRequire2 } from "node:module";
100765
100765
  // package.json
100766
- var version = "0.1.1483";
100766
+ var version = "0.1.1485";
100767
100767
  var package_default = {
100768
100768
  name: "@tscircuit/cli",
100769
100769
  version,
@@ -100814,7 +100814,7 @@ var package_default = {
100814
100814
  cosmiconfig: "^9.0.0",
100815
100815
  debug: "^4.4.0",
100816
100816
  delay: "^6.0.0",
100817
- "dsn-converter": "0.0.86",
100817
+ "dsn-converter": "^0.0.88",
100818
100818
  easyeda: "^0.0.269",
100819
100819
  "fuse.js": "^7.1.0",
100820
100820
  "get-port": "^7.1.0",
@@ -252239,23 +252239,23 @@ import {
252239
252239
  import { su as su7 } from "@tscircuit/soup-util";
252240
252240
  import { applyToPoint as applyToPoint25, scale as scale7 } from "transformation-matrix";
252241
252241
  import { su as su23 } from "@tscircuit/soup-util";
252242
- import Debug4 from "debug";
252243
252242
  import { su as su33 } from "@tscircuit/soup-util";
252244
- import { applyToPoint as applyToPoint24, scale as scale22 } from "transformation-matrix";
252243
+ import Debug4 from "debug";
252245
252244
  import { su as su42 } from "@tscircuit/soup-util";
252245
+ import { applyToPoint as applyToPoint24, scale as scale22 } from "transformation-matrix";
252246
252246
  import Debug22 from "debug";
252247
- import { scale as scale32, applyToPoint as applyToPoint92 } from "transformation-matrix";
252247
+ import { applyToPoint as applyToPoint92, scale as scale32 } from "transformation-matrix";
252248
+ import { su as su5 } from "@tscircuit/soup-util";
252248
252249
  import { applyToPoint as applyToPoint32 } from "transformation-matrix";
252249
252250
  import Debug32 from "debug";
252250
- import"transformation-matrix";
252251
252251
  import { applyToPoint as applyToPoint42 } from "transformation-matrix";
252252
+ import Debug6 from "debug";
252253
+ import"transformation-matrix";
252252
252254
  import { applyToPoint as applyToPoint52 } from "transformation-matrix";
252253
252255
  import Debug42 from "debug";
252254
- import Debug6 from "debug";
252255
252256
  import { applyToPoint as applyToPoint62 } from "transformation-matrix";
252256
252257
  import Debug5 from "debug";
252257
- import { applyToPoint as applyToPoint82 } from "transformation-matrix";
252258
- import { su as su5 } from "@tscircuit/soup-util";
252258
+ import { applyToPoint as applyToPoint72 } from "transformation-matrix";
252259
252259
  import"transformation-matrix";
252260
252260
  import { su as su62 } from "@tscircuit/soup-util";
252261
252261
  import Debug7 from "debug";
@@ -252264,71 +252264,52 @@ import"transformation-matrix";
252264
252264
  import Debug10 from "debug";
252265
252265
  import Debug8 from "debug";
252266
252266
  import Debug9 from "debug";
252267
- function getComponentValue(sourceComponent) {
252268
- if (!sourceComponent)
252269
- return "";
252270
- if ("resistance" in sourceComponent) {
252271
- return sourceComponent.resistance >= 1000 ? `${sourceComponent.resistance / 1000}k` : `${sourceComponent.resistance}`;
252272
- }
252273
- if ("capacitance" in sourceComponent) {
252274
- const capacitanceUF = sourceComponent.capacitance * 1e6;
252275
- if (capacitanceUF >= 1) {
252276
- return `${capacitanceUF}uF`;
252277
- } else {
252278
- return `${capacitanceUF.toFixed(3)}uF`;
252279
- }
252267
+ function generateLayerNames(numLayers) {
252268
+ const names = ["F.Cu"];
252269
+ for (let i2 = 1;i2 < numLayers - 1; i2++) {
252270
+ names.push(`In${i2}.Cu`);
252280
252271
  }
252281
- return "";
252272
+ names.push("B.Cu");
252273
+ return names;
252282
252274
  }
252283
- function getFootprintName(sourceComponent, pcbComponent) {
252284
- if (!sourceComponent || !pcbComponent) {
252285
- return "";
252286
- }
252287
- const width = pcbComponent.width == null ? 0 : pcbComponent.width.toFixed(4);
252288
- const height = pcbComponent.height == null ? 0 : pcbComponent.height.toFixed(4);
252289
- return `${sourceComponent.ftype}:${width}x${height}_mm`;
252275
+ function getViaPadstackName(numLayers, outerDiameter, holeDiameter) {
252276
+ return `Via[0-${numLayers - 1}]_${outerDiameter}:${holeDiameter}_um`;
252290
252277
  }
252291
- function getPadstackName({
252292
- shape,
252293
- width,
252294
- height,
252295
- holeDiameter,
252296
- outerDiameter,
252297
- layer = "top"
252298
- }) {
252299
- const layerCode = {
252300
- top: "T",
252301
- bottom: "B",
252302
- all: "A"
252303
- }[layer] ?? "T";
252304
- switch (shape) {
252305
- case "circle":
252306
- return `Round[${layerCode}]Pad_${holeDiameter}_${outerDiameter}_um`;
252307
- case "oval":
252308
- return `Oval[${layerCode}]Pad_${width}x${height}_um`;
252309
- case "pill":
252310
- return `Oval[${layerCode}]Pad_${width}x${height}_um`;
252311
- case "rect":
252312
- return `RoundRect[${layerCode}]Pad_${width}x${height}_um`;
252313
- default:
252314
- return "default_pad";
252278
+ function generateLayers(numLayers) {
252279
+ const layers = [];
252280
+ layers.push({
252281
+ name: "F.Cu",
252282
+ type: "signal",
252283
+ property: {
252284
+ index: 0
252285
+ }
252286
+ });
252287
+ for (let i2 = 1;i2 < numLayers - 1; i2++) {
252288
+ layers.push({
252289
+ name: `In${i2}.Cu`,
252290
+ type: "signal",
252291
+ property: {
252292
+ index: i2
252293
+ }
252294
+ });
252315
252295
  }
252296
+ layers.push({
252297
+ name: "B.Cu",
252298
+ type: "signal",
252299
+ property: {
252300
+ index: numLayers - 1
252301
+ }
252302
+ });
252303
+ return layers;
252316
252304
  }
252317
- function createCircularPadstack(name, outerDiameter, holeDiameter) {
252305
+ function createCircularPadstack(name, outerDiameter, holeDiameter, numLayers = 2) {
252318
252306
  return {
252319
252307
  name,
252320
- shapes: [
252321
- {
252322
- shapeType: "circle",
252323
- layer: "F.Cu",
252324
- diameter: outerDiameter
252325
- },
252326
- {
252327
- shapeType: "circle",
252328
- layer: "B.Cu",
252329
- diameter: outerDiameter
252330
- }
252331
- ],
252308
+ shapes: generateLayerNames(numLayers).map((layer) => ({
252309
+ shapeType: "circle",
252310
+ layer,
252311
+ diameter: outerDiameter
252312
+ })),
252332
252313
  hole: {
252333
252314
  shape: "circle",
252334
252315
  diameter: holeDiameter
@@ -252336,25 +252317,17 @@ function createCircularPadstack(name, outerDiameter, holeDiameter) {
252336
252317
  attach: "off"
252337
252318
  };
252338
252319
  }
252339
- function createOvalPadstack(name, outerWidth, outerHeight, holeWidth, holeHeight) {
252320
+ function createOvalPadstack(name, outerWidth, outerHeight, holeWidth, holeHeight, numLayers = 2) {
252340
252321
  const pathOffset = Math.abs(outerWidth - outerHeight) / 2;
252341
252322
  const isHorizontal2 = outerWidth > outerHeight;
252342
252323
  return {
252343
252324
  name,
252344
- shapes: [
252345
- {
252346
- shapeType: "path",
252347
- layer: "F.Cu",
252348
- width: isHorizontal2 ? outerHeight : outerWidth,
252349
- coordinates: isHorizontal2 ? [-pathOffset, 0, pathOffset, 0] : [0, -pathOffset, 0, pathOffset]
252350
- },
252351
- {
252352
- shapeType: "path",
252353
- layer: "B.Cu",
252354
- width: isHorizontal2 ? outerHeight : outerWidth,
252355
- coordinates: isHorizontal2 ? [-pathOffset, 0, pathOffset, 0] : [0, -pathOffset, 0, pathOffset]
252356
- }
252357
- ],
252325
+ shapes: generateLayerNames(numLayers).map((layer) => ({
252326
+ shapeType: "path",
252327
+ layer,
252328
+ width: isHorizontal2 ? outerHeight : outerWidth,
252329
+ coordinates: isHorizontal2 ? [-pathOffset, 0, pathOffset, 0] : [0, -pathOffset, 0, pathOffset]
252330
+ })),
252358
252331
  hole: {
252359
252332
  shape: "oval",
252360
252333
  width: holeWidth,
@@ -252390,7 +252363,7 @@ function createRectangularPadstack(name, width, height, layer) {
252390
252363
  attach: "off"
252391
252364
  };
252392
252365
  }
252393
- function createCircularHoleRectangularPadstack(name, outerWidth, outerHeight, holeDiameter) {
252366
+ function createCircularHoleRectangularPadstack(name, outerWidth, outerHeight, holeDiameter, numLayers = 2) {
252394
252367
  const halfWidth = outerWidth / 2;
252395
252368
  const halfHeight = outerHeight / 2;
252396
252369
  const rectPolygon = [
@@ -252407,20 +252380,12 @@ function createCircularHoleRectangularPadstack(name, outerWidth, outerHeight, ho
252407
252380
  ];
252408
252381
  return {
252409
252382
  name,
252410
- shapes: [
252411
- {
252412
- shapeType: "polygon",
252413
- layer: "F.Cu",
252414
- width: 0,
252415
- coordinates: rectPolygon
252416
- },
252417
- {
252418
- shapeType: "polygon",
252419
- layer: "B.Cu",
252420
- width: 0,
252421
- coordinates: rectPolygon
252422
- }
252423
- ],
252383
+ shapes: generateLayerNames(numLayers).map((layer) => ({
252384
+ shapeType: "polygon",
252385
+ layer,
252386
+ width: 0,
252387
+ coordinates: rectPolygon
252388
+ })),
252424
252389
  hole: {
252425
252390
  shape: "circle",
252426
252391
  diameter: holeDiameter
@@ -252428,6 +252393,32 @@ function createCircularHoleRectangularPadstack(name, outerWidth, outerHeight, ho
252428
252393
  attach: "off"
252429
252394
  };
252430
252395
  }
252396
+ function getPadstackName({
252397
+ shape,
252398
+ width,
252399
+ height,
252400
+ holeDiameter,
252401
+ outerDiameter,
252402
+ layer = "top"
252403
+ }) {
252404
+ const layerCode = {
252405
+ top: "T",
252406
+ bottom: "B",
252407
+ all: "A"
252408
+ }[layer] ?? "T";
252409
+ switch (shape) {
252410
+ case "circle":
252411
+ return `Round[${layerCode}]Pad_${holeDiameter}_${outerDiameter}_um`;
252412
+ case "oval":
252413
+ return `Oval[${layerCode}]Pad_${width}x${height}_um`;
252414
+ case "pill":
252415
+ return `Oval[${layerCode}]Pad_${width}x${height}_um`;
252416
+ case "rect":
252417
+ return `RoundRect[${layerCode}]Pad_${width}x${height}_um`;
252418
+ default:
252419
+ return "default_pad";
252420
+ }
252421
+ }
252431
252422
  function createAndAddPadstackFromPcbSmtPad(pcb, pad2, processedPadstacks) {
252432
252423
  const isCircle = pad2.shape === "circle";
252433
252424
  const padstackParams = {
@@ -252465,6 +252456,30 @@ function createPinForImage(pad2, pcbComponent, sourcePort) {
252465
252456
  y: (pad2.y - pcbComponent.center.y) * 1000
252466
252457
  };
252467
252458
  }
252459
+ function getComponentValue(sourceComponent) {
252460
+ if (!sourceComponent)
252461
+ return "";
252462
+ if ("resistance" in sourceComponent) {
252463
+ return sourceComponent.resistance >= 1000 ? `${sourceComponent.resistance / 1000}k` : `${sourceComponent.resistance}`;
252464
+ }
252465
+ if ("capacitance" in sourceComponent) {
252466
+ const capacitanceUF = sourceComponent.capacitance * 1e6;
252467
+ if (capacitanceUF >= 1) {
252468
+ return `${capacitanceUF}uF`;
252469
+ } else {
252470
+ return `${capacitanceUF.toFixed(3)}uF`;
252471
+ }
252472
+ }
252473
+ return "";
252474
+ }
252475
+ function getFootprintName(sourceComponent, pcbComponent) {
252476
+ if (!sourceComponent || !pcbComponent) {
252477
+ return "";
252478
+ }
252479
+ const width = pcbComponent.width == null ? 0 : pcbComponent.width.toFixed(4);
252480
+ const height = pcbComponent.height == null ? 0 : pcbComponent.height.toFixed(4);
252481
+ return `${sourceComponent.ftype}:${width}x${height}_mm`;
252482
+ }
252468
252483
  var transformMmToUm = scale7(1000);
252469
252484
  function processComponentsAndPads(componentGroups, circuitElements, pcb) {
252470
252485
  const processedPadstacks = /* @__PURE__ */ new Set;
@@ -252539,7 +252554,7 @@ function processNets(circuitElements, pcb) {
252539
252554
  if (pcbPort && "source_port_id" in pcbPort) {
252540
252555
  const sourcePort = su23(circuitElements).source_port.list().find((e4) => e4.source_port_id === pcbPort.source_port_id);
252541
252556
  if (sourcePort && "source_component_id" in sourcePort) {
252542
- const componentName = componentNameMap.get(sourcePort.source_component_id) || "";
252557
+ const componentName = componentNameMap.get(sourcePort.source_component_id ?? "") || "";
252543
252558
  const pinNumber = sourcePort.port_hints?.find((hint) => !Number.isNaN(Number(hint)));
252544
252559
  padsBySourcePortId.set(sourcePort.source_port_id, {
252545
252560
  componentName: `${componentName}_${sourcePort.source_component_id}`,
@@ -252694,35 +252709,22 @@ function processNets(circuitElements, pcb) {
252694
252709
  }
252695
252710
  }
252696
252711
  }
252697
- function findOrCreateViaPadstack(pcb, outerDiameter, holeDiameter) {
252698
- const viaName = `Via[0-1]_${outerDiameter}:${holeDiameter}_um`;
252699
- const library = pcb.getLibrary();
252700
- const existingPadstack = library.padstacks.find((p3) => p3.name === viaName);
252701
- if (existingPadstack) {
252702
- return viaName;
252712
+ function getCombinedSourcePortName(circuitElements, connectedSourcePortIds) {
252713
+ const portInfos = [];
252714
+ for (const portId of connectedSourcePortIds) {
252715
+ const sourcePort = circuitElements.find((el3) => el3.type === "source_port" && el3.source_port_id === portId);
252716
+ if (!sourcePort)
252717
+ continue;
252718
+ const sourceComponent = circuitElements.find((el3) => el3.type === "source_component" && el3.source_component_id === sourcePort.source_component_id);
252719
+ if (!sourceComponent)
252720
+ continue;
252721
+ const componentName = sourceComponent.name || sourceComponent.source_component_id;
252722
+ const portName = sourcePort.name || sourcePort.pin_number?.toString() || portId;
252723
+ portInfos.push({
252724
+ displayName: `Pad${portName.replace("pin", "")}_${componentName}_${sourcePort.source_component_id}`
252725
+ });
252703
252726
  }
252704
- const viaPadstack = {
252705
- name: viaName,
252706
- attach: "off",
252707
- shapes: [
252708
- {
252709
- shapeType: "circle",
252710
- layer: "F.Cu",
252711
- diameter: outerDiameter
252712
- },
252713
- {
252714
- shapeType: "circle",
252715
- layer: "B.Cu",
252716
- diameter: outerDiameter
252717
- }
252718
- ],
252719
- hole: {
252720
- shape: "circle",
252721
- diameter: holeDiameter
252722
- }
252723
- };
252724
- library.padstacks.push(viaPadstack);
252725
- return viaName;
252727
+ return portInfos.map((p3) => p3.displayName).join("--");
252726
252728
  }
252727
252729
  var getDsnTraceOperationsWrapper = (dsnObj) => {
252728
252730
  if (dsnObj.is_dsn_pcb) {
@@ -252755,30 +252757,46 @@ var getDsnTraceOperationsWrapper = (dsnObj) => {
252755
252757
  }
252756
252758
  throw new Error("Invalid DSN object");
252757
252759
  };
252758
- function getCombinedSourcePortName(circuitElements, connectedSourcePortIds) {
252759
- const portInfos = [];
252760
- for (const portId of connectedSourcePortIds) {
252761
- const sourcePort = circuitElements.find((el3) => el3.type === "source_port" && el3.source_port_id === portId);
252762
- if (!sourcePort)
252763
- continue;
252764
- const sourceComponent = circuitElements.find((el3) => el3.type === "source_component" && el3.source_component_id === sourcePort.source_component_id);
252765
- if (!sourceComponent)
252766
- continue;
252767
- const componentName = sourceComponent.name || sourceComponent.source_component_id;
252768
- const portName = sourcePort.name || sourcePort.pin_number?.toString() || portId;
252769
- portInfos.push({
252770
- displayName: `Pad${portName.replace("pin", "")}_${componentName}_${sourcePort.source_component_id}`
252771
- });
252760
+ function findOrCreateViaPadstack(pcb, outerDiameter, holeDiameter, numLayers = 2) {
252761
+ const viaName = getViaPadstackName(numLayers, outerDiameter, holeDiameter);
252762
+ const library = pcb.getLibrary();
252763
+ const existingPadstack = library.padstacks.find((p3) => p3.name === viaName);
252764
+ if (existingPadstack) {
252765
+ return viaName;
252772
252766
  }
252773
- return portInfos.map((p3) => p3.displayName).join("--");
252767
+ const viaPadstack = {
252768
+ name: viaName,
252769
+ attach: "off",
252770
+ shapes: generateLayerNames(numLayers).map((layer) => ({
252771
+ shapeType: "circle",
252772
+ layer,
252773
+ diameter: outerDiameter
252774
+ })),
252775
+ hole: {
252776
+ shape: "circle",
252777
+ diameter: holeDiameter
252778
+ }
252779
+ };
252780
+ library.padstacks.push(viaPadstack);
252781
+ return viaName;
252774
252782
  }
252775
252783
  var debug14 = Debug4("dsn-converter:processPcbTraces");
252776
252784
  var DEFAULT_VIA_DIAMETER = 600;
252777
252785
  var DEFAULT_VIA_HOLE = 300;
252786
+ function layerRefToDsnLayer(layer) {
252787
+ if (layer === "top")
252788
+ return "F.Cu";
252789
+ if (layer === "bottom")
252790
+ return "B.Cu";
252791
+ const innerMatch = String(layer).match(/^inner(\d+)$/);
252792
+ if (innerMatch)
252793
+ return `In${innerMatch[1]}.Cu`;
252794
+ return String(layer);
252795
+ }
252778
252796
  function createWire(opts) {
252779
252797
  return {
252780
252798
  path: {
252781
- layer: opts.layer === "top" ? "F.Cu" : "B.Cu",
252799
+ layer: layerRefToDsnLayer(opts.layer),
252782
252800
  width: opts.widthMm,
252783
252801
  coordinates: []
252784
252802
  },
@@ -252786,7 +252804,10 @@ function createWire(opts) {
252786
252804
  type: "route"
252787
252805
  };
252788
252806
  }
252789
- function processPcbTraces(circuitElements, pcb) {
252807
+ function hasCoordinatePosition(point5) {
252808
+ return point5.route_type === "wire" || point5.route_type === "via";
252809
+ }
252810
+ function processPcbTraces(circuitElements, pcb, numLayers = 2) {
252790
252811
  const dsnWrapper = getDsnTraceOperationsWrapper(pcb);
252791
252812
  const CJ_TO_DSN_SCALE = pcb.is_dsn_pcb ? 1000 : 1e4;
252792
252813
  for (const element of circuitElements) {
@@ -252827,13 +252848,25 @@ function processPcbTraces(circuitElements, pcb) {
252827
252848
  }
252828
252849
  if (hasLayerChanged) {
252829
252850
  const prevPoint = pcbTrace.route[i2 - 1];
252830
- const viaPadstackName = findOrCreateViaPadstack(dsnWrapper, DEFAULT_VIA_DIAMETER, DEFAULT_VIA_HOLE);
252851
+ if (!prevPoint || !hasCoordinatePosition(prevPoint)) {
252852
+ currentLayer = point5.layer;
252853
+ currentWire = createWire({
252854
+ layer: point5.layer,
252855
+ widthMm: point5.width * CJ_TO_DSN_SCALE,
252856
+ netName
252857
+ });
252858
+ dsnWrapper.addWire(currentWire);
252859
+ currentWire.path.coordinates.push(point5.x * CJ_TO_DSN_SCALE);
252860
+ currentWire.path.coordinates.push(point5.y * CJ_TO_DSN_SCALE);
252861
+ continue;
252862
+ }
252863
+ const viaPadstackName = findOrCreateViaPadstack(dsnWrapper, DEFAULT_VIA_DIAMETER, DEFAULT_VIA_HOLE, numLayers);
252831
252864
  if (dsnWrapper.getStructure() && !dsnWrapper.getStructure()?.via) {
252832
252865
  dsnWrapper.getStructure().via = viaPadstackName;
252833
252866
  }
252834
252867
  dsnWrapper.addWire({
252835
252868
  path: {
252836
- layer: currentLayer === "top" ? "F.Cu" : "B.Cu",
252869
+ layer: layerRefToDsnLayer(currentLayer),
252837
252870
  width: DEFAULT_VIA_DIAMETER,
252838
252871
  coordinates: [
252839
252872
  prevPoint.x * CJ_TO_DSN_SCALE,
@@ -252855,14 +252888,14 @@ function processPcbTraces(circuitElements, pcb) {
252855
252888
  currentWire.path.coordinates.push(point5.y * CJ_TO_DSN_SCALE);
252856
252889
  currentWire = null;
252857
252890
  }
252858
- const viaPadstackName = findOrCreateViaPadstack(dsnWrapper, DEFAULT_VIA_DIAMETER, DEFAULT_VIA_HOLE);
252891
+ const viaPadstackName = findOrCreateViaPadstack(dsnWrapper, DEFAULT_VIA_DIAMETER, DEFAULT_VIA_HOLE, numLayers);
252859
252892
  debug14("VIA PADSTACK NAME:", viaPadstackName);
252860
252893
  if (dsnWrapper.getStructure() && !dsnWrapper.getStructure()?.via) {
252861
252894
  dsnWrapper.getStructure().via = viaPadstackName;
252862
252895
  }
252863
252896
  dsnWrapper.addWire({
252864
252897
  path: {
252865
- layer: point5.from_layer === "top" ? "F.Cu" : "B.Cu",
252898
+ layer: layerRefToDsnLayer(point5.from_layer),
252866
252899
  width: DEFAULT_VIA_DIAMETER,
252867
252900
  coordinates: [
252868
252901
  point5.x * CJ_TO_DSN_SCALE,
@@ -252881,7 +252914,7 @@ function processPcbTraces(circuitElements, pcb) {
252881
252914
  debug14("PCB WIRING/NETWORK_OUT AT END", JSON.stringify(pcb.is_dsn_pcb ? pcb.wiring : pcb.routes.network_out.nets, null, 2));
252882
252915
  }
252883
252916
  var transformMmToUm2 = scale22(1000);
252884
- function processPlatedHoles(componentGroups, circuitElements, pcb) {
252917
+ function processPlatedHoles(componentGroups, circuitElements, pcb, numLayers = 2) {
252885
252918
  const processedPadstacks = /* @__PURE__ */ new Set;
252886
252919
  function ensurePadstack(hole) {
252887
252920
  switch (hole.shape) {
@@ -252894,7 +252927,7 @@ function processPlatedHoles(componentGroups, circuitElements, pcb) {
252894
252927
  });
252895
252928
  if (!processedPadstacks.has(name)) {
252896
252929
  const d3 = Math.round(hole.outer_diameter * 1000);
252897
- pcb.library.padstacks.push(createCircularPadstack(name, d3, d3));
252930
+ pcb.library.padstacks.push(createCircularPadstack(name, d3, d3, numLayers));
252898
252931
  processedPadstacks.add(name);
252899
252932
  }
252900
252933
  return name;
@@ -252912,7 +252945,7 @@ function processPlatedHoles(componentGroups, circuitElements, pcb) {
252912
252945
  const iH = Math.round(hole.hole_height * 1000);
252913
252946
  const oW = Math.round(hole.outer_width * 1000);
252914
252947
  const oH = Math.round(hole.outer_height * 1000);
252915
- pcb.library.padstacks.push(createOvalPadstack(name, oW, oH, iW, iH));
252948
+ pcb.library.padstacks.push(createOvalPadstack(name, oW, oH, iW, iH, numLayers));
252916
252949
  processedPadstacks.add(name);
252917
252950
  }
252918
252951
  return name;
@@ -252928,7 +252961,7 @@ function processPlatedHoles(componentGroups, circuitElements, pcb) {
252928
252961
  const oW = Math.round(hole.rect_pad_width * 1000);
252929
252962
  const oH = Math.round(hole.rect_pad_height * 1000);
252930
252963
  const hD = Math.round(hole.hole_diameter * 1000);
252931
- pcb.library.padstacks.push(createCircularHoleRectangularPadstack(name, oW, oH, hD));
252964
+ pcb.library.padstacks.push(createCircularHoleRectangularPadstack(name, oW, oH, hD, numLayers));
252932
252965
  processedPadstacks.add(name);
252933
252966
  }
252934
252967
  return name;
@@ -253010,37 +253043,12 @@ function processPlatedHoles(componentGroups, circuitElements, pcb) {
253010
253043
  });
253011
253044
  }
253012
253045
  }
253013
- function generateLayers(numLayers) {
253014
- const layers = [];
253015
- layers.push({
253016
- name: "F.Cu",
253017
- type: "signal",
253018
- property: {
253019
- index: 0
253020
- }
253021
- });
253022
- for (let i2 = 1;i2 < numLayers - 1; i2++) {
253023
- layers.push({
253024
- name: `In${i2}.Cu`,
253025
- type: "signal",
253026
- property: {
253027
- index: i2
253028
- }
253029
- });
253030
- }
253031
- layers.push({
253032
- name: "B.Cu",
253033
- type: "signal",
253034
- property: {
253035
- index: numLayers - 1
253036
- }
253037
- });
253038
- return layers;
253039
- }
253040
253046
  function convertCircuitJsonToDsnJson(circuitElements, options = {}) {
253041
253047
  const pcbBoard = circuitElements.find((element) => element.type === "pcb_board");
253042
253048
  const numLayers = pcbBoard?.num_layers ?? 2;
253043
253049
  const layers = generateLayers(numLayers);
253050
+ const layerNames = generateLayerNames(numLayers);
253051
+ const defaultViaName = getViaPadstackName(numLayers, 600, 300);
253044
253052
  const pcb = {
253045
253053
  is_dsn_pcb: true,
253046
253054
  filename: "",
@@ -253064,7 +253072,7 @@ function convertCircuitJsonToDsnJson(circuitElements, options = {}) {
253064
253072
  coordinates: calculateBoardBoundary(pcbBoard)
253065
253073
  }
253066
253074
  },
253067
- via: "Via[0-1]_600:300_um",
253075
+ via: defaultViaName,
253068
253076
  rule: {
253069
253077
  clearances: [
253070
253078
  {
@@ -253085,19 +253093,12 @@ function convertCircuitJsonToDsnJson(circuitElements, options = {}) {
253085
253093
  images: [],
253086
253094
  padstacks: [
253087
253095
  {
253088
- name: "Via[0-1]_600:300_um",
253089
- shapes: [
253090
- {
253091
- shapeType: "circle",
253092
- layer: "F.Cu",
253093
- diameter: 600
253094
- },
253095
- {
253096
- shapeType: "circle",
253097
- layer: "B.Cu",
253098
- diameter: 600
253099
- }
253100
- ],
253096
+ name: defaultViaName,
253097
+ shapes: layerNames.map((name) => ({
253098
+ shapeType: "circle",
253099
+ layer: name,
253100
+ diameter: 600
253101
+ })),
253101
253102
  attach: "off"
253102
253103
  }
253103
253104
  ]
@@ -253110,7 +253111,7 @@ function convertCircuitJsonToDsnJson(circuitElements, options = {}) {
253110
253111
  description: "",
253111
253112
  net_names: [],
253112
253113
  circuit: {
253113
- use_via: "Via[0-1]_600:300_um"
253114
+ use_via: defaultViaName
253114
253115
  },
253115
253116
  rule: {
253116
253117
  clearances: [
@@ -253129,9 +253130,9 @@ function convertCircuitJsonToDsnJson(circuitElements, options = {}) {
253129
253130
  };
253130
253131
  const componentGroups = groupComponents(circuitElements);
253131
253132
  processComponentsAndPads(componentGroups, circuitElements, pcb);
253132
- processPlatedHoles(componentGroups, circuitElements, pcb);
253133
+ processPlatedHoles(componentGroups, circuitElements, pcb, numLayers);
253133
253134
  processNets(circuitElements, pcb);
253134
- processPcbTraces(circuitElements, pcb);
253135
+ processPcbTraces(circuitElements, pcb, numLayers);
253135
253136
  return pcb;
253136
253137
  }
253137
253138
  function calculateBoardBoundary(pcbBoard) {
package/dist/lib/index.js CHANGED
@@ -65808,7 +65808,7 @@ var getNodeHandler = (winterSpec, { port, middleware = [] }) => {
65808
65808
  }));
65809
65809
  };
65810
65810
  // package.json
65811
- var version = "0.1.1483";
65811
+ var version = "0.1.1485";
65812
65812
  var package_default = {
65813
65813
  name: "@tscircuit/cli",
65814
65814
  version,
@@ -65859,7 +65859,7 @@ var package_default = {
65859
65859
  cosmiconfig: "^9.0.0",
65860
65860
  debug: "^4.4.0",
65861
65861
  delay: "^6.0.0",
65862
- "dsn-converter": "0.0.86",
65862
+ "dsn-converter": "^0.0.88",
65863
65863
  easyeda: "^0.0.269",
65864
65864
  "fuse.js": "^7.1.0",
65865
65865
  "get-port": "^7.1.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/cli",
3
- "version": "0.1.1485",
3
+ "version": "0.1.1486",
4
4
  "main": "dist/cli/main.js",
5
5
  "exports": {
6
6
  ".": "./dist/cli/main.js",
@@ -48,7 +48,7 @@
48
48
  "cosmiconfig": "^9.0.0",
49
49
  "debug": "^4.4.0",
50
50
  "delay": "^6.0.0",
51
- "dsn-converter": "0.0.86",
51
+ "dsn-converter": "^0.0.88",
52
52
  "easyeda": "^0.0.269",
53
53
  "fuse.js": "^7.1.0",
54
54
  "get-port": "^7.1.0",