circuit-json-to-lbrn 0.0.20 → 0.0.22
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 +1 -0
- package/dist/index.js +784 -345
- package/lib/ConvertContext.ts +6 -2
- package/lib/element-handlers/addPcbCutout/addCirclePcbCutout.ts +10 -2
- package/lib/element-handlers/addPcbCutout/addPolygonPcbCutout.ts +10 -6
- package/lib/element-handlers/addPcbCutout/addRectPcbCutout.ts +12 -12
- package/lib/element-handlers/addPcbHole/addCirclePcbHole.ts +10 -2
- package/lib/element-handlers/addPcbHole/addOvalPcbHole.ts +8 -8
- package/lib/element-handlers/addPcbHole/addPillPcbHole.ts +8 -8
- package/lib/element-handlers/addPcbHole/addRectPcbHole.ts +10 -10
- package/lib/element-handlers/addPcbHole/addRotatedPillPcbHole.ts +8 -8
- package/lib/element-handlers/addPcbTrace/index.ts +145 -61
- package/lib/element-handlers/addPcbVia/index.ts +49 -15
- package/lib/element-handlers/addPlatedHole/addCirclePlatedHole.ts +49 -15
- package/lib/element-handlers/addPlatedHole/addCircularHoleWithRectPad.ts +38 -18
- package/lib/element-handlers/addPlatedHole/addHoleWithPolygonPad.ts +41 -16
- package/lib/element-handlers/addPlatedHole/addOvalPlatedHole.ts +39 -18
- package/lib/element-handlers/addPlatedHole/addPillHoleWithRectPad.ts +38 -23
- package/lib/element-handlers/addPlatedHole/addPillPlatedHole.ts +39 -18
- package/lib/element-handlers/addPlatedHole/addRotatedPillHoleWithRectPad.ts +43 -28
- package/lib/element-handlers/addSmtPad/addCircleSmtPad.ts +31 -4
- package/lib/element-handlers/addSmtPad/addPillSmtPad.ts +33 -4
- package/lib/element-handlers/addSmtPad/addPolygonSmtPad.ts +25 -3
- package/lib/element-handlers/addSmtPad/addRectSmtPad.ts +20 -3
- package/lib/element-handlers/addSmtPad/addRotatedPillSmtPad.ts +31 -12
- package/lib/element-handlers/addSmtPad/addRotatedRectSmtPad.ts +31 -12
- package/lib/helpers/circleShape.ts +13 -6
- package/lib/helpers/ovalShape.ts +17 -8
- package/lib/helpers/pathPointUtils.ts +11 -5
- package/lib/helpers/pillShape.ts +24 -11
- package/lib/helpers/polygonShape.ts +11 -5
- package/lib/helpers/roundedRectShape.ts +19 -9
- package/lib/index.ts +92 -41
- package/package.json +1 -1
- package/tests/assets/keyboard-default60.json +92565 -0
- package/tests/examples/__snapshots__/board-outline-soldermask-preset.snap.svg +1 -1
- package/tests/examples/__snapshots__/board-outline.snap.svg +1 -1
- package/tests/examples/__snapshots__/lga-interconnect.snap.svg +1 -1
- package/tests/examples/__snapshots__/single-trace.snap.svg +1 -1
- package/tests/examples/addPcbCutout/__snapshots__/pcb-cutout-circle.snap.svg +1 -1
- package/tests/examples/addPcbCutout/__snapshots__/pcb-cutout-path.snap.svg +1 -1
- package/tests/examples/addPcbCutout/__snapshots__/pcb-cutout-polygon.snap.svg +1 -1
- package/tests/examples/addPcbCutout/__snapshots__/pcb-cutout-rect.snap.svg +1 -1
- package/tests/examples/addPcbHole/__snapshots__/pcb-hole-circle.snap.svg +1 -1
- package/tests/examples/addPcbHole/__snapshots__/pcb-hole-oval.snap.svg +1 -1
- package/tests/examples/addPcbHole/__snapshots__/pcb-hole-pill.snap.svg +1 -1
- package/tests/examples/addPcbHole/__snapshots__/pcb-hole-rect.snap.svg +1 -1
- package/tests/examples/addPcbHole/__snapshots__/pcb-hole-rotated-pill.snap.svg +2 -2
- package/tests/examples/addPcbHole/__snapshots__/pcb-hole-with-soldermask.snap.svg +1 -1
- package/tests/examples/addPcbVia/__snapshots__/pcb-via-basic.snap.svg +1 -1
- package/tests/examples/addPcbVia/__snapshots__/pcb-via-with-net.snap.svg +1 -1
- package/tests/examples/addPcbVia/__snapshots__/pcb-via-with-soldermask.snap.svg +1 -1
- package/tests/examples/addPlatedHole/__snapshots__/pcb-plated-hole-circle.snap.svg +1 -1
- package/tests/examples/addPlatedHole/__snapshots__/pcb-plated-hole-circular-hole-with-rect-pad.snap.svg +1 -1
- package/tests/examples/addPlatedHole/__snapshots__/pcb-plated-hole-oval.snap.svg +1 -1
- package/tests/examples/addPlatedHole/__snapshots__/pcb-plated-hole-pill-with-rect-pad.snap.svg +1 -1
- package/tests/examples/addPlatedHole/__snapshots__/pcb-plated-hole-pill.snap.svg +1 -1
- package/tests/examples/addPlatedHole/__snapshots__/pcb-plated-hole-polygon.snap.svg +1 -1
- package/tests/examples/addPlatedHole/__snapshots__/pcb-plated-hole-rotated-pill-with-rect-pad.snap.svg +1 -1
- package/tests/examples/addSmtPad/__snapshots__/circleSmtPad.snap.svg +1 -1
- package/tests/examples/addSmtPad/__snapshots__/pillSmtPad.snap.svg +1 -1
- package/tests/examples/addSmtPad/__snapshots__/polygonSmtPad.snap.svg +1 -1
- package/tests/examples/addSmtPad/__snapshots__/rotatedPillSmtPad.snap.svg +1 -1
- package/tests/examples/addSmtPad/__snapshots__/rotatedRectSmtPad.snap.svg +1 -1
- package/tests/examples/keyboard-defaul60/__snapshots__/keyboard-both-layer-includeSoldermask.snap.svg +8 -0
- package/tests/examples/keyboard-defaul60/__snapshots__/keyboard-both-layers.snap.svg +8 -0
- package/tests/examples/keyboard-defaul60/__snapshots__/keyboard-bottom-layer.snap.svg +8 -0
- package/tests/examples/keyboard-defaul60/__snapshots__/keyboard-top-layer.snap.svg +8 -0
- package/tests/examples/keyboard-defaul60/keyboard-both-layer-includeSoldermask.test.ts +27 -0
- package/tests/examples/keyboard-defaul60/keyboard-both-layers.test.ts +26 -0
- package/tests/examples/keyboard-defaul60/keyboard-bottom-layer.test.ts +26 -0
- package/tests/examples/keyboard-defaul60/keyboard-top-layer.test.ts +26 -0
- package/tests/examples/lga-interconnect.test.ts +3 -2
- package/tests/examples/soldermask/__snapshots__/copper-and-soldermask.snap.svg +1 -1
- package/tests/examples/soldermask/__snapshots__/copper-only.snap.svg +1 -1
- package/tests/examples/soldermask/__snapshots__/soldermask-only.snap.svg +1 -1
- package/tests/examples/soldermask/copper-and-soldermask.test.ts +18 -10
- package/tests/examples/soldermask/soldermask-only.test.ts +3 -3
- package/tests/examples/soldermask-margin/__snapshots__/negative-soldermask-margin.snap.svg +1 -1
- package/tests/examples/soldermask-margin/__snapshots__/positive-soldermask-margin.snap.svg +1 -1
- package/tsconfig.json +2 -1
|
@@ -11,19 +11,24 @@ export const addCirclePlatedHole = (
|
|
|
11
11
|
): void => {
|
|
12
12
|
const {
|
|
13
13
|
project,
|
|
14
|
-
|
|
14
|
+
topCopperCutSetting,
|
|
15
|
+
bottomCopperCutSetting,
|
|
15
16
|
soldermaskCutSetting,
|
|
16
17
|
throughBoardCutSetting,
|
|
18
|
+
topNetGeoms,
|
|
19
|
+
bottomNetGeoms,
|
|
17
20
|
origin,
|
|
18
21
|
includeCopper,
|
|
19
22
|
includeSoldermask,
|
|
20
23
|
connMap,
|
|
21
24
|
soldermaskMargin,
|
|
25
|
+
includeLayers,
|
|
22
26
|
} = ctx
|
|
23
27
|
const centerX = platedHole.x + origin.x
|
|
24
28
|
const centerY = platedHole.y + origin.y
|
|
25
29
|
|
|
26
30
|
// Add outer circle (copper annulus) if drawing copper - add to netGeoms for merging
|
|
31
|
+
// Plated holes go through all layers, so add to both top and bottom
|
|
27
32
|
if (platedHole.outer_diameter > 0 && includeCopper) {
|
|
28
33
|
const netId = connMap.getNetConnectedToId(platedHole.pcb_plated_hole_id)
|
|
29
34
|
const outerRadius = platedHole.outer_diameter / 2
|
|
@@ -31,26 +36,51 @@ export const addCirclePlatedHole = (
|
|
|
31
36
|
const polygon = circleToPolygon(circle)
|
|
32
37
|
|
|
33
38
|
if (netId) {
|
|
34
|
-
// Add to
|
|
35
|
-
|
|
39
|
+
// Add to both top and bottom netGeoms since plated holes go through the board
|
|
40
|
+
if (includeLayers.includes("top")) {
|
|
41
|
+
topNetGeoms.get(netId)?.push(polygon.clone())
|
|
42
|
+
}
|
|
43
|
+
if (includeLayers.includes("bottom")) {
|
|
44
|
+
bottomNetGeoms.get(netId)?.push(polygon.clone())
|
|
45
|
+
}
|
|
36
46
|
} else {
|
|
37
|
-
// No net connection - draw directly
|
|
38
|
-
const outer = createCirclePath(
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
+
// No net connection - draw directly for each included layer
|
|
48
|
+
const outer = createCirclePath({
|
|
49
|
+
centerX,
|
|
50
|
+
centerY,
|
|
51
|
+
radius: outerRadius,
|
|
52
|
+
})
|
|
53
|
+
if (includeLayers.includes("top")) {
|
|
54
|
+
project.children.push(
|
|
55
|
+
new ShapePath({
|
|
56
|
+
cutIndex: topCopperCutSetting.index,
|
|
57
|
+
verts: outer.verts,
|
|
58
|
+
prims: outer.prims,
|
|
59
|
+
isClosed: true,
|
|
60
|
+
}),
|
|
61
|
+
)
|
|
62
|
+
}
|
|
63
|
+
if (includeLayers.includes("bottom")) {
|
|
64
|
+
project.children.push(
|
|
65
|
+
new ShapePath({
|
|
66
|
+
cutIndex: bottomCopperCutSetting.index,
|
|
67
|
+
verts: outer.verts,
|
|
68
|
+
prims: outer.prims,
|
|
69
|
+
isClosed: true,
|
|
70
|
+
}),
|
|
71
|
+
)
|
|
72
|
+
}
|
|
47
73
|
}
|
|
48
74
|
}
|
|
49
75
|
|
|
50
76
|
// Add soldermask opening if drawing soldermask
|
|
51
77
|
if (platedHole.outer_diameter > 0 && includeSoldermask) {
|
|
52
78
|
const smRadius = platedHole.outer_diameter / 2 + soldermaskMargin
|
|
53
|
-
const outer = createCirclePath(
|
|
79
|
+
const outer = createCirclePath({
|
|
80
|
+
centerX,
|
|
81
|
+
centerY,
|
|
82
|
+
radius: smRadius,
|
|
83
|
+
})
|
|
54
84
|
project.children.push(
|
|
55
85
|
new ShapePath({
|
|
56
86
|
cutIndex: soldermaskCutSetting.index,
|
|
@@ -63,7 +93,11 @@ export const addCirclePlatedHole = (
|
|
|
63
93
|
|
|
64
94
|
if (platedHole.hole_diameter > 0 && includeCopper) {
|
|
65
95
|
const innerRadius = platedHole.hole_diameter / 2
|
|
66
|
-
const inner = createCirclePath(
|
|
96
|
+
const inner = createCirclePath({
|
|
97
|
+
centerX,
|
|
98
|
+
centerY,
|
|
99
|
+
radius: innerRadius,
|
|
100
|
+
})
|
|
67
101
|
project.children.push(
|
|
68
102
|
new ShapePath({
|
|
69
103
|
cutIndex: throughBoardCutSetting.index,
|
|
@@ -10,13 +10,15 @@ export const addCircularHoleWithRectPad = (
|
|
|
10
10
|
): void => {
|
|
11
11
|
const {
|
|
12
12
|
project,
|
|
13
|
-
|
|
13
|
+
topCopperCutSetting,
|
|
14
|
+
bottomCopperCutSetting,
|
|
14
15
|
soldermaskCutSetting,
|
|
15
16
|
throughBoardCutSetting,
|
|
16
17
|
origin,
|
|
17
18
|
includeCopper,
|
|
18
19
|
includeSoldermask,
|
|
19
20
|
soldermaskMargin,
|
|
21
|
+
includeLayers,
|
|
20
22
|
} = ctx
|
|
21
23
|
const centerX = platedHole.x + origin.x
|
|
22
24
|
const centerY = platedHole.y + origin.y
|
|
@@ -26,37 +28,50 @@ export const addCircularHoleWithRectPad = (
|
|
|
26
28
|
const borderRadius = platedHole.rect_border_radius ?? 0
|
|
27
29
|
|
|
28
30
|
// Create rectangle pad vertices
|
|
29
|
-
const padPath = createRoundedRectPath(
|
|
31
|
+
const padPath = createRoundedRectPath({
|
|
30
32
|
centerX,
|
|
31
33
|
centerY,
|
|
32
|
-
padWidth,
|
|
33
|
-
padHeight,
|
|
34
|
+
width: padWidth,
|
|
35
|
+
height: padHeight,
|
|
34
36
|
borderRadius,
|
|
35
|
-
)
|
|
37
|
+
})
|
|
36
38
|
|
|
37
39
|
// Add the rectangular pad if drawing copper
|
|
40
|
+
// Plated holes go through all layers, so add to both top and bottom
|
|
38
41
|
if (includeCopper) {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
42
|
+
if (includeLayers.includes("top")) {
|
|
43
|
+
project.children.push(
|
|
44
|
+
new ShapePath({
|
|
45
|
+
cutIndex: topCopperCutSetting.index,
|
|
46
|
+
verts: padPath.verts,
|
|
47
|
+
prims: padPath.prims,
|
|
48
|
+
isClosed: true,
|
|
49
|
+
}),
|
|
50
|
+
)
|
|
51
|
+
}
|
|
52
|
+
if (includeLayers.includes("bottom")) {
|
|
53
|
+
project.children.push(
|
|
54
|
+
new ShapePath({
|
|
55
|
+
cutIndex: bottomCopperCutSetting.index,
|
|
56
|
+
verts: padPath.verts,
|
|
57
|
+
prims: padPath.prims,
|
|
58
|
+
isClosed: true,
|
|
59
|
+
}),
|
|
60
|
+
)
|
|
61
|
+
}
|
|
47
62
|
}
|
|
48
63
|
|
|
49
64
|
// Add soldermask opening if drawing soldermask
|
|
50
65
|
if (includeSoldermask) {
|
|
51
66
|
const smPadWidth = padWidth + 2 * soldermaskMargin
|
|
52
67
|
const smPadHeight = padHeight + 2 * soldermaskMargin
|
|
53
|
-
const smPadPath = createRoundedRectPath(
|
|
68
|
+
const smPadPath = createRoundedRectPath({
|
|
54
69
|
centerX,
|
|
55
70
|
centerY,
|
|
56
|
-
smPadWidth,
|
|
57
|
-
smPadHeight,
|
|
71
|
+
width: smPadWidth,
|
|
72
|
+
height: smPadHeight,
|
|
58
73
|
borderRadius,
|
|
59
|
-
)
|
|
74
|
+
})
|
|
60
75
|
|
|
61
76
|
project.children.push(
|
|
62
77
|
new ShapePath({
|
|
@@ -72,7 +87,12 @@ export const addCircularHoleWithRectPad = (
|
|
|
72
87
|
if (holeRadius > 0 && includeCopper) {
|
|
73
88
|
const holeCenterX = centerX + platedHole.hole_offset_x
|
|
74
89
|
const holeCenterY = centerY + platedHole.hole_offset_y
|
|
75
|
-
const holePath = createCirclePath(
|
|
90
|
+
const holePath = createCirclePath({
|
|
91
|
+
centerX: holeCenterX,
|
|
92
|
+
centerY: holeCenterY,
|
|
93
|
+
radius: holeRadius,
|
|
94
|
+
segments: 32,
|
|
95
|
+
})
|
|
76
96
|
|
|
77
97
|
project.children.push(
|
|
78
98
|
new ShapePath({
|
|
@@ -10,33 +10,48 @@ export const addHoleWithPolygonPad = (
|
|
|
10
10
|
): void => {
|
|
11
11
|
const {
|
|
12
12
|
project,
|
|
13
|
-
|
|
13
|
+
topCopperCutSetting,
|
|
14
|
+
bottomCopperCutSetting,
|
|
14
15
|
soldermaskCutSetting,
|
|
15
16
|
throughBoardCutSetting,
|
|
16
17
|
origin,
|
|
17
18
|
includeCopper,
|
|
18
19
|
includeSoldermask,
|
|
19
20
|
soldermaskMargin,
|
|
21
|
+
includeLayers,
|
|
20
22
|
} = ctx
|
|
21
23
|
|
|
22
24
|
// Create the polygon pad
|
|
23
25
|
if (platedHole.pad_outline.length >= 3 && includeCopper) {
|
|
24
|
-
const pad = createPolygonPathFromOutline(
|
|
25
|
-
platedHole.pad_outline,
|
|
26
|
-
platedHole.x + origin.x,
|
|
27
|
-
platedHole.y + origin.y,
|
|
28
|
-
)
|
|
26
|
+
const pad = createPolygonPathFromOutline({
|
|
27
|
+
outline: platedHole.pad_outline,
|
|
28
|
+
offsetX: platedHole.x + origin.x,
|
|
29
|
+
offsetY: platedHole.y + origin.y,
|
|
30
|
+
})
|
|
29
31
|
|
|
30
32
|
// Add the polygon pad if drawing copper
|
|
33
|
+
// Plated holes go through all layers, so add to both top and bottom
|
|
31
34
|
if (includeCopper) {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
if (includeLayers.includes("top")) {
|
|
36
|
+
project.children.push(
|
|
37
|
+
new ShapePath({
|
|
38
|
+
cutIndex: topCopperCutSetting.index,
|
|
39
|
+
verts: pad.verts,
|
|
40
|
+
prims: pad.prims,
|
|
41
|
+
isClosed: true,
|
|
42
|
+
}),
|
|
43
|
+
)
|
|
44
|
+
}
|
|
45
|
+
if (includeLayers.includes("bottom")) {
|
|
46
|
+
project.children.push(
|
|
47
|
+
new ShapePath({
|
|
48
|
+
cutIndex: bottomCopperCutSetting.index,
|
|
49
|
+
verts: pad.verts,
|
|
50
|
+
prims: pad.prims,
|
|
51
|
+
isClosed: true,
|
|
52
|
+
}),
|
|
53
|
+
)
|
|
54
|
+
}
|
|
40
55
|
}
|
|
41
56
|
|
|
42
57
|
// Add soldermask opening if drawing soldermask
|
|
@@ -62,7 +77,12 @@ export const addHoleWithPolygonPad = (
|
|
|
62
77
|
const centerX = platedHole.x + platedHole.hole_offset_x + origin.x
|
|
63
78
|
const centerY = platedHole.y + platedHole.hole_offset_y + origin.y
|
|
64
79
|
const radius = platedHole.hole_diameter / 2
|
|
65
|
-
const hole = createCirclePath(
|
|
80
|
+
const hole = createCirclePath({
|
|
81
|
+
centerX,
|
|
82
|
+
centerY,
|
|
83
|
+
radius,
|
|
84
|
+
segments: 64,
|
|
85
|
+
})
|
|
66
86
|
|
|
67
87
|
project.children.push(
|
|
68
88
|
new ShapePath({
|
|
@@ -81,7 +101,12 @@ export const addHoleWithPolygonPad = (
|
|
|
81
101
|
const centerX = platedHole.x + platedHole.hole_offset_x + origin.x
|
|
82
102
|
const centerY = platedHole.y + platedHole.hole_offset_y + origin.y
|
|
83
103
|
const radius = platedHole.hole_diameter / 2
|
|
84
|
-
const hole = createCirclePath(
|
|
104
|
+
const hole = createCirclePath({
|
|
105
|
+
centerX,
|
|
106
|
+
centerY,
|
|
107
|
+
radius,
|
|
108
|
+
segments: 64,
|
|
109
|
+
})
|
|
85
110
|
|
|
86
111
|
// Note: rotation is not supported for holes with polygon pad
|
|
87
112
|
|
|
@@ -9,13 +9,15 @@ export const addOvalPlatedHole = (
|
|
|
9
9
|
): void => {
|
|
10
10
|
const {
|
|
11
11
|
project,
|
|
12
|
-
|
|
12
|
+
topCopperCutSetting,
|
|
13
|
+
bottomCopperCutSetting,
|
|
13
14
|
soldermaskCutSetting,
|
|
14
15
|
throughBoardCutSetting,
|
|
15
16
|
origin,
|
|
16
17
|
includeCopper,
|
|
17
18
|
includeSoldermask,
|
|
18
19
|
soldermaskMargin,
|
|
20
|
+
includeLayers,
|
|
19
21
|
} = ctx
|
|
20
22
|
|
|
21
23
|
if (platedHole.outer_width <= 0 || platedHole.outer_height <= 0) {
|
|
@@ -27,26 +29,39 @@ export const addOvalPlatedHole = (
|
|
|
27
29
|
const rotation = (platedHole.ccw_rotation ?? 0) * (Math.PI / 180)
|
|
28
30
|
|
|
29
31
|
// Add outer oval (copper) if drawing copper
|
|
32
|
+
// Plated holes go through all layers, so add to both top and bottom
|
|
30
33
|
if (
|
|
31
34
|
platedHole.outer_width > 0 &&
|
|
32
35
|
platedHole.outer_height > 0 &&
|
|
33
36
|
includeCopper
|
|
34
37
|
) {
|
|
35
|
-
const outer = createOvalPath(
|
|
38
|
+
const outer = createOvalPath({
|
|
36
39
|
centerX,
|
|
37
40
|
centerY,
|
|
38
|
-
platedHole.outer_width,
|
|
39
|
-
platedHole.outer_height,
|
|
41
|
+
width: platedHole.outer_width,
|
|
42
|
+
height: platedHole.outer_height,
|
|
40
43
|
rotation,
|
|
41
|
-
)
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
44
|
+
})
|
|
45
|
+
if (includeLayers.includes("top")) {
|
|
46
|
+
project.children.push(
|
|
47
|
+
new ShapePath({
|
|
48
|
+
cutIndex: topCopperCutSetting.index,
|
|
49
|
+
verts: outer.verts,
|
|
50
|
+
prims: outer.prims,
|
|
51
|
+
isClosed: true,
|
|
52
|
+
}),
|
|
53
|
+
)
|
|
54
|
+
}
|
|
55
|
+
if (includeLayers.includes("bottom")) {
|
|
56
|
+
project.children.push(
|
|
57
|
+
new ShapePath({
|
|
58
|
+
cutIndex: bottomCopperCutSetting.index,
|
|
59
|
+
verts: outer.verts,
|
|
60
|
+
prims: outer.prims,
|
|
61
|
+
isClosed: true,
|
|
62
|
+
}),
|
|
63
|
+
)
|
|
64
|
+
}
|
|
50
65
|
}
|
|
51
66
|
|
|
52
67
|
// Add soldermask opening if drawing soldermask
|
|
@@ -57,7 +72,13 @@ export const addOvalPlatedHole = (
|
|
|
57
72
|
) {
|
|
58
73
|
const smWidth = platedHole.outer_width + 2 * soldermaskMargin
|
|
59
74
|
const smHeight = platedHole.outer_height + 2 * soldermaskMargin
|
|
60
|
-
const outer = createOvalPath(
|
|
75
|
+
const outer = createOvalPath({
|
|
76
|
+
centerX,
|
|
77
|
+
centerY,
|
|
78
|
+
width: smWidth,
|
|
79
|
+
height: smHeight,
|
|
80
|
+
rotation,
|
|
81
|
+
})
|
|
61
82
|
project.children.push(
|
|
62
83
|
new ShapePath({
|
|
63
84
|
cutIndex: soldermaskCutSetting.index,
|
|
@@ -74,13 +95,13 @@ export const addOvalPlatedHole = (
|
|
|
74
95
|
platedHole.hole_height > 0 &&
|
|
75
96
|
includeCopper
|
|
76
97
|
) {
|
|
77
|
-
const inner = createOvalPath(
|
|
98
|
+
const inner = createOvalPath({
|
|
78
99
|
centerX,
|
|
79
100
|
centerY,
|
|
80
|
-
platedHole.hole_width,
|
|
81
|
-
platedHole.hole_height,
|
|
101
|
+
width: platedHole.hole_width,
|
|
102
|
+
height: platedHole.hole_height,
|
|
82
103
|
rotation,
|
|
83
|
-
)
|
|
104
|
+
})
|
|
84
105
|
project.children.push(
|
|
85
106
|
new ShapePath({
|
|
86
107
|
cutIndex: throughBoardCutSetting.index,
|
|
@@ -10,13 +10,15 @@ export const addPillHoleWithRectPad = (
|
|
|
10
10
|
): void => {
|
|
11
11
|
const {
|
|
12
12
|
project,
|
|
13
|
-
|
|
13
|
+
topCopperCutSetting,
|
|
14
|
+
bottomCopperCutSetting,
|
|
14
15
|
soldermaskCutSetting,
|
|
15
16
|
throughBoardCutSetting,
|
|
16
17
|
origin,
|
|
17
18
|
includeCopper,
|
|
18
19
|
includeSoldermask,
|
|
19
20
|
soldermaskMargin,
|
|
21
|
+
includeLayers,
|
|
20
22
|
} = ctx
|
|
21
23
|
const centerX = platedHole.x + origin.x
|
|
22
24
|
const centerY = platedHole.y + origin.y
|
|
@@ -26,37 +28,50 @@ export const addPillHoleWithRectPad = (
|
|
|
26
28
|
const borderRadius = platedHole.rect_border_radius ?? 0
|
|
27
29
|
|
|
28
30
|
if (padWidth > 0 && padHeight > 0) {
|
|
29
|
-
const padPath = createRoundedRectPath(
|
|
31
|
+
const padPath = createRoundedRectPath({
|
|
30
32
|
centerX,
|
|
31
33
|
centerY,
|
|
32
|
-
padWidth,
|
|
33
|
-
padHeight,
|
|
34
|
+
width: padWidth,
|
|
35
|
+
height: padHeight,
|
|
34
36
|
borderRadius,
|
|
35
|
-
)
|
|
37
|
+
})
|
|
36
38
|
|
|
37
39
|
// Add the rectangular pad if drawing copper
|
|
40
|
+
// Plated holes go through all layers, so add to both top and bottom
|
|
38
41
|
if (includeCopper) {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
42
|
+
if (includeLayers.includes("top")) {
|
|
43
|
+
project.children.push(
|
|
44
|
+
new ShapePath({
|
|
45
|
+
cutIndex: topCopperCutSetting.index,
|
|
46
|
+
verts: padPath.verts,
|
|
47
|
+
prims: padPath.prims,
|
|
48
|
+
isClosed: true,
|
|
49
|
+
}),
|
|
50
|
+
)
|
|
51
|
+
}
|
|
52
|
+
if (includeLayers.includes("bottom")) {
|
|
53
|
+
project.children.push(
|
|
54
|
+
new ShapePath({
|
|
55
|
+
cutIndex: bottomCopperCutSetting.index,
|
|
56
|
+
verts: padPath.verts,
|
|
57
|
+
prims: padPath.prims,
|
|
58
|
+
isClosed: true,
|
|
59
|
+
}),
|
|
60
|
+
)
|
|
61
|
+
}
|
|
47
62
|
}
|
|
48
63
|
|
|
49
64
|
// Add soldermask opening if drawing soldermask
|
|
50
65
|
if (includeSoldermask) {
|
|
51
66
|
const smPadWidth = padWidth + 2 * soldermaskMargin
|
|
52
67
|
const smPadHeight = padHeight + 2 * soldermaskMargin
|
|
53
|
-
const smPadPath = createRoundedRectPath(
|
|
68
|
+
const smPadPath = createRoundedRectPath({
|
|
54
69
|
centerX,
|
|
55
70
|
centerY,
|
|
56
|
-
smPadWidth,
|
|
57
|
-
smPadHeight,
|
|
71
|
+
width: smPadWidth,
|
|
72
|
+
height: smPadHeight,
|
|
58
73
|
borderRadius,
|
|
59
|
-
)
|
|
74
|
+
})
|
|
60
75
|
|
|
61
76
|
project.children.push(
|
|
62
77
|
new ShapePath({
|
|
@@ -75,12 +90,12 @@ export const addPillHoleWithRectPad = (
|
|
|
75
90
|
if (holeWidth > 0 && holeHeight > 0 && includeCopper) {
|
|
76
91
|
const holeCenterX = centerX + platedHole.hole_offset_x
|
|
77
92
|
const holeCenterY = centerY + platedHole.hole_offset_y
|
|
78
|
-
const holePath = createPillPath(
|
|
79
|
-
holeCenterX,
|
|
80
|
-
holeCenterY,
|
|
81
|
-
holeWidth,
|
|
82
|
-
holeHeight,
|
|
83
|
-
)
|
|
93
|
+
const holePath = createPillPath({
|
|
94
|
+
centerX: holeCenterX,
|
|
95
|
+
centerY: holeCenterY,
|
|
96
|
+
width: holeWidth,
|
|
97
|
+
height: holeHeight,
|
|
98
|
+
})
|
|
84
99
|
|
|
85
100
|
project.children.push(
|
|
86
101
|
new ShapePath({
|
|
@@ -9,39 +9,54 @@ export const addPcbPlatedHolePill = (
|
|
|
9
9
|
): void => {
|
|
10
10
|
const {
|
|
11
11
|
project,
|
|
12
|
-
|
|
12
|
+
topCopperCutSetting,
|
|
13
|
+
bottomCopperCutSetting,
|
|
13
14
|
soldermaskCutSetting,
|
|
14
15
|
throughBoardCutSetting,
|
|
15
16
|
origin,
|
|
16
17
|
includeCopper,
|
|
17
18
|
includeSoldermask,
|
|
18
19
|
soldermaskMargin,
|
|
20
|
+
includeLayers,
|
|
19
21
|
} = ctx
|
|
20
22
|
const centerX = platedHole.x + origin.x
|
|
21
23
|
const centerY = platedHole.y + origin.y
|
|
22
24
|
const rotation = (platedHole.ccw_rotation || 0) * (Math.PI / 180) // Convert degrees to radians
|
|
23
25
|
|
|
24
26
|
// Add outer pill shape (copper) if drawing copper
|
|
27
|
+
// Plated holes go through all layers, so add to both top and bottom
|
|
25
28
|
if (
|
|
26
29
|
platedHole.outer_width > 0 &&
|
|
27
30
|
platedHole.outer_height > 0 &&
|
|
28
31
|
includeCopper
|
|
29
32
|
) {
|
|
30
|
-
const outer = createPillPath(
|
|
33
|
+
const outer = createPillPath({
|
|
31
34
|
centerX,
|
|
32
35
|
centerY,
|
|
33
|
-
platedHole.outer_width,
|
|
34
|
-
platedHole.outer_height,
|
|
36
|
+
width: platedHole.outer_width,
|
|
37
|
+
height: platedHole.outer_height,
|
|
35
38
|
rotation,
|
|
36
|
-
)
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
39
|
+
})
|
|
40
|
+
if (includeLayers.includes("top")) {
|
|
41
|
+
project.children.push(
|
|
42
|
+
new ShapePath({
|
|
43
|
+
cutIndex: topCopperCutSetting.index,
|
|
44
|
+
verts: outer.verts,
|
|
45
|
+
prims: outer.prims,
|
|
46
|
+
isClosed: true,
|
|
47
|
+
}),
|
|
48
|
+
)
|
|
49
|
+
}
|
|
50
|
+
if (includeLayers.includes("bottom")) {
|
|
51
|
+
project.children.push(
|
|
52
|
+
new ShapePath({
|
|
53
|
+
cutIndex: bottomCopperCutSetting.index,
|
|
54
|
+
verts: outer.verts,
|
|
55
|
+
prims: outer.prims,
|
|
56
|
+
isClosed: true,
|
|
57
|
+
}),
|
|
58
|
+
)
|
|
59
|
+
}
|
|
45
60
|
}
|
|
46
61
|
|
|
47
62
|
// Add soldermask opening if drawing soldermask
|
|
@@ -52,7 +67,13 @@ export const addPcbPlatedHolePill = (
|
|
|
52
67
|
) {
|
|
53
68
|
const smWidth = platedHole.outer_width + 2 * soldermaskMargin
|
|
54
69
|
const smHeight = platedHole.outer_height + 2 * soldermaskMargin
|
|
55
|
-
const outer = createPillPath(
|
|
70
|
+
const outer = createPillPath({
|
|
71
|
+
centerX,
|
|
72
|
+
centerY,
|
|
73
|
+
width: smWidth,
|
|
74
|
+
height: smHeight,
|
|
75
|
+
rotation,
|
|
76
|
+
})
|
|
56
77
|
project.children.push(
|
|
57
78
|
new ShapePath({
|
|
58
79
|
cutIndex: soldermaskCutSetting.index,
|
|
@@ -69,13 +90,13 @@ export const addPcbPlatedHolePill = (
|
|
|
69
90
|
platedHole.hole_height > 0 &&
|
|
70
91
|
includeCopper
|
|
71
92
|
) {
|
|
72
|
-
const inner = createPillPath(
|
|
93
|
+
const inner = createPillPath({
|
|
73
94
|
centerX,
|
|
74
95
|
centerY,
|
|
75
|
-
platedHole.hole_width,
|
|
76
|
-
platedHole.hole_height,
|
|
96
|
+
width: platedHole.hole_width,
|
|
97
|
+
height: platedHole.hole_height,
|
|
77
98
|
rotation,
|
|
78
|
-
)
|
|
99
|
+
})
|
|
79
100
|
project.children.push(
|
|
80
101
|
new ShapePath({
|
|
81
102
|
cutIndex: throughBoardCutSetting.index,
|