kicad-to-circuit-json 0.0.151 → 0.0.152
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +7 -0
- package/dist/index.js +27 -16
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -314,6 +314,13 @@ declare class CollectZonesStage extends ConverterStage {
|
|
|
314
314
|
private createZonePolygonRecordsFromShape;
|
|
315
315
|
private getPolygonLayers;
|
|
316
316
|
private getZoneLayers;
|
|
317
|
+
private isZoneOnCopper;
|
|
318
|
+
/**
|
|
319
|
+
* The copper layers that the KiCad layers of a zone or of its fill name.
|
|
320
|
+
* "*.Cu" is every copper layer of the board and the legacy "F&B.Cu" is
|
|
321
|
+
* both outer layers; a technical layer such as F.Mask is none.
|
|
322
|
+
*/
|
|
323
|
+
private getCopperLayerRefs;
|
|
317
324
|
private getZoneLayerLabel;
|
|
318
325
|
private extractPointsFromPts;
|
|
319
326
|
}
|
package/dist/index.js
CHANGED
|
@@ -5239,11 +5239,10 @@ var CollectZonesStage = class extends ConverterStage {
|
|
|
5239
5239
|
if (!this.ctx.k2cMatPcb || !this.ctx.netNumToName) return;
|
|
5240
5240
|
const polygonRecords = this.getZonePolygonRecords(zone);
|
|
5241
5241
|
if (polygonRecords.length === 0) {
|
|
5242
|
-
|
|
5243
|
-
|
|
5244
|
-
|
|
5245
|
-
|
|
5246
|
-
}
|
|
5242
|
+
const reason = this.isZoneOnCopper(zone) ? "has no valid polygon points" : "is not on a copper layer and was not imported as a copper pour";
|
|
5243
|
+
this.ctx.warnings?.push(
|
|
5244
|
+
`Zone on layer ${this.getZoneLayerLabel(zone)} ${reason}`
|
|
5245
|
+
);
|
|
5247
5246
|
return;
|
|
5248
5247
|
}
|
|
5249
5248
|
const netKey = getKicadNetKey(zone);
|
|
@@ -5294,21 +5293,33 @@ var CollectZonesStage = class extends ConverterStage {
|
|
|
5294
5293
|
}
|
|
5295
5294
|
getPolygonLayers(zone, polygon) {
|
|
5296
5295
|
if (polygon.layer) {
|
|
5297
|
-
return
|
|
5296
|
+
return this.getCopperLayerRefs(polygon.layer);
|
|
5298
5297
|
}
|
|
5299
5298
|
return this.getZoneLayers(zone);
|
|
5300
5299
|
}
|
|
5301
5300
|
getZoneLayers(zone) {
|
|
5302
|
-
|
|
5303
|
-
|
|
5304
|
-
|
|
5305
|
-
|
|
5306
|
-
|
|
5307
|
-
|
|
5308
|
-
|
|
5309
|
-
|
|
5310
|
-
|
|
5311
|
-
|
|
5301
|
+
return this.getCopperLayerRefs(zone.layer ?? zone.layers);
|
|
5302
|
+
}
|
|
5303
|
+
isZoneOnCopper(zone) {
|
|
5304
|
+
const layerSources = [
|
|
5305
|
+
zone.layer,
|
|
5306
|
+
zone.layers,
|
|
5307
|
+
...zone.filledPolygons.map((filledPolygon) => filledPolygon.layer)
|
|
5308
|
+
];
|
|
5309
|
+
return layerSources.some(
|
|
5310
|
+
(layerSource) => this.getCopperLayerRefs(layerSource).length > 0
|
|
5311
|
+
);
|
|
5312
|
+
}
|
|
5313
|
+
/**
|
|
5314
|
+
* The copper layers that the KiCad layers of a zone or of its fill name.
|
|
5315
|
+
* "*.Cu" is every copper layer of the board and the legacy "F&B.Cu" is
|
|
5316
|
+
* both outer layers; a technical layer such as F.Mask is none.
|
|
5317
|
+
*/
|
|
5318
|
+
getCopperLayerRefs(layer) {
|
|
5319
|
+
const layerNames = extractKicadLayerNames(layer).flatMap(
|
|
5320
|
+
(layerName) => layerName === "F&B.Cu" ? ["F.Cu", "B.Cu"] : [layerName]
|
|
5321
|
+
);
|
|
5322
|
+
return getLayerRefsFromLayers(layerNames, this.ctx.kicadPcb);
|
|
5312
5323
|
}
|
|
5313
5324
|
getZoneLayerLabel(zone) {
|
|
5314
5325
|
return [...zone.layer?.names ?? [], ...zone.layers?.names ?? []].join(" ") || "unknown";
|