[PCB Print][Added] Options to fine tune the centering
- You can select which layers are used for centering purposes Closes #573
This commit is contained in:
parent
83d502422a
commit
b88e09c448
|
|
@ -84,6 +84,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
- Support for CURRENT_DATE text variable
|
||||
- Options to mirror the text in the user layers when creating a mirrored page
|
||||
(#561)
|
||||
- Options to select which layers are used for centering purposes (#573)
|
||||
- Populate:
|
||||
- Basic support for regular list items (#480)
|
||||
- Position:
|
||||
|
|
|
|||
|
|
@ -2342,6 +2342,9 @@ outputs:
|
|||
force_edge_cuts: false
|
||||
# [string=''] Color used for the `force_edge_cuts` option
|
||||
forced_edge_cuts_color: ''
|
||||
# [boolean=true] Used when enabling the `force_edge_cuts`, in this case this is the `use_for_center` option of the forced
|
||||
# layer
|
||||
forced_edge_cuts_use_for_center: true
|
||||
# [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
|
||||
format: 'PDF'
|
||||
|
|
@ -2360,6 +2363,10 @@ outputs:
|
|||
# [boolean=true] Tell KiCad to apply the scaling for each page as a separated entity.
|
||||
# Disabling it the pages are coherent and can be superposed
|
||||
individual_page_scaling: true
|
||||
# [boolean=false] Invert the meaning of the `use_for_center` layer option.
|
||||
# This can be used to just select the edge cuts for centering, in this case enable this option
|
||||
# and disable the `use_for_center` option of the edge cuts layer
|
||||
invert_use_for_center: false
|
||||
# [boolean=false] Store the temporal page and layer files in the output dir and don't delete them
|
||||
keep_temporal_files: false
|
||||
# [string=''] Color used for micro `colored_vias`
|
||||
|
|
@ -2407,6 +2414,9 @@ outputs:
|
|||
# [string=''] Suffix used in file names related to this layer. Derived from the name if not specified.
|
||||
# A default can be specified using the `layer_defaults` global option
|
||||
suffix: ''
|
||||
# [boolean=true] Use this layer for centering purposes.
|
||||
# You can invert the meaning using the `invert_use_for_center` option
|
||||
use_for_center: true
|
||||
# [number=0.1] [0.02,2] For objects without width [mm] (KiCad 5)
|
||||
line_width: 0.1
|
||||
# [boolean=false] Print mirrored (X axis inverted)
|
||||
|
|
@ -2449,6 +2459,9 @@ outputs:
|
|||
# [string=''] Suffix used in file names related to this layer. Derived from the name if not specified.
|
||||
# A default can be specified using the `layer_defaults` global option
|
||||
suffix: ''
|
||||
# [boolean=true] Use this layer for centering purposes.
|
||||
# You can invert the meaning using the `invert_use_for_center` option
|
||||
use_for_center: true
|
||||
# [number=1.0] Scale factor (0 means autoscaling)
|
||||
scaling: 1.0
|
||||
# [string='Assembly'] Text to use for the `sheet` in the title block.
|
||||
|
|
|
|||
|
|
@ -55,6 +55,8 @@ Parameters:
|
|||
- ``plot_footprint_values`` :index:`: <pair: output - pcb_print - options - pages - layers; plot_footprint_values>` [boolean=true] Include the footprint values.
|
||||
- ``suffix`` :index:`: <pair: output - pcb_print - options - pages - layers; suffix>` [string=''] Suffix used in file names related to this layer. Derived from the name if not specified.
|
||||
A default can be specified using the `layer_defaults` global option.
|
||||
- ``use_for_center`` :index:`: <pair: output - pcb_print - options - pages - layers; use_for_center>` [boolean=true] Use this layer for centering purposes.
|
||||
You can invert the meaning using the `invert_use_for_center` option.
|
||||
|
||||
- **scaling** :index:`: <pair: output - pcb_print - options - pages; scaling>` [number=1.0] Scale factor (0 means autoscaling).
|
||||
- **sort_layers** :index:`: <pair: output - pcb_print - options - pages; sort_layers>` [boolean=false] Try to sort the layers in the same order that uses KiCad for printing.
|
||||
|
|
@ -91,6 +93,8 @@ Parameters:
|
|||
- ``plot_footprint_values`` :index:`: <pair: output - pcb_print - options - pages - repeat_layers; plot_footprint_values>` [boolean=true] Include the footprint values.
|
||||
- ``suffix`` :index:`: <pair: output - pcb_print - options - pages - repeat_layers; suffix>` [string=''] Suffix used in file names related to this layer. Derived from the name if not specified.
|
||||
A default can be specified using the `layer_defaults` global option.
|
||||
- ``use_for_center`` :index:`: <pair: output - pcb_print - options - pages - repeat_layers; use_for_center>` [boolean=true] Use this layer for centering purposes.
|
||||
You can invert the meaning using the `invert_use_for_center` option.
|
||||
|
||||
- ``sheet`` :index:`: <pair: output - pcb_print - options - pages; sheet>` [string='Assembly'] Text to use for the `sheet` in the title block.
|
||||
Pattern (%*) and text variables are expanded.
|
||||
|
|
@ -121,6 +125,8 @@ Parameters:
|
|||
like the the solder mask are handled as images by the conversion tools.
|
||||
- ``drill_marks`` :index:`: <pair: output - pcb_print - options; drill_marks>` [string='full'] [none,small,full] What to use to indicate the drill places, can be none, small or full (for real scale).
|
||||
- ``forced_edge_cuts_color`` :index:`: <pair: output - pcb_print - options; forced_edge_cuts_color>` [string=''] Color used for the `force_edge_cuts` option.
|
||||
- ``forced_edge_cuts_use_for_center`` :index:`: <pair: output - pcb_print - options; forced_edge_cuts_use_for_center>` [boolean=true] Used when enabling the `force_edge_cuts`, in this case this is the `use_for_center` option of the forced
|
||||
layer.
|
||||
- ``frame_plot_mechanism`` :index:`: <pair: output - pcb_print - options; frame_plot_mechanism>` [string='internal'] [gui,internal,plot] Plotting the frame from Python is problematic.
|
||||
This option selects a workaround strategy.
|
||||
gui: uses KiCad GUI to do it. Is slow but you get the correct frame.
|
||||
|
|
@ -133,6 +139,9 @@ Parameters:
|
|||
Affected by global options.
|
||||
- ``individual_page_scaling`` :index:`: <pair: output - pcb_print - options; individual_page_scaling>` [boolean=true] Tell KiCad to apply the scaling for each page as a separated entity.
|
||||
Disabling it the pages are coherent and can be superposed.
|
||||
- ``invert_use_for_center`` :index:`: <pair: output - pcb_print - options; invert_use_for_center>` [boolean=false] Invert the meaning of the `use_for_center` layer option.
|
||||
This can be used to just select the edge cuts for centering, in this case enable this option
|
||||
and disable the `use_for_center` option of the edge cuts layer.
|
||||
- ``keep_temporal_files`` :index:`: <pair: output - pcb_print - options; keep_temporal_files>` [boolean=false] Store the temporal page and layer files in the output dir and don't delete them.
|
||||
- ``micro_via_color`` :index:`: <pair: output - pcb_print - options; micro_via_color>` [string=''] Color used for micro `colored_vias`.
|
||||
- ``pad_color`` :index:`: <pair: output - pcb_print - options; pad_color>` [string=''] Color used for `colored_pads`.
|
||||
|
|
|
|||
|
|
@ -135,6 +135,9 @@ class LayerOptions(Layer):
|
|||
""" Include the footprint values """
|
||||
self.force_plot_invisible_refs_vals = False
|
||||
""" Include references and values even when they are marked as invisible """
|
||||
self.use_for_center = True
|
||||
""" Use this layer for centering purposes.
|
||||
You can invert the meaning using the `invert_use_for_center` option """
|
||||
|
||||
def config(self, parent):
|
||||
super().config(parent)
|
||||
|
|
@ -327,6 +330,9 @@ class PCB_PrintOptions(VariantOptions):
|
|||
""" Store the temporal page and layer files in the output dir and don't delete them """
|
||||
self.force_edge_cuts = False
|
||||
""" *Add the `Edge.Cuts` to all the pages """
|
||||
self.forced_edge_cuts_use_for_center = True
|
||||
""" Used when enabling the `force_edge_cuts`, in this case this is the `use_for_center` option of the forced
|
||||
layer """
|
||||
self.forced_edge_cuts_color = ''
|
||||
""" Color used for the `force_edge_cuts` option """
|
||||
self.scaling = 1.0
|
||||
|
|
@ -352,6 +358,10 @@ class PCB_PrintOptions(VariantOptions):
|
|||
""" [0,6] Scale factor used to represent 1 mm in the SVG (KiCad 6).
|
||||
The value is how much zeros has the multiplier (1 mm = 10 power `svg_precision` units).
|
||||
Note that for an A4 paper Firefox 91 and Chrome 105 can't handle more than 5 """
|
||||
self.invert_use_for_center = False
|
||||
""" Invert the meaning of the `use_for_center` layer option.
|
||||
This can be used to just select the edge cuts for centering, in this case enable this option
|
||||
and disable the `use_for_center` option of the edge cuts layer """
|
||||
add_drill_marks(self)
|
||||
super().__init__()
|
||||
self._expand_id = 'assembly'
|
||||
|
|
@ -1164,8 +1174,9 @@ class PCB_PrintOptions(VariantOptions):
|
|||
vis_layers = LSET()
|
||||
for p in self.pages:
|
||||
for la in p.layers:
|
||||
vis_layers.addLayer(la._id)
|
||||
if self.force_edge_cuts:
|
||||
if la.use_for_center ^ self.invert_use_for_center:
|
||||
vis_layers.addLayer(la._id)
|
||||
if self.force_edge_cuts and (self.forced_edge_cuts_use_for_center ^ self.invert_use_for_center):
|
||||
vis_layers.addLayer(edge_id)
|
||||
GS.board.SetVisibleLayers(vis_layers)
|
||||
# Generate the output, page by page
|
||||
|
|
@ -1176,8 +1187,9 @@ class PCB_PrintOptions(VariantOptions):
|
|||
if self.individual_page_scaling:
|
||||
vis_layers = LSET()
|
||||
for la in p.layers:
|
||||
vis_layers.addLayer(la._id)
|
||||
if self.force_edge_cuts:
|
||||
if la.use_for_center ^ self.invert_use_for_center:
|
||||
vis_layers.addLayer(la._id)
|
||||
if self.force_edge_cuts and (self.forced_edge_cuts_use_for_center ^ self.invert_use_for_center):
|
||||
vis_layers.addLayer(edge_id)
|
||||
GS.board.SetVisibleLayers(vis_layers)
|
||||
needs_ki7_scale_workaround = p.scaling != 1.0 and self.check_ki7_scale_issue()
|
||||
|
|
|
|||
Loading…
Reference in New Issue