Added `output` option to control the file name to all plot output formats.

This commit is contained in:
Salvador E. Tropea 2020-07-12 13:00:38 -03:00
parent e2854ef524
commit 41de8c032c
7 changed files with 42 additions and 11 deletions

View File

@ -7,12 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
### Added
- pdf_pcb_print.output can be used instead of pdf_pcb_print.output_name
- `pdf_pcb_print.output` can be used instead of `pdf_pcb_print.output_name`
- The filters now accept the following aliases (suggested by @leoheck):
- filter_msg -> filter
- error_number -> number
- regexp -> regex
- gerber.gerber_job_file option to control the gerber job file name.
- `filter_msg` -> `filter`
- `error_number` -> `number`
- `regexp` -> `regex`
- `gerber.gerber_job_file` option to control the gerber job file name.
- `output` option to control the file name to all plot output formats.
## [0.5.0] - 2020-07-11
### Changed

View File

@ -308,6 +308,7 @@ Next time you need this list just use an alias, like this:
- `exclude_pads_from_silkscreen`: [boolean=false] do not plot the component pads in the silk screen.
- `force_plot_invisible_refs_vals`: [boolean=false] include references and values even when they are marked as invisible.
- `metric_units`: [boolean=false] use mm instead of inches.
- `output`: [string=''] output file name, the default KiCad name if empty.
- `plot_footprint_refs`: [boolean=true] include the footprint references.
- `plot_footprint_values`: [boolean=true] include the footprint values.
- `plot_sheet_reference`: [boolean=false] currently without effect.
@ -384,6 +385,7 @@ Next time you need this list just use an alias, like this:
- `gerber_job_file`: [string='%f-job.%x'] name for the gerber job file.
- `gerber_precision`: [number=4.6] this the gerber coordinate format, can be 4.5 or 4.6.
- `line_width`: [number=0.1] [0.02,2] line_width for objects without width [mm].
- `output`: [string=''] output file name, the default KiCad name if empty.
- `plot_footprint_refs`: [boolean=true] include the footprint references.
- `plot_footprint_values`: [boolean=true] include the footprint values.
- `plot_sheet_reference`: [boolean=false] currently without effect.
@ -415,6 +417,7 @@ Next time you need this list just use an alias, like this:
- `exclude_pads_from_silkscreen`: [boolean=false] do not plot the component pads in the silk screen.
- `force_plot_invisible_refs_vals`: [boolean=false] include references and values even when they are marked as invisible.
- `mirror_plot`: [boolean=false] plot mirrored.
- `output`: [string=''] output file name, the default KiCad name if empty.
- `pen_number`: [number=1] [1,16] pen number.
- `pen_speed`: [number=20] [1,99] pen speed.
- `pen_width`: [number=15] [0,100] pen diameter in MILS, useful to fill areas. However, it is in mm in HPGL files.
@ -556,10 +559,12 @@ Next time you need this list just use an alias, like this:
- `line_width`: [number=0.1] [0.02,2] for objects without width [mm].
- `mirror_plot`: [boolean=false] plot mirrored.
- `negative_plot`: [boolean=false] invert black and white.
- `output`: [string=''] output file name, the default KiCad name if empty.
- `plot_footprint_refs`: [boolean=true] include the footprint references.
- `plot_footprint_values`: [boolean=true] include the footprint values.
- `plot_sheet_reference`: [boolean=false] currently without effect.
- `tent_vias`: [boolean=true] cover the vias.
- `output`: [string=''] output file name, the default KiCad name if empty.
- `plot_footprint_refs`: [boolean=true] include the footprint references.
- `plot_footprint_values`: [boolean=true] include the footprint values.
- `plot_sheet_reference`: [boolean=false] currently without effect.
@ -637,6 +642,7 @@ Next time you need this list just use an alias, like this:
- `line_width`: [number=0.15] [0.02,2] for objects without width [mm].
- `mirror_plot`: [boolean=false] plot mirrored.
- `negative_plot`: [boolean=false] invert black and white.
- `output`: [string=''] output file name, the default KiCad name if empty.
- `plot_footprint_refs`: [boolean=true] include the footprint references.
- `plot_footprint_values`: [boolean=true] include the footprint values.
- `plot_sheet_reference`: [boolean=false] currently without effect.
@ -691,6 +697,7 @@ Next time you need this list just use an alias, like this:
- `line_width`: [number=0.25] [0.02,2] for objects without width [mm].
- `mirror_plot`: [boolean=false] plot mirrored.
- `negative_plot`: [boolean=false] invert black and white.
- `output`: [string=''] output file name, the default KiCad name if empty.
- `plot_footprint_refs`: [boolean=true] include the footprint references.
- `plot_footprint_values`: [boolean=true] include the footprint values.
- `plot_sheet_reference`: [boolean=false] currently without effect.

