-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplot_pdf.py
69 lines (56 loc) · 2.1 KB
/
plot_pdf.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
import sys
# from pcbnew import *
import pcbnew
majorVersion = int(pcbnew.Version().split(".")[0])
def generatePdf(plotControl, plotOptions, ):
# Set some important plot options:
plotOptions.SetPlotFrameRef(False)
# plotOptions.SetLineWidth(pcbnew.FromMM(0.35))
plotOptions.SetAutoScale(False)
plotOptions.SetScale(1)
plotOptions.SetMirror(False)
plotOptions.SetUseGerberAttributes(True)
if (majorVersion < 7):
plotOptions.SetExcludeEdgeLayer(False)
plotOptions.SetScale(1)
# plotOptions.SetUseAuxOrigin(True)
plotOptions.SetUseAuxOrigin(False) # drill file and pdf should be the same
# This by gerbers only (also the name is truly horrid!)
plotOptions.SetSubtractMaskFromSilk(False)
#########################
#### CuBottom.gbr ####
#### CuTop.gbr ####
#### EdgeCuts.gbr ####
#### MaskBottom.gbr ####
#### MaskTop.gbr ####
#### PasteBottom.gbr ####
#### PasteTop.gbr ####
#### SilkBottom.gbr ####
#### SilkTop.gbr ####
#########################
if (majorVersion >= 7):
# Plot Bottom
seq = pcbnew.LSEQ()
seq.push_back(pcbnew.Edge_Cuts)
seq.push_back(pcbnew.B_Cu)
plotControl.OpenPlotfile(
"CuBottom", pcbnew.PLOT_FORMAT_PDF, "Bottom layer")
plotControl.PlotLayers(seq)
# Plot Top inverted
seq = pcbnew.LSEQ()
seq.push_back(pcbnew.Edge_Cuts)
seq.push_back(pcbnew.F_Cu)
plotOptions.SetMirror(True)
plotControl.OpenPlotfile("CuTop", pcbnew.PLOT_FORMAT_PDF, "Top layer")
plotControl.PlotLayers(seq)
else:
# plot Bottom
plotControl.SetLayer(pcbnew.B_Cu)
plotControl.OpenPlotfile(
"CuBottom", pcbnew.PLOT_FORMAT_PDF, "Bottom layer")
plotControl.PlotLayer()
# plot Top inverted
plotOptions.SetMirror(True)
plotControl.SetLayer(pcbnew.F_Cu)
plotControl.OpenPlotfile("CuTop", pcbnew.PLOT_FORMAT_PDF, "Top layer")
plotControl.PlotLayer()