forked from Dollarhyde/AntennaCalculator
-
Notifications
You must be signed in to change notification settings - Fork 1
/
gerber_generator.py
24 lines (19 loc) · 928 Bytes
/
gerber_generator.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
#! /usr/bin/python3
import gerberex # pip install pcb-tools-extension
class GerberGenerator:
def __init__(self, args):
self.args = args
def generate_gerber(self, filename):
# Generate the top layer gerber file
tl_dxf = gerberex.read(filename.split(".")[0] + '_top.dxf')
tl_ctx = gerberex.GerberComposition()
tl_dxf.draw_mode = tl_dxf.DM_FILL
tl_ctx.merge(tl_dxf)
tl_ctx.dump(filename.split(".")[0] + '_top.gtl')
print("[*] Top layer gerber file generated: " + filename.split(".")[0] + "_top.gtl")
# Generate the substrate gerber file
s_dxf = gerberex.read(filename.split(".")[0] + '_substrate.dxf')
s_ctx = gerberex.GerberComposition()
s_ctx.merge(s_dxf)
s_ctx.dump(filename.split(".")[0] + '_substrate.gml')
print("[*] Substrate gerber file generated: " + filename.split(".")[0] + "_substrate.gml")