[PCB Print] Added option to move the page number to the extension
- page_number_as_extension - Can be used to easily create custom output names Related to #283
This commit is contained in:
parent
9cd284a9c0
commit
ba5164ffa4
|
|
@ -29,6 +29,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
- PCB Print:
|
- PCB Print:
|
||||||
- Option to configure the forced edge color. (#281)
|
- Option to configure the forced edge color. (#281)
|
||||||
- Option to control the resolution (DPI). (See #259)
|
- Option to control the resolution (DPI). (See #259)
|
||||||
|
- Option to move the page number to the extension (page_number_as_extension)
|
||||||
|
(See #283)
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
- OAR computation (Report) (#225)
|
- OAR computation (Report) (#225)
|
||||||
|
|
|
||||||
|
|
@ -2187,7 +2187,8 @@ Notes:
|
||||||
- **`force_edge_cuts`**: [boolean=false] Add the `Edge.Cuts` to all the pages.
|
- **`force_edge_cuts`**: [boolean=false] Add the `Edge.Cuts` to all the pages.
|
||||||
- **`format`**: [string='PDF'] [PDF,SVG,PNG,EPS,PS] Format for the output file/s.
|
- **`format`**: [string='PDF'] [PDF,SVG,PNG,EPS,PS] Format for the output file/s.
|
||||||
Note that for PS you need `ghostscript` which isn't part of the default docker images.
|
Note that for PS you need `ghostscript` which isn't part of the default docker images.
|
||||||
- **`output`**: [string='%f-%i%I%v.%x'] Filename for the output (%i=assembly, %x=pdf/ps)/(%i=assembly_page_NN, %x=svg/png/eps). Affected by global options.
|
- **`output`**: [string='%f-%i%I%v.%x'] Filename for the output (%i=assembly, %x=pdf/ps)/(%i=assembly_page_NN, %x=svg/png/eps).
|
||||||
|
Consult the `page_number_as_extension`. Affected by global options.
|
||||||
- *output_name*: Alias for output.
|
- *output_name*: Alias for output.
|
||||||
- **`pages`**: [list(dict)] List of pages to include in the output document.
|
- **`pages`**: [list(dict)] List of pages to include in the output document.
|
||||||
Each page contains one or more layers of the PCB.
|
Each page contains one or more layers of the PCB.
|
||||||
|
|
@ -2242,6 +2243,7 @@ Notes:
|
||||||
- `keep_temporal_files`: [boolean=false] Store the temporal page and layer files in the output dir and don't delete them.
|
- `keep_temporal_files`: [boolean=false] Store the temporal page and layer files in the output dir and don't delete them.
|
||||||
- `micro_via_color`: [string=''] Color used for micro `colored_vias`.
|
- `micro_via_color`: [string=''] Color used for micro `colored_vias`.
|
||||||
- `pad_color`: [string=''] Color used for `colored_pads`.
|
- `pad_color`: [string=''] Color used for `colored_pads`.
|
||||||
|
- `page_number_as_extension`: [boolean=false] When enabled the %i is always `assembly`, the %x will be NN.FORMAT (i.e. 01.png).
|
||||||
- `png_width`: [number=1280] [0,7680] Width of the PNG in pixels. Use 0 to use as many pixels as the DPI needs for the page size.
|
- `png_width`: [number=1280] [0,7680] Width of the PNG in pixels. Use 0 to use as many pixels as the DPI needs for the page size.
|
||||||
- `realistic_solder_mask`: [boolean=true] Try to draw the solder mask as a real solder mask, not the negative used for fabrication.
|
- `realistic_solder_mask`: [boolean=true] Try to draw the solder mask as a real solder mask, not the negative used for fabrication.
|
||||||
In order to get a good looking select a color with transparency, i.e. '#14332440'.
|
In order to get a good looking select a color with transparency, i.e. '#14332440'.
|
||||||
|
|
|
||||||
|
|
@ -1114,11 +1114,14 @@ outputs:
|
||||||
keep_temporal_files: false
|
keep_temporal_files: false
|
||||||
# [string=''] Color used for micro `colored_vias`
|
# [string=''] Color used for micro `colored_vias`
|
||||||
micro_via_color: ''
|
micro_via_color: ''
|
||||||
# [string='%f-%i%I%v.%x'] Filename for the output (%i=assembly, %x=pdf/ps)/(%i=assembly_page_NN, %x=svg/png/eps). Affected by global options
|
# [string='%f-%i%I%v.%x'] Filename for the output (%i=assembly, %x=pdf/ps)/(%i=assembly_page_NN, %x=svg/png/eps).
|
||||||
|
# Consult the `page_number_as_extension`. Affected by global options
|
||||||
output: '%f-%i%I%v.%x'
|
output: '%f-%i%I%v.%x'
|
||||||
# `output_name` is an alias for `output`
|
# `output_name` is an alias for `output`
|
||||||
# [string=''] Color used for `colored_pads`
|
# [string=''] Color used for `colored_pads`
|
||||||
pad_color: ''
|
pad_color: ''
|
||||||
|
# [boolean=false] When enabled the %i is always `assembly`, the %x will be NN.FORMAT (i.e. 01.png)
|
||||||
|
page_number_as_extension: false
|
||||||
# [list(dict)] List of pages to include in the output document.
|
# [list(dict)] List of pages to include in the output document.
|
||||||
# Each page contains one or more layers of the PCB
|
# Each page contains one or more layers of the PCB
|
||||||
pages:
|
pages:
|
||||||
|
|
|
||||||
|
|
@ -220,7 +220,10 @@ class PCB_PrintOptions(VariantOptions):
|
||||||
self.output_name = None
|
self.output_name = None
|
||||||
""" {output} """
|
""" {output} """
|
||||||
self.output = GS.def_global_output
|
self.output = GS.def_global_output
|
||||||
""" *Filename for the output (%i=assembly, %x=pdf/ps)/(%i=assembly_page_NN, %x=svg/png/eps)"""
|
""" *Filename for the output (%i=assembly, %x=pdf/ps)/(%i=assembly_page_NN, %x=svg/png/eps).
|
||||||
|
Consult the `page_number_as_extension` """
|
||||||
|
self.page_number_as_extension = False
|
||||||
|
""" When enabled the %i is always `assembly`, the %x will be NN.FORMAT (i.e. 01.png) """
|
||||||
self.hide_excluded = False
|
self.hide_excluded = False
|
||||||
""" Hide components in the Fab layer that are marked as excluded by a variant """
|
""" Hide components in the Fab layer that are marked as excluded by a variant """
|
||||||
self.color_theme = '_builtin_classic'
|
self.color_theme = '_builtin_classic'
|
||||||
|
|
@ -348,12 +351,18 @@ class PCB_PrintOptions(VariantOptions):
|
||||||
if self.hide_excluded:
|
if self.hide_excluded:
|
||||||
self.restore_fab(GS.board, comps_hash)
|
self.restore_fab(GS.board, comps_hash)
|
||||||
|
|
||||||
|
def get_id_and_ext(self, n=None):
|
||||||
|
pn_str = '%02d' % (n+1) if n is not None else '%02d'
|
||||||
|
if self.page_number_as_extension:
|
||||||
|
return self._expand_id, pn_str+'.'+self._expand_ext
|
||||||
|
return self._expand_id+'_page_'+pn_str, self._expand_ext
|
||||||
|
|
||||||
def get_targets(self, out_dir):
|
def get_targets(self, out_dir):
|
||||||
if self.format in ['SVG', 'PNG', 'EPS']:
|
if self.format in ['SVG', 'PNG', 'EPS']:
|
||||||
files = []
|
files = []
|
||||||
for n in range(len(self.pages)):
|
for n in range(len(self.pages)):
|
||||||
id = self._expand_id+('_page_%02d' % (n+1))
|
id, ext = self.get_id_and_ext(n)
|
||||||
files.append(self.expand_filename(out_dir, self.output, id, self._expand_ext))
|
files.append(self.expand_filename(out_dir, self.output, id, ext))
|
||||||
return files
|
return files
|
||||||
return [self._parent.expand_filename(out_dir, self.output)]
|
return [self._parent.expand_filename(out_dir, self.output)]
|
||||||
|
|
||||||
|
|
@ -1016,8 +1025,8 @@ class PCB_PrintOptions(VariantOptions):
|
||||||
filelist.append((GS.pcb_basename+"-frame.svg", color))
|
filelist.append((GS.pcb_basename+"-frame.svg", color))
|
||||||
# 3) Stack all layers in one file
|
# 3) Stack all layers in one file
|
||||||
if self.format == 'SVG':
|
if self.format == 'SVG':
|
||||||
id = self._expand_id+('_page_'+page_str)
|
id, ext = self.get_id_and_ext(n)
|
||||||
assembly_file = self.expand_filename(output_dir, self.output, id, self._expand_ext)
|
assembly_file = self.expand_filename(output_dir, self.output, id, ext)
|
||||||
else:
|
else:
|
||||||
assembly_file = GS.pcb_basename+".svg"
|
assembly_file = GS.pcb_basename+".svg"
|
||||||
logger.debug('- Merging layers to {}'.format(assembly_file))
|
logger.debug('- Merging layers to {}'.format(assembly_file))
|
||||||
|
|
@ -1039,8 +1048,8 @@ class PCB_PrintOptions(VariantOptions):
|
||||||
# Use GS to create one PS
|
# Use GS to create one PS
|
||||||
self.pdf_to_ps(pdf_file, output)
|
self.pdf_to_ps(pdf_file, output)
|
||||||
else: # EPS and PNG
|
else: # EPS and PNG
|
||||||
id = self._expand_id+('_page_%02d')
|
id, ext = self.get_id_and_ext()
|
||||||
out_file = self.expand_filename(output_dir, self.output, id, self._expand_ext, make_safe=False)
|
out_file = self.expand_filename(output_dir, self.output, id, ext, make_safe=False)
|
||||||
if self.format == 'EPS':
|
if self.format == 'EPS':
|
||||||
# Use GS to create one EPS per page
|
# Use GS to create one EPS per page
|
||||||
self.pdf_to_eps(pdf_file, out_file)
|
self.pdf_to_eps(pdf_file, out_file)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue