circuit-json-to-lbrn 0.0.19 → 0.0.21
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 +296 -164
- 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/addPcbVia/index.ts +15 -3
- package/lib/element-handlers/addPlatedHole/addCirclePlatedHole.ts +15 -3
- package/lib/element-handlers/addPlatedHole/addCircularHoleWithRectPad.ts +14 -9
- package/lib/element-handlers/addPlatedHole/addHoleWithPolygonPad.ts +17 -7
- package/lib/element-handlers/addPlatedHole/addOvalPlatedHole.ts +15 -9
- package/lib/element-handlers/addPlatedHole/addPillHoleWithRectPad.ts +14 -14
- package/lib/element-handlers/addPlatedHole/addPillPlatedHole.ts +15 -9
- package/lib/element-handlers/addPlatedHole/addRotatedPillHoleWithRectPad.ts +19 -19
- package/lib/element-handlers/addSmtPad/addCircleSmtPad.ts +10 -2
- package/lib/element-handlers/addSmtPad/addPillSmtPad.ts +12 -2
- package/lib/element-handlers/addSmtPad/addPolygonSmtPad.ts +5 -1
- package/lib/element-handlers/addSmtPad/addRotatedPillSmtPad.ts +10 -10
- package/lib/element-handlers/addSmtPad/addRotatedRectSmtPad.ts +11 -11
- 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/package.json +1 -1
- package/tests/examples/addSmtPad/__snapshots__/rotatedRectSmtPad.snap.svg +4 -4
- package/tests/examples/addSmtPad/rotatedRectSmtPad.test.ts +15 -3
|
@@ -25,7 +25,11 @@ export const addCirclePcbCutout = (
|
|
|
25
25
|
|
|
26
26
|
// Add the cutout - cut through the board
|
|
27
27
|
if (cutout.radius > 0 && includeCopper) {
|
|
28
|
-
const circlePath = createCirclePath(
|
|
28
|
+
const circlePath = createCirclePath({
|
|
29
|
+
centerX,
|
|
30
|
+
centerY,
|
|
31
|
+
radius: cutout.radius,
|
|
32
|
+
})
|
|
29
33
|
project.children.push(
|
|
30
34
|
new ShapePath({
|
|
31
35
|
cutIndex: throughBoardCutSetting.index,
|
|
@@ -39,7 +43,11 @@ export const addCirclePcbCutout = (
|
|
|
39
43
|
// Add soldermask opening if drawing soldermask
|
|
40
44
|
if (cutout.radius > 0 && includeSoldermask) {
|
|
41
45
|
const smRadius = cutout.radius + soldermaskMargin
|
|
42
|
-
const outer = createCirclePath(
|
|
46
|
+
const outer = createCirclePath({
|
|
47
|
+
centerX,
|
|
48
|
+
centerY,
|
|
49
|
+
radius: smRadius,
|
|
50
|
+
})
|
|
43
51
|
project.children.push(
|
|
44
52
|
new ShapePath({
|
|
45
53
|
cutIndex: soldermaskCutSetting.index,
|
|
@@ -23,11 +23,11 @@ export const addPolygonPcbCutout = (
|
|
|
23
23
|
|
|
24
24
|
// Add the cutout - cut through the board
|
|
25
25
|
if (cutout.points.length >= 3 && includeCopper) {
|
|
26
|
-
const polygonPath = createPolygonPathFromOutline(
|
|
27
|
-
cutout.points,
|
|
28
|
-
origin.x,
|
|
29
|
-
origin.y,
|
|
30
|
-
)
|
|
26
|
+
const polygonPath = createPolygonPathFromOutline({
|
|
27
|
+
outline: cutout.points,
|
|
28
|
+
offsetX: origin.x,
|
|
29
|
+
offsetY: origin.y,
|
|
30
|
+
})
|
|
31
31
|
project.children.push(
|
|
32
32
|
new ShapePath({
|
|
33
33
|
cutIndex: throughBoardCutSetting.index,
|
|
@@ -55,7 +55,11 @@ export const addPolygonPcbCutout = (
|
|
|
55
55
|
}))
|
|
56
56
|
: cutout.points
|
|
57
57
|
|
|
58
|
-
const polygonPath = createPolygonPathFromOutline(
|
|
58
|
+
const polygonPath = createPolygonPathFromOutline({
|
|
59
|
+
outline: points,
|
|
60
|
+
offsetX: origin.x,
|
|
61
|
+
offsetY: origin.y,
|
|
62
|
+
})
|
|
59
63
|
project.children.push(
|
|
60
64
|
new ShapePath({
|
|
61
65
|
cutIndex: soldermaskCutSetting.index,
|
|
@@ -26,15 +26,15 @@ export const addRectPcbCutout = (
|
|
|
26
26
|
// Add the cutout - cut through the board
|
|
27
27
|
if (cutout.width > 0 && cutout.height > 0 && includeCopper) {
|
|
28
28
|
const rotation = (cutout.rotation ?? 0) * (Math.PI / 180) // Convert degrees to radians
|
|
29
|
-
const rectPath = createRoundedRectPath(
|
|
29
|
+
const rectPath = createRoundedRectPath({
|
|
30
30
|
centerX,
|
|
31
31
|
centerY,
|
|
32
|
-
cutout.width,
|
|
33
|
-
cutout.height,
|
|
34
|
-
0, // no border radius for cutouts
|
|
35
|
-
4, // segments
|
|
32
|
+
width: cutout.width,
|
|
33
|
+
height: cutout.height,
|
|
34
|
+
borderRadius: 0, // no border radius for cutouts
|
|
35
|
+
segments: 4, // segments
|
|
36
36
|
rotation,
|
|
37
|
-
)
|
|
37
|
+
})
|
|
38
38
|
project.children.push(
|
|
39
39
|
new ShapePath({
|
|
40
40
|
cutIndex: throughBoardCutSetting.index,
|
|
@@ -50,15 +50,15 @@ export const addRectPcbCutout = (
|
|
|
50
50
|
const rotation = (cutout.rotation ?? 0) * (Math.PI / 180) // Convert degrees to radians
|
|
51
51
|
const smWidth = cutout.width + 2 * soldermaskMargin
|
|
52
52
|
const smHeight = cutout.height + 2 * soldermaskMargin
|
|
53
|
-
const rectPath = createRoundedRectPath(
|
|
53
|
+
const rectPath = createRoundedRectPath({
|
|
54
54
|
centerX,
|
|
55
55
|
centerY,
|
|
56
|
-
smWidth,
|
|
57
|
-
smHeight,
|
|
58
|
-
0, // no border radius for cutouts
|
|
59
|
-
4, // segments
|
|
56
|
+
width: smWidth,
|
|
57
|
+
height: smHeight,
|
|
58
|
+
borderRadius: 0, // no border radius for cutouts
|
|
59
|
+
segments: 4, // segments
|
|
60
60
|
rotation,
|
|
61
|
-
)
|
|
61
|
+
})
|
|
62
62
|
project.children.push(
|
|
63
63
|
new ShapePath({
|
|
64
64
|
cutIndex: soldermaskCutSetting.index,
|
|
@@ -25,7 +25,11 @@ export const addCirclePcbHole = (
|
|
|
25
25
|
// Add soldermask opening if drawing soldermask
|
|
26
26
|
if (hole.hole_diameter > 0 && includeSoldermask) {
|
|
27
27
|
const smRadius = hole.hole_diameter / 2 + soldermaskMargin
|
|
28
|
-
const soldermaskPath = createCirclePath(
|
|
28
|
+
const soldermaskPath = createCirclePath({
|
|
29
|
+
centerX,
|
|
30
|
+
centerY,
|
|
31
|
+
radius: smRadius,
|
|
32
|
+
})
|
|
29
33
|
project.children.push(
|
|
30
34
|
new ShapePath({
|
|
31
35
|
cutIndex: soldermaskCutSetting.index,
|
|
@@ -39,7 +43,11 @@ export const addCirclePcbHole = (
|
|
|
39
43
|
// Add the hole - cut through the board
|
|
40
44
|
if (hole.hole_diameter > 0 && includeCopper) {
|
|
41
45
|
const radius = hole.hole_diameter / 2
|
|
42
|
-
const circlePath = createCirclePath(
|
|
46
|
+
const circlePath = createCirclePath({
|
|
47
|
+
centerX,
|
|
48
|
+
centerY,
|
|
49
|
+
radius,
|
|
50
|
+
})
|
|
43
51
|
project.children.push(
|
|
44
52
|
new ShapePath({
|
|
45
53
|
cutIndex: throughBoardCutSetting.index,
|
|
@@ -24,12 +24,12 @@ export const addOvalPcbHole = (
|
|
|
24
24
|
|
|
25
25
|
// Add soldermask opening if drawing soldermask
|
|
26
26
|
if (hole.hole_width > 0 && hole.hole_height > 0 && includeSoldermask) {
|
|
27
|
-
const soldermaskPath = createOvalPath(
|
|
27
|
+
const soldermaskPath = createOvalPath({
|
|
28
28
|
centerX,
|
|
29
29
|
centerY,
|
|
30
|
-
hole.hole_width + soldermaskMargin * 2,
|
|
31
|
-
hole.hole_height + soldermaskMargin * 2,
|
|
32
|
-
)
|
|
30
|
+
width: hole.hole_width + soldermaskMargin * 2,
|
|
31
|
+
height: hole.hole_height + soldermaskMargin * 2,
|
|
32
|
+
})
|
|
33
33
|
project.children.push(
|
|
34
34
|
new ShapePath({
|
|
35
35
|
cutIndex: soldermaskCutSetting.index,
|
|
@@ -42,12 +42,12 @@ export const addOvalPcbHole = (
|
|
|
42
42
|
|
|
43
43
|
// Add the hole - cut through the board
|
|
44
44
|
if (hole.hole_width > 0 && hole.hole_height > 0 && includeCopper) {
|
|
45
|
-
const ovalPath = createOvalPath(
|
|
45
|
+
const ovalPath = createOvalPath({
|
|
46
46
|
centerX,
|
|
47
47
|
centerY,
|
|
48
|
-
hole.hole_width,
|
|
49
|
-
hole.hole_height,
|
|
50
|
-
)
|
|
48
|
+
width: hole.hole_width,
|
|
49
|
+
height: hole.hole_height,
|
|
50
|
+
})
|
|
51
51
|
project.children.push(
|
|
52
52
|
new ShapePath({
|
|
53
53
|
cutIndex: throughBoardCutSetting.index,
|
|
@@ -24,12 +24,12 @@ export const addPillPcbHole = (
|
|
|
24
24
|
|
|
25
25
|
// Add soldermask opening if drawing soldermask
|
|
26
26
|
if (hole.hole_width > 0 && hole.hole_height > 0 && includeSoldermask) {
|
|
27
|
-
const soldermaskPath = createPillPath(
|
|
27
|
+
const soldermaskPath = createPillPath({
|
|
28
28
|
centerX,
|
|
29
29
|
centerY,
|
|
30
|
-
hole.hole_width + soldermaskMargin * 2,
|
|
31
|
-
hole.hole_height + soldermaskMargin * 2,
|
|
32
|
-
)
|
|
30
|
+
width: hole.hole_width + soldermaskMargin * 2,
|
|
31
|
+
height: hole.hole_height + soldermaskMargin * 2,
|
|
32
|
+
})
|
|
33
33
|
project.children.push(
|
|
34
34
|
new ShapePath({
|
|
35
35
|
cutIndex: soldermaskCutSetting.index,
|
|
@@ -42,12 +42,12 @@ export const addPillPcbHole = (
|
|
|
42
42
|
|
|
43
43
|
// Add the hole - cut through the board
|
|
44
44
|
if (hole.hole_width > 0 && hole.hole_height > 0 && includeCopper) {
|
|
45
|
-
const pillPath = createPillPath(
|
|
45
|
+
const pillPath = createPillPath({
|
|
46
46
|
centerX,
|
|
47
47
|
centerY,
|
|
48
|
-
hole.hole_width,
|
|
49
|
-
hole.hole_height,
|
|
50
|
-
)
|
|
48
|
+
width: hole.hole_width,
|
|
49
|
+
height: hole.hole_height,
|
|
50
|
+
})
|
|
51
51
|
project.children.push(
|
|
52
52
|
new ShapePath({
|
|
53
53
|
cutIndex: throughBoardCutSetting.index,
|
|
@@ -24,13 +24,13 @@ export const addRectPcbHole = (
|
|
|
24
24
|
|
|
25
25
|
// Add soldermask opening if drawing soldermask
|
|
26
26
|
if (hole.hole_width > 0 && hole.hole_height > 0 && includeSoldermask) {
|
|
27
|
-
const soldermaskPath = createRoundedRectPath(
|
|
27
|
+
const soldermaskPath = createRoundedRectPath({
|
|
28
28
|
centerX,
|
|
29
29
|
centerY,
|
|
30
|
-
hole.hole_width + soldermaskMargin * 2,
|
|
31
|
-
hole.hole_height + soldermaskMargin * 2,
|
|
32
|
-
0, // no border radius for rect holes
|
|
33
|
-
)
|
|
30
|
+
width: hole.hole_width + soldermaskMargin * 2,
|
|
31
|
+
height: hole.hole_height + soldermaskMargin * 2,
|
|
32
|
+
borderRadius: 0, // no border radius for rect holes
|
|
33
|
+
})
|
|
34
34
|
project.children.push(
|
|
35
35
|
new ShapePath({
|
|
36
36
|
cutIndex: soldermaskCutSetting.index,
|
|
@@ -43,13 +43,13 @@ export const addRectPcbHole = (
|
|
|
43
43
|
|
|
44
44
|
// Add the hole - cut through the board
|
|
45
45
|
if (hole.hole_width > 0 && hole.hole_height > 0 && includeCopper) {
|
|
46
|
-
const rectPath = createRoundedRectPath(
|
|
46
|
+
const rectPath = createRoundedRectPath({
|
|
47
47
|
centerX,
|
|
48
48
|
centerY,
|
|
49
|
-
hole.hole_width,
|
|
50
|
-
hole.hole_height,
|
|
51
|
-
0, // no border radius for rect holes
|
|
52
|
-
)
|
|
49
|
+
width: hole.hole_width,
|
|
50
|
+
height: hole.hole_height,
|
|
51
|
+
borderRadius: 0, // no border radius for rect holes
|
|
52
|
+
})
|
|
53
53
|
project.children.push(
|
|
54
54
|
new ShapePath({
|
|
55
55
|
cutIndex: throughBoardCutSetting.index,
|
|
@@ -25,13 +25,13 @@ export const addRotatedPillPcbHole = (
|
|
|
25
25
|
|
|
26
26
|
// Add soldermask opening if drawing soldermask
|
|
27
27
|
if (hole.hole_width > 0 && hole.hole_height > 0 && includeSoldermask) {
|
|
28
|
-
const soldermaskPath = createPillPath(
|
|
28
|
+
const soldermaskPath = createPillPath({
|
|
29
29
|
centerX,
|
|
30
30
|
centerY,
|
|
31
|
-
hole.hole_width + soldermaskMargin * 2,
|
|
32
|
-
hole.hole_height + soldermaskMargin * 2,
|
|
31
|
+
width: hole.hole_width + soldermaskMargin * 2,
|
|
32
|
+
height: hole.hole_height + soldermaskMargin * 2,
|
|
33
33
|
rotation,
|
|
34
|
-
)
|
|
34
|
+
})
|
|
35
35
|
project.children.push(
|
|
36
36
|
new ShapePath({
|
|
37
37
|
cutIndex: soldermaskCutSetting.index,
|
|
@@ -44,13 +44,13 @@ export const addRotatedPillPcbHole = (
|
|
|
44
44
|
|
|
45
45
|
// Add the hole - cut through the board
|
|
46
46
|
if (hole.hole_width > 0 && hole.hole_height > 0 && includeCopper) {
|
|
47
|
-
const pillPath = createPillPath(
|
|
47
|
+
const pillPath = createPillPath({
|
|
48
48
|
centerX,
|
|
49
49
|
centerY,
|
|
50
|
-
hole.hole_width,
|
|
51
|
-
hole.hole_height,
|
|
50
|
+
width: hole.hole_width,
|
|
51
|
+
height: hole.hole_height,
|
|
52
52
|
rotation,
|
|
53
|
-
)
|
|
53
|
+
})
|
|
54
54
|
project.children.push(
|
|
55
55
|
new ShapePath({
|
|
56
56
|
cutIndex: throughBoardCutSetting.index,
|
|
@@ -42,7 +42,11 @@ export const addPcbVia = (via: PcbVia, ctx: ConvertContext): void => {
|
|
|
42
42
|
ctx.netGeoms.get(netId)?.push(polygon)
|
|
43
43
|
} else {
|
|
44
44
|
// No net connection - draw directly
|
|
45
|
-
const outer = createCirclePath(
|
|
45
|
+
const outer = createCirclePath({
|
|
46
|
+
centerX,
|
|
47
|
+
centerY,
|
|
48
|
+
radius: outerRadius,
|
|
49
|
+
})
|
|
46
50
|
project.children.push(
|
|
47
51
|
new ShapePath({
|
|
48
52
|
cutIndex: copperCutSetting.index,
|
|
@@ -57,7 +61,11 @@ export const addPcbVia = (via: PcbVia, ctx: ConvertContext): void => {
|
|
|
57
61
|
// Add soldermask opening if drawing soldermask
|
|
58
62
|
if (via.outer_diameter > 0 && includeSoldermask) {
|
|
59
63
|
const smRadius = via.outer_diameter / 2 + soldermaskMargin
|
|
60
|
-
const outer = createCirclePath(
|
|
64
|
+
const outer = createCirclePath({
|
|
65
|
+
centerX,
|
|
66
|
+
centerY,
|
|
67
|
+
radius: smRadius,
|
|
68
|
+
})
|
|
61
69
|
project.children.push(
|
|
62
70
|
new ShapePath({
|
|
63
71
|
cutIndex: soldermaskCutSetting.index,
|
|
@@ -71,7 +79,11 @@ export const addPcbVia = (via: PcbVia, ctx: ConvertContext): void => {
|
|
|
71
79
|
// Add inner circle (hole) - always cut through the board regardless of mode
|
|
72
80
|
if (via.hole_diameter > 0 && includeCopper) {
|
|
73
81
|
const innerRadius = via.hole_diameter / 2
|
|
74
|
-
const inner = createCirclePath(
|
|
82
|
+
const inner = createCirclePath({
|
|
83
|
+
centerX,
|
|
84
|
+
centerY,
|
|
85
|
+
radius: innerRadius,
|
|
86
|
+
})
|
|
75
87
|
project.children.push(
|
|
76
88
|
new ShapePath({
|
|
77
89
|
cutIndex: throughBoardCutSetting.index,
|
|
@@ -35,7 +35,11 @@ export const addCirclePlatedHole = (
|
|
|
35
35
|
ctx.netGeoms.get(netId)?.push(polygon)
|
|
36
36
|
} else {
|
|
37
37
|
// No net connection - draw directly
|
|
38
|
-
const outer = createCirclePath(
|
|
38
|
+
const outer = createCirclePath({
|
|
39
|
+
centerX,
|
|
40
|
+
centerY,
|
|
41
|
+
radius: outerRadius,
|
|
42
|
+
})
|
|
39
43
|
project.children.push(
|
|
40
44
|
new ShapePath({
|
|
41
45
|
cutIndex: copperCutSetting.index,
|
|
@@ -50,7 +54,11 @@ export const addCirclePlatedHole = (
|
|
|
50
54
|
// Add soldermask opening if drawing soldermask
|
|
51
55
|
if (platedHole.outer_diameter > 0 && includeSoldermask) {
|
|
52
56
|
const smRadius = platedHole.outer_diameter / 2 + soldermaskMargin
|
|
53
|
-
const outer = createCirclePath(
|
|
57
|
+
const outer = createCirclePath({
|
|
58
|
+
centerX,
|
|
59
|
+
centerY,
|
|
60
|
+
radius: smRadius,
|
|
61
|
+
})
|
|
54
62
|
project.children.push(
|
|
55
63
|
new ShapePath({
|
|
56
64
|
cutIndex: soldermaskCutSetting.index,
|
|
@@ -63,7 +71,11 @@ export const addCirclePlatedHole = (
|
|
|
63
71
|
|
|
64
72
|
if (platedHole.hole_diameter > 0 && includeCopper) {
|
|
65
73
|
const innerRadius = platedHole.hole_diameter / 2
|
|
66
|
-
const inner = createCirclePath(
|
|
74
|
+
const inner = createCirclePath({
|
|
75
|
+
centerX,
|
|
76
|
+
centerY,
|
|
77
|
+
radius: innerRadius,
|
|
78
|
+
})
|
|
67
79
|
project.children.push(
|
|
68
80
|
new ShapePath({
|
|
69
81
|
cutIndex: throughBoardCutSetting.index,
|
|
@@ -26,13 +26,13 @@ export const addCircularHoleWithRectPad = (
|
|
|
26
26
|
const borderRadius = platedHole.rect_border_radius ?? 0
|
|
27
27
|
|
|
28
28
|
// Create rectangle pad vertices
|
|
29
|
-
const padPath = createRoundedRectPath(
|
|
29
|
+
const padPath = createRoundedRectPath({
|
|
30
30
|
centerX,
|
|
31
31
|
centerY,
|
|
32
|
-
padWidth,
|
|
33
|
-
padHeight,
|
|
32
|
+
width: padWidth,
|
|
33
|
+
height: padHeight,
|
|
34
34
|
borderRadius,
|
|
35
|
-
)
|
|
35
|
+
})
|
|
36
36
|
|
|
37
37
|
// Add the rectangular pad if drawing copper
|
|
38
38
|
if (includeCopper) {
|
|
@@ -50,13 +50,13 @@ export const addCircularHoleWithRectPad = (
|
|
|
50
50
|
if (includeSoldermask) {
|
|
51
51
|
const smPadWidth = padWidth + 2 * soldermaskMargin
|
|
52
52
|
const smPadHeight = padHeight + 2 * soldermaskMargin
|
|
53
|
-
const smPadPath = createRoundedRectPath(
|
|
53
|
+
const smPadPath = createRoundedRectPath({
|
|
54
54
|
centerX,
|
|
55
55
|
centerY,
|
|
56
|
-
smPadWidth,
|
|
57
|
-
smPadHeight,
|
|
56
|
+
width: smPadWidth,
|
|
57
|
+
height: smPadHeight,
|
|
58
58
|
borderRadius,
|
|
59
|
-
)
|
|
59
|
+
})
|
|
60
60
|
|
|
61
61
|
project.children.push(
|
|
62
62
|
new ShapePath({
|
|
@@ -72,7 +72,12 @@ export const addCircularHoleWithRectPad = (
|
|
|
72
72
|
if (holeRadius > 0 && includeCopper) {
|
|
73
73
|
const holeCenterX = centerX + platedHole.hole_offset_x
|
|
74
74
|
const holeCenterY = centerY + platedHole.hole_offset_y
|
|
75
|
-
const holePath = createCirclePath(
|
|
75
|
+
const holePath = createCirclePath({
|
|
76
|
+
centerX: holeCenterX,
|
|
77
|
+
centerY: holeCenterY,
|
|
78
|
+
radius: holeRadius,
|
|
79
|
+
segments: 32,
|
|
80
|
+
})
|
|
76
81
|
|
|
77
82
|
project.children.push(
|
|
78
83
|
new ShapePath({
|
|
@@ -21,11 +21,11 @@ export const addHoleWithPolygonPad = (
|
|
|
21
21
|
|
|
22
22
|
// Create the polygon pad
|
|
23
23
|
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
|
-
)
|
|
24
|
+
const pad = createPolygonPathFromOutline({
|
|
25
|
+
outline: platedHole.pad_outline,
|
|
26
|
+
offsetX: platedHole.x + origin.x,
|
|
27
|
+
offsetY: platedHole.y + origin.y,
|
|
28
|
+
})
|
|
29
29
|
|
|
30
30
|
// Add the polygon pad if drawing copper
|
|
31
31
|
if (includeCopper) {
|
|
@@ -62,7 +62,12 @@ export const addHoleWithPolygonPad = (
|
|
|
62
62
|
const centerX = platedHole.x + platedHole.hole_offset_x + origin.x
|
|
63
63
|
const centerY = platedHole.y + platedHole.hole_offset_y + origin.y
|
|
64
64
|
const radius = platedHole.hole_diameter / 2
|
|
65
|
-
const hole = createCirclePath(
|
|
65
|
+
const hole = createCirclePath({
|
|
66
|
+
centerX,
|
|
67
|
+
centerY,
|
|
68
|
+
radius,
|
|
69
|
+
segments: 64,
|
|
70
|
+
})
|
|
66
71
|
|
|
67
72
|
project.children.push(
|
|
68
73
|
new ShapePath({
|
|
@@ -81,7 +86,12 @@ export const addHoleWithPolygonPad = (
|
|
|
81
86
|
const centerX = platedHole.x + platedHole.hole_offset_x + origin.x
|
|
82
87
|
const centerY = platedHole.y + platedHole.hole_offset_y + origin.y
|
|
83
88
|
const radius = platedHole.hole_diameter / 2
|
|
84
|
-
const hole = createCirclePath(
|
|
89
|
+
const hole = createCirclePath({
|
|
90
|
+
centerX,
|
|
91
|
+
centerY,
|
|
92
|
+
radius,
|
|
93
|
+
segments: 64,
|
|
94
|
+
})
|
|
85
95
|
|
|
86
96
|
// Note: rotation is not supported for holes with polygon pad
|
|
87
97
|
|
|
@@ -32,13 +32,13 @@ export const addOvalPlatedHole = (
|
|
|
32
32
|
platedHole.outer_height > 0 &&
|
|
33
33
|
includeCopper
|
|
34
34
|
) {
|
|
35
|
-
const outer = createOvalPath(
|
|
35
|
+
const outer = createOvalPath({
|
|
36
36
|
centerX,
|
|
37
37
|
centerY,
|
|
38
|
-
platedHole.outer_width,
|
|
39
|
-
platedHole.outer_height,
|
|
38
|
+
width: platedHole.outer_width,
|
|
39
|
+
height: platedHole.outer_height,
|
|
40
40
|
rotation,
|
|
41
|
-
)
|
|
41
|
+
})
|
|
42
42
|
project.children.push(
|
|
43
43
|
new ShapePath({
|
|
44
44
|
cutIndex: copperCutSetting.index,
|
|
@@ -57,7 +57,13 @@ export const addOvalPlatedHole = (
|
|
|
57
57
|
) {
|
|
58
58
|
const smWidth = platedHole.outer_width + 2 * soldermaskMargin
|
|
59
59
|
const smHeight = platedHole.outer_height + 2 * soldermaskMargin
|
|
60
|
-
const outer = createOvalPath(
|
|
60
|
+
const outer = createOvalPath({
|
|
61
|
+
centerX,
|
|
62
|
+
centerY,
|
|
63
|
+
width: smWidth,
|
|
64
|
+
height: smHeight,
|
|
65
|
+
rotation,
|
|
66
|
+
})
|
|
61
67
|
project.children.push(
|
|
62
68
|
new ShapePath({
|
|
63
69
|
cutIndex: soldermaskCutSetting.index,
|
|
@@ -74,13 +80,13 @@ export const addOvalPlatedHole = (
|
|
|
74
80
|
platedHole.hole_height > 0 &&
|
|
75
81
|
includeCopper
|
|
76
82
|
) {
|
|
77
|
-
const inner = createOvalPath(
|
|
83
|
+
const inner = createOvalPath({
|
|
78
84
|
centerX,
|
|
79
85
|
centerY,
|
|
80
|
-
platedHole.hole_width,
|
|
81
|
-
platedHole.hole_height,
|
|
86
|
+
width: platedHole.hole_width,
|
|
87
|
+
height: platedHole.hole_height,
|
|
82
88
|
rotation,
|
|
83
|
-
)
|
|
89
|
+
})
|
|
84
90
|
project.children.push(
|
|
85
91
|
new ShapePath({
|
|
86
92
|
cutIndex: throughBoardCutSetting.index,
|
|
@@ -26,13 +26,13 @@ export const addPillHoleWithRectPad = (
|
|
|
26
26
|
const borderRadius = platedHole.rect_border_radius ?? 0
|
|
27
27
|
|
|
28
28
|
if (padWidth > 0 && padHeight > 0) {
|
|
29
|
-
const padPath = createRoundedRectPath(
|
|
29
|
+
const padPath = createRoundedRectPath({
|
|
30
30
|
centerX,
|
|
31
31
|
centerY,
|
|
32
|
-
padWidth,
|
|
33
|
-
padHeight,
|
|
32
|
+
width: padWidth,
|
|
33
|
+
height: padHeight,
|
|
34
34
|
borderRadius,
|
|
35
|
-
)
|
|
35
|
+
})
|
|
36
36
|
|
|
37
37
|
// Add the rectangular pad if drawing copper
|
|
38
38
|
if (includeCopper) {
|
|
@@ -50,13 +50,13 @@ export const addPillHoleWithRectPad = (
|
|
|
50
50
|
if (includeSoldermask) {
|
|
51
51
|
const smPadWidth = padWidth + 2 * soldermaskMargin
|
|
52
52
|
const smPadHeight = padHeight + 2 * soldermaskMargin
|
|
53
|
-
const smPadPath = createRoundedRectPath(
|
|
53
|
+
const smPadPath = createRoundedRectPath({
|
|
54
54
|
centerX,
|
|
55
55
|
centerY,
|
|
56
|
-
smPadWidth,
|
|
57
|
-
smPadHeight,
|
|
56
|
+
width: smPadWidth,
|
|
57
|
+
height: smPadHeight,
|
|
58
58
|
borderRadius,
|
|
59
|
-
)
|
|
59
|
+
})
|
|
60
60
|
|
|
61
61
|
project.children.push(
|
|
62
62
|
new ShapePath({
|
|
@@ -75,12 +75,12 @@ export const addPillHoleWithRectPad = (
|
|
|
75
75
|
if (holeWidth > 0 && holeHeight > 0 && includeCopper) {
|
|
76
76
|
const holeCenterX = centerX + platedHole.hole_offset_x
|
|
77
77
|
const holeCenterY = centerY + platedHole.hole_offset_y
|
|
78
|
-
const holePath = createPillPath(
|
|
79
|
-
holeCenterX,
|
|
80
|
-
holeCenterY,
|
|
81
|
-
holeWidth,
|
|
82
|
-
holeHeight,
|
|
83
|
-
)
|
|
78
|
+
const holePath = createPillPath({
|
|
79
|
+
centerX: holeCenterX,
|
|
80
|
+
centerY: holeCenterY,
|
|
81
|
+
width: holeWidth,
|
|
82
|
+
height: holeHeight,
|
|
83
|
+
})
|
|
84
84
|
|
|
85
85
|
project.children.push(
|
|
86
86
|
new ShapePath({
|
|
@@ -27,13 +27,13 @@ export const addPcbPlatedHolePill = (
|
|
|
27
27
|
platedHole.outer_height > 0 &&
|
|
28
28
|
includeCopper
|
|
29
29
|
) {
|
|
30
|
-
const outer = createPillPath(
|
|
30
|
+
const outer = createPillPath({
|
|
31
31
|
centerX,
|
|
32
32
|
centerY,
|
|
33
|
-
platedHole.outer_width,
|
|
34
|
-
platedHole.outer_height,
|
|
33
|
+
width: platedHole.outer_width,
|
|
34
|
+
height: platedHole.outer_height,
|
|
35
35
|
rotation,
|
|
36
|
-
)
|
|
36
|
+
})
|
|
37
37
|
project.children.push(
|
|
38
38
|
new ShapePath({
|
|
39
39
|
cutIndex: copperCutSetting.index,
|
|
@@ -52,7 +52,13 @@ export const addPcbPlatedHolePill = (
|
|
|
52
52
|
) {
|
|
53
53
|
const smWidth = platedHole.outer_width + 2 * soldermaskMargin
|
|
54
54
|
const smHeight = platedHole.outer_height + 2 * soldermaskMargin
|
|
55
|
-
const outer = createPillPath(
|
|
55
|
+
const outer = createPillPath({
|
|
56
|
+
centerX,
|
|
57
|
+
centerY,
|
|
58
|
+
width: smWidth,
|
|
59
|
+
height: smHeight,
|
|
60
|
+
rotation,
|
|
61
|
+
})
|
|
56
62
|
project.children.push(
|
|
57
63
|
new ShapePath({
|
|
58
64
|
cutIndex: soldermaskCutSetting.index,
|
|
@@ -69,13 +75,13 @@ export const addPcbPlatedHolePill = (
|
|
|
69
75
|
platedHole.hole_height > 0 &&
|
|
70
76
|
includeCopper
|
|
71
77
|
) {
|
|
72
|
-
const inner = createPillPath(
|
|
78
|
+
const inner = createPillPath({
|
|
73
79
|
centerX,
|
|
74
80
|
centerY,
|
|
75
|
-
platedHole.hole_width,
|
|
76
|
-
platedHole.hole_height,
|
|
81
|
+
width: platedHole.hole_width,
|
|
82
|
+
height: platedHole.hole_height,
|
|
77
83
|
rotation,
|
|
78
|
-
)
|
|
84
|
+
})
|
|
79
85
|
project.children.push(
|
|
80
86
|
new ShapePath({
|
|
81
87
|
cutIndex: throughBoardCutSetting.index,
|
|
@@ -27,15 +27,15 @@ export const addRotatedPillHoleWithRectPad = (
|
|
|
27
27
|
const padRotation = (platedHole.rect_ccw_rotation ?? 0) * (Math.PI / 180)
|
|
28
28
|
|
|
29
29
|
if (padWidth > 0 && padHeight > 0) {
|
|
30
|
-
const padPath = createRoundedRectPath(
|
|
30
|
+
const padPath = createRoundedRectPath({
|
|
31
31
|
centerX,
|
|
32
32
|
centerY,
|
|
33
|
-
padWidth,
|
|
34
|
-
padHeight,
|
|
33
|
+
width: padWidth,
|
|
34
|
+
height: padHeight,
|
|
35
35
|
borderRadius,
|
|
36
|
-
4,
|
|
37
|
-
padRotation,
|
|
38
|
-
)
|
|
36
|
+
segments: 4,
|
|
37
|
+
rotation: padRotation,
|
|
38
|
+
})
|
|
39
39
|
|
|
40
40
|
// Add the rectangular pad if drawing copper
|
|
41
41
|
if (includeCopper) {
|
|
@@ -53,15 +53,15 @@ export const addRotatedPillHoleWithRectPad = (
|
|
|
53
53
|
if (includeSoldermask) {
|
|
54
54
|
const smPadWidth = padWidth + 2 * soldermaskMargin
|
|
55
55
|
const smPadHeight = padHeight + 2 * soldermaskMargin
|
|
56
|
-
const smPadPath = createRoundedRectPath(
|
|
56
|
+
const smPadPath = createRoundedRectPath({
|
|
57
57
|
centerX,
|
|
58
58
|
centerY,
|
|
59
|
-
smPadWidth,
|
|
60
|
-
smPadHeight,
|
|
59
|
+
width: smPadWidth,
|
|
60
|
+
height: smPadHeight,
|
|
61
61
|
borderRadius,
|
|
62
|
-
4,
|
|
63
|
-
padRotation,
|
|
64
|
-
)
|
|
62
|
+
segments: 4,
|
|
63
|
+
rotation: padRotation,
|
|
64
|
+
})
|
|
65
65
|
|
|
66
66
|
project.children.push(
|
|
67
67
|
new ShapePath({
|
|
@@ -81,13 +81,13 @@ export const addRotatedPillHoleWithRectPad = (
|
|
|
81
81
|
if (holeWidth > 0 && holeHeight > 0 && includeCopper) {
|
|
82
82
|
const holeCenterX = centerX + platedHole.hole_offset_x
|
|
83
83
|
const holeCenterY = centerY + platedHole.hole_offset_y
|
|
84
|
-
const holePath = createPillPath(
|
|
85
|
-
holeCenterX,
|
|
86
|
-
holeCenterY,
|
|
87
|
-
holeWidth,
|
|
88
|
-
holeHeight,
|
|
89
|
-
holeRotation,
|
|
90
|
-
)
|
|
84
|
+
const holePath = createPillPath({
|
|
85
|
+
centerX: holeCenterX,
|
|
86
|
+
centerY: holeCenterY,
|
|
87
|
+
width: holeWidth,
|
|
88
|
+
height: holeHeight,
|
|
89
|
+
rotation: holeRotation,
|
|
90
|
+
})
|
|
91
91
|
|
|
92
92
|
project.children.push(
|
|
93
93
|
new ShapePath({
|