kicad-to-circuit-json 0.0.150 → 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 +29 -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);
|
|
@@ -5251,6 +5250,7 @@ var CollectZonesStage = class extends ConverterStage {
|
|
|
5251
5250
|
if (netKey !== null) {
|
|
5252
5251
|
netName = this.ctx.netNumToName.get(netKey) || netName;
|
|
5253
5252
|
}
|
|
5253
|
+
const sourceNetId = netKey !== null && netKey !== 0 ? this.ctx.netNumToSourceNetId?.get(netKey) : void 0;
|
|
5254
5254
|
for (const polygonRecord of polygonRecords) {
|
|
5255
5255
|
const transformedPoints = polygonRecord.points.map(
|
|
5256
5256
|
(point) => applyToPoint10(this.ctx.k2cMatPcb, { x: point.x, y: point.y })
|
|
@@ -5258,6 +5258,7 @@ var CollectZonesStage = class extends ConverterStage {
|
|
|
5258
5258
|
this.ctx.db.pcb_copper_pour.insert({
|
|
5259
5259
|
layer: polygonRecord.layer,
|
|
5260
5260
|
net_name: netName,
|
|
5261
|
+
source_net_id: sourceNetId,
|
|
5261
5262
|
points: transformedPoints,
|
|
5262
5263
|
shape: "polygon"
|
|
5263
5264
|
});
|
|
@@ -5292,21 +5293,33 @@ var CollectZonesStage = class extends ConverterStage {
|
|
|
5292
5293
|
}
|
|
5293
5294
|
getPolygonLayers(zone, polygon) {
|
|
5294
5295
|
if (polygon.layer) {
|
|
5295
|
-
return
|
|
5296
|
+
return this.getCopperLayerRefs(polygon.layer);
|
|
5296
5297
|
}
|
|
5297
5298
|
return this.getZoneLayers(zone);
|
|
5298
5299
|
}
|
|
5299
5300
|
getZoneLayers(zone) {
|
|
5300
|
-
|
|
5301
|
-
|
|
5302
|
-
|
|
5303
|
-
|
|
5304
|
-
|
|
5305
|
-
|
|
5306
|
-
|
|
5307
|
-
|
|
5308
|
-
|
|
5309
|
-
|
|
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);
|
|
5310
5323
|
}
|
|
5311
5324
|
getZoneLayerLabel(zone) {
|
|
5312
5325
|
return [...zone.layer?.names ?? [], ...zone.layers?.names ?? []].join(" ") || "unknown";
|