Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,38 @@ _KiCad to Boardview exporter_ uses the [pcbnew plugin interface][pcbplugin]. It

[pcbplugin]: https://dev-docs.kicad.org/en/apis-and-binding/pcbnew/

## Usage
## Usage CLI

Run the exporter as follows:

./pcbnew2boardview.py example/example.kicad_pcb example/example.brd

This will read the PCB layout from `example/example.kicad_pcb` and write it to `example/example.brd`.

### Installation

1. Download or clone this repository.
2. Copy the plugin folder into your KiCad plugins directory:

```
Documents/KiCad/9.0/scripting/plugins
```

3. Restart KiCad.

### Usage

1. Open your PCB in KiCad.
2. Navigate to:

```
PCB Editor → Tools → External Plugins → Export Boardview
```

3. The plugin will generate a `.brd` boardview file next to your `.kicad_pcb` file.

---

## Examples

The _Boardview_ file for [Glasgow][] visualized with OpenBoardView looks like this, with the I2C SDA net selected:
Expand Down
51 changes: 0 additions & 51 deletions __init__.py

This file was deleted.

3 changes: 0 additions & 3 deletions __main__.py

This file was deleted.

15 changes: 15 additions & 0 deletions metadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "Boardview Exporter",
"description": "Export KiCad PCB files to OpenBoardView BRD format",
"version": "1.0.0",
"author": "Catherine",
"license": "MIT",
"homepage": "https://github.com/whitequark/kicad-boardview",
"kicad_version": "9.0",
"tags": [
"boardview",
"repair",
"export",
"openboardview"
]
}
1 change: 1 addition & 0 deletions plugin/kicad_boardview_plugin/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .boardview_plugin import BoardviewExporter
43 changes: 43 additions & 0 deletions plugin/kicad_boardview_plugin/boardview_plugin.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import pcbnew
import os
import subprocess
import wx
from pcbnew import ActionPlugin


class BoardviewExporter(ActionPlugin):

def defaults(self):
self.name = "Export Boardview"
self.category = "Manufacturing"
self.description = "Export KiCad PCB to Boardview (.brd)"
self.show_toolbar_button = True
self.icon_file_name = os.path.join(os.path.dirname(__file__), "icon.png")

def Run(self):

board = pcbnew.GetBoard()

pcb_file = board.GetFileName()

base = os.path.splitext(pcb_file)[0]

output = base + ".brd"

plugin_dir = os.path.dirname(__file__)

script = os.path.join(plugin_dir, "pcbnew2boardview.py")

subprocess.run(
["python", script, pcb_file, output],
check=True
)

wx.MessageBox(
"Boardview exported:\n" + output,
"Boardview Export",
wx.OK | wx.ICON_INFORMATION
)


BoardviewExporter().register()
20 changes: 20 additions & 0 deletions plugin/kicad_boardview_plugin/exporter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
def export_boardview(board, output_file):

footprints = board.GetFootprints()

with open(output_file, "w") as f:
for footprint in footprints:

ref = footprint.GetReference()

for pad in footprint.Pads():

pad_name = pad.GetName()
pos = pad.GetPosition()

x = pos.x / 1000000
y = pos.y / 1000000

net = pad.GetNetname()

f.write(f"{ref} {pad_name} {x} {y} {net}\n")
Binary file added plugin/kicad_boardview_plugin/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.