@tscircuit/cli 0.1.1977 → 0.1.1978

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
@@ -55441,7 +55441,7 @@ var require_fast_json_stable_stringify = __commonJS(function(exports2, module2)
55441
55441
  };
55442
55442
  });
55443
55443
 
55444
- // node_modules/circuit-json-to-gerber/dist/chunk-MJSWOMMX.js
55444
+ // node_modules/circuit-json-to-gerber/dist/chunk-X27MJBIZ.js
55445
55445
  import { z as z4 } from "zod";
55446
55446
  import { z as z23 } from "zod";
55447
55447
  import { z as z32 } from "zod";
@@ -55677,6 +55677,9 @@ function getAllApertureTemplateConfigsForLayer({
55677
55677
  } else {
55678
55678
  addConfigIfNew(getApertureConfigFromCirclePcbHole(elm));
55679
55679
  }
55680
+ } else if (elm.hole_shape === "rotated_pill") {
55681
+ const soldermaskMargin = isSoldermaskLayer ? elm.soldermask_margin ?? 0 : 0;
55682
+ addConfigIfNew(getApertureConfigFromRotatedPillPcbHole(elm, soldermaskMargin));
55680
55683
  } else
55681
55684
  console.warn("NOT IMPLEMENTED: drawing gerber for non circle holes");
55682
55685
  } else if (elm.type === "pcb_via") {
@@ -56191,6 +56194,50 @@ var import_polygon_clipping, import_fast_json_stable_stringify, import_polygon_c
56191
56194
  }
56192
56195
  builder.add("M30", {});
56193
56196
  return builder.build();
