circuit-json-to-tscircuit 0.0.45 → 0.0.46
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.
|
@@ -565,7 +565,7 @@ var convertSmtPads = (circuitJson) => {
|
|
|
565
565
|
} else if (smtPad.shape === "rotated_rect") {
|
|
566
566
|
const cornerRadius = smtPad.corner_radius ?? smtPad.rect_border_radius ?? void 0;
|
|
567
567
|
elementStrings.push(
|
|
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)}"${
|
|
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)}" ccwRotation={${smtPad.ccw_rotation ?? 0}} shape="rotated_rect" />`
|
|
569
569
|
);
|
|
570
570
|
}
|
|
571
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-E24YLRWU.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.45",
|
|
20
20
|
repository: {
|
|
21
21
|
type: "git",
|
|
22
22
|
url: "https://github.com/tscircuit/circuit-json-to-tscircuit.git"
|
package/dist/lib/index.js
CHANGED
|
@@ -51,7 +51,7 @@ export const convertSmtPads: FootprintElementConverter = (circuitJson) => {
|
|
|
51
51
|
smtPad.corner_radius ?? smtPad.rect_border_radius ?? undefined
|
|
52
52
|
|
|
53
53
|
elementStrings.push(
|
|
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)}"${
|
|
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)}" ccwRotation={${smtPad.ccw_rotation ?? 0}} shape="rotated_rect" />`,
|
|
55
55
|
)
|
|
56
56
|
}
|
|
57
57
|
}
|
package/package.json
CHANGED
|
@@ -16,7 +16,7 @@ test("test16 support pcb smtpad shapes", async () => {
|
|
|
16
16
|
footprint={<footprint>
|
|
17
17
|
<smtpad portHints={["1"]} pcbX="1mm" pcbY="2mm" layer="top" coveredWithSolderMask={true} solderMaskMargin="0.03mm" width="1.5mm" height="0.8mm" radius="0.4mm" shape="pill" />
|
|
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
|
-
<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"
|
|
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" ccwRotation={45} 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
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" />
|
|
22
22
|
</footprint>}
|
|
@@ -24,19 +24,12 @@ test("test16 support pcb smtpad shapes", async () => {
|
|
|
24
24
|
/>
|
|
25
25
|
)"
|
|
26
26
|
`)
|
|
27
|
-
expect(tscircuit).toContain(`
|
|
27
|
+
expect(tscircuit).toContain(`ccwRotation={45}`)
|
|
28
28
|
expect(tscircuit).toContain(`shape="rotated_rect"`)
|
|
29
29
|
expect(tscircuit).toContain(`pcbRotation="30deg"`)
|
|
30
30
|
|
|
31
|
-
// The generator emits pcbRotation for consistency, but the current smtpad
|
|
32
|
-
// runtime still expects ccwRotation for rotated_rect pads.
|
|
33
|
-
const executableTscircuit = tscircuit.replace(
|
|
34
|
-
/pcbRotation="(-?\d+(?:\.\d+)?)deg"(?=[^>]*shape="rotated_rect")/g,
|
|
35
|
-
(_, rotation: string) => `ccwRotation={${rotation}}`,
|
|
36
|
-
)
|
|
37
|
-
|
|
38
31
|
const renderedCircuitJson = (await runTscircuitCode(`
|
|
39
|
-
${
|
|
32
|
+
${tscircuit}
|
|
40
33
|
|
|
41
34
|
circuit.add(
|
|
42
35
|
<board width="20mm" height="20mm">
|
|
@@ -56,6 +49,7 @@ circuit.add(
|
|
|
56
49
|
port_hints: ["3"],
|
|
57
50
|
layer: "bottom",
|
|
58
51
|
shape: "rotated_rect",
|
|
52
|
+
ccw_rotation: 45,
|
|
59
53
|
corner_radius: 0.15,
|
|
60
54
|
is_covered_with_solder_mask: true,
|
|
61
55
|
soldermask_margin: 0.04,
|