View File

@ -36,6 +36,8 @@ outputs:
force_plot_invisible_refs_vals: false
# [boolean=false] use mm instead of inches
metric_units: false
# [string=''] output file name, the default KiCad name if empty
output: ''
# [boolean=true] include the footprint references
plot_footprint_refs: true
# [boolean=true] include the footprint values
@ -122,6 +124,8 @@ outputs:
gerber_precision: 4.6
# [number=0.1] [0.02,2] line_width for objects without width [mm]
line_width: 0.1
# [string=''] output file name, the default KiCad name if empty
output: ''
# [boolean=true] include the footprint references
plot_footprint_refs: true
# [boolean=true] include the footprint values
@ -159,6 +163,8 @@ outputs:
force_plot_invisible_refs_vals: false
# [boolean=false] plot mirrored
mirror_plot: false
# [string=''] output file name, the default KiCad name if empty
output: ''
# [number=1] [1,16] pen number
pen_number: 1
# [number=20] [1,99] pen speed
@ -347,6 +353,8 @@ outputs:
mirror_plot: false
# [boolean=false] invert black and white
negative_plot: false
# [string=''] output file name, the default KiCad name if empty
output: ''
# [boolean=true] include the footprint references
plot_footprint_refs: true
# [boolean=true] include the footprint values
@ -420,6 +428,8 @@ outputs:
mirror_plot: false
# [boolean=false] invert black and white
negative_plot: false
# [string=''] output file name, the default KiCad name if empty
output: ''
# [boolean=true] include the footprint references
plot_footprint_refs: true
# [boolean=true] include the footprint values
@ -484,6 +494,8 @@ outputs:
mirror_plot: false
# [boolean=false] invert black and white
negative_plot: false
# [string=''] output file name, the default KiCad name if empty
output: ''
# [boolean=true] include the footprint references
plot_footprint_refs: true
# [boolean=true] include the footprint values

View File

@ -27,6 +27,8 @@ class AnyLayerOptions(BaseOptions):
""" include the footprint values """
self.force_plot_invisible_refs_vals = False
""" include references and values even when they are marked as invisible """
self.output = ''
""" output file name, the default KiCad name if empty """
self.tent_vias = True
""" cover the vias """ # pragma: no cover
@ -79,11 +81,19 @@ class AnyLayerOptions(BaseOptions):
# Shouldn't happen
raise PlotError("OpenPlotfile failed!") # pragma: no cover
logger.debug("Plotting layer `{}` to `{}`".format(l, plot_ctrl.GetPlotFileName()))
k_filename = plot_ctrl.GetPlotFileName()
if self.output:
filename = self.expand_filename(self.output, suffix, os.path.splitext(k_filename)[1][1:])
filename = os.path.abspath(os.path.join(output_dir, filename))
else:
filename = k_filename
logger.debug("Plotting layer `{}` to `{}`".format(l, filename))
plot_ctrl.PlotLayer()
plot_ctrl.ClosePlot()
if self.output:
os.rename(k_filename, filename)
if create_job:
jobfile_writer.AddGbrFile(id, os.path.basename(plot_ctrl.GetPlotFileName()))
jobfile_writer.AddGbrFile(id, os.path.basename(filename))
if create_job:
job_fn = self.expand_filename(po.gerber_job_file, ext='gbrjob')

View File

@ -41,13 +41,13 @@ def test_gerber_2layer():
ctx.clean_up()
def test_gerber_inner():
def test_gerber_inner_ok():
prj = 'good-project'
ctx = context.TestContext('Gerber_Inner', prj, 'gerber_inner', GERBER_DIR)
ctx.run()
ctx.expect_out_file(ctx.get_gerber_filename('GND_Cu'))
ctx.expect_out_file(ctx.get_gerber_filename('Signal1'))
ctx.expect_out_file(os.path.join(GERBER_DIR, prj+'_GND_Cu.gbr'))
ctx.expect_out_file(os.path.join(GERBER_DIR, prj+'_Signal1.gbr'))
ctx.expect_out_file(os.path.join(GERBER_DIR, 'test-'+prj+'.gbrjob'))
ctx.clean_up()

View File

@ -133,7 +133,7 @@ class TestContext(object):
def expect_out_file(self, filename):
file = self.get_out_path(filename)
assert os.path.isfile(file)
assert os.path.isfile(file), file
assert os.path.getsize(file) > 0
logging.debug(filename+' OK')
return file

View File

@ -28,6 +28,7 @@ outputs:
gerber_job_file: 'test-%f.%x'
use_gerber_x2_attributes: true
use_gerber_net_attributes: false
output: '%f_%i.%x'
layers:
- layer: GND.Cu