@tscircuit/cli 0.1.1499 → 0.1.1500

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/lib/index.js CHANGED
@@ -65364,7 +65364,7 @@ var getNodeHandler = (winterSpec, { port, middleware = [] }) => {
65364
65364
  }));
65365
65365
  };
65366
65366
  // package.json
65367
- var version = "0.1.1498";
65367
+ var version = "0.1.1499";
65368
65368
  var package_default = {
65369
65369
  name: "@tscircuit/cli",
65370
65370
  version,
@@ -65404,7 +65404,7 @@ var package_default = {
65404
65404
  "circuit-json": "^0.0.425",
65405
65405
  "circuit-json-to-bom-csv": "^0.0.7",
65406
65406
  "circuit-json-to-gerber": "^0.0.51",
65407
- "circuit-json-to-kicad": "0.0.150",
65407
+ "circuit-json-to-kicad": "0.0.153",
65408
65408
  "circuit-json-to-pnp-csv": "^0.0.7",
65409
65409
  "circuit-json-to-readable-netlist": "^0.0.15",
65410
65410
  "circuit-json-to-spice": "^0.0.10",
@@ -68504,10 +68504,9 @@ __export2(exports_dist, {
68504
68504
  CircuitJsonToKicadPcbConverter: () => CircuitJsonToKicadPcbConverter,
68505
68505
  CircuitJsonToKicadLibraryConverter: () => CircuitJsonToKicadLibraryConverter
68506
68506
  });
68507
- import { KicadSch } from "kicadts";
68508
68507
  import { cju } from "@tscircuit/circuit-json-util";
68509
- import { compose as compose2, translate as translate2, scale } from "transformation-matrix";
68510
- import { Paper, Uuid } from "kicadts";
68508
+ import { KicadSch } from "kicadts";
68509
+ import { compose as compose2, scale, translate as translate2 } from "transformation-matrix";
68511
68510
  import {
68512
68511
  EmbeddedFonts,
68513
68512
  LibSymbols,
@@ -68546,6 +68545,17 @@ import {
68546
68545
  TextEffectsFont as TextEffectsFont3
68547
68546
  } from "kicadts";
68548
68547
  import { applyToPoint as applyToPoint4, scale as createScaleMatrix2 } from "transformation-matrix";
68548
+ import {
68549
+ Polyline,
68550
+ Pts as Pts2,
68551
+ SchematicText,
68552
+ Stroke as Stroke3,
68553
+ TextEffects as TextEffects4,
68554
+ TextEffectsFont as TextEffectsFont4,
68555
+ Uuid,
68556
+ Xy as Xy2
68557
+ } from "kicadts";
68558
+ import { applyToPoint as applyToPoint5 } from "transformation-matrix";
68549
68559
  import {
68550
68560
  SchematicSymbol as SchematicSymbol5,
68551
68561
  SymbolLibId,
@@ -68554,15 +68564,12 @@ import {
68554
68564
  SymbolInstances,
68555
68565
  SymbolInstancesProject,
68556
68566
  SymbolInstancePath,
68557
- TextEffects as TextEffects4,
68558
- TextEffectsFont as TextEffectsFont4,
68567
+ TextEffects as TextEffects5,
68568
+ TextEffectsFont as TextEffectsFont5,
68559
68569
  TextEffectsJustify,
68560
- EmbeddedFonts as EmbeddedFonts2,
68561
- SymbolPinNames as SymbolPinNames2,
68562
- SymbolPinNumbers as SymbolPinNumbers2
68570
+ GlobalLabel
68563
68571
  } from "kicadts";
68564
- import { applyToPoint as applyToPoint5 } from "transformation-matrix";
68565
- import { symbols as symbols3 } from "schematic-symbols";
68572
+ import { applyToPoint as applyToPoint6 } from "transformation-matrix";
68566
68573
  import {
68567
68574
  SchematicSymbol as SchematicSymbol6,
68568
68575
  SymbolLibId as SymbolLibId2,
@@ -68571,20 +68578,24 @@ import {
68571
68578
  SymbolInstances as SymbolInstances2,
68572
68579
  SymbolInstancesProject as SymbolInstancesProject2,
68573
68580
  SymbolInstancePath as SymbolInstancePath2,
68574
- TextEffects as TextEffects5,
68575
- TextEffectsFont as TextEffectsFont5,
68581
+ TextEffects as TextEffects6,
68582
+ TextEffectsFont as TextEffectsFont6,
68576
68583
  TextEffectsJustify as TextEffectsJustify2,
68577
- GlobalLabel
68584
+ EmbeddedFonts as EmbeddedFonts2,
68585
+ SymbolPinNames as SymbolPinNames2,
68586
+ SymbolPinNumbers as SymbolPinNumbers2
68578
68587
  } from "kicadts";
68579
- import { applyToPoint as applyToPoint6 } from "transformation-matrix";
68580
- import { Wire, Pts as Pts2, Xy as Xy2, Stroke as Stroke3, Junction } from "kicadts";
68581
68588
  import { applyToPoint as applyToPoint7 } from "transformation-matrix";
68589
+ import { symbols as symbols3 } from "schematic-symbols";
68590
+ import { Wire, Pts as Pts3, Xy as Xy3, Stroke as Stroke4, Junction } from "kicadts";
68591
+ import { applyToPoint as applyToPoint8 } from "transformation-matrix";
68582
68592
  import {
68583
68593
  SheetInstances,
68584
68594
  SheetInstancesRootPath,
68585
68595
  SheetInstancesRootPage,
68586
68596
  EmbeddedFonts as EmbeddedFonts3
68587
68597
  } from "kicadts";
68598
+ import { Paper, Uuid as Uuid4 } from "kicadts";
68588
68599
  import { KicadPcb as KicadPcb2 } from "kicadts";
68589
68600
  import { cju as cju2 } from "@tscircuit/circuit-json-util";
68590
68601
  import { compose as compose6, translate as translate6, scale as scale4 } from "transformation-matrix";
@@ -69042,8 +69053,8 @@ function signedArea(data, start, end, dim) {
69042
69053
  // node_modules/circuit-json-to-kicad/dist/index.js
69043
69054
  import {
69044
69055
  Layer,
69045
- Pts as Pts3,
69046
- Xy as Xy3,
69056
+ Pts as Pts4,
69057
+ Xy as Xy4,
69047
69058
  Zone,
69048
69059
  ZoneConnectPads,
69049
69060
  ZoneFill,
@@ -69052,7 +69063,7 @@ import {
69052
69063
  ZonePolygon
69053
69064
  } from "kicadts";
69054
69065
  import {
69055
- applyToPoint as applyToPoint8,
69066
+ applyToPoint as applyToPoint9,
69056
69067
  compose as compose3,
69057
69068
  rotate,
69058
69069
  translate as translate3
@@ -69074,83 +69085,83 @@ import {
69074
69085
  EmbeddedFonts as EmbeddedFonts4,
69075
69086
  FootprintAttr,
69076
69087
  Property,
69077
- TextEffects as TextEffects6,
69078
- TextEffectsFont as TextEffectsFont6
69088
+ TextEffects as TextEffects7,
69089
+ TextEffectsFont as TextEffectsFont7
69079
69090
  } from "kicadts";
69080
- import { applyToPoint as applyToPoint16 } from "transformation-matrix";
69091
+ import { applyToPoint as applyToPoint17 } from "transformation-matrix";
69081
69092
  import {
69082
69093
  Property as Property2,
69083
- TextEffects as TextEffects7,
69084
- TextEffectsFont as TextEffectsFont7,
69094
+ TextEffects as TextEffects8,
69095
+ TextEffectsFont as TextEffectsFont8,
69085
69096
  EmbeddedFonts as EmbeddedFonts5,
69086
69097
  FootprintModel as FootprintModel2,
69087
69098
  FootprintAttr as FootprintAttr2
69088
69099
  } from "kicadts";
69089
- import { FpCircle, Stroke as Stroke4 } from "kicadts";
69090
- import { FpCircle as FpCircle2, Stroke as Stroke5 } from "kicadts";
69091
- import { FpRect, Stroke as Stroke6 } from "kicadts";
69092
- import { FpRect as FpRect2, Stroke as Stroke7 } from "kicadts";
69093
- import { FpRect as FpRect3, Stroke as Stroke8 } from "kicadts";
69094
- import { FpPoly, Pts as Pts4, Stroke as Stroke9, Xy as Xy4 } from "kicadts";
69100
+ import { FpCircle, Stroke as Stroke5 } from "kicadts";
69101
+ import { FpCircle as FpCircle2, Stroke as Stroke6 } from "kicadts";
69102
+ import { FpRect, Stroke as Stroke7 } from "kicadts";
69103
+ import { FpRect as FpRect2, Stroke as Stroke8 } from "kicadts";
69104
+ import { FpRect as FpRect3, Stroke as Stroke9 } from "kicadts";
69105
+ import { FpPoly, Pts as Pts5, Stroke as Stroke10, Xy as Xy5 } from "kicadts";
69095
69106
  import {
69096
- applyToPoint as applyToPoint9,
69107
+ applyToPoint as applyToPoint10,
69097
69108
  compose as compose4,
69098
69109
  rotate as rotate2,
69099
69110
  scale as scale2,
69100
69111
  translate as translate4
69101
69112
  } from "transformation-matrix";
69102
69113
  import"kicadts";
69103
- import { FpText, TextEffects as TextEffects8, TextEffectsFont as TextEffectsFont8 } from "kicadts";
69104
- import { applyToPoint as applyToPoint10, rotate as rotate3, identity } from "transformation-matrix";
69105
- import { FpLine, Stroke as Stroke10 } from "kicadts";
69106
- import { applyToPoint as applyToPoint11, identity as identity2, rotate as rotate4 } from "transformation-matrix";
69107
- import { FpText as FpText3, TextEffects as TextEffects9, TextEffectsFont as TextEffectsFont9 } from "kicadts";
69108
- import { applyToPoint as applyToPoint12, rotate as rotate5, identity as identity3 } from "transformation-matrix";
69114
+ import { FpText, TextEffects as TextEffects9, TextEffectsFont as TextEffectsFont9 } from "kicadts";
69115
+ import { applyToPoint as applyToPoint11, rotate as rotate3, identity } from "transformation-matrix";
69116
+ import { FpLine, Stroke as Stroke11 } from "kicadts";
69117
+ import { applyToPoint as applyToPoint12, identity as identity2, rotate as rotate4 } from "transformation-matrix";
69118
+ import { FpText as FpText3, TextEffects as TextEffects10, TextEffectsFont as TextEffectsFont10 } from "kicadts";
69119
+ import { applyToPoint as applyToPoint13, rotate as rotate5, identity as identity3 } from "transformation-matrix";
69109
69120
  import { FootprintModel as FootprintModel3 } from "kicadts";
69110
69121
  import {
69111
69122
  FootprintPad,
69112
69123
  PadPrimitives,
69113
69124
  PadPrimitiveGrPoly,
69114
- Pts as Pts5,
69115
- Xy as Xy5,
69125
+ Pts as Pts6,
69126
+ Xy as Xy6,
69116
69127
  PadOptions,
69117
69128
  PadNet
69118
69129
  } from "kicadts";
69119
69130
  import {
69120
- applyToPoint as applyToPoint13,
69131
+ applyToPoint as applyToPoint14,
69121
69132
  compose as compose5,
69122
69133
  translate as translate5,
69123
69134
  scale as scale3,
69124
69135
  rotate as rotate6
69125
69136
  } from "transformation-matrix";
69126
69137
  import { FootprintPad as FootprintPad2, PadDrill, PadNet as PadNet2 } from "kicadts";
69127
- import { applyToPoint as applyToPoint14, rotate as rotate7, identity as identity4 } from "transformation-matrix";
69138
+ import { applyToPoint as applyToPoint15, rotate as rotate7, identity as identity4 } from "transformation-matrix";
69128
69139
  import { FootprintPad as FootprintPad3, PadDrill as PadDrill2 } from "kicadts";
69129
- import { applyToPoint as applyToPoint15, rotate as rotate8, identity as identity5 } from "transformation-matrix";
69140
+ import { applyToPoint as applyToPoint16, rotate as rotate8, identity as identity5 } from "transformation-matrix";
69130
69141
  import { Segment, SegmentNet } from "kicadts";
69131
- import { applyToPoint as applyToPoint17 } from "transformation-matrix";
69132
- import { Via, ViaNet } from "kicadts";
69133
69142
  import { applyToPoint as applyToPoint18 } from "transformation-matrix";
69134
- import { Footprint as Footprint4 } from "kicadts";
69143
+ import { Via, ViaNet } from "kicadts";
69135
69144
  import { applyToPoint as applyToPoint19 } from "transformation-matrix";
69145
+ import { Footprint as Footprint4 } from "kicadts";
69146
+ import { applyToPoint as applyToPoint20 } from "transformation-matrix";
69136
69147
  import { GrCircle, GrLine, GrPoly } from "kicadts";
69137
69148
  import {
69138
69149
  At as At2,
69139
69150
  GrText,
69140
- TextEffects as TextEffects10,
69141
- TextEffectsFont as TextEffectsFont10,
69151
+ TextEffects as TextEffects11,
69152
+ TextEffectsFont as TextEffectsFont11,
69142
69153
  TextEffectsJustify as TextEffectsJustify3
69143
69154
  } from "kicadts";
69144
- import { applyToPoint as applyToPoint20 } from "transformation-matrix";
69145
- import { applyToPoint as applyToPoint22, rotate as rotate9 } from "transformation-matrix";
69155
+ import { applyToPoint as applyToPoint21 } from "transformation-matrix";
69156
+ import { applyToPoint as applyToPoint23, rotate as rotate9 } from "transformation-matrix";
69146
69157
  import {
69147
69158
  GrText as GrText2,
69148
- TextEffects as TextEffects11,
69149
- TextEffectsFont as TextEffectsFont11,
69159
+ TextEffects as TextEffects12,
69160
+ TextEffectsFont as TextEffectsFont12,
69150
69161
  TextEffectsJustify as TextEffectsJustify4,
69151
69162
  At as At3
69152
69163
  } from "kicadts";
69153
- import { applyToPoint as applyToPoint21 } from "transformation-matrix";
69164
+ import { applyToPoint as applyToPoint22 } from "transformation-matrix";
69154
69165
  import { cju as cju3 } from "@tscircuit/circuit-json-util";
69155
69166
  import { cju as cju4 } from "@tscircuit/circuit-json-util";
69156
69167
  import { parseKicadSexpr as parseKicadSexpr2, KicadSch as KicadSch2 } from "kicadts";
@@ -69160,8 +69171,8 @@ import {
69160
69171
  parseKicadSexpr as parseKicadSexpr3,
69161
69172
  Footprint as Footprint5,
69162
69173
  Property as Property3,
69163
- TextEffects as TextEffects12,
69164
- TextEffectsFont as TextEffectsFont12
69174
+ TextEffects as TextEffects13,
69175
+ TextEffectsFont as TextEffectsFont13
69165
69176
  } from "kicadts";
69166
69177
  import { parseKicadMod as parseKicadMod2 } from "kicadts";
69167
69178
  import {
@@ -69169,11 +69180,73 @@ import {
69169
69180
  SymbolPinNames as SymbolPinNames3,
69170
69181
  SymbolPinNumbers as SymbolPinNumbers3,
69171
69182
  SymbolProperty as SymbolProperty4,
69172
- TextEffects as TextEffects13,
69173
- TextEffectsFont as TextEffectsFont13,
69183
+ TextEffects as TextEffects14,
69184
+ TextEffectsFont as TextEffectsFont14,
69174
69185
  TextEffectsJustify as TextEffectsJustify5
69175
69186
  } from "kicadts";
69176
69187
  import { KicadSymbolLib as KicadSymbolLib2 } from "kicadts";
69188
+ function getSchematicBoundsAndCenter(db) {
69189
+ const schematicComponents = db.schematic_component.list();
69190
+ const schematicTraces = db.schematic_trace.list();
69191
+ let minX = Infinity;
69192
+ let minY = Infinity;
69193
+ let maxX = -Infinity;
69194
+ let maxY = -Infinity;
69195
+ for (const component of schematicComponents) {
69196
+ const width = component.size?.width ?? 0;
69197
+ const height = component.size?.height ?? 0;
69198
+ minX = Math.min(minX, component.center.x - width / 2);
69199
+ minY = Math.min(minY, component.center.y - height / 2);
69200
+ maxX = Math.max(maxX, component.center.x + width / 2);
69201
+ maxY = Math.max(maxY, component.center.y + height / 2);
69202
+ }
69203
+ for (const trace of schematicTraces) {
69204
+ for (const edge of trace.edges) {
69205
+ minX = Math.min(minX, edge.from.x, edge.to.x);
69206
+ minY = Math.min(minY, edge.from.y, edge.to.y);
69207
+ maxX = Math.max(maxX, edge.from.x, edge.to.x);
69208
+ maxY = Math.max(maxY, edge.from.y, edge.to.y);
69209
+ }
69210
+ }
69211
+ if (minX === Infinity) {
69212
+ minX = 0;
69213
+ minY = 0;
69214
+ maxX = 0;
69215
+ maxY = 0;
69216
+ }
69217
+ const centerX = (minX + maxX) / 2;
69218
+ const centerY = (minY + maxY) / 2;
69219
+ return {
69220
+ center: {
69221
+ x: centerX,
69222
+ y: centerY
69223
+ },
69224
+ bounds: {
69225
+ minX,
69226
+ minY,
69227
+ maxX,
69228
+ maxY
69229
+ }
69230
+ };
69231
+ }
69232
+ var PAPER_SIZES = [
69233
+ { name: "A4", width: 297, height: 210 },
69234
+ { name: "A3", width: 420, height: 297 },
69235
+ { name: "A2", width: 594, height: 420 },
69236
+ { name: "A1", width: 841, height: 594 },
69237
+ { name: "A0", width: 1189, height: 841 }
69238
+ ];
69239
+ function selectSchematicPaperSize(contentWidth, contentHeight, paddingMm = 20) {
69240
+ const requiredWidth = contentWidth + 2 * paddingMm;
69241
+ const requiredHeight = contentHeight + 2 * paddingMm;
69242
+ for (let i = 0;i < PAPER_SIZES.length; i++) {
69243
+ const paperSize = PAPER_SIZES[i];
69244
+ if (requiredWidth <= paperSize.width && requiredHeight <= paperSize.height) {
69245
+ return paperSize;
69246
+ }
69247
+ }
69248
+ return PAPER_SIZES[PAPER_SIZES.length - 1];
69249
+ }
69177
69250
  var ConverterStage = class {
69178
69251
  MAX_ITERATIONS = 1000;
69179
69252
  iteration = 0;
@@ -69203,23 +69276,6 @@ var ConverterStage = class {
69203
69276
  throw new Error("Not implemented");
69204
69277
  }
69205
69278
  };
69206
- var InitializeSchematicStage = class extends ConverterStage {
69207
- _step() {
69208
- const { kicadSch, schematicPaperSize } = this.ctx;
69209
- if (!kicadSch) {
69210
- throw new Error("KicadSch instance not initialized in context");
69211
- }
69212
- kicadSch.version = 20250114;
69213
- const paper = new Paper;
69214
- paper.size = schematicPaperSize?.name ?? "A4";
69215
- kicadSch.paper = paper;
69216
- kicadSch.uuid = new Uuid(crypto.randomUUID());
69217
- this.finished = true;
69218
- }
69219
- getOutput() {
69220
- return this.ctx.kicadSch;
69221
- }
69222
- };
69223
69279
  function getKicadCompatibleComponentName(sourceComponent, cadComponent) {
69224
69280
  if (sourceComponent.manufacturer_part_number) {
69225
69281
  return sanitizeName(sourceComponent.manufacturer_part_number);
@@ -70080,6 +70136,268 @@ var AddLibrarySymbolsStage = class extends ConverterStage {
70080
70136
  return this.ctx.kicadSch;
70081
70137
  }
70082
70138
  };
70139
+ var DEFAULT_SECTION_TEXT_SIZE_MM = 1.27;
70140
+ var DEFAULT_SECTION_LINE_COLOR = { r: 0, g: 0, b: 0, a: 1 };
70141
+ var DEFAULT_SECTION_TEXT_COLOR = { r: 0, g: 0, b: 0, a: 1 };
70142
+ var DEFAULT_SECTION_TEXT_PADDING_X_MM = 0.22;
70143
+ var DEFAULT_SECTION_TEXT_PADDING_Y_MM = 0.18;
70144
+ var isStandaloneSchematicElement = (element) => !element.schematic_component_id;
70145
+ var AddSchematicGraphicsStage = class extends ConverterStage {
70146
+ _step() {
70147
+ const { kicadSch, db } = this.ctx;
70148
+ if (!kicadSch) {
70149
+ throw new Error("KicadSch instance not initialized in context");
70150
+ }
70151
+ if (!this.ctx.c2kMatSch) {
70152
+ this.finished = true;
70153
+ return;
70154
+ }
70155
+ const schematicLines = (db.schematic_line?.list() || []).filter(isStandaloneSchematicElement);
70156
+ const schematicTexts = (db.schematic_text?.list() || []).filter(isStandaloneSchematicElement);
70157
+ if (schematicLines.length === 0 && schematicTexts.length === 0) {
70158
+ this.finished = true;
70159
+ return;
70160
+ }
70161
+ if (schematicLines.length > 0) {
70162
+ const polylines = kicadSch.polylines || [];
70163
+ for (const line of schematicLines) {
70164
+ const start = applyToPoint5(this.ctx.c2kMatSch, {
70165
+ x: line.x1,
70166
+ y: line.y1
70167
+ });
70168
+ const end = applyToPoint5(this.ctx.c2kMatSch, {
70169
+ x: line.x2,
70170
+ y: line.y2
70171
+ });
70172
+ const polyline = new Polyline;
70173
+ polyline.points = new Pts2([
70174
+ new Xy2(start.x, start.y),
70175
+ new Xy2(end.x, end.y)
70176
+ ]);
70177
+ const stroke = new Stroke3;
70178
+ stroke.width = 0;
70179
+ stroke.type = "default";
70180
+ stroke.color = DEFAULT_SECTION_LINE_COLOR;
70181
+ polyline.stroke = stroke;
70182
+ polyline.uuid = new Uuid(crypto.randomUUID());
70183
+ polylines.push(polyline);
70184
+ }
70185
+ kicadSch.polylines = polylines;
70186
+ }
70187
+ if (schematicTexts.length > 0) {
70188
+ const texts = kicadSch.texts || [];
70189
+ for (const text of schematicTexts) {
70190
+ let sourceY = text.position?.y ?? 0;
70191
+ if (text.position?.y !== undefined && text.position.y < 2) {
70192
+ sourceY = text.position.y - DEFAULT_SECTION_TEXT_PADDING_Y_MM;
70193
+ }
70194
+ const position = applyToPoint5(this.ctx.c2kMatSch, {
70195
+ x: (text.position?.x ?? 0) + DEFAULT_SECTION_TEXT_PADDING_X_MM,
70196
+ y: sourceY
70197
+ });
70198
+ const font = new TextEffectsFont4;
70199
+ font.size = {
70200
+ height: DEFAULT_SECTION_TEXT_SIZE_MM,
70201
+ width: DEFAULT_SECTION_TEXT_SIZE_MM
70202
+ };
70203
+ font.color = DEFAULT_SECTION_TEXT_COLOR;
70204
+ const effects = new TextEffects4({
70205
+ font,
70206
+ hiddenText: false
70207
+ });
70208
+ const schematicText = new SchematicText({
70209
+ value: text.text || "",
70210
+ at: [position.x, position.y, text.rotation || 0],
70211
+ excludeFromSim: false,
70212
+ effects,
70213
+ uuid: new Uuid(crypto.randomUUID())
70214
+ });
70215
+ texts.push(schematicText);
70216
+ }
70217
+ kicadSch.texts = texts;
70218
+ }
70219
+ this.finished = true;
70220
+ }
70221
+ getOutput() {
70222
+ return this.ctx.kicadSch;
70223
+ }
70224
+ };
70225
+ var AddSchematicNetLabelsStage = class extends ConverterStage {
70226
+ _step() {
70227
+ const { kicadSch, db } = this.ctx;
70228
+ const netLabels = db.schematic_net_label?.list?.() || [];
70229
+ if (netLabels.length === 0) {
70230
+ this.finished = true;
70231
+ return;
70232
+ }
70233
+ if (!this.ctx.c2kMatSch) {
70234
+ this.finished = true;
70235
+ return;
70236
+ }
70237
+ const symbols4 = [];
70238
+ const globalLabels = [];
70239
+ for (const netLabel of netLabels) {
70240
+ const labelText = netLabel.text || "";
70241
+ const symbolName = netLabel.symbol_name;
70242
+ if (symbolName) {
70243
+ const symbol = this.createSymbolFromNetLabel(netLabel, labelText, symbolName);
70244
+ if (symbol) {
70245
+ symbols4.push(symbol);
70246
+ }
70247
+ } else {
70248
+ const label = this.createGlobalLabel(netLabel, labelText);
70249
+ if (label) {
70250
+ globalLabels.push(label);
70251
+ }
70252
+ }
70253
+ }
70254
+ if (kicadSch && symbols4.length > 0) {
70255
+ const existingSymbols = kicadSch.symbols || [];
70256
+ kicadSch.symbols = [...existingSymbols, ...symbols4];
70257
+ }
70258
+ if (kicadSch && globalLabels.length > 0) {
70259
+ kicadSch.globalLabels = [
70260
+ ...kicadSch.globalLabels || [],
70261
+ ...globalLabels
70262
+ ];
70263
+ }
70264
+ this.finished = true;
70265
+ }
70266
+ createSymbolFromNetLabel(netLabel, labelText, symbolName) {
70267
+ if (!this.ctx.c2kMatSch)
70268
+ return null;
70269
+ const { x, y } = applyToPoint6(this.ctx.c2kMatSch, {
70270
+ x: netLabel.anchor_position?.x ?? netLabel.center?.x ?? 0,
70271
+ y: netLabel.anchor_position?.y ?? netLabel.center?.y ?? 0
70272
+ });
70273
+ const uuid = crypto.randomUUID();
70274
+ const symbol = new SchematicSymbol5({
70275
+ at: [x, y, 0],
70276
+ unit: 1,
70277
+ excludeFromSim: false,
70278
+ inBom: true,
70279
+ onBoard: true,
70280
+ dnp: false,
70281
+ uuid,
70282
+ fieldsAutoplaced: true
70283
+ });
70284
+ const libId = `Custom:${symbolName}`;
70285
+ const symLibId = new SymbolLibId(libId);
70286
+ symbol._sxLibId = symLibId;
70287
+ const isUpSymbol = symbolName.includes("_up") || symbolName.toLowerCase().includes("vcc");
70288
+ const referenceOffset = isUpSymbol ? -4 : 4;
70289
+ const valueOffset = isUpSymbol ? -6 : 6;
70290
+ const referenceProperty = new SymbolProperty2({
70291
+ key: "Reference",
70292
+ value: labelText,
70293
+ id: 0,
70294
+ at: [x, y + referenceOffset, 0],
70295
+ effects: this.createTextEffects(1.27, false)
70296
+ });
70297
+ const valueProperty = new SymbolProperty2({
70298
+ key: "Value",
70299
+ value: labelText,
70300
+ id: 1,
70301
+ at: [x, y + valueOffset, 0],
70302
+ effects: this.createTextEffects(1.27, true)
70303
+ });
70304
+ const footprintProperty = new SymbolProperty2({
70305
+ key: "Footprint",
70306
+ value: "",
70307
+ id: 2,
70308
+ at: [x - 1.778, y, 90],
70309
+ effects: this.createTextEffects(1.27, true)
70310
+ });
70311
+ const datasheetProperty = new SymbolProperty2({
70312
+ key: "Datasheet",
70313
+ value: "~",
70314
+ id: 3,
70315
+ at: [x, y, 0],
70316
+ effects: this.createTextEffects(1.27, true)
70317
+ });
70318
+ const descriptionProperty = new SymbolProperty2({
70319
+ key: "Description",
70320
+ value: `Power/Net symbol: ${labelText}`,
70321
+ id: 4,
70322
+ at: [x, y, 0],
70323
+ effects: this.createTextEffects(1.27, true)
70324
+ });
70325
+ symbol.properties.push(referenceProperty, valueProperty, footprintProperty, datasheetProperty, descriptionProperty);
70326
+ const pin = new SymbolPin2;
70327
+ pin.numberString = "1";
70328
+ pin.uuid = crypto.randomUUID();
70329
+ symbol.pins.push(pin);
70330
+ const { kicadSch } = this.ctx;
70331
+ const instances = new SymbolInstances;
70332
+ const project = new SymbolInstancesProject("");
70333
+ const path7 = new SymbolInstancePath(`/${kicadSch?.uuid?.value || ""}`);
70334
+ path7.reference = labelText;
70335
+ path7.unit = 1;
70336
+ project.paths.push(path7);
70337
+ instances.projects.push(project);
70338
+ symbol._sxInstances = instances;
70339
+ return symbol;
70340
+ }
70341
+ createGlobalLabel(netLabel, labelText) {
70342
+ if (!this.ctx.c2kMatSch || !this.ctx.kicadSch)
70343
+ return null;
70344
+ const { x, y } = applyToPoint6(this.ctx.c2kMatSch, {
70345
+ x: netLabel.anchor_position?.x ?? netLabel.center?.x ?? 0,
70346
+ y: netLabel.anchor_position?.y ?? netLabel.center?.y ?? 0
70347
+ });
70348
+ const anchorSide = netLabel.anchor_side || "left";
70349
+ const orientationMap = {
70350
+ left: {
70351
+ angle: 0,
70352
+ shape: "input",
70353
+ justify: { horizontal: "left" }
70354
+ },
70355
+ right: {
70356
+ angle: 180,
70357
+ shape: "input",
70358
+ justify: { horizontal: "right" }
70359
+ },
70360
+ top: {
70361
+ angle: 270,
70362
+ shape: "input",
70363
+ justify: { horizontal: "right" }
70364
+ },
70365
+ bottom: {
70366
+ angle: 90,
70367
+ shape: "input",
70368
+ justify: { horizontal: "left" }
70369
+ }
70370
+ };
70371
+ const orientation = orientationMap[anchorSide] || orientationMap["left"];
70372
+ const effects = this.createTextEffects(1.27, false);
70373
+ if (Object.keys(orientation.justify).length > 0) {
70374
+ effects.justify = new TextEffectsJustify(orientation.justify);
70375
+ }
70376
+ const globalLabel = new GlobalLabel({
70377
+ value: labelText,
70378
+ shape: orientation.shape,
70379
+ at: [x, y, orientation.angle],
70380
+ effects,
70381
+ uuid: crypto.randomUUID(),
70382
+ fieldsAutoplaced: true
70383
+ });
70384
+ return globalLabel;
70385
+ }
70386
+ createTextEffects(size, hide = false) {
70387
+ const font = new TextEffectsFont5;
70388
+ font.size = { height: size, width: size };
70389
+ return new TextEffects5({
70390
+ font,
70391
+ hiddenText: hide
70392
+ });
70393
+ }
70394
+ getOutput() {
70395
+ if (!this.ctx.kicadSch) {
70396
+ throw new Error("kicadSch is not initialized");
70397
+ }
70398
+ return this.ctx.kicadSch;
70399
+ }
70400
+ };
70083
70401
  var AddSchematicSymbolsStage = class extends ConverterStage {
70084
70402
  _step() {
70085
70403
  const { kicadSch, db } = this.ctx;
@@ -70095,12 +70413,12 @@ var AddSchematicSymbolsStage = class extends ConverterStage {
70095
70413
  continue;
70096
70414
  if (!this.ctx.c2kMatSch)
70097
70415
  continue;
70098
- const { x, y } = applyToPoint5(this.ctx.c2kMatSch, {
70416
+ const { x, y } = applyToPoint7(this.ctx.c2kMatSch, {
70099
70417
  x: schematicComponent.center.x,
70100
70418
  y: schematicComponent.center.y
70101
70419
  });
70102
70420
  const uuid = crypto.randomUUID();
70103
- const symbol = new SchematicSymbol5({
70421
+ const symbol = new SchematicSymbol6({
70104
70422
  at: [x, y, 0],
70105
70423
  unit: 1,
70106
70424
  excludeFromSim: false,
@@ -70133,7 +70451,7 @@ var AddSchematicSymbolsStage = class extends ConverterStage {
70133
70451
  }
70134
70452
  }
70135
70453
  const libId = getLibraryId(sourceComponent, schematicComponent, cadComponent, schematicSymbolName);
70136
- const symLibId = new SymbolLibId(libId);
70454
+ const symLibId = new SymbolLibId2(libId);
70137
70455
  symbol._sxLibId = symLibId;
70138
70456
  const { reference, value, description } = this.getComponentMetadata(sourceComponent);
70139
70457
  const hasManufacturerValueForValuePlacement = (sourceComponent.ftype === "simple_chip" || sourceComponent.ftype === "simple_connector") && Boolean(sourceComponent.manufacturer_part_number);
@@ -70146,7 +70464,7 @@ var AddSchematicSymbolsStage = class extends ConverterStage {
70146
70464
  }
70147
70465
  }
70148
70466
  const refMeta = symbolMetadata?.properties?.Reference;
70149
- const referenceProperty = new SymbolProperty2({
70467
+ const referenceProperty = new SymbolProperty3({
70150
70468
  key: "Reference",
70151
70469
  value: refMeta?.value ?? reference,
70152
70470
  id: 0,
@@ -70155,7 +70473,7 @@ var AddSchematicSymbolsStage = class extends ConverterStage {
70155
70473
  });
70156
70474
  const hideValue = sourceComponent.ftype === "simple_chip" && !hasManufacturerValueForValuePlacement || sourceComponent.ftype === "simple_pin_header";
70157
70475
  const valMeta = symbolMetadata?.properties?.Value;
70158
- const valueProperty = new SymbolProperty2({
70476
+ const valueProperty = new SymbolProperty3({
70159
70477
  key: "Value",
70160
70478
  value: valMeta?.value ?? value,
70161
70479
  id: 1,
@@ -70163,7 +70481,7 @@ var AddSchematicSymbolsStage = class extends ConverterStage {
70163
70481
  effects: this.createTextEffects(Number(valMeta?.effects?.font?.size?.x ?? 1.27), valMeta?.effects?.hide ?? hideValue)
70164
70482
  });
70165
70483
  const fpMeta = symbolMetadata?.properties?.Footprint;
70166
- const footprintProperty = new SymbolProperty2({
70484
+ const footprintProperty = new SymbolProperty3({
70167
70485
  key: "Footprint",
70168
70486
  value: fpMeta?.value ?? "",
70169
70487
  id: 2,
@@ -70171,7 +70489,7 @@ var AddSchematicSymbolsStage = class extends ConverterStage {
70171
70489
  effects: this.createTextEffects(1.27, fpMeta?.effects?.hide ?? true)
70172
70490
  });
70173
70491
  const dsMeta = symbolMetadata?.properties?.Datasheet;
70174
- const datasheetProperty = new SymbolProperty2({
70492
+ const datasheetProperty = new SymbolProperty3({
70175
70493
  key: "Datasheet",
70176
70494
  value: dsMeta?.value ?? "~",
70177
70495
  id: 3,
@@ -70179,7 +70497,7 @@ var AddSchematicSymbolsStage = class extends ConverterStage {
70179
70497
  effects: this.createTextEffects(1.27, dsMeta?.effects?.hide ?? true)
70180
70498
  });
70181
70499
  const descMeta = symbolMetadata?.properties?.Description;
70182
- const descriptionProperty = new SymbolProperty2({
70500
+ const descriptionProperty = new SymbolProperty3({
70183
70501
  key: "Description",
70184
70502
  value: descMeta?.value ?? description,
70185
70503
  id: 4,
@@ -70189,7 +70507,7 @@ var AddSchematicSymbolsStage = class extends ConverterStage {
70189
70507
  symbol.properties.push(referenceProperty, valueProperty, footprintProperty, datasheetProperty, descriptionProperty);
70190
70508
  const kwMeta = symbolMetadata?.properties?.ki_keywords;
70191
70509
  if (kwMeta?.value) {
70192
- const keywordsProperty = new SymbolProperty2({
70510
+ const keywordsProperty = new SymbolProperty3({
70193
70511
  key: "ki_keywords",
70194
70512
  value: kwMeta.value,
70195
70513
  id: 5,
@@ -70200,7 +70518,7 @@ var AddSchematicSymbolsStage = class extends ConverterStage {
70200
70518
  }
70201
70519
  const fpFilterMeta = symbolMetadata?.properties?.ki_fp_filters;
70202
70520
  if (fpFilterMeta?.value) {
70203
- const fpFiltersProperty = new SymbolProperty2({
70521
+ const fpFiltersProperty = new SymbolProperty3({
70204
70522
  key: "ki_fp_filters",
70205
70523
  value: fpFilterMeta.value,
70206
70524
  id: 6,
@@ -70252,14 +70570,14 @@ var AddSchematicSymbolsStage = class extends ConverterStage {
70252
70570
  const port = schematicPorts[i];
70253
70571
  if (!port)
70254
70572
  continue;
70255
- const pin = new SymbolPin2;
70573
+ const pin = new SymbolPin3;
70256
70574
  pin.numberString = `${port.pin_number || i + 1}`;
70257
70575
  pin.uuid = crypto.randomUUID();
70258
70576
  symbol.pins.push(pin);
70259
70577
  }
70260
- const instances = new SymbolInstances;
70261
- const project = new SymbolInstancesProject("");
70262
- const path7 = new SymbolInstancePath(`/${kicadSch?.uuid?.value || ""}`);
70578
+ const instances = new SymbolInstances2;
70579
+ const project = new SymbolInstancesProject2("");
70580
+ const path7 = new SymbolInstancePath2(`/${kicadSch?.uuid?.value || ""}`);
70263
70581
  path7.reference = reference;
70264
70582
  path7.unit = 1;
70265
70583
  project.paths.push(path7);
@@ -70275,7 +70593,7 @@ var AddSchematicSymbolsStage = class extends ConverterStage {
70275
70593
  getTextPositions(schematicComponent, placeValueAtNamePosition) {
70276
70594
  const c2kMatSch = this.ctx.c2kMatSch;
70277
70595
  const schematicScale = c2kMatSch.a;
70278
- const symbolKicadPos = applyToPoint5(c2kMatSch, {
70596
+ const symbolKicadPos = applyToPoint7(c2kMatSch, {
70279
70597
  x: schematicComponent.center.x,
70280
70598
  y: schematicComponent.center.y
70281
70599
  });
@@ -70303,7 +70621,7 @@ var AddSchematicSymbolsStage = class extends ConverterStage {
70303
70621
  const schematicTexts = this.ctx.db.schematic_text?.list?.()?.filter((t) => t.schematic_component_id === schematicComponent.schematic_component_id) || [];
70304
70622
  const refText = schematicTexts.find((t) => t.text && t.text.length > 0);
70305
70623
  if (refText) {
70306
- const nameTextPos = applyToPoint5(c2kMatSch, {
70624
+ const nameTextPos = applyToPoint7(c2kMatSch, {
70307
70625
  x: refText.position.x,
70308
70626
  y: refText.position.y
70309
70627
  });
@@ -70345,11 +70663,11 @@ var AddSchematicSymbolsStage = class extends ConverterStage {
70345
70663
  const symbolCenter = symbol.center || { x: 0, y: 0 };
70346
70664
  const isVertical = symbolName.includes("_down") || symbolName.includes("_up");
70347
70665
  const horizontalTextOffset = isVertical ? 0.15 : 0;
70348
- const refTextPos = refTextPrimitive ? applyToPoint5(c2kMatSch, {
70666
+ const refTextPos = refTextPrimitive ? applyToPoint7(c2kMatSch, {
70349
70667
  x: schematicComponent.center.x + (refTextPrimitive.x - symbolCenter.x) + horizontalTextOffset,
70350
70668
  y: schematicComponent.center.y + (refTextPrimitive.y - symbolCenter.y)
70351
70669
  }) : { x: symbolKicadPos.x, y: referenceAboveBodyY };
70352
- const valTextPos = valTextPrimitive ? applyToPoint5(c2kMatSch, {
70670
+ const valTextPos = valTextPrimitive ? applyToPoint7(c2kMatSch, {
70353
70671
  x: schematicComponent.center.x + (valTextPrimitive.x - symbolCenter.x) + horizontalTextOffset,
70354
70672
  y: schematicComponent.center.y + (valTextPrimitive.y - symbolCenter.y)
70355
70673
  }) : { x: symbolKicadPos.x, y: symbolKicadPos.y + 6 };
@@ -70434,10 +70752,10 @@ var AddSchematicSymbolsStage = class extends ConverterStage {
70434
70752
  };
70435
70753
  }
70436
70754
  createTextEffects(size, hide = false, justify) {
70437
- const font = new TextEffectsFont4;
70755
+ const font = new TextEffectsFont6;
70438
70756
  font.size = { height: size, width: size };
70439
- const justifyObj = justify ? new TextEffectsJustify({ horizontal: justify }) : undefined;
70440
- const effects = new TextEffects4({
70757
+ const justifyObj = justify ? new TextEffectsJustify2({ horizontal: justify }) : undefined;
70758
+ const effects = new TextEffects6({
70441
70759
  font,
70442
70760
  hiddenText: hide,
70443
70761
  justify: justifyObj
@@ -70451,182 +70769,6 @@ var AddSchematicSymbolsStage = class extends ConverterStage {
70451
70769
  return this.ctx.kicadSch;
70452
70770
  }
70453
70771
  };
70454
- var AddSchematicNetLabelsStage = class extends ConverterStage {
70455
- _step() {
70456
- const { kicadSch, db } = this.ctx;
70457
- const netLabels = db.schematic_net_label?.list?.() || [];
70458
- if (netLabels.length === 0) {
70459
- this.finished = true;
70460
- return;
70461
- }
70462
- if (!this.ctx.c2kMatSch) {
70463
- this.finished = true;
70464
- return;
70465
- }
70466
- const symbols4 = [];
70467
- const globalLabels = [];
70468
- for (const netLabel of netLabels) {
70469
- const labelText = netLabel.text || "";
70470
- const symbolName = netLabel.symbol_name;
70471
- if (symbolName) {
70472
- const symbol = this.createSymbolFromNetLabel(netLabel, labelText, symbolName);
70473
- if (symbol) {
70474
- symbols4.push(symbol);
70475
- }
70476
- } else {
70477
- const label = this.createGlobalLabel(netLabel, labelText);
70478
- if (label) {
70479
- globalLabels.push(label);
70480
- }
70481
- }
70482
- }
70483
- if (kicadSch && symbols4.length > 0) {
70484
- const existingSymbols = kicadSch.symbols || [];
70485
- kicadSch.symbols = [...existingSymbols, ...symbols4];
70486
- }
70487
- if (kicadSch && globalLabels.length > 0) {
70488
- kicadSch.globalLabels = [
70489
- ...kicadSch.globalLabels || [],
70490
- ...globalLabels
70491
- ];
70492
- }
70493
- this.finished = true;
70494
- }
70495
- createSymbolFromNetLabel(netLabel, labelText, symbolName) {
70496
- if (!this.ctx.c2kMatSch)
70497
- return null;
70498
- const { x, y } = applyToPoint6(this.ctx.c2kMatSch, {
70499
- x: netLabel.anchor_position?.x ?? netLabel.center?.x ?? 0,
70500
- y: netLabel.anchor_position?.y ?? netLabel.center?.y ?? 0
70501
- });
70502
- const uuid = crypto.randomUUID();
70503
- const symbol = new SchematicSymbol6({
70504
- at: [x, y, 0],
70505
- unit: 1,
70506
- excludeFromSim: false,
70507
- inBom: true,
70508
- onBoard: true,
70509
- dnp: false,
70510
- uuid,
70511
- fieldsAutoplaced: true
70512
- });
70513
- const libId = `Custom:${symbolName}`;
70514
- const symLibId = new SymbolLibId2(libId);
70515
- symbol._sxLibId = symLibId;
70516
- const isUpSymbol = symbolName.includes("_up") || symbolName.toLowerCase().includes("vcc");
70517
- const referenceOffset = isUpSymbol ? -4 : 4;
70518
- const valueOffset = isUpSymbol ? -6 : 6;
70519
- const referenceProperty = new SymbolProperty3({
70520
- key: "Reference",
70521
- value: labelText,
70522
- id: 0,
70523
- at: [x, y + referenceOffset, 0],
70524
- effects: this.createTextEffects(1.27, false)
70525
- });
70526
- const valueProperty = new SymbolProperty3({
70527
- key: "Value",
70528
- value: labelText,
70529
- id: 1,
70530
- at: [x, y + valueOffset, 0],
70531
- effects: this.createTextEffects(1.27, true)
70532
- });
70533
- const footprintProperty = new SymbolProperty3({
70534
- key: "Footprint",
70535
- value: "",
70536
- id: 2,
70537
- at: [x - 1.778, y, 90],
70538
- effects: this.createTextEffects(1.27, true)
70539
- });
70540
- const datasheetProperty = new SymbolProperty3({
70541
- key: "Datasheet",
70542
- value: "~",
70543
- id: 3,
70544
- at: [x, y, 0],
70545
- effects: this.createTextEffects(1.27, true)
70546
- });
70547
- const descriptionProperty = new SymbolProperty3({
70548
- key: "Description",
70549
- value: `Power/Net symbol: ${labelText}`,
70550
- id: 4,
70551
- at: [x, y, 0],
70552
- effects: this.createTextEffects(1.27, true)
70553
- });
70554
- symbol.properties.push(referenceProperty, valueProperty, footprintProperty, datasheetProperty, descriptionProperty);
70555
- const pin = new SymbolPin3;
70556
- pin.numberString = "1";
70557
- pin.uuid = crypto.randomUUID();
70558
- symbol.pins.push(pin);
70559
- const { kicadSch } = this.ctx;
70560
- const instances = new SymbolInstances2;
70561
- const project = new SymbolInstancesProject2("");
70562
- const path7 = new SymbolInstancePath2(`/${kicadSch?.uuid?.value || ""}`);
70563
- path7.reference = labelText;
70564
- path7.unit = 1;
70565
- project.paths.push(path7);
70566
- instances.projects.push(project);
70567
- symbol._sxInstances = instances;
70568
- return symbol;
70569
- }
70570
- createGlobalLabel(netLabel, labelText) {
70571
- if (!this.ctx.c2kMatSch || !this.ctx.kicadSch)
70572
- return null;
70573
- const { x, y } = applyToPoint6(this.ctx.c2kMatSch, {
70574
- x: netLabel.anchor_position?.x ?? netLabel.center?.x ?? 0,
70575
- y: netLabel.anchor_position?.y ?? netLabel.center?.y ?? 0
70576
- });
70577
- const anchorSide = netLabel.anchor_side || "left";
70578
- const orientationMap = {
70579
- left: {
70580
- angle: 0,
70581
- shape: "input",
70582
- justify: { horizontal: "left" }
70583
- },
70584
- right: {
70585
- angle: 180,
70586
- shape: "input",
70587
- justify: { horizontal: "right" }
70588
- },
70589
- top: {
70590
- angle: 270,
70591
- shape: "input",
70592
- justify: { horizontal: "right" }
70593
- },
70594
- bottom: {
70595
- angle: 90,
70596
- shape: "input",
70597
- justify: { horizontal: "left" }
70598
- }
70599
- };
70600
- const orientation = orientationMap[anchorSide] || orientationMap["left"];
70601
- const effects = this.createTextEffects(1.27, false);
70602
- if (Object.keys(orientation.justify).length > 0) {
70603
- effects.justify = new TextEffectsJustify2(orientation.justify);
70604
- }
70605
- const globalLabel = new GlobalLabel({
70606
- value: labelText,
70607
- shape: orientation.shape,
70608
- at: [x, y, orientation.angle],
70609
- effects,
70610
- uuid: crypto.randomUUID(),
70611
- fieldsAutoplaced: true
70612
- });
70613
- return globalLabel;
70614
- }
70615
- createTextEffects(size, hide = false) {
70616
- const font = new TextEffectsFont5;
70617
- font.size = { height: size, width: size };
70618
- return new TextEffects5({
70619
- font,
70620
- hiddenText: hide
70621
- });
70622
- }
70623
- getOutput() {
70624
- if (!this.ctx.kicadSch) {
70625
- throw new Error("kicadSch is not initialized");
70626
- }
70627
- return this.ctx.kicadSch;
70628
- }
70629
- };
70630
70772
  var DEFAULT_LINE_WIDTH_MM = 0.254;
70631
70773
  var AddSchematicTracesStage = class extends ConverterStage {
70632
70774
  _step() {
@@ -70660,11 +70802,11 @@ var AddSchematicTracesStage = class extends ConverterStage {
70660
70802
  if (!this.ctx.c2kMatSch) {
70661
70803
  throw new Error("Schematic transformation matrix not initialized in context");
70662
70804
  }
70663
- const from = applyToPoint7(this.ctx.c2kMatSch, {
70805
+ const from = applyToPoint8(this.ctx.c2kMatSch, {
70664
70806
  x: edge.from.x,
70665
70807
  y: edge.from.y
70666
70808
  });
70667
- const to = applyToPoint7(this.ctx.c2kMatSch, {
70809
+ const to = applyToPoint8(this.ctx.c2kMatSch, {
70668
70810
  x: edge.to.x,
70669
70811
  y: edge.to.y
70670
70812
  });
@@ -70672,9 +70814,9 @@ var AddSchematicTracesStage = class extends ConverterStage {
70672
70814
  const y1 = from.y;
70673
70815
  const x2 = to.x;
70674
70816
  const y2 = to.y;
70675
- const pts = new Pts2([new Xy2(x1, y1), new Xy2(x2, y2)]);
70817
+ const pts = new Pts3([new Xy3(x1, y1), new Xy3(x2, y2)]);
70676
70818
  wire.points = pts;
70677
- const stroke = new Stroke3;
70819
+ const stroke = new Stroke4;
70678
70820
  stroke.width = DEFAULT_LINE_WIDTH_MM;
70679
70821
  stroke.type = "default";
70680
70822
  wire.stroke = stroke;
@@ -70685,7 +70827,7 @@ var AddSchematicTracesStage = class extends ConverterStage {
70685
70827
  if (!this.ctx.c2kMatSch) {
70686
70828
  throw new Error("Schematic transformation matrix not initialized in context");
70687
70829
  }
70688
- const { x, y } = applyToPoint7(this.ctx.c2kMatSch, {
70830
+ const { x, y } = applyToPoint8(this.ctx.c2kMatSch, {
70689
70831
  x: junction.x,
70690
70832
  y: junction.y
70691
70833
  });
@@ -70720,68 +70862,23 @@ var AddSheetInstancesStage = class extends ConverterStage {
70720
70862
  return this.ctx.kicadSch;
70721
70863
  }
70722
70864
  };
70723
- function getSchematicBoundsAndCenter(db) {
70724
- const schematicComponents = db.schematic_component.list();
70725
- const schematicTraces = db.schematic_trace.list();
70726
- let minX = Infinity;
70727
- let minY = Infinity;
70728
- let maxX = -Infinity;
70729
- let maxY = -Infinity;
70730
- for (const component of schematicComponents) {
70731
- const width = component.size?.width ?? 0;
70732
- const height = component.size?.height ?? 0;
70733
- minX = Math.min(minX, component.center.x - width / 2);
70734
- minY = Math.min(minY, component.center.y - height / 2);
70735
- maxX = Math.max(maxX, component.center.x + width / 2);
70736
- maxY = Math.max(maxY, component.center.y + height / 2);
70737
- }
70738
- for (const trace of schematicTraces) {
70739
- for (const edge of trace.edges) {
70740
- minX = Math.min(minX, edge.from.x, edge.to.x);
70741
- minY = Math.min(minY, edge.from.y, edge.to.y);
70742
- maxX = Math.max(maxX, edge.from.x, edge.to.x);
70743
- maxY = Math.max(maxY, edge.from.y, edge.to.y);
70865
+ var InitializeSchematicStage = class extends ConverterStage {
70866
+ _step() {
70867
+ const { kicadSch, schematicPaperSize } = this.ctx;
70868
+ if (!kicadSch) {
70869
+ throw new Error("KicadSch instance not initialized in context");
70744
70870
  }
70871
+ kicadSch.version = 20250114;
70872
+ const paper = new Paper;
70873
+ paper.size = schematicPaperSize?.name ?? "A4";
70874
+ kicadSch.paper = paper;
70875
+ kicadSch.uuid = new Uuid4(crypto.randomUUID());
70876
+ this.finished = true;
70745
70877
  }
70746
- if (minX === Infinity) {
70747
- minX = 0;
70748
- minY = 0;
70749
- maxX = 0;
70750
- maxY = 0;
70751
- }
70752
- const centerX = (minX + maxX) / 2;
70753
- const centerY = (minY + maxY) / 2;
70754
- return {
70755
- center: {
70756
- x: centerX,
70757
- y: centerY
70758
- },
70759
- bounds: {
70760
- minX,
70761
- minY,
70762
- maxX,
70763
- maxY
70764
- }
70765
- };
70766
- }
70767
- var PAPER_SIZES = [
70768
- { name: "A4", width: 297, height: 210 },
70769
- { name: "A3", width: 420, height: 297 },
70770
- { name: "A2", width: 594, height: 420 },
70771
- { name: "A1", width: 841, height: 594 },
70772
- { name: "A0", width: 1189, height: 841 }
70773
- ];
70774
- function selectSchematicPaperSize(contentWidth, contentHeight, paddingMm = 20) {
70775
- const requiredWidth = contentWidth + 2 * paddingMm;
70776
- const requiredHeight = contentHeight + 2 * paddingMm;
70777
- for (let i = 0;i < PAPER_SIZES.length; i++) {
70778
- const paperSize = PAPER_SIZES[i];
70779
- if (requiredWidth <= paperSize.width && requiredHeight <= paperSize.height) {
70780
- return paperSize;
70781
- }
70878
+ getOutput() {
70879
+ return this.ctx.kicadSch;
70782
70880
  }
70783
- return PAPER_SIZES[PAPER_SIZES.length - 1];
70784
- }
70881
+ };
70785
70882
  var DEFAULT_SCHEMATIC_SCALE_FACTOR = 15;
70786
70883
  var CircuitJsonToKicadSchConverter = class {
70787
70884
  ctx;
@@ -70817,6 +70914,7 @@ var CircuitJsonToKicadSchConverter = class {
70817
70914
  new AddSchematicSymbolsStage(circuitJson, this.ctx),
70818
70915
  new AddSchematicNetLabelsStage(circuitJson, this.ctx),
70819
70916
  new AddSchematicTracesStage(circuitJson, this.ctx),
70917
+ new AddSchematicGraphicsStage(circuitJson, this.ctx),
70820
70918
  new AddSheetInstancesStage(circuitJson, this.ctx)
70821
70919
  ];
70822
70920
  }
@@ -70901,8 +70999,8 @@ var getCopperPourNetInfo = (pour, ctx) => {
70901
70999
  };
70902
71000
  var convertPointsToKicadXy = (points, c2kMatPcb) => {
70903
71001
  return (points ?? []).map((point) => {
70904
- const transformedPoint = applyToPoint8(c2kMatPcb, point);
70905
- return new Xy3(transformedPoint.x, transformedPoint.y);
71002
+ const transformedPoint = applyToPoint9(c2kMatPcb, point);
71003
+ return new Xy4(transformedPoint.x, transformedPoint.y);
70906
71004
  });
70907
71005
  };
70908
71006
  var rotateRingToStartAtTopRight = (points) => {
@@ -70950,7 +71048,7 @@ var getRectRingPoints = (pour, c2kMatPcb) => {
70950
71048
  { x: halfWidth, y: -halfHeight },
70951
71049
  { x: halfWidth, y: halfHeight },
70952
71050
  { x: -halfWidth, y: halfHeight }
70953
- ].map((corner) => applyToPoint8(cornerTransform, corner));
71051
+ ].map((corner) => applyToPoint9(cornerTransform, corner));
70954
71052
  return convertPointsToKicadXy(corners, c2kMatPcb);
70955
71053
  };
70956
71054
  var getPolygonRingPoints = (pour, c2kMatPcb) => removeRepeatedClosingPoint(removeConsecutiveDuplicatePoints(rotateRingToStartAtTopRight(convertPointsToKicadXy(pour.points, c2kMatPcb))));
@@ -70974,12 +71072,12 @@ var getCopperPourZoneRings = (pour, c2kMatPcb) => {
70974
71072
  var createZonePolygons = (outerRing, innerRings) => {
70975
71073
  const polygons = [];
70976
71074
  if (outerRing.length >= 3) {
70977
- polygons.push(new ZonePolygon(new Pts3(outerRing)));
71075
+ polygons.push(new ZonePolygon(new Pts4(outerRing)));
70978
71076
  }
70979
71077
  for (const innerRing of innerRings) {
70980
71078
  if (innerRing.length < 3)
70981
71079
  continue;
70982
- polygons.push(new ZonePolygon(new Pts3(innerRing)));
71080
+ polygons.push(new ZonePolygon(new Pts4(innerRing)));
70983
71081
  }
70984
71082
  return polygons;
70985
71083
  };
@@ -70993,7 +71091,7 @@ var createZoneFilledPolygons = (outerRing, innerRings, kicadLayer) => {
70993
71091
  return [
70994
71092
  new ZoneFilledPolygon({
70995
71093
  layer,
70996
- pts: new Pts3(outerRing)
71094
+ pts: new Pts4(outerRing)
70997
71095
  })
70998
71096
  ];
70999
71097
  }
@@ -71021,14 +71119,14 @@ var createZoneFilledPolygons = (outerRing, innerRings, kicadLayer) => {
71021
71119
  const y = flattenedPoints[pointOffset + 1];
71022
71120
  if (x === undefined || y === undefined)
71023
71121
  continue;
71024
- trianglePoints.push(new Xy3(x, y));
71122
+ trianglePoints.push(new Xy4(x, y));
71025
71123
  }
71026
71124
  if (trianglePoints.length !== 3 || getTriangleArea(trianglePoints[0], trianglePoints[1], trianglePoints[2]) === 0) {
71027
71125
  continue;
71028
71126
  }
71029
71127
  filledPolygons.push(new ZoneFilledPolygon({
71030
71128
  layer,
71031
- pts: new Pts3(trianglePoints)
71129
+ pts: new Pts4(trianglePoints)
71032
71130
  }));
71033
71131
  }
71034
71132
  return filledPolygons;
@@ -71274,10 +71372,10 @@ var ExtractFootprintsStage = class extends ConverterStage {
71274
71372
  footprint.path = undefined;
71275
71373
  footprint.sheetfile = undefined;
71276
71374
  footprint.sheetname = undefined;
71277
- const defaultFont = new TextEffectsFont6;
71375
+ const defaultFont = new TextEffectsFont7;
71278
71376
  defaultFont.size = { width: 1.27, height: 1.27 };
71279
71377
  defaultFont.thickness = 0.15;
71280
- const defaultEffects = new TextEffects6({ font: defaultFont });
71378
+ const defaultEffects = new TextEffects7({ font: defaultFont });
71281
71379
  const fpPads = footprint.fpPads ?? [];
71282
71380
  let minY = 0;
71283
71381
  let maxY = 0;
@@ -71393,7 +71491,7 @@ var ExtractFootprintsStage = class extends ConverterStage {
71393
71491
  }
71394
71492
  };
71395
71493
  function createTextEffects2(metadataEffects) {
71396
- const font = new TextEffectsFont7;
71494
+ const font = new TextEffectsFont8;
71397
71495
  if (metadataEffects?.font?.size) {
71398
71496
  font.size = {
71399
71497
  width: Number(metadataEffects.font.size.x),
@@ -71407,7 +71505,7 @@ function createTextEffects2(metadataEffects) {
71407
71505
  } else {
71408
71506
  font.thickness = 0.15;
71409
71507
  }
71410
- return new TextEffects7({ font });
71508
+ return new TextEffects8({ font });
71411
71509
  }
71412
71510
  function applyMetadataToFootprint({
71413
71511
  footprint,
@@ -71622,7 +71720,7 @@ function convertSilkscreenCircles(silkscreenCircles, componentCenter) {
71622
71720
  center: { x: relX, y: relY },
71623
71721
  end: { x: relX + circle.radius, y: relY },
71624
71722
  layer: kicadLayer,
71625
- stroke: new Stroke4,
71723
+ stroke: new Stroke5,
71626
71724
  fill: false
71627
71725
  });
71628
71726
  if (fpCircle.stroke) {
@@ -71647,7 +71745,7 @@ function convertCourtyardCircles(courtyardCircles, componentCenter) {
71647
71745
  center: { x: relX, y: relY },
71648
71746
  end: { x: relX + circle.radius, y: relY },
71649
71747
  layer: kicadLayer,
71650
- stroke: new Stroke5,
71748
+ stroke: new Stroke6,
71651
71749
  fill: false
71652
71750
  });
71653
71751
  if (fpCircle.stroke) {
@@ -71674,7 +71772,7 @@ function convertFabricationNoteRects(fabRects, componentCenter) {
71674
71772
  start: { x: relX - halfW, y: relY - halfH },
71675
71773
  end: { x: relX + halfW, y: relY + halfH },
71676
71774
  layer: kicadLayer,
71677
- stroke: new Stroke6,
71775
+ stroke: new Stroke7,
71678
71776
  fill: false
71679
71777
  });
71680
71778
  if (fpRect.stroke) {
@@ -71697,7 +71795,7 @@ function convertNoteRects(noteRects, componentCenter) {
71697
71795
  start: { x: relX - halfW, y: relY - halfH },
71698
71796
  end: { x: relX + halfW, y: relY + halfH },
71699
71797
  layer: kicadLayer,
71700
- stroke: new Stroke7,
71798
+ stroke: new Stroke8,
71701
71799
  fill: false
71702
71800
  });
71703
71801
  if (fpRect.stroke) {
@@ -71724,7 +71822,7 @@ function convertCourtyardRects(courtyardRects, componentCenter) {
71724
71822
  start: { x: relX - halfW, y: relY - halfH },
71725
71823
  end: { x: relX + halfW, y: relY + halfH },
71726
71824
  layer: kicadLayer,
71727
- stroke: new Stroke8,
71825
+ stroke: new Stroke9,
71728
71826
  fill: false
71729
71827
  });
71730
71828
  if (fpRect.stroke) {
@@ -71748,15 +71846,15 @@ function convertCourtyardOutlines(params2) {
71748
71846
  };
71749
71847
  const kicadLayer = layerMap[outline.layer] || "F.CrtYd";
71750
71848
  const xyPoints = outline.outline.map((point) => {
71751
- const transformedPoint = applyToPoint9(cj2kicadMatrix, point);
71752
- return new Xy4(transformedPoint.x, transformedPoint.y);
71849
+ const transformedPoint = applyToPoint10(cj2kicadMatrix, point);
71850
+ return new Xy5(transformedPoint.x, transformedPoint.y);
71753
71851
  });
71754
71852
  const fpPoly = new FpPoly;
71755
- fpPoly.points = new Pts4(xyPoints);
71853
+ fpPoly.points = new Pts5(xyPoints);
71756
71854
  fpPoly.layer = kicadLayer;
71757
71855
  fpPoly.fill = false;
71758
71856
  fpPoly.uuid = generateDeterministicUuid(outline.pcb_courtyard_outline_id);
71759
- const stroke = new Stroke9;
71857
+ const stroke = new Stroke10;
71760
71858
  stroke.width = 0.05;
71761
71859
  stroke.type = "default";
71762
71860
  fpPoly.stroke = stroke;
@@ -71775,7 +71873,7 @@ function createFpTextFromCircuitJson({
71775
71873
  const relativeX = textElement.anchor_position.x - componentCenter.x;
71776
71874
  const relativeY = -(textElement.anchor_position.y - componentCenter.y);
71777
71875
  const rotationMatrix = componentRotation !== 0 ? rotate3(componentRotation * Math.PI / 180) : identity();
71778
- const rotatedPos = applyToPoint10(rotationMatrix, {
71876
+ const rotatedPos = applyToPoint11(rotationMatrix, {
71779
71877
  x: relativeX,
71780
71878
  y: relativeY
71781
71879
  });
@@ -71789,9 +71887,9 @@ function createFpTextFromCircuitJson({
71789
71887
  };
71790
71888
  const kicadLayer = layerMap[textElement.layer] || textElement.layer || "F.SilkS";
71791
71889
  const fontSize = (textElement.font_size || 1) / 1.5;
71792
- const font = new TextEffectsFont8;
71890
+ const font = new TextEffectsFont9;
71793
71891
  font.size = { width: fontSize, height: fontSize };
71794
- const textEffects = new TextEffects8({
71892
+ const textEffects = new TextEffects9({
71795
71893
  font
71796
71894
  });
71797
71895
  const rotation = textElement.ccw_rotation || 0;
@@ -71846,11 +71944,11 @@ function convertSilkscreenPaths(silkscreenPaths, { componentCenter, componentRot
71846
71944
  const endPoint = path7.route[i + 1];
71847
71945
  if (!startPoint || !endPoint)
71848
71946
  continue;
71849
- const startRelative = applyToPoint11(rotationMatrix, {
71947
+ const startRelative = applyToPoint12(rotationMatrix, {
71850
71948
  x: startPoint.x - componentCenter.x,
71851
71949
  y: -(startPoint.y - componentCenter.y)
71852
71950
  });
71853
- const endRelative = applyToPoint11(rotationMatrix, {
71951
+ const endRelative = applyToPoint12(rotationMatrix, {
71854
71952
  x: endPoint.x - componentCenter.x,
71855
71953
  y: -(endPoint.y - componentCenter.y)
71856
71954
  });
@@ -71858,7 +71956,7 @@ function convertSilkscreenPaths(silkscreenPaths, { componentCenter, componentRot
71858
71956
  start: { x: startRelative.x, y: startRelative.y },
71859
71957
  end: { x: endRelative.x, y: endRelative.y },
71860
71958
  layer: kicadLayer,
71861
- stroke: new Stroke10
71959
+ stroke: new Stroke11
71862
71960
  });
71863
71961
  if (fpLine.stroke) {
71864
71962
  fpLine.stroke.width = path7.stroke_width || 0.15;
@@ -71876,11 +71974,11 @@ function convertNoteTexts(params2) {
71876
71974
  const relX = textElement.anchor_position.x - componentCenter.x;
71877
71975
  const relY = -(textElement.anchor_position.y - componentCenter.y);
71878
71976
  const rotationMatrix = componentRotation !== 0 ? rotate5(componentRotation * Math.PI / 180) : identity3();
71879
- const rotatedPos = applyToPoint12(rotationMatrix, { x: relX, y: relY });
71977
+ const rotatedPos = applyToPoint13(rotationMatrix, { x: relX, y: relY });
71880
71978
  const fontSize = textElement.font_size || 1;
71881
- const font = new TextEffectsFont9;
71979
+ const font = new TextEffectsFont10;
71882
71980
  font.size = { width: fontSize, height: fontSize };
71883
- const textEffects = new TextEffects9({ font });
71981
+ const textEffects = new TextEffects10({ font });
71884
71982
  const fpText = new FpText3({
71885
71983
  type: "user",
71886
71984
  text: textElement.text,
@@ -71943,7 +72041,7 @@ function createSmdPadFromCircuitJson({
71943
72041
  throw new Error("Pad must have either x/y coordinates or points array");
71944
72042
  }
71945
72043
  const cj2kicadMatrix = compose5(componentRotation !== 0 ? rotate6(componentRotation * Math.PI / 180) : { a: 1, b: 0, c: 0, d: 1, e: 0, f: 0 }, scale3(1, -1), translate5(-componentCenter.x, -componentCenter.y));
71946
- const rotatedPos = applyToPoint13(cj2kicadMatrix, {
72044
+ const rotatedPos = applyToPoint14(cj2kicadMatrix, {
71947
72045
  x: padX,
71948
72046
  y: padY
71949
72047
  });
@@ -71968,11 +72066,11 @@ function createSmdPadFromCircuitJson({
71968
72066
  const points = pcbPad.points;
71969
72067
  const pointTransformMatrix = compose5(scale3(1, -1), translate5(-padX, -padY));
71970
72068
  const relativePoints = points.map((p) => {
71971
- const transformed = applyToPoint13(pointTransformMatrix, { x: p.x, y: p.y });
71972
- return new Xy5(transformed.x, transformed.y);
72069
+ const transformed = applyToPoint14(pointTransformMatrix, { x: p.x, y: p.y });
72070
+ return new Xy6(transformed.x, transformed.y);
71973
72071
  });
71974
72072
  const grPoly = new PadPrimitiveGrPoly;
71975
- grPoly.contours = [new Pts5(relativePoints)];
72073
+ grPoly.contours = [new Pts6(relativePoints)];
71976
72074
  grPoly.width = 0;
71977
72075
  grPoly.filled = true;
71978
72076
  padPrimitives = new PadPrimitives;
@@ -72081,7 +72179,7 @@ function createThruHolePadFromCircuitJson({
72081
72179
  const relativeX = platedHole.x - componentCenter.x;
72082
72180
  const relativeY = -(platedHole.y - componentCenter.y);
72083
72181
  const rotationMatrix = componentRotation !== 0 ? rotate7(componentRotation * Math.PI / 180) : identity4();
72084
- const rotatedPos = applyToPoint14(rotationMatrix, {
72182
+ const rotatedPos = applyToPoint15(rotationMatrix, {
72085
72183
  x: relativeX,
72086
72184
  y: relativeY
72087
72185
  });
@@ -72097,7 +72195,7 @@ function createThruHolePadFromCircuitJson({
72097
72195
  y: platedHole.hole_offset_y ?? 0
72098
72196
  };
72099
72197
  if (rawOffset.x !== 0 || rawOffset.y !== 0) {
72100
- const rotatedOffset = applyToPoint14(rotationMatrix, {
72198
+ const rotatedOffset = applyToPoint15(rotationMatrix, {
72101
72199
  x: -rawOffset.x,
72102
72200
  y: rawOffset.y
72103
72201
  });
@@ -72213,7 +72311,7 @@ function createNpthPadFromCircuitJson({
72213
72311
  const relativeX = pcbHole.x - componentCenter.x;
72214
72312
  const relativeY = -(pcbHole.y - componentCenter.y);
72215
72313
  const rotationMatrix = componentRotation !== 0 ? rotate8(componentRotation * Math.PI / 180) : identity5();
72216
- const rotatedPos = applyToPoint15(rotationMatrix, {
72314
+ const rotatedPos = applyToPoint16(rotationMatrix, {
72217
72315
  x: relativeX,
72218
72316
  y: relativeY
72219
72317
  });
@@ -72328,7 +72426,7 @@ var AddFootprintsStage = class extends ConverterStage {
72328
72426
  const sourceComponent = component.source_component_id ? this.ctx.db.source_component.get(component.source_component_id) : null;
72329
72427
  const cadComponent = this.getCadComponentForPcbComponent(component.pcb_component_id);
72330
72428
  const footprintName = sourceComponent ? getKicadCompatibleComponentName(sourceComponent, cadComponent) : "Unknown";
72331
- const transformedPos = applyToPoint16(c2kMatPcb, {
72429
+ const transformedPos = applyToPoint17(c2kMatPcb, {
72332
72430
  x: component.center.x,
72333
72431
  y: component.center.y
72334
72432
  });
@@ -72539,8 +72637,8 @@ var AddTracesStage = class extends ConverterStage {
72539
72637
  if (!startPosition || !endPosition) {
72540
72638
  throw new Error(`Unable to convert pcb_trace route segment ${trace.pcb_trace_id ?? this.tracesProcessed}:${i} to KiCad segment`);
72541
72639
  }
72542
- const transformedStart = applyToPoint17(c2kMatPcb, startPosition);
72543
- const transformedEnd = applyToPoint17(c2kMatPcb, endPosition);
72640
+ const transformedStart = applyToPoint18(c2kMatPcb, startPosition);
72641
+ const transformedEnd = applyToPoint18(c2kMatPcb, endPosition);
72544
72642
  if (transformedStart.x === transformedEnd.x && transformedStart.y === transformedEnd.y) {
72545
72643
  continue;
72546
72644
  }
@@ -72665,7 +72763,7 @@ var AddViasStage = class extends ConverterStage {
72665
72763
  this.finished = true;
72666
72764
  return;
72667
72765
  }
72668
- const transformedPos = applyToPoint18(c2kMatPcb, {
72766
+ const transformedPos = applyToPoint19(c2kMatPcb, {
72669
72767
  x: via.x,
72670
72768
  y: via.y
72671
72769
  });
@@ -72761,7 +72859,7 @@ var AddStandalonePcbElements = class extends ConverterStage {
72761
72859
  const pcbPad = elm;
72762
72860
  const padCenter = this.getPcbSmtPadCenter(pcbPad);
72763
72861
  const footprintSeed = `standalone_smtpad:${pcbPad.pcb_smtpad_id}:${padCenter.x},${padCenter.y}`;
72764
- const kicadPos = applyToPoint19(c2kMatPcb, padCenter);
72862
+ const kicadPos = applyToPoint20(c2kMatPcb, padCenter);
72765
72863
  const footprint = new Footprint4({
72766
72864
  libraryLink: this.getSmtPadLibraryLink(pcbPad),
72767
72865
  layer: "F.Cu",
@@ -72783,7 +72881,7 @@ var AddStandalonePcbElements = class extends ConverterStage {
72783
72881
  } else if (elm.type === "pcb_hole") {
72784
72882
  const hole = elm;
72785
72883
  const footprintSeed = `standalone_hole:${hole.pcb_hole_id}:${hole.x},${hole.y}`;
72786
- const kicadPos = applyToPoint19(c2kMatPcb, { x: hole.x, y: hole.y });
72884
+ const kicadPos = applyToPoint20(c2kMatPcb, { x: hole.x, y: hole.y });
72787
72885
  const libraryLink = this.getHoleLibraryLink(hole);
72788
72886
  const footprint = new Footprint4({
72789
72887
  libraryLink,
@@ -72806,7 +72904,7 @@ var AddStandalonePcbElements = class extends ConverterStage {
72806
72904
  } else if (elm.type === "pcb_plated_hole") {
72807
72905
  const hole = elm;
72808
72906
  const footprintSeed = `standalone_plated_hole:${hole.pcb_plated_hole_id}:${hole.x},${hole.y}`;
72809
- const kicadPos = applyToPoint19(c2kMatPcb, { x: hole.x, y: hole.y });
72907
+ const kicadPos = applyToPoint20(c2kMatPcb, { x: hole.x, y: hole.y });
72810
72908
  const libraryLink = this.getPlatedHoleLibraryLink(hole);
72811
72909
  const footprint = new Footprint4({
72812
72910
  libraryLink,
@@ -72903,7 +73001,7 @@ function createFabricationNoteTextFromCircuitJson({
72903
73001
  if (!textElement.text || !textElement.anchor_position) {
72904
73002
  return null;
72905
73003
  }
72906
- const transformedPos = applyToPoint20(c2kMatPcb, {
73004
+ const transformedPos = applyToPoint21(c2kMatPcb, {
72907
73005
  x: textElement.anchor_position.x,
72908
73006
  y: textElement.anchor_position.y
72909
73007
  });
@@ -72913,7 +73011,7 @@ function createFabricationNoteTextFromCircuitJson({
72913
73011
  };
72914
73012
  const kicadLayer = layerMap[textElement.layer] || textElement.layer || "F.Fab";
72915
73013
  const fontSize = (textElement.font_size || 1) / 1.5;
72916
- const font = new TextEffectsFont10;
73014
+ const font = new TextEffectsFont11;
72917
73015
  font.size = { width: fontSize, height: fontSize };
72918
73016
  const justify = new TextEffectsJustify3;
72919
73017
  const anchorAlignment = textElement.anchor_alignment || "center";
@@ -72937,7 +73035,7 @@ function createFabricationNoteTextFromCircuitJson({
72937
73035
  case "center":
72938
73036
  break;
72939
73037
  }
72940
- const textEffects = new TextEffects10({
73038
+ const textEffects = new TextEffects11({
72941
73039
  font
72942
73040
  });
72943
73041
  if (anchorAlignment !== "center") {
@@ -72960,7 +73058,7 @@ function createGrTextFromCircuitJson({
72960
73058
  if (!textElement.text || !textElement.anchor_position) {
72961
73059
  return null;
72962
73060
  }
72963
- const transformedPos = applyToPoint21(c2kMatPcb, {
73061
+ const transformedPos = applyToPoint22(c2kMatPcb, {
72964
73062
  x: textElement.anchor_position.x,
72965
73063
  y: textElement.anchor_position.y
72966
73064
  });
@@ -72970,7 +73068,7 @@ function createGrTextFromCircuitJson({
72970
73068
  };
72971
73069
  const kicadLayer = layerMap[textElement.layer] || textElement.layer || "F.SilkS";
72972
73070
  const fontSize = (textElement.font_size || 1) / 1.5;
72973
- const font = new TextEffectsFont11;
73071
+ const font = new TextEffectsFont12;
72974
73072
  font.size = { width: fontSize, height: fontSize };
72975
73073
  const justify = new TextEffectsJustify4;
72976
73074
  const anchorAlignment = textElement.anchor_alignment || "center";
@@ -72994,7 +73092,7 @@ function createGrTextFromCircuitJson({
72994
73092
  case "center":
72995
73093
  break;
72996
73094
  }
72997
- const textEffects = new TextEffects11({
73095
+ const textEffects = new TextEffects12({
72998
73096
  font
72999
73097
  });
73000
73098
  if (anchorAlignment !== "center") {
@@ -73044,7 +73142,7 @@ var appendGraphicPoly = (kicadPcb, grPoly) => {
73044
73142
  var rotatePointAroundOrigin = (point, rotationDegrees = 0) => {
73045
73143
  if (!rotationDegrees)
73046
73144
  return point;
73047
- return applyToPoint22(rotate9(rotationDegrees * Math.PI / 180), point);
73145
+ return applyToPoint23(rotate9(rotationDegrees * Math.PI / 180), point);
73048
73146
  };
73049
73147
  var getRectCutoutCorners = (cutout) => {
73050
73148
  const halfWidth = cutout.width / 2;
@@ -73081,11 +73179,11 @@ var AddGraphicsStage = class extends ConverterStage {
73081
73179
  const endPoint = path7.route[i + 1];
73082
73180
  if (!startPoint || !endPoint)
73083
73181
  continue;
73084
- const transformedStart = applyToPoint22(c2kMatPcb, {
73182
+ const transformedStart = applyToPoint23(c2kMatPcb, {
73085
73183
  x: startPoint.x,
73086
73184
  y: startPoint.y
73087
73185
  });
73088
- const transformedEnd = applyToPoint22(c2kMatPcb, {
73186
+ const transformedEnd = applyToPoint23(c2kMatPcb, {
73089
73187
  x: endPoint.x,
73090
73188
  y: endPoint.y
73091
73189
  });
@@ -73147,7 +73245,7 @@ var AddGraphicsStage = class extends ConverterStage {
73147
73245
  { x: board.center.x - halfWidth, y: board.center.y + halfHeight }
73148
73246
  ];
73149
73247
  }
73150
- const transformedCorners = corners.map((corner) => applyToPoint22(c2kMatPcb, corner));
73248
+ const transformedCorners = corners.map((corner) => applyToPoint23(c2kMatPcb, corner));
73151
73249
  if (transformedCorners.length < 2) {
73152
73250
  this.finished = true;
73153
73251
  return;
@@ -73171,8 +73269,8 @@ var AddGraphicsStage = class extends ConverterStage {
73171
73269
  const pcbCutouts = this.ctx.db.pcb_cutout?.list() || [];
73172
73270
  for (const cutout of pcbCutouts) {
73173
73271
  if (cutout.shape === "circle") {
73174
- const transformedCenter = applyToPoint22(c2kMatPcb, cutout.center);
73175
- const transformedEnd = applyToPoint22(c2kMatPcb, {
73272
+ const transformedCenter = applyToPoint23(c2kMatPcb, cutout.center);
73273
+ const transformedEnd = applyToPoint23(c2kMatPcb, {
73176
73274
  x: cutout.center.x + cutout.radius,
73177
73275
  y: cutout.center.y
73178
73276
  });
@@ -73187,7 +73285,7 @@ var AddGraphicsStage = class extends ConverterStage {
73187
73285
  if (corners.length < 3)
73188
73286
  continue;
73189
73287
  appendGraphicPoly(kicadPcb, new GrPoly({
73190
- points: corners.map((point) => applyToPoint22(c2kMatPcb, point)),
73288
+ points: corners.map((point) => applyToPoint23(c2kMatPcb, point)),
73191
73289
  layer: "Edge.Cuts",
73192
73290
  width: EDGE_CUTS_WIDTH,
73193
73291
  fill: false
@@ -73197,7 +73295,7 @@ var AddGraphicsStage = class extends ConverterStage {
73197
73295
  if (corners.length < 3)
73198
73296
  continue;
73199
73297
  appendGraphicPoly(kicadPcb, new GrPoly({
73200
- points: corners.map((point) => applyToPoint22(c2kMatPcb, point)),
73298
+ points: corners.map((point) => applyToPoint23(c2kMatPcb, point)),
73201
73299
  layer: "Edge.Cuts",
73202
73300
  width: EDGE_CUTS_WIDTH,
73203
73301
  fill: false
@@ -73210,8 +73308,8 @@ var AddGraphicsStage = class extends ConverterStage {
73210
73308
  const endPoint = cutout.route[i + 1];
73211
73309
  if (!startPoint || !endPoint)
73212
73310
  continue;
73213
- const transformedStart = applyToPoint22(c2kMatPcb, startPoint);
73214
- const transformedEnd = applyToPoint22(c2kMatPcb, endPoint);
73311
+ const transformedStart = applyToPoint23(c2kMatPcb, startPoint);
73312
+ const transformedEnd = applyToPoint23(c2kMatPcb, endPoint);
73215
73313
  appendGraphicLine(kicadPcb, new GrLine({
73216
73314
  start: transformedStart,
73217
73315
  end: transformedEnd,
@@ -73728,7 +73826,7 @@ function renameKicadFootprint(params2) {
73728
73826
  };
73729
73827
  }
73730
73828
  function createTextEffects3(metadataEffects) {
73731
- const font = new TextEffectsFont12;
73829
+ const font = new TextEffectsFont13;
73732
73830
  if (metadataEffects?.font?.size) {
73733
73831
  font.size = {
73734
73832
  width: Number(metadataEffects.font.size.x),
@@ -73742,7 +73840,7 @@ function createTextEffects3(metadataEffects) {
73742
73840
  } else {
73743
73841
  font.thickness = 0.15;
73744
73842
  }
73745
- return new TextEffects12({ font });
73843
+ return new TextEffects13({ font });
73746
73844
  }
73747
73845
  function applyKicadFootprintMetadata(kicadModString, metadata, footprintName) {
73748
73846
  try {
@@ -73984,13 +74082,13 @@ var toNumber = (value, fallback) => {
73984
74082
  var createTextEffects4 = (effectsMeta, fallback) => {
73985
74083
  if (!effectsMeta)
73986
74084
  return fallback;
73987
- const effects = new TextEffects13({
74085
+ const effects = new TextEffects14({
73988
74086
  font: fallback?.font,
73989
74087
  justify: fallback?.justify,
73990
74088
  hiddenText: fallback?.hiddenText ?? false
73991
74089
  });
73992
74090
  if (!effects.font) {
73993
- const defaultFont = new TextEffectsFont13;
74091
+ const defaultFont = new TextEffectsFont14;
73994
74092
  defaultFont.size = { width: DEFAULT_TEXT_SIZE, height: DEFAULT_TEXT_SIZE };
73995
74093
  effects.font = defaultFont;
73996
74094
  }