-
Notifications
You must be signed in to change notification settings - Fork 23
/
__init__.py
36 lines (25 loc) · 1.02 KB
/
__init__.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import pcbnew
import os
from .pcbnew2boardview import convert_brd, convert_bvr
class Pcbnew2Boardview_BRD(pcbnew.ActionPlugin):
def defaults(self):
self.name = "Pcbnew to Boardview (BRD)"
self.category = "Read PCB"
self.description = "Generate Boardview file from KiCad PCB."
def Run(self):
kicad_pcb = pcbnew.GetBoard()
with open(kicad_pcb.GetFileName().replace('.kicad_pcb', '.brd'), 'w') as brd_file:
convert_brd(kicad_pcb, brd_file)
class Pcbnew2Boardview_BVR(pcbnew.ActionPlugin):
def defaults(self):
self.name = "Pcbnew to Boardview (BVR)"
self.category = "Read PCB"
self.description = "Generate Boardview file from KiCad PCB."
def Run(self):
kicad_pcb = pcbnew.GetBoard()
with open(kicad_pcb.GetFileName().replace('.kicad_pcb', '.bvr'), 'w') as bvr_file:
convert_bvr(kicad_pcb, bvr_file)
plugin_brd = Pcbnew2Boardview_BRD()
plugin_brd.register()
plugin_bvr = Pcbnew2Boardview_BVR()
plugin_bvr.register()