circuit-json-to-tscircuit 0.0.41 → 0.0.42
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/{chunk-BA4FQZIF.js → chunk-UXTI3RT6.js} +10 -64
- package/dist/cli/main.js +2 -2
- package/dist/lib/index.js +1 -1
- package/lib/generate-footprint-tsx/convert-smt-pads.ts +12 -64
- package/package.json +1 -1
- package/tests/__snapshots__/test16-support-pcb-smtpad-shapes-pcb.snap.svg +1 -1
- package/tests/test16-support-pcb-smtpad-shapes.test.tsx +30 -1
|
@@ -529,6 +529,7 @@ var convertSmtPads = (circuitJson) => {
|
|
|
529
529
|
const elementStrings = [];
|
|
530
530
|
for (const smtPad of smtPads) {
|
|
531
531
|
const commonAttrs = [];
|
|
532
|
+
const solderMaskAttrs = formatSolderMaskAttrs(smtPad);
|
|
532
533
|
if (smtPad.port_hints !== void 0) {
|
|
533
534
|
commonAttrs.push(`portHints={${JSON.stringify(smtPad.port_hints)}}`);
|
|
534
535
|
}
|
|
@@ -541,85 +542,30 @@ var convertSmtPads = (circuitJson) => {
|
|
|
541
542
|
if (smtPad.layer !== void 0) {
|
|
542
543
|
commonAttrs.push(`layer="${smtPad.layer}"`);
|
|
543
544
|
}
|
|
544
|
-
if (smtPad.is_covered_with_solder_mask !== void 0) {
|
|
545
|
-
commonAttrs.push(
|
|
546
|
-
`coveredWithSolderMask={${smtPad.is_covered_with_solder_mask}}`
|
|
547
|
-
);
|
|
548
|
-
}
|
|
549
|
-
if (smtPad.soldermask_margin !== void 0) {
|
|
550
|
-
commonAttrs.push(`solderMaskMargin="${mmStr6(smtPad.soldermask_margin)}"`);
|
|
551
|
-
}
|
|
552
545
|
if (smtPad.shape === "circle") {
|
|
553
546
|
elementStrings.push(
|
|
554
|
-
`<smtpad ${commonAttrs.join(" ")} radius="${mmStr6(smtPad.radius ?? 0)}" shape="circle" />`
|
|
547
|
+
`<smtpad ${commonAttrs.join(" ")}${solderMaskAttrs} radius="${mmStr6(smtPad.radius ?? 0)}" shape="circle" />`
|
|
555
548
|
);
|
|
556
549
|
} else if (smtPad.shape === "rect") {
|
|
557
|
-
if (smtPad.rect_border_radius !== void 0) {
|
|
558
|
-
commonAttrs.push(
|
|
559
|
-
`rectBorderRadius="${mmStr6(smtPad.rect_border_radius)}"`
|
|
560
|
-
);
|
|
561
|
-
}
|
|
562
|
-
if (smtPad.corner_radius !== void 0) {
|
|
563
|
-
commonAttrs.push(`cornerRadius="${mmStr6(smtPad.corner_radius)}"`);
|
|
564
|
-
}
|
|
565
|
-
if (smtPad.soldermask_margin_left !== void 0) {
|
|
566
|
-
commonAttrs.push(
|
|
567
|
-
`solderMaskMarginLeft="${mmStr6(smtPad.soldermask_margin_left)}"`
|
|
568
|
-
);
|
|
569
|
-
}
|
|
570
|
-
if (smtPad.soldermask_margin_top !== void 0) {
|
|
571
|
-
commonAttrs.push(
|
|
572
|
-
`solderMaskMarginTop="${mmStr6(smtPad.soldermask_margin_top)}"`
|
|
573
|
-
);
|
|
574
|
-
}
|
|
575
|
-
if (smtPad.soldermask_margin_right !== void 0) {
|
|
576
|
-
commonAttrs.push(
|
|
577
|
-
`solderMaskMarginRight="${mmStr6(smtPad.soldermask_margin_right)}"`
|
|
578
|
-
);
|
|
579
|
-
}
|
|
580
|
-
if (smtPad.soldermask_margin_bottom !== void 0) {
|
|
581
|
-
commonAttrs.push(
|
|
582
|
-
`solderMaskMarginBottom="${mmStr6(smtPad.soldermask_margin_bottom)}"`
|
|
583
|
-
);
|
|
584
|
-
}
|
|
585
550
|
elementStrings.push(
|
|
586
|
-
`<smtpad ${commonAttrs.join(" ")} width="${mmStr6(smtPad.width ?? 0)}" height="${mmStr6(smtPad.height ?? 0)}" shape="rect" />`
|
|
551
|
+
`<smtpad ${commonAttrs.join(" ")}${solderMaskAttrs}${formatOptionalMmAttr("rectBorderRadius", smtPad.rect_border_radius)}${formatOptionalMmAttr("cornerRadius", smtPad.corner_radius)}${formatOptionalMmAttr("solderMaskMarginLeft", smtPad.soldermask_margin_left)}${formatOptionalMmAttr("solderMaskMarginTop", smtPad.soldermask_margin_top)}${formatOptionalMmAttr("solderMaskMarginRight", smtPad.soldermask_margin_right)}${formatOptionalMmAttr("solderMaskMarginBottom", smtPad.soldermask_margin_bottom)} width="${mmStr6(smtPad.width ?? 0)}" height="${mmStr6(smtPad.height ?? 0)}" shape="rect" />`
|
|
587
552
|
);
|
|
588
553
|
} else if (smtPad.shape === "pill") {
|
|
589
554
|
elementStrings.push(
|
|
590
|
-
`<smtpad ${commonAttrs.join(" ")} width="${mmStr6(smtPad.width ?? 0)}" height="${mmStr6(smtPad.height ?? 0)}" radius="${mmStr6(smtPad.radius ?? 0)}" shape="pill" />`
|
|
555
|
+
`<smtpad ${commonAttrs.join(" ")}${solderMaskAttrs} width="${mmStr6(smtPad.width ?? 0)}" height="${mmStr6(smtPad.height ?? 0)}" radius="${mmStr6(smtPad.radius ?? 0)}" shape="pill" />`
|
|
556
|
+
);
|
|
557
|
+
} else if (smtPad.shape === "rotated_pill") {
|
|
558
|
+
elementStrings.push(
|
|
559
|
+
`<smtpad ${commonAttrs.join(" ")}${solderMaskAttrs} width="${mmStr6(smtPad.width ?? 0)}" height="${mmStr6(smtPad.height ?? 0)}" radius="${mmStr6(smtPad.radius ?? 0)}"${formatPcbRotationAttr(smtPad.ccw_rotation)} shape="pill" />`
|
|
591
560
|
);
|
|
592
561
|
} else if (smtPad.shape === "polygon") {
|
|
593
562
|
elementStrings.push(
|
|
594
|
-
`<smtpad ${commonAttrs.join(" ")} shape="polygon" points={${JSON.stringify(smtPad.points)}} />`
|
|
563
|
+
`<smtpad ${commonAttrs.join(" ")}${solderMaskAttrs} shape="polygon" points={${JSON.stringify(smtPad.points)}} />`
|
|
595
564
|
);
|
|
596
565
|
} else if (smtPad.shape === "rotated_rect") {
|
|
597
566
|
const cornerRadius = smtPad.corner_radius ?? smtPad.rect_border_radius ?? void 0;
|
|
598
|
-
if (cornerRadius !== void 0) {
|
|
599
|
-
commonAttrs.push(`cornerRadius="${mmStr6(cornerRadius)}"`);
|
|
600
|
-
}
|
|
601
|
-
if (smtPad.soldermask_margin_left !== void 0) {
|
|
602
|
-
commonAttrs.push(
|
|
603
|
-
`solderMaskMarginLeft="${mmStr6(smtPad.soldermask_margin_left)}"`
|
|
604
|
-
);
|
|
605
|
-
}
|
|
606
|
-
if (smtPad.soldermask_margin_top !== void 0) {
|
|
607
|
-
commonAttrs.push(
|
|
608
|
-
`solderMaskMarginTop="${mmStr6(smtPad.soldermask_margin_top)}"`
|
|
609
|
-
);
|
|
610
|
-
}
|
|
611
|
-
if (smtPad.soldermask_margin_right !== void 0) {
|
|
612
|
-
commonAttrs.push(
|
|
613
|
-
`solderMaskMarginRight="${mmStr6(smtPad.soldermask_margin_right)}"`
|
|
614
|
-
);
|
|
615
|
-
}
|
|
616
|
-
if (smtPad.soldermask_margin_bottom !== void 0) {
|
|
617
|
-
commonAttrs.push(
|
|
618
|
-
`solderMaskMarginBottom="${mmStr6(smtPad.soldermask_margin_bottom)}"`
|
|
619
|
-
);
|
|
620
|
-
}
|
|
621
567
|
elementStrings.push(
|
|
622
|
-
`<smtpad ${commonAttrs.join(" ")} width="${mmStr6(smtPad.width ?? 0)}" height="${mmStr6(smtPad.height ?? 0)}"${formatPcbRotationAttr(smtPad.ccw_rotation)} shape="rotated_rect" />`
|
|
568
|
+
`<smtpad ${commonAttrs.join(" ")}${solderMaskAttrs}${formatOptionalMmAttr("cornerRadius", cornerRadius)}${formatOptionalMmAttr("solderMaskMarginLeft", smtPad.soldermask_margin_left)}${formatOptionalMmAttr("solderMaskMarginTop", smtPad.soldermask_margin_top)}${formatOptionalMmAttr("solderMaskMarginRight", smtPad.soldermask_margin_right)}${formatOptionalMmAttr("solderMaskMarginBottom", smtPad.soldermask_margin_bottom)} width="${mmStr6(smtPad.width ?? 0)}" height="${mmStr6(smtPad.height ?? 0)}"${formatPcbRotationAttr(smtPad.ccw_rotation)} shape="rotated_rect" />`
|
|
623
569
|
);
|
|
624
570
|
}
|
|
625
571
|
}
|
package/dist/cli/main.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
convertCircuitJsonToTscircuit
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-UXTI3RT6.js";
|
|
5
5
|
|
|
6
6
|
// cli/main.ts
|
|
7
7
|
import { Command } from "commander";
|
|
@@ -16,7 +16,7 @@ var package_default = {
|
|
|
16
16
|
"./cli": "./dist/cli/main.js"
|
|
17
17
|
},
|
|
18
18
|
type: "module",
|
|
19
|
-
version: "0.0.
|
|
19
|
+
version: "0.0.41",
|
|
20
20
|
scripts: {
|
|
21
21
|
build: "tsup-node lib/index.ts cli/main.ts --format esm --dts",
|
|
22
22
|
test: "bun test",
|
package/dist/lib/index.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { su } from "@tscircuit/soup-util"
|
|
2
2
|
import { mmStr } from "@tscircuit/mm"
|
|
3
3
|
import type { FootprintElementConverter } from "./converter-types"
|
|
4
|
+
import { formatOptionalMmAttr } from "./footprint-tsx-attribute-formatters/format-optional-mm-attr"
|
|
4
5
|
import { formatPcbRotationAttr } from "./footprint-tsx-attribute-formatters/format-pcb-rotation-attr"
|
|
6
|
+
import { formatSolderMaskAttrs } from "./footprint-tsx-attribute-formatters/format-solder-mask-attrs"
|
|
5
7
|
|
|
6
8
|
export const convertSmtPads: FootprintElementConverter = (circuitJson) => {
|
|
7
9
|
const smtPads = su(circuitJson).pcb_smtpad.list()
|
|
@@ -9,6 +11,7 @@ export const convertSmtPads: FootprintElementConverter = (circuitJson) => {
|
|
|
9
11
|
|
|
10
12
|
for (const smtPad of smtPads) {
|
|
11
13
|
const commonAttrs: string[] = []
|
|
14
|
+
const solderMaskAttrs = formatSolderMaskAttrs(smtPad)
|
|
12
15
|
|
|
13
16
|
if (smtPad.port_hints !== undefined) {
|
|
14
17
|
commonAttrs.push(`portHints={${JSON.stringify(smtPad.port_hints)}}`)
|
|
@@ -22,88 +25,33 @@ export const convertSmtPads: FootprintElementConverter = (circuitJson) => {
|
|
|
22
25
|
if (smtPad.layer !== undefined) {
|
|
23
26
|
commonAttrs.push(`layer="${smtPad.layer}"`)
|
|
24
27
|
}
|
|
25
|
-
if (smtPad.is_covered_with_solder_mask !== undefined) {
|
|
26
|
-
commonAttrs.push(
|
|
27
|
-
`coveredWithSolderMask={${smtPad.is_covered_with_solder_mask}}`,
|
|
28
|
-
)
|
|
29
|
-
}
|
|
30
|
-
if (smtPad.soldermask_margin !== undefined) {
|
|
31
|
-
commonAttrs.push(`solderMaskMargin="${mmStr(smtPad.soldermask_margin)}"`)
|
|
32
|
-
}
|
|
33
28
|
|
|
34
29
|
if (smtPad.shape === "circle") {
|
|
35
30
|
elementStrings.push(
|
|
36
|
-
`<smtpad ${commonAttrs.join(" ")} radius="${mmStr(smtPad.radius ?? 0)}" shape="circle" />`,
|
|
31
|
+
`<smtpad ${commonAttrs.join(" ")}${solderMaskAttrs} radius="${mmStr(smtPad.radius ?? 0)}" shape="circle" />`,
|
|
37
32
|
)
|
|
38
33
|
} else if (smtPad.shape === "rect") {
|
|
39
|
-
if (smtPad.rect_border_radius !== undefined) {
|
|
40
|
-
commonAttrs.push(
|
|
41
|
-
`rectBorderRadius="${mmStr(smtPad.rect_border_radius)}"`,
|
|
42
|
-
)
|
|
43
|
-
}
|
|
44
|
-
if (smtPad.corner_radius !== undefined) {
|
|
45
|
-
commonAttrs.push(`cornerRadius="${mmStr(smtPad.corner_radius)}"`)
|
|
46
|
-
}
|
|
47
|
-
if (smtPad.soldermask_margin_left !== undefined) {
|
|
48
|
-
commonAttrs.push(
|
|
49
|
-
`solderMaskMarginLeft="${mmStr(smtPad.soldermask_margin_left)}"`,
|
|
50
|
-
)
|
|
51
|
-
}
|
|
52
|
-
if (smtPad.soldermask_margin_top !== undefined) {
|
|
53
|
-
commonAttrs.push(
|
|
54
|
-
`solderMaskMarginTop="${mmStr(smtPad.soldermask_margin_top)}"`,
|
|
55
|
-
)
|
|
56
|
-
}
|
|
57
|
-
if (smtPad.soldermask_margin_right !== undefined) {
|
|
58
|
-
commonAttrs.push(
|
|
59
|
-
`solderMaskMarginRight="${mmStr(smtPad.soldermask_margin_right)}"`,
|
|
60
|
-
)
|
|
61
|
-
}
|
|
62
|
-
if (smtPad.soldermask_margin_bottom !== undefined) {
|
|
63
|
-
commonAttrs.push(
|
|
64
|
-
`solderMaskMarginBottom="${mmStr(smtPad.soldermask_margin_bottom)}"`,
|
|
65
|
-
)
|
|
66
|
-
}
|
|
67
34
|
elementStrings.push(
|
|
68
|
-
`<smtpad ${commonAttrs.join(" ")} width="${mmStr(smtPad.width ?? 0)}" height="${mmStr(smtPad.height ?? 0)}" shape="rect" />`,
|
|
35
|
+
`<smtpad ${commonAttrs.join(" ")}${solderMaskAttrs}${formatOptionalMmAttr("rectBorderRadius", smtPad.rect_border_radius)}${formatOptionalMmAttr("cornerRadius", smtPad.corner_radius)}${formatOptionalMmAttr("solderMaskMarginLeft", smtPad.soldermask_margin_left)}${formatOptionalMmAttr("solderMaskMarginTop", smtPad.soldermask_margin_top)}${formatOptionalMmAttr("solderMaskMarginRight", smtPad.soldermask_margin_right)}${formatOptionalMmAttr("solderMaskMarginBottom", smtPad.soldermask_margin_bottom)} width="${mmStr(smtPad.width ?? 0)}" height="${mmStr(smtPad.height ?? 0)}" shape="rect" />`,
|
|
69
36
|
)
|
|
70
37
|
} else if (smtPad.shape === "pill") {
|
|
71
38
|
elementStrings.push(
|
|
72
|
-
`<smtpad ${commonAttrs.join(" ")} width="${mmStr(smtPad.width ?? 0)}" height="${mmStr(smtPad.height ?? 0)}" radius="${mmStr(smtPad.radius ?? 0)}" shape="pill" />`,
|
|
39
|
+
`<smtpad ${commonAttrs.join(" ")}${solderMaskAttrs} width="${mmStr(smtPad.width ?? 0)}" height="${mmStr(smtPad.height ?? 0)}" radius="${mmStr(smtPad.radius ?? 0)}" shape="pill" />`,
|
|
40
|
+
)
|
|
41
|
+
} else if (smtPad.shape === "rotated_pill") {
|
|
42
|
+
elementStrings.push(
|
|
43
|
+
`<smtpad ${commonAttrs.join(" ")}${solderMaskAttrs} width="${mmStr(smtPad.width ?? 0)}" height="${mmStr(smtPad.height ?? 0)}" radius="${mmStr(smtPad.radius ?? 0)}"${formatPcbRotationAttr(smtPad.ccw_rotation)} shape="pill" />`,
|
|
73
44
|
)
|
|
74
45
|
} else if (smtPad.shape === "polygon") {
|
|
75
46
|
elementStrings.push(
|
|
76
|
-
`<smtpad ${commonAttrs.join(" ")} shape="polygon" points={${JSON.stringify(smtPad.points)}} />`,
|
|
47
|
+
`<smtpad ${commonAttrs.join(" ")}${solderMaskAttrs} shape="polygon" points={${JSON.stringify(smtPad.points)}} />`,
|
|
77
48
|
)
|
|
78
49
|
} else if (smtPad.shape === "rotated_rect") {
|
|
79
50
|
const cornerRadius =
|
|
80
51
|
smtPad.corner_radius ?? smtPad.rect_border_radius ?? undefined
|
|
81
52
|
|
|
82
|
-
if (cornerRadius !== undefined) {
|
|
83
|
-
commonAttrs.push(`cornerRadius="${mmStr(cornerRadius)}"`)
|
|
84
|
-
}
|
|
85
|
-
if (smtPad.soldermask_margin_left !== undefined) {
|
|
86
|
-
commonAttrs.push(
|
|
87
|
-
`solderMaskMarginLeft="${mmStr(smtPad.soldermask_margin_left)}"`,
|
|
88
|
-
)
|
|
89
|
-
}
|
|
90
|
-
if (smtPad.soldermask_margin_top !== undefined) {
|
|
91
|
-
commonAttrs.push(
|
|
92
|
-
`solderMaskMarginTop="${mmStr(smtPad.soldermask_margin_top)}"`,
|
|
93
|
-
)
|
|
94
|
-
}
|
|
95
|
-
if (smtPad.soldermask_margin_right !== undefined) {
|
|
96
|
-
commonAttrs.push(
|
|
97
|
-
`solderMaskMarginRight="${mmStr(smtPad.soldermask_margin_right)}"`,
|
|
98
|
-
)
|
|
99
|
-
}
|
|
100
|
-
if (smtPad.soldermask_margin_bottom !== undefined) {
|
|
101
|
-
commonAttrs.push(
|
|
102
|
-
`solderMaskMarginBottom="${mmStr(smtPad.soldermask_margin_bottom)}"`,
|
|
103
|
-
)
|
|
104
|
-
}
|
|
105
53
|
elementStrings.push(
|
|
106
|
-
`<smtpad ${commonAttrs.join(" ")} width="${mmStr(smtPad.width ?? 0)}" height="${mmStr(smtPad.height ?? 0)}"${formatPcbRotationAttr(smtPad.ccw_rotation)} shape="rotated_rect" />`,
|
|
54
|
+
`<smtpad ${commonAttrs.join(" ")}${solderMaskAttrs}${formatOptionalMmAttr("cornerRadius", cornerRadius)}${formatOptionalMmAttr("solderMaskMarginLeft", smtPad.soldermask_margin_left)}${formatOptionalMmAttr("solderMaskMarginTop", smtPad.soldermask_margin_top)}${formatOptionalMmAttr("solderMaskMarginRight", smtPad.soldermask_margin_right)}${formatOptionalMmAttr("solderMaskMarginBottom", smtPad.soldermask_margin_bottom)} width="${mmStr(smtPad.width ?? 0)}" height="${mmStr(smtPad.height ?? 0)}"${formatPcbRotationAttr(smtPad.ccw_rotation)} shape="rotated_rect" />`,
|
|
107
55
|
)
|
|
108
56
|
}
|
|
109
57
|
}
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="800" height="600" data-software-used-string="@tscircuit/core@0.0.
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="800" height="600" data-software-used-string="@tscircuit/core@0.0.1322"><style></style><rect class="boundary" x="0" y="0" fill="#000" width="800" height="600" data-type="pcb_background" data-pcb-layer="global"/><rect class="pcb-boundary" fill="none" stroke="#fff" stroke-width="0.3" x="127.27272727272725" y="27.272727272727252" width="545.4545454545455" height="545.4545454545455" data-type="pcb_boundary" data-pcb-layer="global"/><path class="pcb-board" d="M 127.27272727272725 572.7272727272727 L 672.7272727272727 572.7272727272727 L 672.7272727272727 27.272727272727252 L 127.27272727272725 27.272727272727252 Z" fill="none" stroke="rgba(255, 255, 255, 0.5)" stroke-width="2.7272727272727275" data-type="pcb_board" data-pcb-layer="board"/><rect class="pcb-pad" fill="rgb(77, 127, 196)" x="-27.272727272727273" y="-8.181818181818182" width="54.54545454545455" height="16.363636363636363" transform="translate(372.72727272727275 354.54545454545456) rotate(-45)" data-type="pcb_smtpad" data-pcb-layer="bottom" rx="4.090909090909091" ry="4.090909090909091"/><rect class="pcb-pad" fill="rgb(77, 127, 196)" x="443.6363636363636" y="328.6363636363636" width="49.09090909090909" height="24.545454545454547" data-type="pcb_smtpad" data-pcb-layer="bottom" rx="5.454545454545455" ry="5.454545454545455"/><rect class="pcb-pad" fill="rgb(77, 127, 196)" x="-27.272727272727273" y="-8.181818181818182" width="54.54545454545455" height="16.363636363636363" transform="translate(372.72727272727275 354.54545454545456) rotate(-45)" data-type="pcb_smtpad" data-pcb-layer="bottom" rx="4.090909090909091" ry="4.090909090909091"/><rect class="pcb-pad" fill="rgb(77, 127, 196)" x="443.6363636363636" y="328.6363636363636" width="49.09090909090909" height="24.545454545454547" data-type="pcb_smtpad" data-pcb-layer="bottom" rx="5.454545454545455" ry="5.454545454545455"/><rect class="pcb-pad" fill="rgb(200, 52, 52)" x="406.8181818181818" y="234.54545454545453" width="40.90909090909091" height="21.81818181818182" rx="10.90909090909091" ry="10.90909090909091" data-type="pcb_smtpad" data-pcb-layer="top"/><polygon class="pcb-pad" fill="rgb(200, 52, 52)" points="400,300 427.27272727272725,300 413.6363636363636,272.72727272727275" data-type="pcb_smtpad" data-pcb-layer="top"/><rect class="pcb-pad" fill="rgb(200, 52, 52)" x="-30.000000000000004" y="-12.272727272727273" width="60.00000000000001" height="24.545454545454547" rx="12.272727272727273" ry="12.272727272727273" data-type="pcb_smtpad" data-pcb-layer="top" transform="translate(334.54545454545456 256.3636363636364) rotate(-30)"/><rect class="pcb-pad" fill="rgb(200, 52, 52)" x="406.8181818181818" y="234.54545454545453" width="40.90909090909091" height="21.81818181818182" rx="10.90909090909091" ry="10.90909090909091" data-type="pcb_smtpad" data-pcb-layer="top"/><polygon class="pcb-pad" fill="rgb(200, 52, 52)" points="400,300 427.27272727272725,300 413.6363636363636,272.72727272727275" data-type="pcb_smtpad" data-pcb-layer="top"/><rect class="pcb-pad" fill="rgb(200, 52, 52)" x="-30.000000000000004" y="-12.272727272727273" width="60.00000000000001" height="24.545454545454547" rx="12.272727272727273" ry="12.272727272727273" data-type="pcb_smtpad" data-pcb-layer="top" transform="translate(334.54545454545456 256.3636363636364) rotate(-30)"/></svg>
|
|
@@ -18,6 +18,7 @@ test("test16 support pcb smtpad shapes", async () => {
|
|
|
18
18
|
<smtpad portHints={["2"]} layer="top" coveredWithSolderMask={true} solderMaskMargin="0.06mm" shape="polygon" points={[{"x":0,"y":0},{"x":1,"y":0},{"x":0.5,"y":1}]} />
|
|
19
19
|
<smtpad portHints={["3"]} pcbX="-1mm" pcbY="-2mm" layer="bottom" coveredWithSolderMask={true} solderMaskMargin="0.04mm" cornerRadius="0.15mm" solderMaskMarginLeft="0.01mm" solderMaskMarginTop="0.02mm" solderMaskMarginRight="0.03mm" solderMaskMarginBottom="0.05mm" width="2mm" height="0.6mm" pcbRotation="45deg" shape="rotated_rect" />
|
|
20
20
|
<smtpad portHints={["4"]} pcbX="2.5mm" pcbY="-1.5mm" layer="bottom" coveredWithSolderMask={true} solderMaskMargin="0.05mm" rectBorderRadius="0.25mm" cornerRadius="0.2mm" solderMaskMarginLeft="0.11mm" solderMaskMarginTop="0.12mm" solderMaskMarginRight="0.13mm" solderMaskMarginBottom="0.14mm" width="1.8mm" height="0.9mm" shape="rect" />
|
|
21
|
+
<smtpad portHints={["5"]} pcbX="-2.4mm" pcbY="1.6mm" layer="top" coveredWithSolderMask={true} solderMaskMargin="0.07mm" width="2.2mm" height="0.9mm" radius="0.45mm" pcbRotation="30deg" shape="pill" />
|
|
21
22
|
</footprint>}
|
|
22
23
|
{...props}
|
|
23
24
|
/>
|
|
@@ -25,6 +26,7 @@ test("test16 support pcb smtpad shapes", async () => {
|
|
|
25
26
|
`)
|
|
26
27
|
expect(tscircuit).toContain(`pcbRotation="45deg"`)
|
|
27
28
|
expect(tscircuit).toContain(`shape="rotated_rect"`)
|
|
29
|
+
expect(tscircuit).toContain(`pcbRotation="30deg"`)
|
|
28
30
|
|
|
29
31
|
// The generator emits pcbRotation for consistency, but the current smtpad
|
|
30
32
|
// runtime still expects ccwRotation for rotated_rect pads.
|
|
@@ -47,7 +49,7 @@ circuit.add(
|
|
|
47
49
|
(elm): elm is PcbSmtPad => elm.type === "pcb_smtpad",
|
|
48
50
|
)
|
|
49
51
|
|
|
50
|
-
expect(renderedSmtPads).toHaveLength(
|
|
52
|
+
expect(renderedSmtPads).toHaveLength(10)
|
|
51
53
|
expect(renderedSmtPads).toEqual(
|
|
52
54
|
expect.arrayContaining([
|
|
53
55
|
expect.objectContaining({
|
|
@@ -66,6 +68,17 @@ circuit.add(
|
|
|
66
68
|
is_covered_with_solder_mask: true,
|
|
67
69
|
soldermask_margin: 0.05,
|
|
68
70
|
}),
|
|
71
|
+
expect.objectContaining({
|
|
72
|
+
port_hints: ["5"],
|
|
73
|
+
layer: "top",
|
|
74
|
+
shape: "rotated_pill",
|
|
75
|
+
ccw_rotation: 30,
|
|
76
|
+
radius: 0.45,
|
|
77
|
+
width: 2.2,
|
|
78
|
+
height: 0.9,
|
|
79
|
+
is_covered_with_solder_mask: true,
|
|
80
|
+
soldermask_margin: 0.07,
|
|
81
|
+
}),
|
|
69
82
|
]),
|
|
70
83
|
)
|
|
71
84
|
|
|
@@ -167,4 +180,20 @@ const circuitJson: any = [
|
|
|
167
180
|
soldermask_margin_bottom: 0.14,
|
|
168
181
|
port_hints: ["4"],
|
|
169
182
|
},
|
|
183
|
+
{
|
|
184
|
+
type: "pcb_smtpad",
|
|
185
|
+
pcb_smtpad_id: "rotated_pill_pad",
|
|
186
|
+
pcb_component_id: "pcb_generic_component_0",
|
|
187
|
+
shape: "rotated_pill",
|
|
188
|
+
x: -2.4,
|
|
189
|
+
y: 1.6,
|
|
190
|
+
width: 2.2,
|
|
191
|
+
height: 0.9,
|
|
192
|
+
radius: 0.45,
|
|
193
|
+
ccw_rotation: 30,
|
|
194
|
+
layer: "top",
|
|
195
|
+
is_covered_with_solder_mask: true,
|
|
196
|
+
soldermask_margin: 0.07,
|
|
197
|
+
port_hints: ["5"],
|
|
198
|
+
},
|
|
170
199
|
]
|