Add preflight options, but they don't wowork
This commit is contained in:
parent
ac2ceedae2
commit
02f3db1a2d
|
|
@ -2,6 +2,12 @@
|
||||||
kiplot:
|
kiplot:
|
||||||
version: 1
|
version: 1
|
||||||
|
|
||||||
|
preflight:
|
||||||
|
|
||||||
|
# one day....
|
||||||
|
check_zone_fills: false
|
||||||
|
run_drc: false
|
||||||
|
|
||||||
outputs:
|
outputs:
|
||||||
|
|
||||||
- name: 'gerbers'
|
- name: 'gerbers'
|
||||||
|
|
|
||||||
|
|
@ -437,6 +437,16 @@ class CfgYamlReader(CfgReader):
|
||||||
|
|
||||||
return o_cfg
|
return o_cfg
|
||||||
|
|
||||||
|
def _parse_preflight(self, pf, cfg):
|
||||||
|
|
||||||
|
logging.debug("Parsing preflight options: {}".format(pf))
|
||||||
|
|
||||||
|
if 'check_zone_fills' in pf:
|
||||||
|
cfg.check_zone_fills = pf['check_zone_fills']
|
||||||
|
|
||||||
|
if 'run_drc' in pf:
|
||||||
|
cfg.run_drc = pf['run_drc']
|
||||||
|
|
||||||
def read(self, fstream):
|
def read(self, fstream):
|
||||||
"""
|
"""
|
||||||
Read a file object into a config object
|
Read a file object into a config object
|
||||||
|
|
@ -452,13 +462,11 @@ class CfgYamlReader(CfgReader):
|
||||||
|
|
||||||
self._check_version(data)
|
self._check_version(data)
|
||||||
|
|
||||||
try:
|
|
||||||
outdir = data['options']['basedir']
|
|
||||||
except KeyError:
|
|
||||||
outdir = ""
|
|
||||||
|
|
||||||
cfg = PC.PlotConfig()
|
cfg = PC.PlotConfig()
|
||||||
|
|
||||||
|
if 'preflight' in data:
|
||||||
|
self._parse_preflight(data['preflight'], cfg)
|
||||||
|
|
||||||
for o in data['outputs']:
|
for o in data['outputs']:
|
||||||
|
|
||||||
op_cfg = self._parse_output(o)
|
op_cfg = self._parse_output(o)
|
||||||
|
|
|
||||||
|
|
@ -29,12 +29,15 @@ class Plotter(object):
|
||||||
self.cfg = cfg
|
self.cfg = cfg
|
||||||
|
|
||||||
def plot(self, brd_file):
|
def plot(self, brd_file):
|
||||||
|
|
||||||
logging.debug("Starting plot of board {}".format(brd_file))
|
logging.debug("Starting plot of board {}".format(brd_file))
|
||||||
|
|
||||||
board = pcbnew.LoadBoard(brd_file)
|
board = pcbnew.LoadBoard(brd_file)
|
||||||
|
|
||||||
logging.debug("Board loaded")
|
logging.debug("Board loaded")
|
||||||
|
|
||||||
|
self._preflight_checks(board)
|
||||||
|
|
||||||
for op in self.cfg.outputs:
|
for op in self.cfg.outputs:
|
||||||
|
|
||||||
logging.debug("Processing output: {}".format(op.name))
|
logging.debug("Processing output: {}".format(op.name))
|
||||||
|
|
@ -54,6 +57,16 @@ class Plotter(object):
|
||||||
|
|
||||||
pc.ClosePlot()
|
pc.ClosePlot()
|
||||||
|
|
||||||
|
def _preflight_checks(self, board):
|
||||||
|
|
||||||
|
logging.debug("Preflight checks")
|
||||||
|
|
||||||
|
if self.cfg.check_zone_fills:
|
||||||
|
raise PlotError("Not sure if Python scripts can do zone check!")
|
||||||
|
|
||||||
|
if self.cfg.run_drc:
|
||||||
|
raise PlotError("Not sure if Python scripts can run DRC!")
|
||||||
|
|
||||||
def _output_is_layer(self, output):
|
def _output_is_layer(self, output):
|
||||||
|
|
||||||
return output.options.type in [
|
return output.options.type in [
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,6 @@ class LayerOptions(TypeOptions):
|
||||||
"""
|
"""
|
||||||
if self._supports_line_width:
|
if self._supports_line_width:
|
||||||
self._line_width = pcbnew.FromMM(value)
|
self._line_width = pcbnew.FromMM(value)
|
||||||
print("Set LW %d" % self._line_width)
|
|
||||||
else:
|
else:
|
||||||
raise KiPlotConfigurationError(
|
raise KiPlotConfigurationError(
|
||||||
"This output doesn't support setting line width")
|
"This output doesn't support setting line width")
|
||||||
|
|
@ -441,6 +440,9 @@ class PlotConfig(object):
|
||||||
self._outputs = []
|
self._outputs = []
|
||||||
self.outdir = None
|
self.outdir = None
|
||||||
|
|
||||||
|
self.check_zone_fills = False
|
||||||
|
self.run_drc = False
|
||||||
|
|
||||||
def add_output(self, new_op):
|
def add_output(self, new_op):
|
||||||
self._outputs.append(new_op)
|
self._outputs.append(new_op)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue