circuit-json-to-gerber 0.0.77 → 0.0.79
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.
|
@@ -402,9 +402,11 @@ var getTraceRouteViaElements = (circuitJson) => {
|
|
|
402
402
|
continue;
|
|
403
403
|
}
|
|
404
404
|
for (const [index, point] of element.route.entries()) {
|
|
405
|
-
if (point.route_type !== "via" || typeof point.hole_diameter !== "number" || typeof point.outer_diameter !== "number") {
|
|
405
|
+
if (point.route_type !== "via" || typeof point.hole_diameter !== "number" || typeof point.outer_diameter !== "number" || typeof point.from_layer !== "string" || typeof point.to_layer !== "string") {
|
|
406
406
|
continue;
|
|
407
407
|
}
|
|
408
|
+
const fromLayer = point.from_layer;
|
|
409
|
+
const toLayer = point.to_layer;
|
|
408
410
|
routeVias.push({
|
|
409
411
|
type: "pcb_via",
|
|
410
412
|
pcb_via_id: `${element.pcb_trace_id}_route_via_${index}`,
|
|
@@ -412,9 +414,9 @@ var getTraceRouteViaElements = (circuitJson) => {
|
|
|
412
414
|
y: point.y,
|
|
413
415
|
hole_diameter: point.hole_diameter,
|
|
414
416
|
outer_diameter: point.outer_diameter,
|
|
415
|
-
from_layer:
|
|
416
|
-
to_layer:
|
|
417
|
-
layers: [
|
|
417
|
+
from_layer: fromLayer,
|
|
418
|
+
to_layer: toLayer,
|
|
419
|
+
layers: [fromLayer, toLayer]
|
|
418
420
|
});
|
|
419
421
|
}
|
|
420
422
|
}
|
|
@@ -464,6 +466,9 @@ var convertSoupToExcellonDrillCommands = ({
|
|
|
464
466
|
})) {
|
|
465
467
|
continue;
|
|
466
468
|
}
|
|
469
|
+
if (is_plated && element.type === "pcb_hole") {
|
|
470
|
+
continue;
|
|
471
|
+
}
|
|
467
472
|
const holeDiameter = "hole_diameter" in element && typeof element.hole_diameter === "number" ? element.hole_diameter : "hole_width" in element && typeof element.hole_width === "number" && "hole_height" in element && typeof element.hole_height === "number" ? Math.min(element.hole_width, element.hole_height) : void 0;
|
|
468
473
|
if (!holeDiameter) continue;
|
|
469
474
|
if (!diameterToToolNumber[holeDiameter]) {
|
|
@@ -493,6 +498,9 @@ var convertSoupToExcellonDrillCommands = ({
|
|
|
493
498
|
})) {
|
|
494
499
|
continue;
|
|
495
500
|
}
|
|
501
|
+
if (is_plated && element.type === "pcb_hole") {
|
|
502
|
+
continue;
|
|
503
|
+
}
|
|
496
504
|
const holeDiameter = "hole_diameter" in element && typeof element.hole_diameter === "number" ? element.hole_diameter : "hole_width" in element && typeof element.hole_width === "number" && "hole_height" in element && typeof element.hole_height === "number" ? Math.min(element.hole_width, element.hole_height) : void 0;
|
|
497
505
|
if (!holeDiameter || diameterToToolNumber[holeDiameter] !== i) {
|
|
498
506
|
continue;
|
|
@@ -1568,6 +1576,33 @@ var getApertureConfigFromPcbCopperText = (elm) => {
|
|
|
1568
1576
|
}
|
|
1569
1577
|
throw new Error(`Provide font_size for: ${elm}`);
|
|
1570
1578
|
};
|
|
1579
|
+
var getApertureConfigFromPcbFabricationNoteText = (elm) => {
|
|
1580
|
+
if ("font_size" in elm) {
|
|
1581
|
+
return {
|
|
1582
|
+
standard_template_code: "C",
|
|
1583
|
+
diameter: elm.font_size / 8
|
|
1584
|
+
};
|
|
1585
|
+
}
|
|
1586
|
+
throw new Error(`Provide font_size for: ${elm}`);
|
|
1587
|
+
};
|
|
1588
|
+
var getApertureConfigFromPcbFabricationNotePath = (elm) => {
|
|
1589
|
+
if (!("stroke_width" in elm) || typeof elm.stroke_width !== "number") {
|
|
1590
|
+
return {
|
|
1591
|
+
standard_template_code: "C",
|
|
1592
|
+
diameter: 0.1
|
|
1593
|
+
};
|
|
1594
|
+
}
|
|
1595
|
+
return {
|
|
1596
|
+
standard_template_code: "C",
|
|
1597
|
+
diameter: elm.stroke_width
|
|
1598
|
+
};
|
|
1599
|
+
};
|
|
1600
|
+
var getApertureConfigFromPcbFabricationNoteDimension = (elm) => {
|
|
1601
|
+
return {
|
|
1602
|
+
standard_template_code: "C",
|
|
1603
|
+
diameter: Math.max(0.05, elm.font_size / 10)
|
|
1604
|
+
};
|
|
1605
|
+
};
|
|
1571
1606
|
var getApertureConfigFromPcbSolderPaste = (elm) => {
|
|
1572
1607
|
if (elm.shape === "rect") {
|
|
1573
1608
|
return {
|
|
@@ -1770,6 +1805,7 @@ function getAllApertureTemplateConfigsForLayer({
|
|
|
1770
1805
|
const configHashMap = /* @__PURE__ */ new Set();
|
|
1771
1806
|
const isSoldermaskLayer = glayer_name.endsWith("_Mask");
|
|
1772
1807
|
const isCopperLayer = glayer_name.endsWith("_Cu");
|
|
1808
|
+
const isFabricationLayer = glayer_name.endsWith("_Fab");
|
|
1773
1809
|
const addConfigIfNew = (config) => {
|
|
1774
1810
|
const hash = stableStringify(config);
|
|
1775
1811
|
if (!configHashMap.has(hash)) {
|
|
@@ -1779,6 +1815,7 @@ function getAllApertureTemplateConfigsForLayer({
|
|
|
1779
1815
|
};
|
|
1780
1816
|
for (const elm of circuitJson) {
|
|
1781
1817
|
if (elm.type === "pcb_smtpad") {
|
|
1818
|
+
if (isFabricationLayer) continue;
|
|
1782
1819
|
if (elm.layer === layer && elm.shape !== "polygon") {
|
|
1783
1820
|
if (isSoldermaskLayer) {
|
|
1784
1821
|
addConfigIfNew(getApertureConfigFromPcbSmtpadSoldermask(elm));
|
|
@@ -1787,6 +1824,7 @@ function getAllApertureTemplateConfigsForLayer({
|
|
|
1787
1824
|
}
|
|
1788
1825
|
}
|
|
1789
1826
|
} else if (elm.type === "pcb_solder_paste") {
|
|
1827
|
+
if (isFabricationLayer) continue;
|
|
1790
1828
|
if (elm.layer === layer) {
|
|
1791
1829
|
addConfigIfNew(getApertureConfigFromPcbSolderPaste(elm));
|
|
1792
1830
|
if (elm.shape === "pill") {
|
|
@@ -1800,6 +1838,7 @@ function getAllApertureTemplateConfigsForLayer({
|
|
|
1800
1838
|
}
|
|
1801
1839
|
}
|
|
1802
1840
|
} else if (elm.type === "pcb_plated_hole") {
|
|
1841
|
+
if (isFabricationLayer) continue;
|
|
1803
1842
|
if (elm.layers.includes(layer)) {
|
|
1804
1843
|
if (elm.shape === "hole_with_polygon_pad") {
|
|
1805
1844
|
continue;
|
|
@@ -1814,6 +1853,7 @@ function getAllApertureTemplateConfigsForLayer({
|
|
|
1814
1853
|
}
|
|
1815
1854
|
}
|
|
1816
1855
|
} else if (elm.type === "pcb_hole") {
|
|
1856
|
+
if (!isSoldermaskLayer) continue;
|
|
1817
1857
|
if (glayer_name.endsWith("_Mask") && elm.is_covered_with_solder_mask === true) {
|
|
1818
1858
|
continue;
|
|
1819
1859
|
}
|
|
@@ -1826,18 +1866,39 @@ function getAllApertureTemplateConfigsForLayer({
|
|
|
1826
1866
|
} else
|
|
1827
1867
|
console.warn("NOT IMPLEMENTED: drawing gerber for non circle holes");
|
|
1828
1868
|
} else if (elm.type === "pcb_via") {
|
|
1869
|
+
if (isFabricationLayer) continue;
|
|
1829
1870
|
addConfigIfNew(getApertureConfigFromOuterDiameter(elm));
|
|
1830
1871
|
} else if (elm.type === "pcb_trace") {
|
|
1872
|
+
if (isFabricationLayer) continue;
|
|
1831
1873
|
for (const point of elm.route) {
|
|
1832
1874
|
if (point.route_type === "via" && typeof point.outer_diameter === "number" && (point.from_layer === layer || point.to_layer === layer)) {
|
|
1833
1875
|
addConfigIfNew(getApertureConfigFromOuterDiameter(point));
|
|
1834
1876
|
}
|
|
1835
1877
|
}
|
|
1836
|
-
} else if (elm.type === "pcb_silkscreen_path")
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1878
|
+
} else if (elm.type === "pcb_silkscreen_path") {
|
|
1879
|
+
if (!isFabricationLayer)
|
|
1880
|
+
addConfigIfNew(getApertureConfigFromPcbSilkscreenPath(elm));
|
|
1881
|
+
} else if (elm.type === "pcb_silkscreen_text") {
|
|
1882
|
+
if (!isFabricationLayer)
|
|
1883
|
+
addConfigIfNew(getApertureConfigFromPcbSilkscreenText(elm));
|
|
1884
|
+
} else if (elm.type === "pcb_fabrication_note_text") {
|
|
1885
|
+
if (isFabricationLayer && elm.layer === layer)
|
|
1886
|
+
addConfigIfNew(getApertureConfigFromPcbFabricationNoteText(elm));
|
|
1887
|
+
} else if (elm.type === "pcb_fabrication_note_path") {
|
|
1888
|
+
if (isFabricationLayer && elm.layer === layer)
|
|
1889
|
+
addConfigIfNew(getApertureConfigFromPcbFabricationNotePath(elm));
|
|
1890
|
+
} else if (elm.type === "pcb_fabrication_note_rect") {
|
|
1891
|
+
if (isFabricationLayer && elm.layer === layer) {
|
|
1892
|
+
if (elm.has_stroke !== false)
|
|
1893
|
+
addConfigIfNew(getApertureConfigFromPcbFabricationNotePath(elm));
|
|
1894
|
+
if (elm.is_filled === true) addConfigIfNew(REGION_APERTURE_CONFIG);
|
|
1895
|
+
}
|
|
1896
|
+
} else if (elm.type === "pcb_fabrication_note_dimension") {
|
|
1897
|
+
if (isFabricationLayer && elm.layer === layer) {
|
|
1898
|
+
addConfigIfNew(getApertureConfigFromPcbFabricationNoteDimension(elm));
|
|
1899
|
+
addConfigIfNew(getApertureConfigFromPcbFabricationNoteText(elm));
|
|
1900
|
+
}
|
|
1901
|
+
} else if (elm.type === "pcb_copper_text") {
|
|
1841
1902
|
if (elm.layer === layer)
|
|
1842
1903
|
addConfigIfNew(getApertureConfigFromPcbCopperText(elm));
|
|
1843
1904
|
}
|
|
@@ -1892,7 +1953,7 @@ var findApertureNumber = (glayer, search_params) => {
|
|
|
1892
1953
|
// package.json
|
|
1893
1954
|
var package_default = {
|
|
1894
1955
|
name: "circuit-json-to-gerber",
|
|
1895
|
-
version: "0.0.
|
|
1956
|
+
version: "0.0.78",
|
|
1896
1957
|
main: "dist/index.js",
|
|
1897
1958
|
type: "module",
|
|
1898
1959
|
scripts: {
|
|
@@ -1947,6 +2008,8 @@ var layerAndTypeToFileFunction = {
|
|
|
1947
2008
|
"bottom-soldermask": "Soldermask,Bot",
|
|
1948
2009
|
"top-silkscreen": "Legend,Top",
|
|
1949
2010
|
"bottom-silkscreen": "Legend,Bot",
|
|
2011
|
+
"top-fabrication": "Other,Fab,Top",
|
|
2012
|
+
"bottom-fabrication": "Other,Fab,Bot",
|
|
1950
2013
|
"top-paste": "Paste,Top",
|
|
1951
2014
|
"bottom-paste": "Paste,Bot",
|
|
1952
2015
|
edgecut: "Profile,NP"
|
|
@@ -2009,6 +2072,7 @@ var layerRefToGerberPrefix = {
|
|
|
2009
2072
|
var layerTypeToGerberSuffix = {
|
|
2010
2073
|
copper: "Cu",
|
|
2011
2074
|
silkscreen: "SilkScreen",
|
|
2075
|
+
fabrication: "Fab",
|
|
2012
2076
|
soldermask: "Mask",
|
|
2013
2077
|
mask: "Mask",
|
|
2014
2078
|
paste: "Paste"
|
|
@@ -2106,6 +2170,176 @@ import {
|
|
|
2106
2170
|
rotate,
|
|
2107
2171
|
translate
|
|
2108
2172
|
} from "transformation-matrix";
|
|
2173
|
+
|
|
2174
|
+
// src/gerber/convert-soup-to-gerber-commands/fabricationLayerRefs.ts
|
|
2175
|
+
var outerLayerRefs = ["top", "bottom"];
|
|
2176
|
+
var isOuterLayerRef = (layerRef) => layerRef === "top" || layerRef === "bottom";
|
|
2177
|
+
var isFabricationElementOnLayer = (element, layerRef) => (element.type === "pcb_fabrication_note_text" || element.type === "pcb_fabrication_note_path" || element.type === "pcb_fabrication_note_rect" || element.type === "pcb_fabrication_note_dimension") && element.layer === layerRef;
|
|
2178
|
+
var getFabricationLayerRefs = (circuitJson) => outerLayerRefs.filter(
|
|
2179
|
+
(layerRef) => circuitJson.some(
|
|
2180
|
+
(element) => isFabricationElementOnLayer(element, layerRef)
|
|
2181
|
+
)
|
|
2182
|
+
);
|
|
2183
|
+
|
|
2184
|
+
// src/gerber/convert-soup-to-gerber-commands/getFabRectPoints.ts
|
|
2185
|
+
var getFabRectPoints = (element) => {
|
|
2186
|
+
const halfWidth = element.width / 2;
|
|
2187
|
+
const halfHeight = element.height / 2;
|
|
2188
|
+
const { x, y } = element.center;
|
|
2189
|
+
return [
|
|
2190
|
+
{ x: x - halfWidth, y: y - halfHeight },
|
|
2191
|
+
{ x: x + halfWidth, y: y - halfHeight },
|
|
2192
|
+
{ x: x + halfWidth, y: y + halfHeight },
|
|
2193
|
+
{ x: x - halfWidth, y: y + halfHeight }
|
|
2194
|
+
];
|
|
2195
|
+
};
|
|
2196
|
+
|
|
2197
|
+
// src/gerber/convert-soup-to-gerber-commands/renderOpenPath.ts
|
|
2198
|
+
var renderOpenPath = ({
|
|
2199
|
+
element,
|
|
2200
|
+
glayer,
|
|
2201
|
+
apertureConfig,
|
|
2202
|
+
route,
|
|
2203
|
+
mapY
|
|
2204
|
+
}) => {
|
|
2205
|
+
if (route.length === 0) return;
|
|
2206
|
+
const gerber = gerberBuilder().add("select_aperture", {
|
|
2207
|
+
aperture_number: findApertureNumber(glayer, apertureConfig)
|
|
2208
|
+
});
|
|
2209
|
+
gerber.add("move_operation", {
|
|
2210
|
+
x: route[0].x,
|
|
2211
|
+
y: mapY(route[0].y)
|
|
2212
|
+
});
|
|
2213
|
+
const isDashed = element.is_stroke_dashed === true;
|
|
2214
|
+
if (!isDashed) {
|
|
2215
|
+
for (let i = 1; i < route.length; i++) {
|
|
2216
|
+
gerber.add("plot_operation", {
|
|
2217
|
+
x: route[i].x,
|
|
2218
|
+
y: mapY(route[i].y)
|
|
2219
|
+
});
|
|
2220
|
+
}
|
|
2221
|
+
glayer.push(...gerber.build());
|
|
2222
|
+
return;
|
|
2223
|
+
}
|
|
2224
|
+
const dashLength = Math.max(0.2, (element.stroke_width ?? 0.1) * 4);
|
|
2225
|
+
const gapLength = dashLength;
|
|
2226
|
+
for (const [start, end] of pairs(route)) {
|
|
2227
|
+
const dx = end.x - start.x;
|
|
2228
|
+
const dy = end.y - start.y;
|
|
2229
|
+
const length = Math.hypot(dx, dy);
|
|
2230
|
+
if (length <= 1e-9) continue;
|
|
2231
|
+
const ux = dx / length;
|
|
2232
|
+
const uy = dy / length;
|
|
2233
|
+
let distance = 0;
|
|
2234
|
+
while (distance < length) {
|
|
2235
|
+
const dashEndDistance = Math.min(distance + dashLength, length);
|
|
2236
|
+
const dashStart = {
|
|
2237
|
+
x: start.x + ux * distance,
|
|
2238
|
+
y: start.y + uy * distance
|
|
2239
|
+
};
|
|
2240
|
+
const dashEnd = {
|
|
2241
|
+
x: start.x + ux * dashEndDistance,
|
|
2242
|
+
y: start.y + uy * dashEndDistance
|
|
2243
|
+
};
|
|
2244
|
+
gerber.add("move_operation", {
|
|
2245
|
+
x: dashStart.x,
|
|
2246
|
+
y: mapY(dashStart.y)
|
|
2247
|
+
});
|
|
2248
|
+
gerber.add("plot_operation", {
|
|
2249
|
+
x: dashEnd.x,
|
|
2250
|
+
y: mapY(dashEnd.y)
|
|
2251
|
+
});
|
|
2252
|
+
distance += dashLength + gapLength;
|
|
2253
|
+
}
|
|
2254
|
+
}
|
|
2255
|
+
glayer.push(...gerber.build());
|
|
2256
|
+
};
|
|
2257
|
+
|
|
2258
|
+
// src/gerber/convert-soup-to-gerber-commands/renderFabricationDimension.ts
|
|
2259
|
+
var renderFabricationDimension = ({
|
|
2260
|
+
element,
|
|
2261
|
+
glayer,
|
|
2262
|
+
mapY,
|
|
2263
|
+
renderText
|
|
2264
|
+
}) => {
|
|
2265
|
+
const from = element.from;
|
|
2266
|
+
const to = element.to;
|
|
2267
|
+
const dx = to.x - from.x;
|
|
2268
|
+
const dy = to.y - from.y;
|
|
2269
|
+
const length = Math.hypot(dx, dy);
|
|
2270
|
+
if (length <= 1e-9) return;
|
|
2271
|
+
const offsetDistance = element.offset_distance ?? element.offset ?? 0;
|
|
2272
|
+
const defaultOffsetDirection = { x: -dy / length, y: dx / length };
|
|
2273
|
+
const offsetDirection = element.offset_direction ?? defaultOffsetDirection;
|
|
2274
|
+
const offsetMagnitude = Math.hypot(offsetDirection.x, offsetDirection.y) || 1;
|
|
2275
|
+
const offsetVector = {
|
|
2276
|
+
x: offsetDirection.x / offsetMagnitude * offsetDistance,
|
|
2277
|
+
y: offsetDirection.y / offsetMagnitude * offsetDistance
|
|
2278
|
+
};
|
|
2279
|
+
const dimStart = { x: from.x + offsetVector.x, y: from.y + offsetVector.y };
|
|
2280
|
+
const dimEnd = { x: to.x + offsetVector.x, y: to.y + offsetVector.y };
|
|
2281
|
+
const arrowSize = element.arrow_size ?? 1;
|
|
2282
|
+
const ux = dx / length;
|
|
2283
|
+
const uy = dy / length;
|
|
2284
|
+
const px = -uy;
|
|
2285
|
+
const py = ux;
|
|
2286
|
+
const arrowHalfWidth = arrowSize * 0.35;
|
|
2287
|
+
const lineConfig = getApertureConfigFromPcbFabricationNoteDimension(element);
|
|
2288
|
+
renderOpenPath({
|
|
2289
|
+
element,
|
|
2290
|
+
glayer,
|
|
2291
|
+
apertureConfig: lineConfig,
|
|
2292
|
+
route: [from, dimStart, dimEnd, to],
|
|
2293
|
+
mapY
|
|
2294
|
+
});
|
|
2295
|
+
renderOpenPath({
|
|
2296
|
+
element,
|
|
2297
|
+
glayer,
|
|
2298
|
+
apertureConfig: lineConfig,
|
|
2299
|
+
route: [
|
|
2300
|
+
{
|
|
2301
|
+
x: dimStart.x + ux * arrowSize + px * arrowHalfWidth,
|
|
2302
|
+
y: dimStart.y + uy * arrowSize + py * arrowHalfWidth
|
|
2303
|
+
},
|
|
2304
|
+
dimStart,
|
|
2305
|
+
{
|
|
2306
|
+
x: dimStart.x + ux * arrowSize - px * arrowHalfWidth,
|
|
2307
|
+
y: dimStart.y + uy * arrowSize - py * arrowHalfWidth
|
|
2308
|
+
}
|
|
2309
|
+
],
|
|
2310
|
+
mapY
|
|
2311
|
+
});
|
|
2312
|
+
renderOpenPath({
|
|
2313
|
+
element,
|
|
2314
|
+
glayer,
|
|
2315
|
+
apertureConfig: lineConfig,
|
|
2316
|
+
route: [
|
|
2317
|
+
{
|
|
2318
|
+
x: dimEnd.x - ux * arrowSize + px * arrowHalfWidth,
|
|
2319
|
+
y: dimEnd.y - uy * arrowSize + py * arrowHalfWidth
|
|
2320
|
+
},
|
|
2321
|
+
dimEnd,
|
|
2322
|
+
{
|
|
2323
|
+
x: dimEnd.x - ux * arrowSize - px * arrowHalfWidth,
|
|
2324
|
+
y: dimEnd.y - uy * arrowSize - py * arrowHalfWidth
|
|
2325
|
+
}
|
|
2326
|
+
],
|
|
2327
|
+
mapY
|
|
2328
|
+
});
|
|
2329
|
+
if (element.text) {
|
|
2330
|
+
renderText({
|
|
2331
|
+
...element,
|
|
2332
|
+
anchor_position: {
|
|
2333
|
+
x: (dimStart.x + dimEnd.x) / 2,
|
|
2334
|
+
y: (dimStart.y + dimEnd.y) / 2
|
|
2335
|
+
},
|
|
2336
|
+
anchor_alignment: "center",
|
|
2337
|
+
ccw_rotation: element.text_ccw_rotation ?? Math.atan2(dy, dx) * 180 / Math.PI
|
|
2338
|
+
});
|
|
2339
|
+
}
|
|
2340
|
+
};
|
|
2341
|
+
|
|
2342
|
+
// src/gerber/convert-soup-to-gerber-commands/index.ts
|
|
2109
2343
|
var getLayerCount2 = (circuitJson) => {
|
|
2110
2344
|
const board = circuitJson.find((element) => element.type === "pcb_board");
|
|
2111
2345
|
const numLayers = board?.num_layers ?? 2;
|
|
@@ -2124,7 +2358,7 @@ var convertSoupToGerberCommands = (circuitJson, opts = {}) => {
|
|
|
2124
2358
|
const layerCount = getLayerCount2(circuitJson);
|
|
2125
2359
|
const innerLayerRefs = getInnerLayerRefs(layerCount);
|
|
2126
2360
|
const copperLayerRefs = ["top", ...innerLayerRefs, "bottom"];
|
|
2127
|
-
const
|
|
2361
|
+
const fabricationLayerRefs = getFabricationLayerRefs(circuitJson);
|
|
2128
2362
|
const glayers = {
|
|
2129
2363
|
F_Cu: getCommandHeaders({
|
|
2130
2364
|
layer: "top",
|
|
@@ -2171,9 +2405,18 @@ var convertSoupToGerberCommands = (circuitJson, opts = {}) => {
|
|
|
2171
2405
|
total_layer_count: layerCount
|
|
2172
2406
|
});
|
|
2173
2407
|
}
|
|
2408
|
+
for (const layerRef of fabricationLayerRefs) {
|
|
2409
|
+
glayers[getGerberLayerName(layerRef, "fabrication")] = getCommandHeaders({
|
|
2410
|
+
layer: layerRef,
|
|
2411
|
+
layer_type: "fabrication"
|
|
2412
|
+
});
|
|
2413
|
+
}
|
|
2174
2414
|
const copperGerberLayerNames = copperLayerRefs.map(
|
|
2175
2415
|
(layerRef) => getGerberLayerName(layerRef, "copper")
|
|
2176
2416
|
);
|
|
2417
|
+
const fabricationGerberLayerNames = fabricationLayerRefs.map(
|
|
2418
|
+
(layerRef) => getGerberLayerName(layerRef, "fabrication")
|
|
2419
|
+
);
|
|
2177
2420
|
const outerGerberLayerNames = outerLayerRefs.flatMap((layerRef) => [
|
|
2178
2421
|
getGerberLayerName(layerRef, "soldermask"),
|
|
2179
2422
|
getGerberLayerName(layerRef, "paste"),
|
|
@@ -2182,6 +2425,7 @@ var convertSoupToGerberCommands = (circuitJson, opts = {}) => {
|
|
|
2182
2425
|
for (const glayer_name of [
|
|
2183
2426
|
"F_Cu",
|
|
2184
2427
|
...copperGerberLayerNames.filter((name) => name !== "F_Cu"),
|
|
2428
|
+
...fabricationGerberLayerNames,
|
|
2185
2429
|
...outerGerberLayerNames
|
|
2186
2430
|
]) {
|
|
2187
2431
|
const glayer = glayers[glayer_name];
|
|
@@ -2666,7 +2910,7 @@ var convertSoupToGerberCommands = (circuitJson, opts = {}) => {
|
|
|
2666
2910
|
);
|
|
2667
2911
|
}
|
|
2668
2912
|
}
|
|
2669
|
-
} else if (element.type === "pcb_silkscreen_path" &&
|
|
2913
|
+
} else if (element.type === "pcb_silkscreen_path" && isOuterLayerRef(layer)) {
|
|
2670
2914
|
if (element.layer === layer) {
|
|
2671
2915
|
const glayer = glayers[getGerberLayerName(layer, "silkscreen")];
|
|
2672
2916
|
const apertureConfig = getApertureConfigFromPcbSilkscreenPath(element);
|
|
@@ -2687,13 +2931,65 @@ var convertSoupToGerberCommands = (circuitJson, opts = {}) => {
|
|
|
2687
2931
|
}
|
|
2688
2932
|
glayer.push(...gerber.build());
|
|
2689
2933
|
}
|
|
2690
|
-
} else if (element.type === "pcb_silkscreen_text" &&
|
|
2934
|
+
} else if (element.type === "pcb_silkscreen_text" && isOuterLayerRef(layer)) {
|
|
2691
2935
|
renderVectorText(
|
|
2692
2936
|
element,
|
|
2693
2937
|
layer,
|
|
2694
2938
|
"silkscreen",
|
|
2695
2939
|
getApertureConfigFromPcbSilkscreenText
|
|
2696
2940
|
);
|
|
2941
|
+
} else if (element.type === "pcb_fabrication_note_path" && isOuterLayerRef(layer)) {
|
|
2942
|
+
if (element.layer === layer) {
|
|
2943
|
+
renderOpenPath({
|
|
2944
|
+
element,
|
|
2945
|
+
glayer: glayers[getGerberLayerName(layer, "fabrication")],
|
|
2946
|
+
apertureConfig: getApertureConfigFromPcbFabricationNotePath(element),
|
|
2947
|
+
route: element.route,
|
|
2948
|
+
mapY: mfy
|
|
2949
|
+
});
|
|
2950
|
+
}
|
|
2951
|
+
} else if (element.type === "pcb_fabrication_note_rect" && isOuterLayerRef(layer)) {
|
|
2952
|
+
if (element.layer === layer) {
|
|
2953
|
+
const glayer = glayers[getGerberLayerName(layer, "fabrication")];
|
|
2954
|
+
const points = getFabRectPoints(element);
|
|
2955
|
+
if (element.is_filled === true) {
|
|
2956
|
+
addClosedRegionFromPoints({
|
|
2957
|
+
target: glayer,
|
|
2958
|
+
apertureSource: glayer,
|
|
2959
|
+
points
|
|
2960
|
+
});
|
|
2961
|
+
}
|
|
2962
|
+
if (element.has_stroke !== false) {
|
|
2963
|
+
renderOpenPath({
|
|
2964
|
+
element,
|
|
2965
|
+
glayer,
|
|
2966
|
+
apertureConfig: getApertureConfigFromPcbFabricationNotePath(element),
|
|
2967
|
+
route: [...points, points[0]],
|
|
2968
|
+
mapY: mfy
|
|
2969
|
+
});
|
|
2970
|
+
}
|
|
2971
|
+
}
|
|
2972
|
+
} else if (element.type === "pcb_fabrication_note_dimension" && isOuterLayerRef(layer)) {
|
|
2973
|
+
if (element.layer === layer) {
|
|
2974
|
+
renderFabricationDimension({
|
|
2975
|
+
element,
|
|
2976
|
+
glayer: glayers[getGerberLayerName(layer, "fabrication")],
|
|
2977
|
+
mapY: mfy,
|
|
2978
|
+
renderText: (textElement) => renderVectorText(
|
|
2979
|
+
textElement,
|
|
2980
|
+
layer,
|
|
2981
|
+
"fabrication",
|
|
2982
|
+
getApertureConfigFromPcbFabricationNoteText
|
|
2983
|
+
)
|
|
2984
|
+
});
|
|
2985
|
+
}
|
|
2986
|
+
} else if (element.type === "pcb_fabrication_note_text" && isOuterLayerRef(layer)) {
|
|
2987
|
+
renderVectorText(
|
|
2988
|
+
element,
|
|
2989
|
+
layer,
|
|
2990
|
+
"fabrication",
|
|
2991
|
+
getApertureConfigFromPcbFabricationNoteText
|
|
2992
|
+
);
|
|
2697
2993
|
} else if (element.type === "pcb_copper_text" && layer !== "edgecut") {
|
|
2698
2994
|
renderVectorText(
|
|
2699
2995
|
element,
|
|
@@ -2702,7 +2998,7 @@ var convertSoupToGerberCommands = (circuitJson, opts = {}) => {
|
|
|
2702
2998
|
getApertureConfigFromPcbCopperText
|
|
2703
2999
|
);
|
|
2704
3000
|
} else if (element.type === "pcb_smtpad" && element.shape !== "polygon") {
|
|
2705
|
-
if (element.layer === layer &&
|
|
3001
|
+
if (element.layer === layer && isOuterLayerRef(layer)) {
|
|
2706
3002
|
if (element.shape === "pill" || element.shape === "rotated_pill") {
|
|
2707
3003
|
const soldermaskMargin = typeof element.soldermask_margin === "number" ? element.soldermask_margin : 0;
|
|
2708
3004
|
const rotation2 = element.shape === "rotated_pill" && typeof element.ccw_rotation === "number" ? element.ccw_rotation : 0;
|
|
@@ -2752,7 +3048,7 @@ var convertSoupToGerberCommands = (circuitJson, opts = {}) => {
|
|
|
2752
3048
|
}
|
|
2753
3049
|
}
|
|
2754
3050
|
} else if (element.type === "pcb_smtpad" && element.shape === "polygon") {
|
|
2755
|
-
if (element.layer === layer &&
|
|
3051
|
+
if (element.layer === layer && isOuterLayerRef(layer)) {
|
|
2756
3052
|
const layers_to_add_to = [
|
|
2757
3053
|
glayers[getGerberLayerName(layer, "copper")]
|
|
2758
3054
|
];
|
|
@@ -2772,7 +3068,7 @@ var convertSoupToGerberCommands = (circuitJson, opts = {}) => {
|
|
|
2772
3068
|
}
|
|
2773
3069
|
}
|
|
2774
3070
|
} else if (element.type === "pcb_solder_paste") {
|
|
2775
|
-
if (element.layer === layer &&
|
|
3071
|
+
if (element.layer === layer && isOuterLayerRef(layer)) {
|
|
2776
3072
|
const glayer = glayers[getGerberLayerName(layer, "paste")];
|
|
2777
3073
|
let rotation = 0;
|
|
2778
3074
|
if ("ccw_rotation" in element && typeof element.ccw_rotation === "number") {
|
|
@@ -2814,7 +3110,7 @@ var convertSoupToGerberCommands = (circuitJson, opts = {}) => {
|
|
|
2814
3110
|
const layersToAddTo = [
|
|
2815
3111
|
glayers[getGerberLayerName(layer, "copper")]
|
|
2816
3112
|
];
|
|
2817
|
-
if (
|
|
3113
|
+
if (isOuterLayerRef(layer) && element.is_covered_with_solder_mask !== true) {
|
|
2818
3114
|
layersToAddTo.push(glayers[getGerberLayerName(layer, "soldermask")]);
|
|
2819
3115
|
}
|
|
2820
3116
|
for (const glayer of layersToAddTo) {
|
|
@@ -2957,7 +3253,7 @@ var convertSoupToGerberCommands = (circuitJson, opts = {}) => {
|
|
|
2957
3253
|
}
|
|
2958
3254
|
}
|
|
2959
3255
|
} else if (element.type === "pcb_hole") {
|
|
2960
|
-
if (
|
|
3256
|
+
if (isOuterLayerRef(layer) && element.is_covered_with_solder_mask !== true) {
|
|
2961
3257
|
for (const glayer of [
|
|
2962
3258
|
glayers[getGerberLayerName(layer, "soldermask")]
|
|
2963
3259
|
]) {
|
|
@@ -2982,7 +3278,7 @@ var convertSoupToGerberCommands = (circuitJson, opts = {}) => {
|
|
|
2982
3278
|
const layersToAddTo = [
|
|
2983
3279
|
glayers[getGerberLayerName(layer, "copper")]
|
|
2984
3280
|
];
|
|
2985
|
-
if (element.is_tented === false &&
|
|
3281
|
+
if (element.is_tented === false && isOuterLayerRef(layer)) {
|
|
2986
3282
|
layersToAddTo.push(glayers[getGerberLayerName(layer, "soldermask")]);
|
|
2987
3283
|
}
|
|
2988
3284
|
for (const glayer of layersToAddTo) {
|
|
@@ -3225,4 +3521,4 @@ export {
|
|
|
3225
3521
|
stringifyGerberCommands,
|
|
3226
3522
|
convertSoupToGerberCommands
|
|
3227
3523
|
};
|
|
3228
|
-
//# sourceMappingURL=chunk-
|
|
3524
|
+
//# sourceMappingURL=chunk-UPPCW5VE.js.map
|