circuit-json-to-lbrn 0.0.37 → 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 -226
- 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__/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/keyboard-defaul60/__snapshots__/keyboard-both-layer-includeSoldermask.snap.svg +1 -1
package/dist/index.js
CHANGED
|
@@ -2029,31 +2029,9 @@ var addPcbVia = (via, ctx) => {
|
|
|
2029
2029
|
// lib/element-handlers/addPcbHole/addCirclePcbHole.ts
|
|
2030
2030
|
import { ShapePath as ShapePath16 } from "lbrnts";
|
|
2031
2031
|
var addCirclePcbHole = (hole, ctx) => {
|
|
2032
|
-
const {
|
|
2033
|
-
project,
|
|
2034
|
-
throughBoardCutSetting,
|
|
2035
|
-
soldermaskCutSetting,
|
|
2036
|
-
origin,
|
|
2037
|
-
includeSoldermask,
|
|
2038
|
-
includeCopper
|
|
2039
|
-
} = ctx;
|
|
2032
|
+
const { project, throughBoardCutSetting, origin, includeCopper } = ctx;
|
|
2040
2033
|
const centerX = hole.x + origin.x;
|
|
2041
2034
|
const centerY = hole.y + origin.y;
|
|
2042
|
-
if (hole.hole_diameter > 0 && includeSoldermask) {
|
|
2043
|
-
const soldermaskPath = createCirclePath({
|
|
2044
|
-
centerX,
|
|
2045
|
-
centerY,
|
|
2046
|
-
radius: hole.hole_diameter / 2 + (hole.soldermask_margin ?? 0)
|
|
2047
|
-
});
|
|
2048
|
-
project.children.push(
|
|
2049
|
-
new ShapePath16({
|
|
2050
|
-
cutIndex: soldermaskCutSetting.index,
|
|
2051
|
-
verts: soldermaskPath.verts,
|
|
2052
|
-
prims: soldermaskPath.prims,
|
|
2053
|
-
isClosed: true
|
|
2054
|
-
})
|
|
2055
|
-
);
|
|
2056
|
-
}
|
|
2057
2035
|
if (hole.hole_diameter > 0 && includeCopper) {
|
|
2058
2036
|
const radius = hole.hole_diameter / 2;
|
|
2059
2037
|
const circlePath = createCirclePath({
|
|
@@ -2075,34 +2053,9 @@ var addCirclePcbHole = (hole, ctx) => {
|
|
|
2075
2053
|
// lib/element-handlers/addPcbHole/addRectPcbHole.ts
|
|
2076
2054
|
import { ShapePath as ShapePath17 } from "lbrnts";
|
|
2077
2055
|
var addRectPcbHole = (hole, ctx) => {
|
|
2078
|
-
const {
|
|
2079
|
-
project,
|
|
2080
|
-
throughBoardCutSetting,
|
|
2081
|
-
soldermaskCutSetting,
|
|
2082
|
-
origin,
|
|
2083
|
-
includeSoldermask,
|
|
2084
|
-
includeCopper
|
|
2085
|
-
} = ctx;
|
|
2056
|
+
const { project, throughBoardCutSetting, origin, includeCopper } = ctx;
|
|
2086
2057
|
const centerX = hole.x + origin.x;
|
|
2087
2058
|
const centerY = hole.y + origin.y;
|
|
2088
|
-
if (hole.hole_width > 0 && hole.hole_height > 0 && includeSoldermask) {
|
|
2089
|
-
const soldermaskPath = createRoundedRectPath({
|
|
2090
|
-
centerX,
|
|
2091
|
-
centerY,
|
|
2092
|
-
width: hole.hole_width + 2 * (hole.soldermask_margin ?? 0),
|
|
2093
|
-
height: hole.hole_height + 2 * (hole.soldermask_margin ?? 0),
|
|
2094
|
-
borderRadius: 0
|
|
2095
|
-
// no border radius for rect holes
|
|
2096
|
-
});
|
|
2097
|
-
project.children.push(
|
|
2098
|
-
new ShapePath17({
|
|
2099
|
-
cutIndex: soldermaskCutSetting.index,
|
|
2100
|
-
verts: soldermaskPath.verts,
|
|
2101
|
-
prims: soldermaskPath.prims,
|
|
2102
|
-
isClosed: true
|
|
2103
|
-
})
|
|
2104
|
-
);
|
|
2105
|
-
}
|
|
2106
2059
|
if (hole.hole_width > 0 && hole.hole_height > 0 && includeCopper) {
|
|
2107
2060
|
const rectPath = createRoundedRectPath({
|
|
2108
2061
|
centerX,
|
|
@@ -2126,32 +2079,9 @@ var addRectPcbHole = (hole, ctx) => {
|
|
|
2126
2079
|
// lib/element-handlers/addPcbHole/addOvalPcbHole.ts
|
|
2127
2080
|
import { ShapePath as ShapePath18 } from "lbrnts";
|
|
2128
2081
|
var addOvalPcbHole = (hole, ctx) => {
|
|
2129
|
-
const {
|
|
2130
|
-
project,
|
|
2131
|
-
throughBoardCutSetting,
|
|
2132
|
-
soldermaskCutSetting,
|
|
2133
|
-
origin,
|
|
2134
|
-
includeSoldermask,
|
|
2135
|
-
includeCopper
|
|
2136
|
-
} = ctx;
|
|
2082
|
+
const { project, throughBoardCutSetting, origin, includeCopper } = ctx;
|
|
2137
2083
|
const centerX = hole.x + origin.x;
|
|
2138
2084
|
const centerY = hole.y + origin.y;
|
|
2139
|
-
if (hole.hole_width > 0 && hole.hole_height > 0 && includeSoldermask) {
|
|
2140
|
-
const soldermaskPath = createOvalPath({
|
|
2141
|
-
centerX,
|
|
2142
|
-
centerY,
|
|
2143
|
-
width: hole.hole_width + 2 * (hole.soldermask_margin ?? 0),
|
|
2144
|
-
height: hole.hole_height + 2 * (hole.soldermask_margin ?? 0)
|
|
2145
|
-
});
|
|
2146
|
-
project.children.push(
|
|
2147
|
-
new ShapePath18({
|
|
2148
|
-
cutIndex: soldermaskCutSetting.index,
|
|
2149
|
-
verts: soldermaskPath.verts,
|
|
2150
|
-
prims: soldermaskPath.prims,
|
|
2151
|
-
isClosed: true
|
|
2152
|
-
})
|
|
2153
|
-
);
|
|
2154
|
-
}
|
|
2155
2085
|
if (hole.hole_width > 0 && hole.hole_height > 0 && includeCopper) {
|
|
2156
2086
|
const ovalPath = createOvalPath({
|
|
2157
2087
|
centerX,
|
|
@@ -2173,32 +2103,9 @@ var addOvalPcbHole = (hole, ctx) => {
|
|
|
2173
2103
|
// lib/element-handlers/addPcbHole/addPillPcbHole.ts
|
|
2174
2104
|
import { ShapePath as ShapePath19 } from "lbrnts";
|
|
2175
2105
|
var addPillPcbHole = (hole, ctx) => {
|
|
2176
|
-
const {
|
|
2177
|
-
project,
|
|
2178
|
-
throughBoardCutSetting,
|
|
2179
|
-
soldermaskCutSetting,
|
|
2180
|
-
origin,
|
|
2181
|
-
includeSoldermask,
|
|
2182
|
-
includeCopper
|
|
2183
|
-
} = ctx;
|
|
2106
|
+
const { project, throughBoardCutSetting, origin, includeCopper } = ctx;
|
|
2184
2107
|
const centerX = hole.x + origin.x;
|
|
2185
2108
|
const centerY = hole.y + origin.y;
|
|
2186
|
-
if (hole.hole_width > 0 && hole.hole_height > 0 && includeSoldermask) {
|
|
2187
|
-
const soldermaskPath = createPillPath({
|
|
2188
|
-
centerX,
|
|
2189
|
-
centerY,
|
|
2190
|
-
width: hole.hole_width + 2 * (hole.soldermask_margin ?? 0),
|
|
2191
|
-
height: hole.hole_height + 2 * (hole.soldermask_margin ?? 0)
|
|
2192
|
-
});
|
|
2193
|
-
project.children.push(
|
|
2194
|
-
new ShapePath19({
|
|
2195
|
-
cutIndex: soldermaskCutSetting.index,
|
|
2196
|
-
verts: soldermaskPath.verts,
|
|
2197
|
-
prims: soldermaskPath.prims,
|
|
2198
|
-
isClosed: true
|
|
2199
|
-
})
|
|
2200
|
-
);
|
|
2201
|
-
}
|
|
2202
2109
|
if (hole.hole_width > 0 && hole.hole_height > 0 && includeCopper) {
|
|
2203
2110
|
const pillPath = createPillPath({
|
|
2204
2111
|
centerX,
|
|
@@ -2220,34 +2127,10 @@ var addPillPcbHole = (hole, ctx) => {
|
|
|
2220
2127
|
// lib/element-handlers/addPcbHole/addRotatedPillPcbHole.ts
|
|
2221
2128
|
import { ShapePath as ShapePath20 } from "lbrnts";
|
|
2222
2129
|
var addRotatedPillPcbHole = (hole, ctx) => {
|
|
2223
|
-
const {
|
|
2224
|
-
project,
|
|
2225
|
-
throughBoardCutSetting,
|
|
2226
|
-
soldermaskCutSetting,
|
|
2227
|
-
origin,
|
|
2228
|
-
includeSoldermask,
|
|
2229
|
-
includeCopper
|
|
2230
|
-
} = ctx;
|
|
2130
|
+
const { project, throughBoardCutSetting, origin, includeCopper } = ctx;
|
|
2231
2131
|
const centerX = hole.x + origin.x;
|
|
2232
2132
|
const centerY = hole.y + origin.y;
|
|
2233
2133
|
const rotation = (hole.ccw_rotation || 0) * (Math.PI / 180);
|
|
2234
|
-
if (hole.hole_width > 0 && hole.hole_height > 0 && includeSoldermask) {
|
|
2235
|
-
const soldermaskPath = createPillPath({
|
|
2236
|
-
centerX,
|
|
2237
|
-
centerY,
|
|
2238
|
-
width: hole.hole_width + 2 * (hole.soldermask_margin ?? 0),
|
|
2239
|
-
height: hole.hole_height + 2 * (hole.soldermask_margin ?? 0),
|
|
2240
|
-
rotation
|
|
2241
|
-
});
|
|
2242
|
-
project.children.push(
|
|
2243
|
-
new ShapePath20({
|
|
2244
|
-
cutIndex: soldermaskCutSetting.index,
|
|
2245
|
-
verts: soldermaskPath.verts,
|
|
2246
|
-
prims: soldermaskPath.prims,
|
|
2247
|
-
isClosed: true
|
|
2248
|
-
})
|
|
2249
|
-
);
|
|
2250
|
-
}
|
|
2251
2134
|
if (hole.hole_width > 0 && hole.hole_height > 0 && includeCopper) {
|
|
2252
2135
|
const pillPath = createPillPath({
|
|
2253
2136
|
centerX,
|
|
@@ -2290,14 +2173,7 @@ var addPcbHole = (hole, ctx) => {
|
|
|
2290
2173
|
// lib/element-handlers/addPcbCutout/addCirclePcbCutout.ts
|
|
2291
2174
|
import { ShapePath as ShapePath21 } from "lbrnts";
|
|
2292
2175
|
var addCirclePcbCutout = (cutout, ctx) => {
|
|
2293
|
-
const {
|
|
2294
|
-
project,
|
|
2295
|
-
throughBoardCutSetting,
|
|
2296
|
-
origin,
|
|
2297
|
-
includeCopper,
|
|
2298
|
-
includeSoldermask,
|
|
2299
|
-
soldermaskCutSetting
|
|
2300
|
-
} = ctx;
|
|
2176
|
+
const { project, throughBoardCutSetting, origin, includeCopper } = ctx;
|
|
2301
2177
|
const centerX = cutout.center.x + origin.x;
|
|
2302
2178
|
const centerY = cutout.center.y + origin.y;
|
|
2303
2179
|
if (cutout.radius > 0 && includeCopper) {
|
|
@@ -2315,34 +2191,12 @@ var addCirclePcbCutout = (cutout, ctx) => {
|
|
|
2315
2191
|
})
|
|
2316
2192
|
);
|
|
2317
2193
|
}
|
|
2318
|
-
if (cutout.radius > 0 && includeSoldermask) {
|
|
2319
|
-
const outer = createCirclePath({
|
|
2320
|
-
centerX,
|
|
2321
|
-
centerY,
|
|
2322
|
-
radius: cutout.radius
|
|
2323
|
-
});
|
|
2324
|
-
project.children.push(
|
|
2325
|
-
new ShapePath21({
|
|
2326
|
-
cutIndex: soldermaskCutSetting.index,
|
|
2327
|
-
verts: outer.verts,
|
|
2328
|
-
prims: outer.prims,
|
|
2329
|
-
isClosed: true
|
|
2330
|
-
})
|
|
2331
|
-
);
|
|
2332
|
-
}
|
|
2333
2194
|
};
|
|
2334
2195
|
|
|
2335
2196
|
// lib/element-handlers/addPcbCutout/addRectPcbCutout.ts
|
|
2336
2197
|
import { ShapePath as ShapePath22 } from "lbrnts";
|
|
2337
2198
|
var addRectPcbCutout = (cutout, ctx) => {
|
|
2338
|
-
const {
|
|
2339
|
-
project,
|
|
2340
|
-
throughBoardCutSetting,
|
|
2341
|
-
origin,
|
|
2342
|
-
includeCopper,
|
|
2343
|
-
includeSoldermask,
|
|
2344
|
-
soldermaskCutSetting
|
|
2345
|
-
} = ctx;
|
|
2199
|
+
const { project, throughBoardCutSetting, origin, includeCopper } = ctx;
|
|
2346
2200
|
const centerX = cutout.center.x + origin.x;
|
|
2347
2201
|
const centerY = cutout.center.y + origin.y;
|
|
2348
2202
|
if (cutout.width > 0 && cutout.height > 0 && includeCopper) {
|
|
@@ -2367,41 +2221,12 @@ var addRectPcbCutout = (cutout, ctx) => {
|
|
|
2367
2221
|
})
|
|
2368
2222
|
);
|
|
2369
2223
|
}
|
|
2370
|
-
if (cutout.width > 0 && cutout.height > 0 && includeSoldermask) {
|
|
2371
|
-
const rotation = (cutout.rotation ?? 0) * (Math.PI / 180);
|
|
2372
|
-
const rectPath = createRoundedRectPath({
|
|
2373
|
-
centerX,
|
|
2374
|
-
centerY,
|
|
2375
|
-
width: cutout.width,
|
|
2376
|
-
height: cutout.height,
|
|
2377
|
-
borderRadius: 0,
|
|
2378
|
-
// no border radius for cutouts
|
|
2379
|
-
segments: 4,
|
|
2380
|
-
// segments
|
|
2381
|
-
rotation
|
|
2382
|
-
});
|
|
2383
|
-
project.children.push(
|
|
2384
|
-
new ShapePath22({
|
|
2385
|
-
cutIndex: soldermaskCutSetting.index,
|
|
2386
|
-
verts: rectPath.verts,
|
|
2387
|
-
prims: rectPath.prims,
|
|
2388
|
-
isClosed: true
|
|
2389
|
-
})
|
|
2390
|
-
);
|
|
2391
|
-
}
|
|
2392
2224
|
};
|
|
2393
2225
|
|
|
2394
2226
|
// lib/element-handlers/addPcbCutout/addPolygonPcbCutout.ts
|
|
2395
2227
|
import { ShapePath as ShapePath23 } from "lbrnts";
|
|
2396
2228
|
var addPolygonPcbCutout = (cutout, ctx) => {
|
|
2397
|
-
const {
|
|
2398
|
-
project,
|
|
2399
|
-
throughBoardCutSetting,
|
|
2400
|
-
origin,
|
|
2401
|
-
includeCopper,
|
|
2402
|
-
includeSoldermask,
|
|
2403
|
-
soldermaskCutSetting
|
|
2404
|
-
} = ctx;
|
|
2229
|
+
const { project, throughBoardCutSetting, origin, includeCopper } = ctx;
|
|
2405
2230
|
if (cutout.points.length >= 3 && includeCopper) {
|
|
2406
2231
|
const polygonPath = createPolygonPathFromOutline({
|
|
2407
2232
|
outline: cutout.points,
|
|
@@ -2417,34 +2242,12 @@ var addPolygonPcbCutout = (cutout, ctx) => {
|
|
|
2417
2242
|
})
|
|
2418
2243
|
);
|
|
2419
2244
|
}
|
|
2420
|
-
if (cutout.points.length >= 3 && includeSoldermask) {
|
|
2421
|
-
const polygonPath = createPolygonPathFromOutline({
|
|
2422
|
-
outline: cutout.points,
|
|
2423
|
-
offsetX: origin.x,
|
|
2424
|
-
offsetY: origin.y
|
|
2425
|
-
});
|
|
2426
|
-
project.children.push(
|
|
2427
|
-
new ShapePath23({
|
|
2428
|
-
cutIndex: soldermaskCutSetting.index,
|
|
2429
|
-
verts: polygonPath.verts,
|
|
2430
|
-
prims: polygonPath.prims,
|
|
2431
|
-
isClosed: true
|
|
2432
|
-
})
|
|
2433
|
-
);
|
|
2434
|
-
}
|
|
2435
2245
|
};
|
|
2436
2246
|
|
|
2437
2247
|
// lib/element-handlers/addPcbCutout/addPathPcbCutout.ts
|
|
2438
2248
|
import { ShapePath as ShapePath24 } from "lbrnts";
|
|
2439
2249
|
var addPathPcbCutout = (cutout, ctx) => {
|
|
2440
|
-
const {
|
|
2441
|
-
project,
|
|
2442
|
-
throughBoardCutSetting,
|
|
2443
|
-
origin,
|
|
2444
|
-
includeCopper,
|
|
2445
|
-
includeSoldermask,
|
|
2446
|
-
soldermaskCutSetting
|
|
2447
|
-
} = ctx;
|
|
2250
|
+
const { project, throughBoardCutSetting, origin, includeCopper } = ctx;
|
|
2448
2251
|
if (cutout.route.length >= 2 && includeCopper) {
|
|
2449
2252
|
const verts = [];
|
|
2450
2253
|
const prims = [];
|
|
@@ -2465,26 +2268,6 @@ var addPathPcbCutout = (cutout, ctx) => {
|
|
|
2465
2268
|
})
|
|
2466
2269
|
);
|
|
2467
2270
|
}
|
|
2468
|
-
if (cutout.route.length >= 2 && includeSoldermask) {
|
|
2469
|
-
const verts = [];
|
|
2470
|
-
const prims = [];
|
|
2471
|
-
for (const point6 of cutout.route) {
|
|
2472
|
-
verts.push({
|
|
2473
|
-
x: point6.x + origin.x,
|
|
2474
|
-
y: point6.y + origin.y
|
|
2475
|
-
});
|
|
2476
|
-
prims.push({ type: 0 });
|
|
2477
|
-
}
|
|
2478
|
-
project.children.push(
|
|
2479
|
-
new ShapePath24({
|
|
2480
|
-
cutIndex: soldermaskCutSetting.index,
|
|
2481
|
-
verts,
|
|
2482
|
-
prims,
|
|
2483
|
-
isClosed: false
|
|
2484
|
-
// Match the same path as the copper cutout
|
|
2485
|
-
})
|
|
2486
|
-
);
|
|
2487
|
-
}
|
|
2488
2271
|
};
|
|
2489
2272
|
|
|
2490
2273
|
// lib/element-handlers/addPcbCutout/index.ts
|
|
@@ -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({
|
|
@@ -10,37 +10,11 @@ export const addRotatedPillPcbHole = (
|
|
|
10
10
|
hole: PcbHoleRotatedPill,
|
|
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
|
const rotation = (hole.ccw_rotation || 0) * (Math.PI / 180) // Convert degrees to radians
|
|
24
17
|
|
|
25
|
-
// Add soldermask opening if drawing soldermask
|
|
26
|
-
if (hole.hole_width > 0 && hole.hole_height > 0 && includeSoldermask) {
|
|
27
|
-
const soldermaskPath = createPillPath({
|
|
28
|
-
centerX,
|
|
29
|
-
centerY,
|
|
30
|
-
width: hole.hole_width + 2 * (hole.soldermask_margin ?? 0),
|
|
31
|
-
height: hole.hole_height + 2 * (hole.soldermask_margin ?? 0),
|
|
32
|
-
rotation,
|
|
33
|
-
})
|
|
34
|
-
project.children.push(
|
|
35
|
-
new ShapePath({
|
|
36
|
-
cutIndex: soldermaskCutSetting.index,
|
|
37
|
-
verts: soldermaskPath.verts,
|
|
38
|
-
prims: soldermaskPath.prims,
|
|
39
|
-
isClosed: true,
|
|
40
|
-
}),
|
|
41
|
-
)
|
|
42
|
-
}
|
|
43
|
-
|
|
44
18
|
// Add the hole - cut through the board
|
|
45
19
|
if (hole.hole_width > 0 && hole.hole_height > 0 && includeCopper) {
|
|
46
20
|
const pillPath = createPillPath({
|