circuit-json-to-lbrn 0.0.36 → 0.0.38
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.js +9 -236
- package/lib/element-handlers/addPcbBoard/index.ts +0 -10
- package/lib/element-handlers/addPcbCutout/addCirclePcbCutout.ts +1 -25
- package/lib/element-handlers/addPcbCutout/addPathPcbCutout.ts +1 -32
- package/lib/element-handlers/addPcbCutout/addPolygonPcbCutout.ts +1 -25
- package/lib/element-handlers/addPcbCutout/addRectPcbCutout.ts +1 -30
- package/lib/element-handlers/addPcbHole/addCirclePcbHole.ts +1 -25
- package/lib/element-handlers/addPcbHole/addOvalPcbHole.ts +1 -26
- package/lib/element-handlers/addPcbHole/addPillPcbHole.ts +1 -26
- package/lib/element-handlers/addPcbHole/addRectPcbHole.ts +1 -27
- package/lib/element-handlers/addPcbHole/addRotatedPillPcbHole.ts +1 -27
- package/package.json +1 -1
- package/tests/basics/__snapshots__/board-outline-does-not-appear-in soldermask.snap.svg +8 -0
- package/tests/basics/__snapshots__/mixed-soldermask-margins.snap.svg +1 -1
- package/tests/basics/addPcbCutout/__snapshots__/pcb-cutout-circle.snap.svg +1 -1
- package/tests/basics/addPcbHole/__snapshots__/pcb-hole-soldermask-margin.snap.svg +1 -1
- package/tests/basics/addPcbHole/__snapshots__/pcb-hole-with-soldermask.snap.svg +1 -1
- package/tests/basics/addPcbVia/__snapshots__/pcb-via-with-soldermask.snap.svg +2 -2
- package/tests/basics/{board-outline-soldermask-preset.test.ts → board-outline-does-not-appear-in soldermask.test.ts } +1 -1
- package/tests/basics/keyboard-defaul60/__snapshots__/keyboard-both-layer-includeSoldermask.snap.svg +1 -1
- package/tests/basics/soldermask/__snapshots__/copper-and-soldermask.snap.svg +1 -1
- package/tests/basics/soldermask/__snapshots__/soldermask-only.snap.svg +3 -3
- package/tests/basics/soldermask-margin/__snapshots__/negative-soldermask-margin.snap.svg +1 -1
- package/tests/basics/soldermask-margin/__snapshots__/positive-soldermask-margin.snap.svg +1 -1
- package/tests/basics/__snapshots__/board-outline-soldermask-preset.snap.svg +0 -8
package/dist/index.js
CHANGED
|
@@ -1860,16 +1860,6 @@ var addPcbBoard = (board, ctx) => {
|
|
|
1860
1860
|
})
|
|
1861
1861
|
);
|
|
1862
1862
|
}
|
|
1863
|
-
if (includeSoldermask) {
|
|
1864
|
-
project.children.push(
|
|
1865
|
-
new ShapePath14({
|
|
1866
|
-
cutIndex: soldermaskCutSetting.index,
|
|
1867
|
-
verts,
|
|
1868
|
-
prims,
|
|
1869
|
-
isClosed: false
|
|
1870
|
-
})
|
|
1871
|
-
);
|
|
1872
|
-
}
|
|
1873
1863
|
};
|
|
1874
1864
|
|
|
1875
1865
|
// lib/index.ts
|
|
@@ -2039,31 +2029,9 @@ var addPcbVia = (via, ctx) => {
|
|
|
2039
2029
|
// lib/element-handlers/addPcbHole/addCirclePcbHole.ts
|
|
2040
2030
|
import { ShapePath as ShapePath16 } from "lbrnts";
|
|
2041
2031
|
var addCirclePcbHole = (hole, ctx) => {
|
|
2042
|
-
const {
|
|
2043
|
-
project,
|
|
2044
|
-
throughBoardCutSetting,
|
|
2045
|
-
soldermaskCutSetting,
|
|
2046
|
-
origin,
|
|
2047
|
-
includeSoldermask,
|
|
2048
|
-
includeCopper
|
|
2049
|
-
} = ctx;
|
|
2032
|
+
const { project, throughBoardCutSetting, origin, includeCopper } = ctx;
|
|
2050
2033
|
const centerX = hole.x + origin.x;
|
|
2051
2034
|
const centerY = hole.y + origin.y;
|
|
2052
|
-
if (hole.hole_diameter > 0 && includeSoldermask) {
|
|
2053
|
-
const soldermaskPath = createCirclePath({
|
|
2054
|
-
centerX,
|
|
2055
|
-
centerY,
|
|
2056
|
-
radius: hole.hole_diameter / 2 + (hole.soldermask_margin ?? 0)
|
|
2057
|
-
});
|
|
2058
|
-
project.children.push(
|
|
2059
|
-
new ShapePath16({
|
|
2060
|
-
cutIndex: soldermaskCutSetting.index,
|
|
2061
|
-
verts: soldermaskPath.verts,
|
|
2062
|
-
prims: soldermaskPath.prims,
|
|
2063
|
-
isClosed: true
|
|
2064
|
-
})
|
|
2065
|
-
);
|
|
2066
|
-
}
|
|
2067
2035
|
if (hole.hole_diameter > 0 && includeCopper) {
|
|
2068
2036
|
const radius = hole.hole_diameter / 2;
|
|
2069
2037
|
const circlePath = createCirclePath({
|
|
@@ -2085,34 +2053,9 @@ var addCirclePcbHole = (hole, ctx) => {
|
|
|
2085
2053
|
// lib/element-handlers/addPcbHole/addRectPcbHole.ts
|
|
2086
2054
|
import { ShapePath as ShapePath17 } from "lbrnts";
|
|
2087
2055
|
var addRectPcbHole = (hole, ctx) => {
|
|
2088
|
-
const {
|
|
2089
|
-
project,
|
|
2090
|
-
throughBoardCutSetting,
|
|
2091
|
-
soldermaskCutSetting,
|
|
2092
|
-
origin,
|
|
2093
|
-
includeSoldermask,
|
|
2094
|
-
includeCopper
|
|
2095
|
-
} = ctx;
|
|
2056
|
+
const { project, throughBoardCutSetting, origin, includeCopper } = ctx;
|
|
2096
2057
|
const centerX = hole.x + origin.x;
|
|
2097
2058
|
const centerY = hole.y + origin.y;
|
|
2098
|
-
if (hole.hole_width > 0 && hole.hole_height > 0 && includeSoldermask) {
|
|
2099
|
-
const soldermaskPath = createRoundedRectPath({
|
|
2100
|
-
centerX,
|
|
2101
|
-
centerY,
|
|
2102
|
-
width: hole.hole_width + 2 * (hole.soldermask_margin ?? 0),
|
|
2103
|
-
height: hole.hole_height + 2 * (hole.soldermask_margin ?? 0),
|
|
2104
|
-
borderRadius: 0
|
|
2105
|
-
// no border radius for rect holes
|
|
2106
|
-
});
|
|
2107
|
-
project.children.push(
|
|
2108
|
-
new ShapePath17({
|
|
2109
|
-
cutIndex: soldermaskCutSetting.index,
|
|
2110
|
-
verts: soldermaskPath.verts,
|
|
2111
|
-
prims: soldermaskPath.prims,
|
|
2112
|
-
isClosed: true
|
|
2113
|
-
})
|
|
2114
|
-
);
|
|
2115
|
-
}
|
|
2116
2059
|
if (hole.hole_width > 0 && hole.hole_height > 0 && includeCopper) {
|
|
2117
2060
|
const rectPath = createRoundedRectPath({
|
|
2118
2061
|
centerX,
|
|
@@ -2136,32 +2079,9 @@ var addRectPcbHole = (hole, ctx) => {
|
|
|
2136
2079
|
// lib/element-handlers/addPcbHole/addOvalPcbHole.ts
|
|
2137
2080
|
import { ShapePath as ShapePath18 } from "lbrnts";
|
|
2138
2081
|
var addOvalPcbHole = (hole, ctx) => {
|
|
2139
|
-
const {
|
|
2140
|
-
project,
|
|
2141
|
-
throughBoardCutSetting,
|
|
2142
|
-
soldermaskCutSetting,
|
|
2143
|
-
origin,
|
|
2144
|
-
includeSoldermask,
|
|
2145
|
-
includeCopper
|
|
2146
|
-
} = ctx;
|
|
2082
|
+
const { project, throughBoardCutSetting, origin, includeCopper } = ctx;
|
|
2147
2083
|
const centerX = hole.x + origin.x;
|
|
2148
2084
|
const centerY = hole.y + origin.y;
|
|
2149
|
-
if (hole.hole_width > 0 && hole.hole_height > 0 && includeSoldermask) {
|
|
2150
|
-
const soldermaskPath = createOvalPath({
|
|
2151
|
-
centerX,
|
|
2152
|
-
centerY,
|
|
2153
|
-
width: hole.hole_width + 2 * (hole.soldermask_margin ?? 0),
|
|
2154
|
-
height: hole.hole_height + 2 * (hole.soldermask_margin ?? 0)
|
|
2155
|
-
});
|
|
2156
|
-
project.children.push(
|
|
2157
|
-
new ShapePath18({
|
|
2158
|
-
cutIndex: soldermaskCutSetting.index,
|
|
2159
|
-
verts: soldermaskPath.verts,
|
|
2160
|
-
prims: soldermaskPath.prims,
|
|
2161
|
-
isClosed: true
|
|
2162
|
-
})
|
|
2163
|
-
);
|
|
2164
|
-
}
|
|
2165
2085
|
if (hole.hole_width > 0 && hole.hole_height > 0 && includeCopper) {
|
|
2166
2086
|
const ovalPath = createOvalPath({
|
|
2167
2087
|
centerX,
|
|
@@ -2183,32 +2103,9 @@ var addOvalPcbHole = (hole, ctx) => {
|
|
|
2183
2103
|
// lib/element-handlers/addPcbHole/addPillPcbHole.ts
|
|
2184
2104
|
import { ShapePath as ShapePath19 } from "lbrnts";
|
|
2185
2105
|
var addPillPcbHole = (hole, ctx) => {
|
|
2186
|
-
const {
|
|
2187
|
-
project,
|
|
2188
|
-
throughBoardCutSetting,
|
|
2189
|
-
soldermaskCutSetting,
|
|
2190
|
-
origin,
|
|
2191
|
-
includeSoldermask,
|
|
2192
|
-
includeCopper
|
|
2193
|
-
} = ctx;
|
|
2106
|
+
const { project, throughBoardCutSetting, origin, includeCopper } = ctx;
|
|
2194
2107
|
const centerX = hole.x + origin.x;
|
|
2195
2108
|
const centerY = hole.y + origin.y;
|
|
2196
|
-
if (hole.hole_width > 0 && hole.hole_height > 0 && includeSoldermask) {
|
|
2197
|
-
const soldermaskPath = createPillPath({
|
|
2198
|
-
centerX,
|
|
2199
|
-
centerY,
|
|
2200
|
-
width: hole.hole_width + 2 * (hole.soldermask_margin ?? 0),
|
|
2201
|
-
height: hole.hole_height + 2 * (hole.soldermask_margin ?? 0)
|
|
2202
|
-
});
|
|
2203
|
-
project.children.push(
|
|
2204
|
-
new ShapePath19({
|
|
2205
|
-
cutIndex: soldermaskCutSetting.index,
|
|
2206
|
-
verts: soldermaskPath.verts,
|
|
2207
|
-
prims: soldermaskPath.prims,
|
|
2208
|
-
isClosed: true
|
|
2209
|
-
})
|
|
2210
|
-
);
|
|
2211
|
-
}
|
|
2212
2109
|
if (hole.hole_width > 0 && hole.hole_height > 0 && includeCopper) {
|
|
2213
2110
|
const pillPath = createPillPath({
|
|
2214
2111
|
centerX,
|
|
@@ -2230,34 +2127,10 @@ var addPillPcbHole = (hole, ctx) => {
|
|
|
2230
2127
|
// lib/element-handlers/addPcbHole/addRotatedPillPcbHole.ts
|
|
2231
2128
|
import { ShapePath as ShapePath20 } from "lbrnts";
|
|
2232
2129
|
var addRotatedPillPcbHole = (hole, ctx) => {
|
|
2233
|
-
const {
|
|
2234
|
-
project,
|
|
2235
|
-
throughBoardCutSetting,
|
|
2236
|
-
soldermaskCutSetting,
|
|
2237
|
-
origin,
|
|
2238
|
-
includeSoldermask,
|
|
2239
|
-
includeCopper
|
|
2240
|
-
} = ctx;
|
|
2130
|
+
const { project, throughBoardCutSetting, origin, includeCopper } = ctx;
|
|
2241
2131
|
const centerX = hole.x + origin.x;
|
|
2242
2132
|
const centerY = hole.y + origin.y;
|
|
2243
2133
|
const rotation = (hole.ccw_rotation || 0) * (Math.PI / 180);
|
|
2244
|
-
if (hole.hole_width > 0 && hole.hole_height > 0 && includeSoldermask) {
|
|
2245
|
-
const soldermaskPath = createPillPath({
|
|
2246
|
-
centerX,
|
|
2247
|
-
centerY,
|
|
2248
|
-
width: hole.hole_width + 2 * (hole.soldermask_margin ?? 0),
|
|
2249
|
-
height: hole.hole_height + 2 * (hole.soldermask_margin ?? 0),
|
|
2250
|
-
rotation
|
|
2251
|
-
});
|
|
2252
|
-
project.children.push(
|
|
2253
|
-
new ShapePath20({
|
|
2254
|
-
cutIndex: soldermaskCutSetting.index,
|
|
2255
|
-
verts: soldermaskPath.verts,
|
|
2256
|
-
prims: soldermaskPath.prims,
|
|
2257
|
-
isClosed: true
|
|
2258
|
-
})
|
|
2259
|
-
);
|
|
2260
|
-
}
|
|
2261
2134
|
if (hole.hole_width > 0 && hole.hole_height > 0 && includeCopper) {
|
|
2262
2135
|
const pillPath = createPillPath({
|
|
2263
2136
|
centerX,
|
|
@@ -2300,14 +2173,7 @@ var addPcbHole = (hole, ctx) => {
|
|
|
2300
2173
|
// lib/element-handlers/addPcbCutout/addCirclePcbCutout.ts
|
|
2301
2174
|
import { ShapePath as ShapePath21 } from "lbrnts";
|
|
2302
2175
|
var addCirclePcbCutout = (cutout, ctx) => {
|
|
2303
|
-
const {
|
|
2304
|
-
project,
|
|
2305
|
-
throughBoardCutSetting,
|
|
2306
|
-
origin,
|
|
2307
|
-
includeCopper,
|
|
2308
|
-
includeSoldermask,
|
|
2309
|
-
soldermaskCutSetting
|
|
2310
|
-
} = ctx;
|
|
2176
|
+
const { project, throughBoardCutSetting, origin, includeCopper } = ctx;
|
|
2311
2177
|
const centerX = cutout.center.x + origin.x;
|
|
2312
2178
|
const centerY = cutout.center.y + origin.y;
|
|
2313
2179
|
if (cutout.radius > 0 && includeCopper) {
|
|
@@ -2325,34 +2191,12 @@ var addCirclePcbCutout = (cutout, ctx) => {
|
|
|
2325
2191
|
})
|
|
2326
2192
|
);
|
|
2327
2193
|
}
|
|
2328
|
-
if (cutout.radius > 0 && includeSoldermask) {
|
|
2329
|
-
const outer = createCirclePath({
|
|
2330
|
-
centerX,
|
|
2331
|
-
centerY,
|
|
2332
|
-
radius: cutout.radius
|
|
2333
|
-
});
|
|
2334
|
-
project.children.push(
|
|
2335
|
-
new ShapePath21({
|
|
2336
|
-
cutIndex: soldermaskCutSetting.index,
|
|
2337
|
-
verts: outer.verts,
|
|
2338
|
-
prims: outer.prims,
|
|
2339
|
-
isClosed: true
|
|
2340
|
-
})
|
|
2341
|
-
);
|
|
2342
|
-
}
|
|
2343
2194
|
};
|
|
2344
2195
|
|
|
2345
2196
|
// lib/element-handlers/addPcbCutout/addRectPcbCutout.ts
|
|
2346
2197
|
import { ShapePath as ShapePath22 } from "lbrnts";
|
|
2347
2198
|
var addRectPcbCutout = (cutout, ctx) => {
|
|
2348
|
-
const {
|
|
2349
|
-
project,
|
|
2350
|
-
throughBoardCutSetting,
|
|
2351
|
-
origin,
|
|
2352
|
-
includeCopper,
|
|
2353
|
-
includeSoldermask,
|
|
2354
|
-
soldermaskCutSetting
|
|
2355
|
-
} = ctx;
|
|
2199
|
+
const { project, throughBoardCutSetting, origin, includeCopper } = ctx;
|
|
2356
2200
|
const centerX = cutout.center.x + origin.x;
|
|
2357
2201
|
const centerY = cutout.center.y + origin.y;
|
|
2358
2202
|
if (cutout.width > 0 && cutout.height > 0 && includeCopper) {
|
|
@@ -2377,41 +2221,12 @@ var addRectPcbCutout = (cutout, ctx) => {
|
|
|
2377
2221
|
})
|
|
2378
2222
|
);
|
|
2379
2223
|
}
|
|
2380
|
-
if (cutout.width > 0 && cutout.height > 0 && includeSoldermask) {
|
|
2381
|
-
const rotation = (cutout.rotation ?? 0) * (Math.PI / 180);
|
|
2382
|
-
const rectPath = createRoundedRectPath({
|
|
2383
|
-
centerX,
|
|
2384
|
-
centerY,
|
|
2385
|
-
width: cutout.width,
|
|
2386
|
-
height: cutout.height,
|
|
2387
|
-
borderRadius: 0,
|
|
2388
|
-
// no border radius for cutouts
|
|
2389
|
-
segments: 4,
|
|
2390
|
-
// segments
|
|
2391
|
-
rotation
|
|
2392
|
-
});
|
|
2393
|
-
project.children.push(
|
|
2394
|
-
new ShapePath22({
|
|
2395
|
-
cutIndex: soldermaskCutSetting.index,
|
|
2396
|
-
verts: rectPath.verts,
|
|
2397
|
-
prims: rectPath.prims,
|
|
2398
|
-
isClosed: true
|
|
2399
|
-
})
|
|
2400
|
-
);
|
|
2401
|
-
}
|
|
2402
2224
|
};
|
|
2403
2225
|
|
|
2404
2226
|
// lib/element-handlers/addPcbCutout/addPolygonPcbCutout.ts
|
|
2405
2227
|
import { ShapePath as ShapePath23 } from "lbrnts";
|
|
2406
2228
|
var addPolygonPcbCutout = (cutout, ctx) => {
|
|
2407
|
-
const {
|
|
2408
|
-
project,
|
|
2409
|
-
throughBoardCutSetting,
|
|
2410
|
-
origin,
|
|
2411
|
-
includeCopper,
|
|
2412
|
-
includeSoldermask,
|
|
2413
|
-
soldermaskCutSetting
|
|
2414
|
-
} = ctx;
|
|
2229
|
+
const { project, throughBoardCutSetting, origin, includeCopper } = ctx;
|
|
2415
2230
|
if (cutout.points.length >= 3 && includeCopper) {
|
|
2416
2231
|
const polygonPath = createPolygonPathFromOutline({
|
|
2417
2232
|
outline: cutout.points,
|
|
@@ -2427,34 +2242,12 @@ var addPolygonPcbCutout = (cutout, ctx) => {
|
|
|
2427
2242
|
})
|
|
2428
2243
|
);
|
|
2429
2244
|
}
|
|
2430
|
-
if (cutout.points.length >= 3 && includeSoldermask) {
|
|
2431
|
-
const polygonPath = createPolygonPathFromOutline({
|
|
2432
|
-
outline: cutout.points,
|
|
2433
|
-
offsetX: origin.x,
|
|
2434
|
-
offsetY: origin.y
|
|
2435
|
-
});
|
|
2436
|
-
project.children.push(
|
|
2437
|
-
new ShapePath23({
|
|
2438
|
-
cutIndex: soldermaskCutSetting.index,
|
|
2439
|
-
verts: polygonPath.verts,
|
|
2440
|
-
prims: polygonPath.prims,
|
|
2441
|
-
isClosed: true
|
|
2442
|
-
})
|
|
2443
|
-
);
|
|
2444
|
-
}
|
|
2445
2245
|
};
|
|
2446
2246
|
|
|
2447
2247
|
// lib/element-handlers/addPcbCutout/addPathPcbCutout.ts
|
|
2448
2248
|
import { ShapePath as ShapePath24 } from "lbrnts";
|
|
2449
2249
|
var addPathPcbCutout = (cutout, ctx) => {
|
|
2450
|
-
const {
|
|
2451
|
-
project,
|
|
2452
|
-
throughBoardCutSetting,
|
|
2453
|
-
origin,
|
|
2454
|
-
includeCopper,
|
|
2455
|
-
includeSoldermask,
|
|
2456
|
-
soldermaskCutSetting
|
|
2457
|
-
} = ctx;
|
|
2250
|
+
const { project, throughBoardCutSetting, origin, includeCopper } = ctx;
|
|
2458
2251
|
if (cutout.route.length >= 2 && includeCopper) {
|
|
2459
2252
|
const verts = [];
|
|
2460
2253
|
const prims = [];
|
|
@@ -2475,26 +2268,6 @@ var addPathPcbCutout = (cutout, ctx) => {
|
|
|
2475
2268
|
})
|
|
2476
2269
|
);
|
|
2477
2270
|
}
|
|
2478
|
-
if (cutout.route.length >= 2 && includeSoldermask) {
|
|
2479
|
-
const verts = [];
|
|
2480
|
-
const prims = [];
|
|
2481
|
-
for (const point6 of cutout.route) {
|
|
2482
|
-
verts.push({
|
|
2483
|
-
x: point6.x + origin.x,
|
|
2484
|
-
y: point6.y + origin.y
|
|
2485
|
-
});
|
|
2486
|
-
prims.push({ type: 0 });
|
|
2487
|
-
}
|
|
2488
|
-
project.children.push(
|
|
2489
|
-
new ShapePath24({
|
|
2490
|
-
cutIndex: soldermaskCutSetting.index,
|
|
2491
|
-
verts,
|
|
2492
|
-
prims,
|
|
2493
|
-
isClosed: false
|
|
2494
|
-
// Match the same path as the copper cutout
|
|
2495
|
-
})
|
|
2496
|
-
);
|
|
2497
|
-
}
|
|
2498
2271
|
};
|
|
2499
2272
|
|
|
2500
2273
|
// lib/element-handlers/addPcbCutout/index.ts
|
|
@@ -56,14 +56,4 @@ export const addPcbBoard = (board: PcbBoard, ctx: ConvertContext) => {
|
|
|
56
56
|
}),
|
|
57
57
|
)
|
|
58
58
|
}
|
|
59
|
-
if (includeSoldermask) {
|
|
60
|
-
project.children.push(
|
|
61
|
-
new ShapePath({
|
|
62
|
-
cutIndex: soldermaskCutSetting.index,
|
|
63
|
-
verts,
|
|
64
|
-
prims,
|
|
65
|
-
isClosed: false,
|
|
66
|
-
}),
|
|
67
|
-
)
|
|
68
|
-
}
|
|
69
59
|
}
|
|
@@ -11,14 +11,7 @@ export const addCirclePcbCutout = (
|
|
|
11
11
|
cutout: PcbCutoutCircle,
|
|
12
12
|
ctx: ConvertContext,
|
|
13
13
|
): void => {
|
|
14
|
-
const {
|
|
15
|
-
project,
|
|
16
|
-
throughBoardCutSetting,
|
|
17
|
-
origin,
|
|
18
|
-
includeCopper,
|
|
19
|
-
includeSoldermask,
|
|
20
|
-
soldermaskCutSetting,
|
|
21
|
-
} = ctx
|
|
14
|
+
const { project, throughBoardCutSetting, origin, includeCopper } = ctx
|
|
22
15
|
const centerX = cutout.center.x + origin.x
|
|
23
16
|
const centerY = cutout.center.y + origin.y
|
|
24
17
|
|
|
@@ -38,21 +31,4 @@ export const addCirclePcbCutout = (
|
|
|
38
31
|
}),
|
|
39
32
|
)
|
|
40
33
|
}
|
|
41
|
-
|
|
42
|
-
// Add soldermask opening if drawing soldermask
|
|
43
|
-
if (cutout.radius > 0 && includeSoldermask) {
|
|
44
|
-
const outer = createCirclePath({
|
|
45
|
-
centerX,
|
|
46
|
-
centerY,
|
|
47
|
-
radius: cutout.radius,
|
|
48
|
-
})
|
|
49
|
-
project.children.push(
|
|
50
|
-
new ShapePath({
|
|
51
|
-
cutIndex: soldermaskCutSetting.index,
|
|
52
|
-
verts: outer.verts,
|
|
53
|
-
prims: outer.prims,
|
|
54
|
-
isClosed: true,
|
|
55
|
-
}),
|
|
56
|
-
)
|
|
57
|
-
}
|
|
58
34
|
}
|
|
@@ -10,14 +10,7 @@ export const addPathPcbCutout = (
|
|
|
10
10
|
cutout: PcbCutoutPath,
|
|
11
11
|
ctx: ConvertContext,
|
|
12
12
|
): void => {
|
|
13
|
-
const {
|
|
14
|
-
project,
|
|
15
|
-
throughBoardCutSetting,
|
|
16
|
-
origin,
|
|
17
|
-
includeCopper,
|
|
18
|
-
includeSoldermask,
|
|
19
|
-
soldermaskCutSetting,
|
|
20
|
-
} = ctx
|
|
13
|
+
const { project, throughBoardCutSetting, origin, includeCopper } = ctx
|
|
21
14
|
|
|
22
15
|
// For path cutouts, we need to create a stroke along the route with the given width
|
|
23
16
|
// For simplicity, we'll convert the path to a polyline
|
|
@@ -45,28 +38,4 @@ export const addPathPcbCutout = (
|
|
|
45
38
|
}),
|
|
46
39
|
)
|
|
47
40
|
}
|
|
48
|
-
|
|
49
|
-
// Add soldermask opening if drawing soldermask
|
|
50
|
-
if (cutout.route.length >= 2 && includeSoldermask) {
|
|
51
|
-
const verts: { x: number; y: number }[] = []
|
|
52
|
-
const prims: { type: number }[] = []
|
|
53
|
-
|
|
54
|
-
// Create path with soldermask margin
|
|
55
|
-
for (const point of cutout.route) {
|
|
56
|
-
verts.push({
|
|
57
|
-
x: point.x + origin.x,
|
|
58
|
-
y: point.y + origin.y,
|
|
59
|
-
})
|
|
60
|
-
prims.push({ type: 0 })
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
project.children.push(
|
|
64
|
-
new ShapePath({
|
|
65
|
-
cutIndex: soldermaskCutSetting.index,
|
|
66
|
-
verts,
|
|
67
|
-
prims,
|
|
68
|
-
isClosed: false, // Match the same path as the copper cutout
|
|
69
|
-
}),
|
|
70
|
-
)
|
|
71
|
-
}
|
|
72
41
|
}
|
|
@@ -11,14 +11,7 @@ export const addPolygonPcbCutout = (
|
|
|
11
11
|
cutout: PcbCutoutPolygon,
|
|
12
12
|
ctx: ConvertContext,
|
|
13
13
|
): void => {
|
|
14
|
-
const {
|
|
15
|
-
project,
|
|
16
|
-
throughBoardCutSetting,
|
|
17
|
-
origin,
|
|
18
|
-
includeCopper,
|
|
19
|
-
includeSoldermask,
|
|
20
|
-
soldermaskCutSetting,
|
|
21
|
-
} = ctx
|
|
14
|
+
const { project, throughBoardCutSetting, origin, includeCopper } = ctx
|
|
22
15
|
|
|
23
16
|
// Add the cutout - cut through the board
|
|
24
17
|
if (cutout.points.length >= 3 && includeCopper) {
|
|
@@ -36,21 +29,4 @@ export const addPolygonPcbCutout = (
|
|
|
36
29
|
}),
|
|
37
30
|
)
|
|
38
31
|
}
|
|
39
|
-
|
|
40
|
-
// Add soldermask opening if drawing soldermask
|
|
41
|
-
if (cutout.points.length >= 3 && includeSoldermask) {
|
|
42
|
-
const polygonPath = createPolygonPathFromOutline({
|
|
43
|
-
outline: cutout.points,
|
|
44
|
-
offsetX: origin.x,
|
|
45
|
-
offsetY: origin.y,
|
|
46
|
-
})
|
|
47
|
-
project.children.push(
|
|
48
|
-
new ShapePath({
|
|
49
|
-
cutIndex: soldermaskCutSetting.index,
|
|
50
|
-
verts: polygonPath.verts,
|
|
51
|
-
prims: polygonPath.prims,
|
|
52
|
-
isClosed: true,
|
|
53
|
-
}),
|
|
54
|
-
)
|
|
55
|
-
}
|
|
56
32
|
}
|
|
@@ -11,14 +11,7 @@ export const addRectPcbCutout = (
|
|
|
11
11
|
cutout: PcbCutoutRect,
|
|
12
12
|
ctx: ConvertContext,
|
|
13
13
|
): void => {
|
|
14
|
-
const {
|
|
15
|
-
project,
|
|
16
|
-
throughBoardCutSetting,
|
|
17
|
-
origin,
|
|
18
|
-
includeCopper,
|
|
19
|
-
includeSoldermask,
|
|
20
|
-
soldermaskCutSetting,
|
|
21
|
-
} = ctx
|
|
14
|
+
const { project, throughBoardCutSetting, origin, includeCopper } = ctx
|
|
22
15
|
const centerX = cutout.center.x + origin.x
|
|
23
16
|
const centerY = cutout.center.y + origin.y
|
|
24
17
|
|
|
@@ -43,26 +36,4 @@ export const addRectPcbCutout = (
|
|
|
43
36
|
}),
|
|
44
37
|
)
|
|
45
38
|
}
|
|
46
|
-
|
|
47
|
-
// Add soldermask opening if drawing soldermask
|
|
48
|
-
if (cutout.width > 0 && cutout.height > 0 && includeSoldermask) {
|
|
49
|
-
const rotation = (cutout.rotation ?? 0) * (Math.PI / 180) // Convert degrees to radians
|
|
50
|
-
const rectPath = createRoundedRectPath({
|
|
51
|
-
centerX,
|
|
52
|
-
centerY,
|
|
53
|
-
width: cutout.width,
|
|
54
|
-
height: cutout.height,
|
|
55
|
-
borderRadius: 0, // no border radius for cutouts
|
|
56
|
-
segments: 4, // segments
|
|
57
|
-
rotation,
|
|
58
|
-
})
|
|
59
|
-
project.children.push(
|
|
60
|
-
new ShapePath({
|
|
61
|
-
cutIndex: soldermaskCutSetting.index,
|
|
62
|
-
verts: rectPath.verts,
|
|
63
|
-
prims: rectPath.prims,
|
|
64
|
-
isClosed: true,
|
|
65
|
-
}),
|
|
66
|
-
)
|
|
67
|
-
}
|
|
68
39
|
}
|
|
@@ -10,34 +10,10 @@ export const addCirclePcbHole = (
|
|
|
10
10
|
hole: PcbHoleCircle | PcbHoleCircleOrSquare,
|
|
11
11
|
ctx: ConvertContext,
|
|
12
12
|
): void => {
|
|
13
|
-
const {
|
|
14
|
-
project,
|
|
15
|
-
throughBoardCutSetting,
|
|
16
|
-
soldermaskCutSetting,
|
|
17
|
-
origin,
|
|
18
|
-
includeSoldermask,
|
|
19
|
-
includeCopper,
|
|
20
|
-
} = ctx
|
|
13
|
+
const { project, throughBoardCutSetting, origin, includeCopper } = ctx
|
|
21
14
|
const centerX = hole.x + origin.x
|
|
22
15
|
const centerY = hole.y + origin.y
|
|
23
16
|
|
|
24
|
-
// Add soldermask opening if drawing soldermask
|
|
25
|
-
if (hole.hole_diameter > 0 && includeSoldermask) {
|
|
26
|
-
const soldermaskPath = createCirclePath({
|
|
27
|
-
centerX,
|
|
28
|
-
centerY,
|
|
29
|
-
radius: hole.hole_diameter / 2 + (hole.soldermask_margin ?? 0),
|
|
30
|
-
})
|
|
31
|
-
project.children.push(
|
|
32
|
-
new ShapePath({
|
|
33
|
-
cutIndex: soldermaskCutSetting.index,
|
|
34
|
-
verts: soldermaskPath.verts,
|
|
35
|
-
prims: soldermaskPath.prims,
|
|
36
|
-
isClosed: true,
|
|
37
|
-
}),
|
|
38
|
-
)
|
|
39
|
-
}
|
|
40
|
-
|
|
41
17
|
// Add the hole - cut through the board
|
|
42
18
|
if (hole.hole_diameter > 0 && includeCopper) {
|
|
43
19
|
const radius = hole.hole_diameter / 2
|
|
@@ -10,35 +10,10 @@ export const addOvalPcbHole = (
|
|
|
10
10
|
hole: PcbHoleOval,
|
|
11
11
|
ctx: ConvertContext,
|
|
12
12
|
): void => {
|
|
13
|
-
const {
|
|
14
|
-
project,
|
|
15
|
-
throughBoardCutSetting,
|
|
16
|
-
soldermaskCutSetting,
|
|
17
|
-
origin,
|
|
18
|
-
includeSoldermask,
|
|
19
|
-
includeCopper,
|
|
20
|
-
} = ctx
|
|
13
|
+
const { project, throughBoardCutSetting, origin, includeCopper } = ctx
|
|
21
14
|
const centerX = hole.x + origin.x
|
|
22
15
|
const centerY = hole.y + origin.y
|
|
23
16
|
|
|
24
|
-
// Add soldermask opening if drawing soldermask
|
|
25
|
-
if (hole.hole_width > 0 && hole.hole_height > 0 && includeSoldermask) {
|
|
26
|
-
const soldermaskPath = createOvalPath({
|
|
27
|
-
centerX,
|
|
28
|
-
centerY,
|
|
29
|
-
width: hole.hole_width + 2 * (hole.soldermask_margin ?? 0),
|
|
30
|
-
height: hole.hole_height + 2 * (hole.soldermask_margin ?? 0),
|
|
31
|
-
})
|
|
32
|
-
project.children.push(
|
|
33
|
-
new ShapePath({
|
|
34
|
-
cutIndex: soldermaskCutSetting.index,
|
|
35
|
-
verts: soldermaskPath.verts,
|
|
36
|
-
prims: soldermaskPath.prims,
|
|
37
|
-
isClosed: true,
|
|
38
|
-
}),
|
|
39
|
-
)
|
|
40
|
-
}
|
|
41
|
-
|
|
42
17
|
// Add the hole - cut through the board
|
|
43
18
|
if (hole.hole_width > 0 && hole.hole_height > 0 && includeCopper) {
|
|
44
19
|
const ovalPath = createOvalPath({
|
|
@@ -10,35 +10,10 @@ export const addPillPcbHole = (
|
|
|
10
10
|
hole: PcbHolePill,
|
|
11
11
|
ctx: ConvertContext,
|
|
12
12
|
): void => {
|
|
13
|
-
const {
|
|
14
|
-
project,
|
|
15
|
-
throughBoardCutSetting,
|
|
16
|
-
soldermaskCutSetting,
|
|
17
|
-
origin,
|
|
18
|
-
includeSoldermask,
|
|
19
|
-
includeCopper,
|
|
20
|
-
} = ctx
|
|
13
|
+
const { project, throughBoardCutSetting, origin, includeCopper } = ctx
|
|
21
14
|
const centerX = hole.x + origin.x
|
|
22
15
|
const centerY = hole.y + origin.y
|
|
23
16
|
|
|
24
|
-
// Add soldermask opening if drawing soldermask
|
|
25
|
-
if (hole.hole_width > 0 && hole.hole_height > 0 && includeSoldermask) {
|
|
26
|
-
const soldermaskPath = createPillPath({
|
|
27
|
-
centerX,
|
|
28
|
-
centerY,
|
|
29
|
-
width: hole.hole_width + 2 * (hole.soldermask_margin ?? 0),
|
|
30
|
-
height: hole.hole_height + 2 * (hole.soldermask_margin ?? 0),
|
|
31
|
-
})
|
|
32
|
-
project.children.push(
|
|
33
|
-
new ShapePath({
|
|
34
|
-
cutIndex: soldermaskCutSetting.index,
|
|
35
|
-
verts: soldermaskPath.verts,
|
|
36
|
-
prims: soldermaskPath.prims,
|
|
37
|
-
isClosed: true,
|
|
38
|
-
}),
|
|
39
|
-
)
|
|
40
|
-
}
|
|
41
|
-
|
|
42
17
|
// Add the hole - cut through the board
|
|
43
18
|
if (hole.hole_width > 0 && hole.hole_height > 0 && includeCopper) {
|
|
44
19
|
const pillPath = createPillPath({
|
|
@@ -10,36 +10,10 @@ export const addRectPcbHole = (
|
|
|
10
10
|
hole: PcbHoleRect,
|
|
11
11
|
ctx: ConvertContext,
|
|
12
12
|
): void => {
|
|
13
|
-
const {
|
|
14
|
-
project,
|
|
15
|
-
throughBoardCutSetting,
|
|
16
|
-
soldermaskCutSetting,
|
|
17
|
-
origin,
|
|
18
|
-
includeSoldermask,
|
|
19
|
-
includeCopper,
|
|
20
|
-
} = ctx
|
|
13
|
+
const { project, throughBoardCutSetting, origin, includeCopper } = ctx
|
|
21
14
|
const centerX = hole.x + origin.x
|
|
22
15
|
const centerY = hole.y + origin.y
|
|
23
16
|
|
|
24
|
-
// Add soldermask opening if drawing soldermask
|
|
25
|
-
if (hole.hole_width > 0 && hole.hole_height > 0 && includeSoldermask) {
|
|
26
|
-
const soldermaskPath = createRoundedRectPath({
|
|
27
|
-
centerX,
|
|
28
|
-
centerY,
|
|
29
|
-
width: hole.hole_width + 2 * (hole.soldermask_margin ?? 0),
|
|
30
|
-
height: hole.hole_height + 2 * (hole.soldermask_margin ?? 0),
|
|
31
|
-
borderRadius: 0, // no border radius for rect holes
|
|
32
|
-
})
|
|
33
|
-
project.children.push(
|
|
34
|
-
new ShapePath({
|
|
35
|
-
cutIndex: soldermaskCutSetting.index,
|
|
36
|
-
verts: soldermaskPath.verts,
|
|
37
|
-
prims: soldermaskPath.prims,
|
|
38
|
-
isClosed: true,
|
|
39
|
-
}),
|
|
40
|
-
)
|
|
41
|
-
}
|
|
42
|
-
|
|
43
17
|
// Add the hole - cut through the board
|
|
44
18
|
if (hole.hole_width > 0 && hole.hole_height > 0 && includeCopper) {
|
|
45
19
|
const rectPath = createRoundedRectPath({
|