Skip to content

Commit

Permalink
Fix silkscreen paths causing extra pins in schematic view
Browse files Browse the repository at this point in the history
Related to tscircuit#308

Add method to prevent silkscreen paths from being interpreted as pins in schematic view.

* **SilkscreenPath.ts**
  - Add `doInitialSchematicComponentRender` method to `SilkscreenPath` class to prevent silkscreen paths from being interpreted as pins in the schematic view.
* **silkscreenpath.test.tsx**
  - Add test case to verify that silkscreen paths are not interpreted as pins in the schematic view.
  • Loading branch information
vishwamartur committed Nov 15, 2024
1 parent a0e8a79 commit f62c5ae
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/components/primitive-components/SilkscreenPath.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,8 @@ export class SilkscreenPath extends PrimitiveComponent<

this.pcb_silkscreen_path_id = pcb_silkscreen_path.pcb_silkscreen_path_id
}

doInitialSchematicComponentRender(): void {
// This method intentionally left blank to prevent silkscreen paths from being interpreted as pins in the schematic view
}
}
24 changes: 24 additions & 0 deletions tests/components/primitive-components/silkscreenpath.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,27 @@ test("SilkscreenPath rendering", () => {

expect(project).toMatchPcbSnapshot(import.meta.path)
})

test("SilkscreenPath not interpreted as pins in schematic view", () => {
const { project } = getTestFixture()

project.add(
<board width="10mm" height="10mm">
<silkscreenpath
route={[
{ x: "0mm", y: "0mm" },
{ x: "5mm", y: "5mm" },
{ x: "10mm", y: "0mm" },
]}
strokeWidth="0.2mm"
layer="top"
/>
</board>,
)

project.render()

const schematicPins = project.db.schematic_pin.list()

expect(schematicPins.length).toBe(0)
})

0 comments on commit f62c5ae

Please sign in to comment.