diff --git a/README.md b/README.md index 6c0afb0..87fcf03 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,7 @@ Options can be set in the dialog that appears when the plugin is invoked. They a ☑ __Additional layers__: Comma-separated list of additional layers to include in the gerber archive.
☑ __Set User.1 as V-Cut layer__: Merge User.1 layer with the Edge-Cut layer in production.
+☑ __Use User.2 for an alternative Edge-Cut layer__: Use the User.2 instead of the Edge-Cut layer for the board outline in production. This is useful if you need process edges or panelization during production but still want to keep the individual outline for prototyping, 3D model exports, or similar purposes.
☑ __Apply automatic translations__: Apply known translation fixes for common components.
☑ __Apply automatic fill for all zones__: Refill all zones before generation production files.
☑ __Exclude DNP components from BOM__: Exclude components the had been set a DNP from th BOM.
@@ -138,14 +139,14 @@ Some footprints may have their components defined on the opposite layer to there Values can be `top`, `bottom`, `t` or `b`. #### Primary Fields*: - | 'JLCPCB Layer Override' | - | --- | +| 'JLCPCB Layer Override' | +| --- | _The fields will be queried in the order denoted above._ #### Fallback Fields*: - | 'JlcLayerOverride' | 'JLCLayerOverride' | - | --- | --- | +| 'JlcLayerOverride' | 'JLCLayerOverride' | +| --- | --- | _The fields will be queried in the order denoted above._ diff --git a/plugins/options.py b/plugins/options.py index d1a95b1..a2d91c4 100644 --- a/plugins/options.py +++ b/plugins/options.py @@ -3,4 +3,5 @@ EXCLUDE_DNP_OPT = "EXCLUDE DNP" OUTPUT_NAME_OPT = "OUTPUT NAME" EXTEND_EDGE_CUT_OPT = "EXTEND_EDGE_CUT" +ALTERNATIVE_EDGE_CUT_OPT = "ALTERNATIVE_EDGE_CUT" EXTRA_LAYERS = "EXTRA_LAYERS" \ No newline at end of file diff --git a/plugins/plugin.py b/plugins/plugin.py index 932b84a..911a8ff 100644 --- a/plugins/plugin.py +++ b/plugins/plugin.py @@ -4,7 +4,7 @@ from .thread import ProcessThread from .events import StatusEvent -from .options import AUTO_FILL_OPT, AUTO_TRANSLATE_OPT, EXCLUDE_DNP_OPT, EXTEND_EDGE_CUT_OPT, EXTRA_LAYERS +from .options import AUTO_FILL_OPT, AUTO_TRANSLATE_OPT, EXCLUDE_DNP_OPT, EXTEND_EDGE_CUT_OPT, ALTERNATIVE_EDGE_CUT_OPT, EXTRA_LAYERS from .utils import load_user_options, save_user_options, get_layer_names @@ -30,6 +30,7 @@ def __init__(self): userOptions = load_user_options({ EXTRA_LAYERS: "", EXTEND_EDGE_CUT_OPT: False, + ALTERNATIVE_EDGE_CUT_OPT: False, AUTO_TRANSLATE_OPT: True, AUTO_FILL_OPT: True, EXCLUDE_DNP_OPT: False @@ -47,6 +48,8 @@ def __init__(self): self.mExtendEdgeCutsCheckbox = wx.CheckBox(self, label='Set User.1 as V-Cut layer') self.mExtendEdgeCutsCheckbox.SetValue(userOptions[EXTEND_EDGE_CUT_OPT]) + self.mAlternativeEdgeCutsCheckbox = wx.CheckBox(self, label='Use User.2 for alternative Edge-Cut layer') + self.mAlternativeEdgeCutsCheckbox.SetValue(userOptions[ALTERNATIVE_EDGE_CUT_OPT]) self.mAutomaticTranslationCheckbox = wx.CheckBox(self, label='Apply automatic translations') self.mAutomaticTranslationCheckbox.SetValue(userOptions[AUTO_TRANSLATE_OPT]) self.mAutomaticFillCheckbox = wx.CheckBox(self, label='Apply automatic fill for all zones') @@ -68,6 +71,7 @@ def __init__(self): # boxSizer.Add(self.mOptionsSeparator, 0, wx.ALL, 5) boxSizer.Add(self.mAdditionalLayersControl, 0, wx.ALL, 5) boxSizer.Add(self.mExtendEdgeCutsCheckbox, 0, wx.ALL, 5) + boxSizer.Add(self.mAlternativeEdgeCutsCheckbox, 0, wx.ALL, 5) boxSizer.Add(self.mAutomaticTranslationCheckbox, 0, wx.ALL, 5) boxSizer.Add(self.mAutomaticFillCheckbox, 0, wx.ALL, 5) boxSizer.Add(self.mExcludeDnpCheckbox, 0, wx.ALL, 5) @@ -85,6 +89,7 @@ def onGenerateButtonClick(self, event): options = dict() options[EXTRA_LAYERS] = self.mAdditionalLayersControl.GetValue() options[EXTEND_EDGE_CUT_OPT] = self.mExtendEdgeCutsCheckbox.GetValue() + options[ALTERNATIVE_EDGE_CUT_OPT] = self.mAlternativeEdgeCutsCheckbox.GetValue() options[AUTO_TRANSLATE_OPT] = self.mAutomaticTranslationCheckbox.GetValue() options[AUTO_FILL_OPT] = self.mAutomaticFillCheckbox.GetValue() options[EXCLUDE_DNP_OPT] = self.mExcludeDnpCheckbox.GetValue() @@ -94,6 +99,7 @@ def onGenerateButtonClick(self, event): self.mOptionsLabel.Hide() self.mAdditionalLayersControl.Hide() self.mExtendEdgeCutsCheckbox.Hide() + self.mAlternativeEdgeCutsCheckbox.Hide() self.mAutomaticTranslationCheckbox.Hide() self.mAutomaticFillCheckbox.Hide() self.mExcludeDnpCheckbox.Hide() diff --git a/plugins/process.py b/plugins/process.py index 5e0773d..803e2b3 100644 --- a/plugins/process.py +++ b/plugins/process.py @@ -42,7 +42,7 @@ def update_zone_fills(self): # Finally rebuild the connectivity db self.board.BuildConnectivity() - def generate_gerber(self, temp_dir, extra_layers, extend_edge_cuts): + def generate_gerber(self, temp_dir, extra_layers, extend_edge_cuts, alternative_edge_cuts): '''Generate the Gerber files.''' settings = self.board.GetDesignSettings() settings.m_SolderMaskMargin = 50000 @@ -77,13 +77,19 @@ def generate_gerber(self, temp_dir, extra_layers, extend_edge_cuts): if self.board.IsLayerEnabled(layer_info[1]) or layer_info[0] in extra_layers: plot_controller.SetLayer(layer_info[1]) plot_controller.OpenPlotfile(layer_info[0], pcbnew.PLOT_FORMAT_GERBER, layer_info[2]) - - if layer_info[1] == pcbnew.Edge_Cuts and hasattr(plot_controller, 'PlotLayers') and extend_edge_cuts: + + if layer_info[1] == pcbnew.Edge_Cuts and hasattr(plot_controller, 'PlotLayers') and (extend_edge_cuts or alternative_edge_cuts): + seq = pcbnew.LSEQ() + # uses User_2 layer for alternative Edge_Cuts layer + if alternative_edge_cuts: + seq.push_back(pcbnew.User_2) + else: + seq.push_back(layer_info[1]) # includes User_1 layer with Edge_Cuts layer to allow V Cuts to be defined as User_1 layer # available for KiCad 7.0.1+ - seq = pcbnew.LSEQ() - seq.push_back(layer_info[1]) - seq.push_back(pcbnew.User_1) + if extend_edge_cuts: + seq.push_back(layer_info[1]) + seq.push_back(pcbnew.User_1) plot_controller.PlotLayers(seq) else: plot_controller.PlotLayer() diff --git a/plugins/thread.py b/plugins/thread.py index 5eada6d..7b8a463 100644 --- a/plugins/thread.py +++ b/plugins/thread.py @@ -40,7 +40,7 @@ def run(self): # generate gerber self.progress(20) - self.process_manager.generate_gerber(temp_dir_gerber, self.options[EXTRA_LAYERS], self.options[EXTEND_EDGE_CUT_OPT]) + self.process_manager.generate_gerber(temp_dir_gerber, self.options[EXTRA_LAYERS], self.options[EXTEND_EDGE_CUT_OPT], self.options[ALTERNATIVE_EDGE_CUT_OPT]) # generate drill file self.progress(30)