Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| bce98f72c3 | |||
| 84e933b566 | |||
| 3714af0afb | |||
| b80a14dfbb | |||
| bfa87db797 |
+1
-1
@@ -29,7 +29,7 @@
|
||||
],
|
||||
"versions": [
|
||||
{
|
||||
"version": "4.0.0",
|
||||
"version": "4.1.0",
|
||||
"status": "stable",
|
||||
"kicad_version": "6.00"
|
||||
}
|
||||
|
||||
@@ -52,3 +52,5 @@ plotPlan = [
|
||||
("Edge.Cuts", pcbnew.Edge_Cuts, "Board Outline"),
|
||||
("User.Comments", pcbnew.Cmts_User, "User Comments")
|
||||
]
|
||||
|
||||
layers = [layer[0] for layer in plotPlan]
|
||||
+2
-1
@@ -1,2 +1,3 @@
|
||||
EXCLUDE_DNP_OPT = "EXCLUDE DNP"
|
||||
OUTPUT_NAME_OPT = "OUTPUT NAME"
|
||||
OUTPUT_NAME_OPT = "OUTPUT NAME"
|
||||
EXTRA_LAYERS = "EXTRA_LAYERS"
|
||||
+11
-2
@@ -1,10 +1,11 @@
|
||||
import os
|
||||
import wx
|
||||
import pcbnew # type: ignore
|
||||
import pcbnew # type: ignore
|
||||
|
||||
from .thread import ProcessThread
|
||||
from .events import StatusEvent
|
||||
from .options import EXCLUDE_DNP_OPT
|
||||
from .options import EXCLUDE_DNP_OPT, EXTRA_LAYERS
|
||||
from .config import layers
|
||||
|
||||
|
||||
# WX GUI form that show the plugin progress
|
||||
@@ -31,6 +32,11 @@ class KiCadToJLCForm(wx.Frame):
|
||||
self.mExcludeDnpCheckbox = wx.CheckBox(self, label='Exclude DNP components')
|
||||
self.mExcludeDnpCheckbox.SetValue(False)
|
||||
|
||||
self.mAdditionalLayersControl = wx.TextCtrl(self, size=wx.Size(600, 50))
|
||||
self.mAdditionalLayersControl.Hint = "Additional layers"
|
||||
self.mAdditionalLayersControl.AutoComplete(layers)
|
||||
self.mAdditionalLayersControl.Enable()
|
||||
|
||||
self.mGenerateButton = wx.Button(self, label='Generate', size=wx.Size(600, 60))
|
||||
|
||||
self.mGaugeStatus = wx.Gauge(
|
||||
@@ -44,6 +50,7 @@ class KiCadToJLCForm(wx.Frame):
|
||||
|
||||
boxSizer.Add(self.mOptionsLabel, 0, wx.ALL, 5)
|
||||
# boxSizer.Add(self.mOptionsSeparator, 0, wx.ALL, 5)
|
||||
boxSizer.Add(self.mAdditionalLayersControl, 0, wx.ALL, 5)
|
||||
boxSizer.Add(self.mExcludeDnpCheckbox, 0, wx.ALL, 5)
|
||||
boxSizer.Add(self.mGaugeStatus, 0, wx.ALL, 5)
|
||||
boxSizer.Add(self.mGenerateButton, 0, wx.ALL, 5)
|
||||
@@ -58,7 +65,9 @@ class KiCadToJLCForm(wx.Frame):
|
||||
def onGenerateButtonClick(self, event):
|
||||
options = dict()
|
||||
options[EXCLUDE_DNP_OPT] = self.mExcludeDnpCheckbox.GetValue()
|
||||
options[EXTRA_LAYERS] = self.mAdditionalLayersControl.GetValue()
|
||||
|
||||
self.mAdditionalLayersControl.Hide()
|
||||
self.mExcludeDnpCheckbox.Hide()
|
||||
self.mOptionsLabel.Hide()
|
||||
self.mGenerateButton.Hide()
|
||||
|
||||
+10
-3
@@ -42,7 +42,7 @@ class ProcessManager:
|
||||
# Finally rebuild the connectivity db
|
||||
self.board.BuildConnectivity()
|
||||
|
||||
def generate_gerber(self, temp_dir):
|
||||
def generate_gerber(self, temp_dir, extra_layers):
|
||||
'''Generate the Gerber files.'''
|
||||
settings = self.board.GetDesignSettings()
|
||||
settings.m_SolderMaskMargin = 50000
|
||||
@@ -67,8 +67,13 @@ class ProcessManager:
|
||||
if hasattr(plot_options, "SetExcludeEdgeLayer"):
|
||||
plot_options.SetExcludeEdgeLayer(True)
|
||||
|
||||
if extra_layers is not None:
|
||||
extra_layers = [element.strip() for element in extra_layers.strip().split(',') if element.strip()]
|
||||
else:
|
||||
extra_layers = []
|
||||
|
||||
for layer_info in plotPlan:
|
||||
if self.board.IsLayerEnabled(layer_info[1]):
|
||||
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])
|
||||
|
||||
@@ -150,7 +155,9 @@ class ProcessManager:
|
||||
# 2: 'unspecified'
|
||||
# }.get(footprint.GetAttributes())
|
||||
|
||||
skip_footprint = exclude_dnp and (footprint_has_field(footprint, 'dnp') or footprint.GetValue().upper() == 'DNP')
|
||||
skip_footprint = exclude_dnp and (footprint_has_field(footprint, 'dnp')
|
||||
or footprint.GetValue().upper() == 'DNP'
|
||||
or getattr(footprint, 'IsDNP', bool)())
|
||||
|
||||
if not (footprint.GetAttributes() & pcbnew.FP_EXCLUDE_FROM_POS_FILES) and not skip_footprint:
|
||||
# append unique ID if duplicate footprint designator
|
||||
|
||||
+1
-1
@@ -39,7 +39,7 @@ class ProcessThread(Thread):
|
||||
|
||||
# generate gerber
|
||||
self.progress(20)
|
||||
self.process_manager.generate_gerber(temp_dir_gerber)
|
||||
self.process_manager.generate_gerber(temp_dir_gerber, self.options[EXTRA_LAYERS])
|
||||
|
||||
# generate drill file
|
||||
self.progress(30)
|
||||
|
||||
Reference in New Issue
Block a user