56197
+ }, getDrillLayerSpanKey = (span, layerCount) => {
56198
+ const normalizedSpan = normalizeLayerSpan(span, layerCount);
56199
+ return `L${getLayerNumber(normalizedSpan.from_layer, layerCount)}-L${getLayerNumber(normalizedSpan.to_layer, layerCount)}`;
56200
+ }, hasDrillGeometry = (element) => {
56201
+ if ("hole_diameter" in element && typeof element.hole_diameter === "number") {
56202
+ return true;
56203
+ }
56204
+ return "hole_width" in element && typeof element.hole_width === "number" && "hole_height" in element && typeof element.hole_height === "number";
56205
+ }, convertSoupToExcellonDrillCommandLayers = ({
56206
+ circuitJson,
56207
+ flip_y_axis = false
56208
+ }) => {
56209
+ const layerCount = getLayerCount(circuitJson);
56210
+ const platedSpans = new Map(getDrillableElements(circuitJson).flatMap((element) => {
56211
+ const span = getPlatedElementLayerSpan(element, layerCount);
56212
+ if (!span) {
56213
+ return [];
56214
+ }
56215
+ return [[getDrillLayerSpanKey(span, layerCount), span]];
56216
+ }));
56217
+ const platedDrillLayers = Object.fromEntries([...platedSpans.entries()].sort().map(([spanKey, span]) => [
56218
+ `drill-${spanKey}.drl`,
56219
+ convertSoupToExcellonDrillCommands({
56220
+ circuitJson,
56221
+ is_plated: true,
56222
+ flip_y_axis,
56223
+ layer_span: span
56224
+ })
56225
+ ]));
56226
+ const hasNonPlatedDrill = circuitJson.some((element) => {
56227
+ return element.type === "pcb_hole" && hasDrillGeometry(element);
56228
+ });
56229
+ const hasInternalCircularCutoutDrill = getInternalCircularCutoutDrills(circuitJson).length > 0;
56230
+ if (!hasNonPlatedDrill && !hasInternalCircularCutoutDrill) {
56231
+ return platedDrillLayers;
56232
+ }
56233
+ return {
56234
+ ...platedDrillLayers,
56235
+ "drill_npth.drl": convertSoupToExcellonDrillCommands({
56236
+ circuitJson,
56237
+ is_plated: false,
56238
+ flip_y_axis
56239
+ })
56240
+ };
56194
56241
  }, defineGerberCommand = ({
56195
56242
  command_code,
56196
56243
  schema,
@@ -56696,6 +56743,11 @@ var import_polygon_clipping, import_fast_json_stable_stringify, import_polygon_c
56696
56743
  standard_template_code: "C",
56697
56744
  diameter: elm.hole_diameter + soldermaskMargin * 2
56698
56745
  };
56746
+ }, getApertureConfigFromRotatedPillPcbHole = (elm, soldermaskMargin = 0) => {
56747
+ return {
56748
+ standard_template_code: "C",
56749
+ diameter: Math.min(elm.hole_width, elm.hole_height) + soldermaskMargin * 2
56750
+ };
56699
56751
  }, getApertureConfigFromOuterDiameter = (elm) => {
56700
56752
  if (typeof elm.outer_diameter !== "number") {
56701
56753
  throw new Error("outer_diameter not specified in getApertureConfigFromOuterDiameter");
@@ -58290,6 +58342,18 @@ var import_polygon_clipping, import_fast_json_stable_stringify, import_polygon_c
58290
58342
  for (const glayer of [
58291
58343
  glayers[getGerberLayerName(layer, "soldermask")]
58292
58344
  ]) {
58345
+ if (element.hole_shape === "rotated_pill") {
58346
+ const soldermaskMargin = element.soldermask_margin ?? 0;
58347
+ renderPillFlash({
58348
+ glayer,
58349
+ x: element.x,
58350
+ y: element.y,
58351
+ width: element.hole_width + soldermaskMargin * 2,
58352
+ height: element.hole_height + soldermaskMargin * 2,
58353
+ rotationDegrees: element.ccw_rotation
58354
+ });
58355
+ continue;
58356
+ }
58293
58357
  if (element.hole_shape !== "circle") {
58294
58358
  console.warn("NOT IMPLEMENTED: drawing gerber for non-round holes");
58295
58359
  continue;
@@ -58410,9 +58474,24 @@ var import_polygon_clipping, import_fast_json_stable_stringify, import_polygon_c
58410
58474
  continue;
58411
58475
  const copperGlayer = glayers[getGerberLayerName(layer, "copper")];
58412
58476
  for (const element of circuitJson) {
58413
- if (element.type !== "pcb_hole" || element.hole_shape !== "circle") {
58477
+ if (element.type !== "pcb_hole") {
58478
+ continue;
58479
+ }
58480
+ if (element.hole_shape === "rotated_pill") {
58481
+ copperGlayer.push(...gerberBuilder().add("set_layer_polarity", { polarity: "C" }).build());
58482
+ renderPillFlash({
58483
+ glayer: copperGlayer,
58484
+ x: element.x,
58485
+ y: element.y,
58486
+ width: element.hole_width,
58487
+ height: element.hole_height,
58488
+ rotationDegrees: element.ccw_rotation
58489
+ });
58490
+ copperGlayer.push(...gerberBuilder().add("set_layer_polarity", { polarity: "D" }).build());
58414
58491
  continue;
58415
58492
  }
58493
+ if (element.hole_shape !== "circle")
58494
+ continue;
58416
58495
  copperGlayer.push(...gerberBuilder().add("set_layer_polarity", { polarity: "C" }).add("select_aperture", {
58417
58496
  aperture_number: findApertureNumber(copperGlayer, getApertureConfigFromCirclePcbHole(element))
58418
58497
  }).add("flash_operation", { x: element.x, y: mfy(element.y) }).add("set_layer_polarity", { polarity: "D" }).build());
@@ -58422,8 +58501,23 @@ var import_polygon_clipping, import_fast_json_stable_stringify, import_polygon_c
58422
58501
  glayers[key].push(...gerberBuilder().add("end_of_file", {}).build());
58423
58502
  }
58424
58503
  return glayers;
58504
+ }, convertCircuitJsonToGerberFiles = (circuitJson, options = {}) => {
58505
+ const { flip_y_axis = false } = options;
58506
+ const gerberCommandLayers = convertSoupToGerberCommands(circuitJson, {
58507
+ flip_y_axis
58508
+ });
58509
+ const gerberFiles = Object.fromEntries(Object.entries(stringifyGerberCommandLayers(gerberCommandLayers)).map(([layerName, contents]) => [`${layerName}.gbr`, contents]));
58510
+ const drillCommandLayers = convertSoupToExcellonDrillCommandLayers({
58511
+ circuitJson,
58512
+ flip_y_axis
58513
+ });
58514
+ const drillFiles = Object.fromEntries(Object.entries(drillCommandLayers).map(([fileName, commands]) => [
58515
+ fileName,
58516
+ stringifyExcellonDrill(commands)
58517
+ ]));
58518
+ return { ...gerberFiles, ...drillFiles };
58425
58519
  };
58426
- var init_chunk_MJSWOMMX = __esm(() => {
58520
+ var init_chunk_X27MJBIZ = __esm(() => {
58427
58521
  import_polygon_clipping = __toESM2(require_polygon_clipping_cjs(), 1);
58428
58522
  import_fast_json_stable_stringify = __toESM2(require_fast_json_stable_stringify(), 1);
58429
58523
  import_polygon_clipping2 = __toESM2(require_polygon_clipping_cjs(), 1);
@@ -59038,7 +59132,11 @@ ${template_code}%`;
59038
59132
  };
59039
59133
  package_default5 = {
59040
59134
  name: "circuit-json-to-gerber",
59041
- version: "0.0.93",
59135
+ version: "0.0.96",
59136
+ repository: {
59137
+ type: "git",
59138
+ url: "https://github.com/tscircuit/circuit-json-to-gerber"
59139
+ },
59042
59140
  license: "MIT",
59043
59141
  main: "dist/index.js",
59044
59142
  type: "module",
@@ -59117,7 +59215,7 @@ ${template_code}%`;
59117
59215
 
59118
59216
  // node_modules/circuit-json-to-gerber/dist/index.js
59119
59217
  var init_dist = __esm(() => {
59120
- init_chunk_MJSWOMMX();
59218
+ init_chunk_X27MJBIZ();
59121
59219
  });
59122
59220
 
59123
59221
  // node_modules/@tracespace/xml-id/index.js
@@ -136094,7 +136192,7 @@ var package_default = {
136094
136192
  "circuit-json-to-connectivity-map": "^0.0.25",
136095
136193
  "circuit-json-to-fdm-component-box": "^0.0.2",
136096
136194
  "circuit-json-to-footprinter": "^0.0.15",
136097
- "circuit-json-to-gerber": "^0.0.94",
136195
+ "circuit-json-to-gerber": "^0.0.97",
136098
136196
  "circuit-json-to-kicad": "0.0.157",
136099
136197
  "circuit-json-to-pnp-csv": "^0.0.9",
136100
136198
  "circuit-json-to-readable-netlist": "^0.0.15",
@@ -316223,28 +316321,11 @@ var exportSnippet = async ({
316223
316321
  }
316224
316322
  case "gerbers": {
316225
316323
  const zip = new import_jszip4.default;
316226
- const gerberLayerCmds = convertSoupToGerberCommands(circuitJson, {
316227
- flip_y_axis: false
316228
- });
316229
- const gerberFileContents = stringifyGerberCommandLayers(gerberLayerCmds);
316230
- for (const [fileName, fileContents] of Object.entries(gerberFileContents)) {
316231
- zip.file(`${fileName}.gbr`, fileContents);
316232
- }
316233
- const platedDrillCmds = convertSoupToExcellonDrillCommands({
316234
- circuitJson,
316235
- is_plated: true,
316236
- flip_y_axis: false
316237
- });
316238
- if (platedDrillCmds.length > 0) {
316239
- zip.file("drill.drl", stringifyExcellonDrill(platedDrillCmds));
316240
- }
316241
- const nonPlatedDrillCmds = convertSoupToExcellonDrillCommands({
316242
- circuitJson,
316243
- is_plated: false,
316324
+ const gerberFiles = convertCircuitJsonToGerberFiles(circuitJson, {
316244
316325
  flip_y_axis: false
316245
316326
  });
316246
- if (nonPlatedDrillCmds.length > 0) {
316247
- zip.file("drill_npth.drl", stringifyExcellonDrill(nonPlatedDrillCmds));
316327
+ for (const [fileName, fileContents] of Object.entries(gerberFiles)) {
316328
+ zip.file(fileName, fileContents);
316248
316329
  }
316249
316330
  const bomRows = await convertCircuitJsonToBomRows({ circuitJson });
316250
316331
  const bomCsv = await convertBomRowsToCsv(bomRows);
package/dist/lib/index.js CHANGED
@@ -65807,7 +65807,7 @@ var package_default = {
65807
65807
  "circuit-json-to-connectivity-map": "^0.0.25",
65808
65808
  "circuit-json-to-fdm-component-box": "^0.0.2",
65809
65809
  "circuit-json-to-footprinter": "^0.0.15",
65810
- "circuit-json-to-gerber": "^0.0.94",
65810
+ "circuit-json-to-gerber": "^0.0.97",
65811
65811
  "circuit-json-to-kicad": "0.0.157",
65812
65812
  "circuit-json-to-pnp-csv": "^0.0.9",
65813
65813
  "circuit-json-to-readable-netlist": "^0.0.15",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/cli",
3
- "version": "0.1.1977",
3
+ "version": "0.1.1978",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/tscircuit/cli"
@@ -45,7 +45,7 @@
45
45
  "circuit-json-to-connectivity-map": "^0.0.25",
46
46
  "circuit-json-to-fdm-component-box": "^0.0.2",
47
47
  "circuit-json-to-footprinter": "^0.0.15",
48
- "circuit-json-to-gerber": "^0.0.94",
48
+ "circuit-json-to-gerber": "^0.0.97",
49
49
  "circuit-json-to-kicad": "0.0.157",
50
50
  "circuit-json-to-pnp-csv": "^0.0.9",
51
51
  "circuit-json-to-readable-netlist": "^0.0.15",