Skip to content

Commit

Permalink
Merge pull request #139 from tscircuit/feat/schematic
Browse files Browse the repository at this point in the history
fix: Chip placement
  • Loading branch information
imrishabh18 authored Oct 6, 2024
2 parents 0a92424 + 7d7a135 commit b6222b5
Show file tree
Hide file tree
Showing 9 changed files with 234 additions and 197 deletions.
370 changes: 199 additions & 171 deletions lib/utils/schematic/getAllDimensionsForSchematicBox.ts

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
39 changes: 24 additions & 15 deletions tests/examples/example4-kicad.test.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { it, expect } from "bun:test"
import { getTestFixture } from "tests/fixtures/get-test-fixture"
import { expect, it } from "bun:test";
import { getTestFixture } from "tests/fixtures/get-test-fixture";

it("example 4: kicad theme demo", async () => {
const { project, logSoup } = getTestFixture()
const { project, logSoup } = getTestFixture();

project.add(
<board width="10mm" height="10mm">
Expand All @@ -14,7 +14,13 @@ it("example 4: kicad theme demo", async () => {
schX={-2}
/>

<capacitor capacitance={"10uF"} name="C1" footprint="0402" pcbX={2} schX={2} />
<capacitor
capacitance={"10uF"}
name="C1"
footprint="0402"
pcbX={2}
schX={2}
/>
<trace from=".R1 > .pin2" to=".C1 > .anode" />

<chip
Expand All @@ -24,11 +30,13 @@ it("example 4: kicad theme demo", async () => {
schWidth={3}
schHeight={7}
pinLabels={{
pin7: "GND",
pin8: "-V+"
pin7: "GND",
pin8: "-V+",
}}
schPinStyle={{
pin29: { bottomMargin: 0.5 },
pin22: { topMargin: 0.8 },
pin12: { bottomMargin: 0.5 },
pin15: { topMargin: 0.8 },
}}
schPortArrangement={{
leftSide: {
Expand All @@ -43,15 +51,16 @@ it("example 4: kicad theme demo", async () => {
direction: "bottom-to-top",
pins: [12, 13, 14, 15, 16, 17, 23],
},
bottomSide: {
direction: "left-to-right",
pins: [2, 3],
},
}}
/>
</board>,
)
const fs = require('node:fs');
const circuitJson = project.getCircuitJson();
fs.writeFileSync('circuit.json', JSON.stringify(circuitJson, null, 2));
</board>
);

project.render()
project.render();

expect(project).toMatchSchematicSnapshot(import.meta.path)
})
expect(project).toMatchSchematicSnapshot(import.meta.path);
});
Loading

0 comments on commit b6222b5

Please sign in to comment.