circuit-json-to-lbrn 0.0.39 → 0.0.40
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 +245 -351
- package/lib/element-handlers/addPlatedHole/addCircularHoleWithRectPad.ts +13 -22
- package/lib/element-handlers/addPlatedHole/addHoleWithPolygonPad.ts +13 -22
- package/lib/element-handlers/addPlatedHole/addPillHoleWithRectPad.ts +13 -22
- package/lib/element-handlers/addPlatedHole/addRotatedPillHoleWithRectPad.ts +13 -22
- package/lib/element-handlers/addSmtPad/addCircleSmtPad.ts +13 -35
- package/lib/element-handlers/addSmtPad/addPillSmtPad.ts +8 -29
- package/lib/element-handlers/addSmtPad/addPolygonSmtPad.ts +8 -29
- package/lib/element-handlers/addSmtPad/addRectSmtPad.ts +12 -45
- package/lib/element-handlers/addSmtPad/addRotatedPillSmtPad.ts +8 -29
- package/lib/element-handlers/addSmtPad/addRotatedRectSmtPad.ts +8 -29
- package/lib/helpers/addCopperGeometryToNetOrProject.ts +48 -0
- package/package.json +1 -1
- package/tests/examples/example02/__snapshots__/example02.snap.svg +1 -1
- package/tests/examples/example04/1206x4_3216metric.json +2973 -0
- package/tests/examples/example04/__snapshots__/example04.snap.svg +1 -0
- package/tests/examples/example04/example04.test.ts +32 -0
|
@@ -3,6 +3,7 @@ import type { ConvertContext } from "../../ConvertContext"
|
|
|
3
3
|
import { ShapePath } from "lbrnts"
|
|
4
4
|
import { createRoundedRectPath } from "../../helpers/roundedRectShape"
|
|
5
5
|
import { createCirclePath } from "../../helpers/circleShape"
|
|
6
|
+
import { addCopperGeometryToNetOrProject } from "../../helpers/addCopperGeometryToNetOrProject"
|
|
6
7
|
|
|
7
8
|
export const addCircularHoleWithRectPad = (
|
|
8
9
|
platedHole: PcbHoleCircularWithRectPad,
|
|
@@ -10,8 +11,6 @@ export const addCircularHoleWithRectPad = (
|
|
|
10
11
|
): void => {
|
|
11
12
|
const {
|
|
12
13
|
project,
|
|
13
|
-
topCopperCutSetting,
|
|
14
|
-
bottomCopperCutSetting,
|
|
15
14
|
soldermaskCutSetting,
|
|
16
15
|
throughBoardCutSetting,
|
|
17
16
|
origin,
|
|
@@ -39,26 +38,18 @@ export const addCircularHoleWithRectPad = (
|
|
|
39
38
|
// Add the rectangular pad if drawing copper
|
|
40
39
|
// Plated holes go through all layers, so add to both top and bottom
|
|
41
40
|
if (includeCopper) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
new ShapePath({
|
|
55
|
-
cutIndex: bottomCopperCutSetting.index,
|
|
56
|
-
verts: padPath.verts,
|
|
57
|
-
prims: padPath.prims,
|
|
58
|
-
isClosed: true,
|
|
59
|
-
}),
|
|
60
|
-
)
|
|
61
|
-
}
|
|
41
|
+
addCopperGeometryToNetOrProject({
|
|
42
|
+
geometryId: platedHole.pcb_plated_hole_id,
|
|
43
|
+
path: padPath,
|
|
44
|
+
layer: "top",
|
|
45
|
+
ctx,
|
|
46
|
+
})
|
|
47
|
+
addCopperGeometryToNetOrProject({
|
|
48
|
+
geometryId: platedHole.pcb_plated_hole_id,
|
|
49
|
+
path: padPath,
|
|
50
|
+
layer: "bottom",
|
|
51
|
+
ctx,
|
|
52
|
+
})
|
|
62
53
|
}
|
|
63
54
|
|
|
64
55
|
// Add soldermask opening if drawing soldermask
|
|
@@ -3,6 +3,7 @@ import type { ConvertContext } from "../../ConvertContext"
|
|
|
3
3
|
import { ShapePath } from "lbrnts"
|
|
4
4
|
import { createPolygonPathFromOutline } from "../../helpers/polygonShape"
|
|
5
5
|
import { createCirclePath } from "../../helpers/circleShape"
|
|
6
|
+
import { addCopperGeometryToNetOrProject } from "../../helpers/addCopperGeometryToNetOrProject"
|
|
6
7
|
|
|
7
8
|
export const addHoleWithPolygonPad = (
|
|
8
9
|
platedHole: PcbHoleWithPolygonPad,
|
|
@@ -10,8 +11,6 @@ export const addHoleWithPolygonPad = (
|
|
|
10
11
|
): void => {
|
|
11
12
|
const {
|
|
12
13
|
project,
|
|
13
|
-
topCopperCutSetting,
|
|
14
|
-
bottomCopperCutSetting,
|
|
15
14
|
soldermaskCutSetting,
|
|
16
15
|
throughBoardCutSetting,
|
|
17
16
|
origin,
|
|
@@ -32,26 +31,18 @@ export const addHoleWithPolygonPad = (
|
|
|
32
31
|
// Add the polygon pad if drawing copper
|
|
33
32
|
// Plated holes go through all layers, so add to both top and bottom
|
|
34
33
|
if (includeCopper) {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
new ShapePath({
|
|
48
|
-
cutIndex: bottomCopperCutSetting.index,
|
|
49
|
-
verts: pad.verts,
|
|
50
|
-
prims: pad.prims,
|
|
51
|
-
isClosed: true,
|
|
52
|
-
}),
|
|
53
|
-
)
|
|
54
|
-
}
|
|
34
|
+
addCopperGeometryToNetOrProject({
|
|
35
|
+
geometryId: platedHole.pcb_plated_hole_id,
|
|
36
|
+
path: pad,
|
|
37
|
+
layer: "top",
|
|
38
|
+
ctx,
|
|
39
|
+
})
|
|
40
|
+
addCopperGeometryToNetOrProject({
|
|
41
|
+
geometryId: platedHole.pcb_plated_hole_id,
|
|
42
|
+
path: pad,
|
|
43
|
+
layer: "bottom",
|
|
44
|
+
ctx,
|
|
45
|
+
})
|
|
55
46
|
}
|
|
56
47
|
|
|
57
48
|
// Add soldermask opening if drawing soldermask
|
|
@@ -3,6 +3,7 @@ import type { ConvertContext } from "../../ConvertContext"
|
|
|
3
3
|
import { ShapePath } from "lbrnts"
|
|
4
4
|
import { createRoundedRectPath } from "../../helpers/roundedRectShape"
|
|
5
5
|
import { createPillPath } from "../../helpers/pillShape"
|
|
6
|
+
import { addCopperGeometryToNetOrProject } from "../../helpers/addCopperGeometryToNetOrProject"
|
|
6
7
|
|
|
7
8
|
export const addPillHoleWithRectPad = (
|
|
8
9
|
platedHole: PcbHolePillWithRectPad,
|
|
@@ -10,8 +11,6 @@ export const addPillHoleWithRectPad = (
|
|
|
10
11
|
): void => {
|
|
11
12
|
const {
|
|
12
13
|
project,
|
|
13
|
-
topCopperCutSetting,
|
|
14
|
-
bottomCopperCutSetting,
|
|
15
14
|
soldermaskCutSetting,
|
|
16
15
|
throughBoardCutSetting,
|
|
17
16
|
origin,
|
|
@@ -39,26 +38,18 @@ export const addPillHoleWithRectPad = (
|
|
|
39
38
|
// Add the rectangular pad if drawing copper
|
|
40
39
|
// Plated holes go through all layers, so add to both top and bottom
|
|
41
40
|
if (includeCopper) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
new ShapePath({
|
|
55
|
-
cutIndex: bottomCopperCutSetting.index,
|
|
56
|
-
verts: padPath.verts,
|
|
57
|
-
prims: padPath.prims,
|
|
58
|
-
isClosed: true,
|
|
59
|
-
}),
|
|
60
|
-
)
|
|
61
|
-
}
|
|
41
|
+
addCopperGeometryToNetOrProject({
|
|
42
|
+
geometryId: platedHole.pcb_plated_hole_id,
|
|
43
|
+
path: padPath,
|
|
44
|
+
layer: "top",
|
|
45
|
+
ctx,
|
|
46
|
+
})
|
|
47
|
+
addCopperGeometryToNetOrProject({
|
|
48
|
+
geometryId: platedHole.pcb_plated_hole_id,
|
|
49
|
+
path: padPath,
|
|
50
|
+
layer: "bottom",
|
|
51
|
+
ctx,
|
|
52
|
+
})
|
|
62
53
|
}
|
|
63
54
|
|
|
64
55
|
// Add soldermask opening if drawing soldermask
|
|
@@ -3,6 +3,7 @@ import type { ConvertContext } from "../../ConvertContext"
|
|
|
3
3
|
import { ShapePath } from "lbrnts"
|
|
4
4
|
import { createRoundedRectPath } from "../../helpers/roundedRectShape"
|
|
5
5
|
import { createPillPath } from "../../helpers/pillShape"
|
|
6
|
+
import { addCopperGeometryToNetOrProject } from "../../helpers/addCopperGeometryToNetOrProject"
|
|
6
7
|
|
|
7
8
|
export const addRotatedPillHoleWithRectPad = (
|
|
8
9
|
platedHole: PcbHoleRotatedPillWithRectPad,
|
|
@@ -10,8 +11,6 @@ export const addRotatedPillHoleWithRectPad = (
|
|
|
10
11
|
): void => {
|
|
11
12
|
const {
|
|
12
13
|
project,
|
|
13
|
-
topCopperCutSetting,
|
|
14
|
-
bottomCopperCutSetting,
|
|
15
14
|
soldermaskCutSetting,
|
|
16
15
|
throughBoardCutSetting,
|
|
17
16
|
origin,
|
|
@@ -42,26 +41,18 @@ export const addRotatedPillHoleWithRectPad = (
|
|
|
42
41
|
// Add the rectangular pad if drawing copper
|
|
43
42
|
// Plated holes go through all layers, so add to both top and bottom
|
|
44
43
|
if (includeCopper) {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
new ShapePath({
|
|
58
|
-
cutIndex: bottomCopperCutSetting.index,
|
|
59
|
-
verts: padPath.verts,
|
|
60
|
-
prims: padPath.prims,
|
|
61
|
-
isClosed: true,
|
|
62
|
-
}),
|
|
63
|
-
)
|
|
64
|
-
}
|
|
44
|
+
addCopperGeometryToNetOrProject({
|
|
45
|
+
geometryId: platedHole.pcb_plated_hole_id,
|
|
46
|
+
path: padPath,
|
|
47
|
+
layer: "top",
|
|
48
|
+
ctx,
|
|
49
|
+
})
|
|
50
|
+
addCopperGeometryToNetOrProject({
|
|
51
|
+
geometryId: platedHole.pcb_plated_hole_id,
|
|
52
|
+
path: padPath,
|
|
53
|
+
layer: "bottom",
|
|
54
|
+
ctx,
|
|
55
|
+
})
|
|
65
56
|
}
|
|
66
57
|
|
|
67
58
|
// Add soldermask opening if drawing soldermask
|
|
@@ -2,8 +2,7 @@ import type { PcbSmtPadCircle } from "circuit-json"
|
|
|
2
2
|
import type { ConvertContext } from "../../ConvertContext"
|
|
3
3
|
import { ShapePath } from "lbrnts"
|
|
4
4
|
import { createCirclePath } from "../../helpers/circleShape"
|
|
5
|
-
import {
|
|
6
|
-
import { circleToPolygon } from "../addPcbTrace/circle-to-polygon"
|
|
5
|
+
import { addCopperGeometryToNetOrProject } from "../../helpers/addCopperGeometryToNetOrProject"
|
|
7
6
|
|
|
8
7
|
export const addCircleSmtPad = (
|
|
9
8
|
smtPad: PcbSmtPadCircle,
|
|
@@ -11,15 +10,10 @@ export const addCircleSmtPad = (
|
|
|
11
10
|
): void => {
|
|
12
11
|
const {
|
|
13
12
|
project,
|
|
14
|
-
topCopperCutSetting,
|
|
15
|
-
bottomCopperCutSetting,
|
|
16
13
|
soldermaskCutSetting,
|
|
17
|
-
topCutNetGeoms,
|
|
18
|
-
bottomCutNetGeoms,
|
|
19
14
|
origin,
|
|
20
15
|
includeCopper,
|
|
21
16
|
includeSoldermask,
|
|
22
|
-
connMap,
|
|
23
17
|
globalCopperSoldermaskMarginAdjustment,
|
|
24
18
|
includeLayers,
|
|
25
19
|
} = ctx
|
|
@@ -33,42 +27,26 @@ export const addCircleSmtPad = (
|
|
|
33
27
|
return
|
|
34
28
|
}
|
|
35
29
|
|
|
36
|
-
// Select the correct cut setting and net geoms based on layer
|
|
37
|
-
const copperCutSetting =
|
|
38
|
-
padLayer === "top" ? topCopperCutSetting : bottomCopperCutSetting
|
|
39
|
-
const netGeoms = padLayer === "top" ? topCutNetGeoms : bottomCutNetGeoms
|
|
40
|
-
|
|
41
30
|
const centerX = smtPad.x + origin.x
|
|
42
31
|
const centerY = smtPad.y + origin.y
|
|
43
32
|
|
|
44
33
|
if (smtPad.radius > 0) {
|
|
45
34
|
const outerRadius = smtPad.radius
|
|
46
35
|
|
|
47
|
-
// Add to
|
|
36
|
+
// Add to copper geometry (will be merged with traces if connected)
|
|
48
37
|
if (includeCopper) {
|
|
49
|
-
const
|
|
50
|
-
|
|
51
|
-
|
|
38
|
+
const path = createCirclePath({
|
|
39
|
+
centerX,
|
|
40
|
+
centerY,
|
|
41
|
+
radius: outerRadius,
|
|
42
|
+
})
|
|
52
43
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
centerX,
|
|
60
|
-
centerY,
|
|
61
|
-
radius: outerRadius,
|
|
62
|
-
})
|
|
63
|
-
project.children.push(
|
|
64
|
-
new ShapePath({
|
|
65
|
-
cutIndex: copperCutSetting.index,
|
|
66
|
-
verts: outer.verts,
|
|
67
|
-
prims: outer.prims,
|
|
68
|
-
isClosed: true,
|
|
69
|
-
}),
|
|
70
|
-
)
|
|
71
|
-
}
|
|
44
|
+
addCopperGeometryToNetOrProject({
|
|
45
|
+
geometryId: smtPad.pcb_smtpad_id,
|
|
46
|
+
path,
|
|
47
|
+
layer: padLayer,
|
|
48
|
+
ctx,
|
|
49
|
+
})
|
|
72
50
|
}
|
|
73
51
|
|
|
74
52
|
// Add soldermask opening if drawing soldermask
|
|
@@ -2,7 +2,7 @@ import type { PcbSmtPadPill } from "circuit-json"
|
|
|
2
2
|
import type { ConvertContext } from "../../ConvertContext"
|
|
3
3
|
import { ShapePath } from "lbrnts"
|
|
4
4
|
import { createPillPath } from "../../helpers/pillShape"
|
|
5
|
-
import {
|
|
5
|
+
import { addCopperGeometryToNetOrProject } from "../../helpers/addCopperGeometryToNetOrProject"
|
|
6
6
|
|
|
7
7
|
export const addPillSmtPad = (
|
|
8
8
|
smtPad: PcbSmtPadPill,
|
|
@@ -10,15 +10,10 @@ export const addPillSmtPad = (
|
|
|
10
10
|
): void => {
|
|
11
11
|
const {
|
|
12
12
|
project,
|
|
13
|
-
topCopperCutSetting,
|
|
14
|
-
bottomCopperCutSetting,
|
|
15
13
|
soldermaskCutSetting,
|
|
16
|
-
topCutNetGeoms,
|
|
17
|
-
bottomCutNetGeoms,
|
|
18
14
|
origin,
|
|
19
15
|
includeCopper,
|
|
20
16
|
includeSoldermask,
|
|
21
|
-
connMap,
|
|
22
17
|
globalCopperSoldermaskMarginAdjustment,
|
|
23
18
|
includeLayers,
|
|
24
19
|
} = ctx
|
|
@@ -32,11 +27,6 @@ export const addPillSmtPad = (
|
|
|
32
27
|
return
|
|
33
28
|
}
|
|
34
29
|
|
|
35
|
-
// Select the correct cut setting and net geoms based on layer
|
|
36
|
-
const copperCutSetting =
|
|
37
|
-
padLayer === "top" ? topCopperCutSetting : bottomCopperCutSetting
|
|
38
|
-
const netGeoms = padLayer === "top" ? topCutNetGeoms : bottomCutNetGeoms
|
|
39
|
-
|
|
40
30
|
const centerX = smtPad.x + origin.x
|
|
41
31
|
const centerY = smtPad.y + origin.y
|
|
42
32
|
|
|
@@ -48,25 +38,14 @@ export const addPillSmtPad = (
|
|
|
48
38
|
height: smtPad.height,
|
|
49
39
|
})
|
|
50
40
|
|
|
51
|
-
// Add to
|
|
41
|
+
// Add to copper geometry (will be merged with traces if connected)
|
|
52
42
|
if (includeCopper) {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
} else {
|
|
60
|
-
// No net connection - draw directly
|
|
61
|
-
project.children.push(
|
|
62
|
-
new ShapePath({
|
|
63
|
-
cutIndex: copperCutSetting.index,
|
|
64
|
-
verts: outer.verts,
|
|
65
|
-
prims: outer.prims,
|
|
66
|
-
isClosed: true,
|
|
67
|
-
}),
|
|
68
|
-
)
|
|
69
|
-
}
|
|
43
|
+
addCopperGeometryToNetOrProject({
|
|
44
|
+
geometryId: smtPad.pcb_smtpad_id,
|
|
45
|
+
path: outer,
|
|
46
|
+
layer: padLayer,
|
|
47
|
+
ctx,
|
|
48
|
+
})
|
|
70
49
|
}
|
|
71
50
|
|
|
72
51
|
// Add soldermask opening if drawing soldermask
|
|
@@ -2,7 +2,7 @@ import type { PcbSmtPadPolygon } from "circuit-json"
|
|
|
2
2
|
import type { ConvertContext } from "../../ConvertContext"
|
|
3
3
|
import { ShapePath } from "lbrnts"
|
|
4
4
|
import { createPolygonPathFromOutline } from "../../helpers/polygonShape"
|
|
5
|
-
import {
|
|
5
|
+
import { addCopperGeometryToNetOrProject } from "../../helpers/addCopperGeometryToNetOrProject"
|
|
6
6
|
import { polygonToShapePathData } from "../../polygon-to-shape-path"
|
|
7
7
|
|
|
8
8
|
export const addPolygonSmtPad = (
|
|
@@ -11,15 +11,10 @@ export const addPolygonSmtPad = (
|
|
|
11
11
|
): void => {
|
|
12
12
|
const {
|
|
13
13
|
project,
|
|
14
|
-
topCopperCutSetting,
|
|
15
|
-
bottomCopperCutSetting,
|
|
16
14
|
soldermaskCutSetting,
|
|
17
|
-
topCutNetGeoms,
|
|
18
|
-
bottomCutNetGeoms,
|
|
19
15
|
origin,
|
|
20
16
|
includeCopper,
|
|
21
17
|
includeSoldermask,
|
|
22
|
-
connMap,
|
|
23
18
|
globalCopperSoldermaskMarginAdjustment,
|
|
24
19
|
includeLayers,
|
|
25
20
|
} = ctx
|
|
@@ -33,11 +28,6 @@ export const addPolygonSmtPad = (
|
|
|
33
28
|
return
|
|
34
29
|
}
|
|
35
30
|
|
|
36
|
-
// Select the correct cut setting and net geoms based on layer
|
|
37
|
-
const copperCutSetting =
|
|
38
|
-
padLayer === "top" ? topCopperCutSetting : bottomCopperCutSetting
|
|
39
|
-
const netGeoms = padLayer === "top" ? topCutNetGeoms : bottomCutNetGeoms
|
|
40
|
-
|
|
41
31
|
// Create the polygon pad
|
|
42
32
|
if (smtPad.points.length >= 3) {
|
|
43
33
|
const pad = createPolygonPathFromOutline({
|
|
@@ -46,25 +36,14 @@ export const addPolygonSmtPad = (
|
|
|
46
36
|
offsetY: origin.y,
|
|
47
37
|
})
|
|
48
38
|
|
|
49
|
-
// Add to
|
|
39
|
+
// Add to copper geometry (will be merged with traces if connected)
|
|
50
40
|
if (includeCopper) {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
} else {
|
|
58
|
-
// No net connection - draw directly
|
|
59
|
-
project.children.push(
|
|
60
|
-
new ShapePath({
|
|
61
|
-
cutIndex: copperCutSetting.index,
|
|
62
|
-
verts: pad.verts,
|
|
63
|
-
prims: pad.prims,
|
|
64
|
-
isClosed: true,
|
|
65
|
-
}),
|
|
66
|
-
)
|
|
67
|
-
}
|
|
41
|
+
addCopperGeometryToNetOrProject({
|
|
42
|
+
geometryId: smtPad.pcb_smtpad_id,
|
|
43
|
+
path: pad,
|
|
44
|
+
layer: padLayer,
|
|
45
|
+
ctx,
|
|
46
|
+
})
|
|
68
47
|
}
|
|
69
48
|
|
|
70
49
|
// Add soldermask opening if drawing soldermask
|
|
@@ -2,16 +2,12 @@ import { Box } from "@flatten-js/core"
|
|
|
2
2
|
import type { ConvertContext } from "../../ConvertContext"
|
|
3
3
|
import type { PcbSmtPadRect } from "circuit-json"
|
|
4
4
|
import { ShapePath } from "lbrnts"
|
|
5
|
+
import { addCopperGeometryToNetOrProject } from "../../helpers/addCopperGeometryToNetOrProject"
|
|
5
6
|
|
|
6
7
|
export const addRectSmtPad = (smtPad: PcbSmtPadRect, ctx: ConvertContext) => {
|
|
7
8
|
const {
|
|
8
9
|
project,
|
|
9
|
-
topCopperCutSetting,
|
|
10
|
-
bottomCopperCutSetting,
|
|
11
10
|
soldermaskCutSetting,
|
|
12
|
-
connMap,
|
|
13
|
-
topCutNetGeoms,
|
|
14
|
-
bottomCutNetGeoms,
|
|
15
11
|
origin,
|
|
16
12
|
includeCopper,
|
|
17
13
|
includeSoldermask,
|
|
@@ -33,54 +29,25 @@ export const addRectSmtPad = (smtPad: PcbSmtPadRect, ctx: ConvertContext) => {
|
|
|
33
29
|
const halfWidth = smtPad.width / 2
|
|
34
30
|
const halfHeight = smtPad.height / 2
|
|
35
31
|
|
|
36
|
-
const netId = connMap.getNetConnectedToId(smtPad.pcb_smtpad_id)
|
|
37
|
-
|
|
38
|
-
// Select the correct cut setting and net geoms based on layer
|
|
39
|
-
const copperCutSetting =
|
|
40
|
-
padLayer === "top" ? topCopperCutSetting : bottomCopperCutSetting
|
|
41
|
-
const netGeoms = padLayer === "top" ? topCutNetGeoms : bottomCutNetGeoms
|
|
42
|
-
|
|
43
32
|
// Only add to netGeoms if drawing copper
|
|
44
33
|
if (includeCopper) {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
netGeoms
|
|
48
|
-
.get(netId)
|
|
49
|
-
?.push(
|
|
50
|
-
new Box(
|
|
51
|
-
centerX - halfWidth,
|
|
52
|
-
centerY - halfHeight,
|
|
53
|
-
centerX + halfWidth,
|
|
54
|
-
centerY + halfHeight,
|
|
55
|
-
),
|
|
56
|
-
)
|
|
57
|
-
} else {
|
|
58
|
-
// No net connection - draw directly
|
|
59
|
-
const verts = [
|
|
34
|
+
const path = {
|
|
35
|
+
verts: [
|
|
60
36
|
{ x: centerX - halfWidth, y: centerY - halfHeight },
|
|
61
37
|
{ x: centerX + halfWidth, y: centerY - halfHeight },
|
|
62
38
|
{ x: centerX + halfWidth, y: centerY + halfHeight },
|
|
63
39
|
{ x: centerX - halfWidth, y: centerY + halfHeight },
|
|
64
40
|
{ x: centerX - halfWidth, y: centerY - halfHeight }, // Close the path
|
|
65
|
-
]
|
|
66
|
-
|
|
67
|
-
const prims = [
|
|
68
|
-
{ type: 0 },
|
|
69
|
-
{ type: 0 },
|
|
70
|
-
{ type: 0 },
|
|
71
|
-
{ type: 0 },
|
|
72
|
-
{ type: 0 },
|
|
73
|
-
]
|
|
74
|
-
|
|
75
|
-
project.children.push(
|
|
76
|
-
new ShapePath({
|
|
77
|
-
cutIndex: copperCutSetting.index,
|
|
78
|
-
verts,
|
|
79
|
-
prims,
|
|
80
|
-
isClosed: true,
|
|
81
|
-
}),
|
|
82
|
-
)
|
|
41
|
+
],
|
|
42
|
+
prims: [{ type: 0 }, { type: 0 }, { type: 0 }, { type: 0 }, { type: 0 }],
|
|
83
43
|
}
|
|
44
|
+
|
|
45
|
+
addCopperGeometryToNetOrProject({
|
|
46
|
+
geometryId: smtPad.pcb_smtpad_id,
|
|
47
|
+
path,
|
|
48
|
+
layer: padLayer,
|
|
49
|
+
ctx,
|
|
50
|
+
})
|
|
84
51
|
}
|
|
85
52
|
|
|
86
53
|
// Add soldermask opening if drawing soldermask
|
|
@@ -2,7 +2,7 @@ import type { PcbSmtPadRotatedPill } from "circuit-json"
|
|
|
2
2
|
import type { ConvertContext } from "../../ConvertContext"
|
|
3
3
|
import { ShapePath } from "lbrnts"
|
|
4
4
|
import { createPillPath } from "../../helpers/pillShape"
|
|
5
|
-
import {
|
|
5
|
+
import { addCopperGeometryToNetOrProject } from "../../helpers/addCopperGeometryToNetOrProject"
|
|
6
6
|
|
|
7
7
|
export const addRotatedPillSmtPad = (
|
|
8
8
|
smtPad: PcbSmtPadRotatedPill,
|
|
@@ -10,15 +10,10 @@ export const addRotatedPillSmtPad = (
|
|
|
10
10
|
): void => {
|
|
11
11
|
const {
|
|
12
12
|
project,
|
|
13
|
-
topCopperCutSetting,
|
|
14
|
-
bottomCopperCutSetting,
|
|
15
13
|
soldermaskCutSetting,
|
|
16
|
-
topCutNetGeoms,
|
|
17
|
-
bottomCutNetGeoms,
|
|
18
14
|
origin,
|
|
19
15
|
includeCopper,
|
|
20
16
|
includeSoldermask,
|
|
21
|
-
connMap,
|
|
22
17
|
globalCopperSoldermaskMarginAdjustment,
|
|
23
18
|
includeLayers,
|
|
24
19
|
} = ctx
|
|
@@ -32,11 +27,6 @@ export const addRotatedPillSmtPad = (
|
|
|
32
27
|
return
|
|
33
28
|
}
|
|
34
29
|
|
|
35
|
-
// Select the correct cut setting and net geoms based on layer
|
|
36
|
-
const copperCutSetting =
|
|
37
|
-
padLayer === "top" ? topCopperCutSetting : bottomCopperCutSetting
|
|
38
|
-
const netGeoms = padLayer === "top" ? topCutNetGeoms : bottomCutNetGeoms
|
|
39
|
-
|
|
40
30
|
const centerX = smtPad.x + origin.x
|
|
41
31
|
const centerY = smtPad.y + origin.y
|
|
42
32
|
|
|
@@ -49,25 +39,14 @@ export const addRotatedPillSmtPad = (
|
|
|
49
39
|
rotation: (smtPad.ccw_rotation ?? 0) * (Math.PI / 180),
|
|
50
40
|
})
|
|
51
41
|
|
|
52
|
-
// Add to
|
|
42
|
+
// Add to copper geometry (will be merged with traces if connected)
|
|
53
43
|
if (includeCopper) {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
} else {
|
|
61
|
-
// No net connection - draw directly
|
|
62
|
-
project.children.push(
|
|
63
|
-
new ShapePath({
|
|
64
|
-
cutIndex: copperCutSetting.index,
|
|
65
|
-
verts: outer.verts,
|
|
66
|
-
prims: outer.prims,
|
|
67
|
-
isClosed: true,
|
|
68
|
-
}),
|
|
69
|
-
)
|
|
70
|
-
}
|
|
44
|
+
addCopperGeometryToNetOrProject({
|
|
45
|
+
geometryId: smtPad.pcb_smtpad_id,
|
|
46
|
+
path: outer,
|
|
47
|
+
layer: padLayer,
|
|
48
|
+
ctx,
|
|
49
|
+
})
|
|
71
50
|
}
|
|
72
51
|
|
|
73
52
|
// Add soldermask opening if drawing soldermask
|
|
@@ -2,7 +2,7 @@ import type { PcbSmtPadRotatedRect } from "circuit-json"
|
|
|
2
2
|
import type { ConvertContext } from "../../ConvertContext"
|
|
3
3
|
import { ShapePath } from "lbrnts"
|
|
4
4
|
import { createRoundedRectPath } from "../../helpers/roundedRectShape"
|
|
5
|
-
import {
|
|
5
|
+
import { addCopperGeometryToNetOrProject } from "../../helpers/addCopperGeometryToNetOrProject"
|
|
6
6
|
|
|
7
7
|
export const addRotatedRectSmtPad = (
|
|
8
8
|
smtPad: PcbSmtPadRotatedRect,
|
|
@@ -10,15 +10,10 @@ export const addRotatedRectSmtPad = (
|
|
|
10
10
|
): void => {
|
|
11
11
|
const {
|
|
12
12
|
project,
|
|
13
|
-
topCopperCutSetting,
|
|
14
|
-
bottomCopperCutSetting,
|
|
15
13
|
soldermaskCutSetting,
|
|
16
|
-
topCutNetGeoms,
|
|
17
|
-
bottomCutNetGeoms,
|
|
18
14
|
origin,
|
|
19
15
|
includeCopper,
|
|
20
16
|
includeSoldermask,
|
|
21
|
-
connMap,
|
|
22
17
|
globalCopperSoldermaskMarginAdjustment,
|
|
23
18
|
includeLayers,
|
|
24
19
|
} = ctx
|
|
@@ -32,11 +27,6 @@ export const addRotatedRectSmtPad = (
|
|
|
32
27
|
return
|
|
33
28
|
}
|
|
34
29
|
|
|
35
|
-
// Select the correct cut setting and net geoms based on layer
|
|
36
|
-
const copperCutSetting =
|
|
37
|
-
padLayer === "top" ? topCopperCutSetting : bottomCopperCutSetting
|
|
38
|
-
const netGeoms = padLayer === "top" ? topCutNetGeoms : bottomCutNetGeoms
|
|
39
|
-
|
|
40
30
|
const centerX = smtPad.x + origin.x
|
|
41
31
|
const centerY = smtPad.y + origin.y
|
|
42
32
|
const rotation = (smtPad.ccw_rotation ?? 0) * (Math.PI / 180)
|
|
@@ -53,25 +43,14 @@ export const addRotatedRectSmtPad = (
|
|
|
53
43
|
rotation,
|
|
54
44
|
})
|
|
55
45
|
|
|
56
|
-
// Add to
|
|
46
|
+
// Add to copper geometry (will be merged with traces if connected)
|
|
57
47
|
if (includeCopper) {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
} else {
|
|
65
|
-
// No net connection - draw directly
|
|
66
|
-
project.children.push(
|
|
67
|
-
new ShapePath({
|
|
68
|
-
cutIndex: copperCutSetting.index,
|
|
69
|
-
verts: outer.verts,
|
|
70
|
-
prims: outer.prims,
|
|
71
|
-
isClosed: true,
|
|
72
|
-
}),
|
|
73
|
-
)
|
|
74
|
-
}
|
|
48
|
+
addCopperGeometryToNetOrProject({
|
|
49
|
+
geometryId: smtPad.pcb_smtpad_id,
|
|
50
|
+
path: outer,
|
|
51
|
+
layer: padLayer,
|
|
52
|
+
ctx,
|
|
53
|
+
})
|
|
75
54
|
}
|
|
76
55
|
|
|
77
56
|
// Add soldermask opening if drawing soldermask
|