clean up output generation plugin

This commit is contained in:
Brendan Haines 2021-07-01 23:47:02 -06:00
parent 1a35690b3f
commit d2ea4eba1a
16 changed files with 39 additions and 65 deletions

View File

@ -1,16 +0,0 @@
import pcbnew
__all__ = ["AsyOutputs"]
class AsyOutputs(pcbnew.ActionPlugin):
def defaults(self):
self.name = "Generate Assembly Outputs"
self.category = "Output Generation"
self.description = "Generate CSV BOM, Drawings, and add to pdf"
self.pcbnew_icon_support = hasattr(self, "show_toolbar_button")
self.show_toolbar_button = True
def Run(self):
# The entry function of the plugin that is executed on user action
print("Hello World - AsyOutputs")

View File

@ -13,8 +13,8 @@ class FabOutputs(pcbnew.ActionPlugin):
self.category = "Output Generation" self.category = "Output Generation"
self.description = "Generate Gerbers, BOM, Drawings, etc and add to pdf/zip" self.description = "Generate Gerbers, BOM, Drawings, etc and add to pdf/zip"
self.pcbnew_icon_support = hasattr(self, "show_toolbar_button")
self.show_toolbar_button = True self.show_toolbar_button = True
self.icon_file_name = os.path.join(os.path.dirname(__file__), "icon.png")
def Run(self): def Run(self):
# ================ # ================
@ -84,38 +84,45 @@ class FabOutputs(pcbnew.ActionPlugin):
"soldermask defined": None, # TODO: how do I want to determine this? "soldermask defined": None, # TODO: how do I want to determine this?
} }
dir_fab.mkdir(parents=True, exist_ok=True)
dir_asy.mkdir(parents=True, exist_ok=True)
files_fab = [] files_fab = []
files_asy = [] files_asy = []
# ================ # ================
# Gerbers # Gerbers
# ================ # ================
#### SETTINGS
tent_vias = True
trim_silkscreen = False
plot_controller = pcbnew.PLOT_CONTROLLER(pcb) plot_controller = pcbnew.PLOT_CONTROLLER(pcb)
plot_options = plot_controller.GetPlotOptions() plot_options = plot_controller.GetPlotOptions()
# Set General Options: # Set General Options:
# plot_options.Format()
plot_options.SetOutputDirectory(dir_fab) plot_options.SetOutputDirectory(dir_fab)
plot_options.SetPlotFrameRef(False) plot_options.SetPlotFrameRef(False)
plot_options.SetPlotValue(False) plot_options.SetPlotValue(False)
plot_options.SetPlotReference(True) plot_options.SetPlotReference(True)
plot_options.SetPlotInvisibleText(False) plot_options.SetPlotInvisibleText(False)
plot_options.SetPlotViaOnMaskLayer(False) plot_options.SetPlotViaOnMaskLayer(not tent_vias)
plot_options.SetExcludeEdgeLayer(True) plot_options.SetExcludeEdgeLayer(True)
plot_options.SetUseAuxOrigin(False) plot_options.SetUseAuxOrigin(False)
plot_options.SetMirror(False) plot_options.SetMirror(False)
plot_options.SetNegative(False) plot_options.SetNegative(False)
#plot_options.SetDrillMarksType(PLOT_DRILL_MARKS_TYPE) plot_options.SetScale(1)
#plot_options.SetScale(PLOT_SCALE) # plot_options.SetAutoScale(True)
plot_options.SetAutoScale(True)
#plot_options.SetPlotMode(PLOT_MODE) #plot_options.SetPlotMode(PLOT_MODE)
#plot_options.SetLineWidth(pcbnew.FromMM(PLOT_LINE_WIDTH)) #plot_options.SetLineWidth(pcbnew.FromMM(PLOT_LINE_WIDTH))
plot_options.SetUseGerberAttributes(True) plot_options.SetUseGerberAttributes(True)
plot_options.SetUseGerberProtelExtensions(False) plot_options.SetUseGerberProtelExtensions(False)
plot_options.SetCreateGerberJobFile(False) plot_options.SetCreateGerberJobFile(False)
plot_options.SetSubtractMaskFromSilk(True)
plot_options.SetIncludeGerberNetlistInfo(False) plot_options.SetIncludeGerberNetlistInfo(False)
plot_options.SetUseGerberX2format(True)
# plot_options.SetDrillMarksType()
plot_options.SetSubtractMaskFromSilk(trim_silkscreen)
plot_plan = [ plot_plan = [
# ( layer ID, file extension, description) # ( layer ID, file extension, description)
@ -169,32 +176,39 @@ class FabOutputs(pcbnew.ActionPlugin):
files_fab.append(fname) files_fab.append(fname)
# ================ # ================
# Pick and Place # Drawing
# ================s # ================
# TODO # TODO
# ================ # ================
# Fab Drawing # BOM
# ================ # ================
# TODO
fname = f"README_FABRICATION{suffix}.TXT"
with open(dir_fab / fname, "w") as f:
f.write(f"{project_name}-REV{rev}\n")
f.write(f"Layer Order\n")
# for layer in plot_plan:
files_fab.append(fname)
# ================ # ================
# Assembly Drawing # Pick and Place
# ================
# TODO
# ================
# Fab Notes
# ================ # ================
with open(dir_asy / f"README_ASSEMBLY{suffix}.TXT", "w") as f: # fname = f"README_FABRICATION{suffix}.TXT"
f.write(f"{project_name}-REV{rev}\n") # with open(dir_fab / fname, "w") as f:
# f.write(f"{project_name}-REV{rev}\n")
# f.write(f"Layer Order\n")
# # for layer in plot_plan:
# files_fab.append(fname)
files_asy.append(fname) # ================
# Assembly Notes
# ================
# fname = f"README_ASSEMBLY{suffix}.TXT"
# with open(dir_asy / fname, "w") as f:
# f.write(f"{project_name}-REV{rev}\n")
# files_asy.append(fname)
# ================ # ================
# Zip # Zip

View File

@ -1,5 +1,2 @@
from .FabOutputs import FabOutputs from .FabOutputs import FabOutputs
from .AsyOutputs import AsyOutputs
FabOutputs().register() # Instantiate and register to Pcbnew FabOutputs().register() # Instantiate and register to Pcbnew
AsyOutputs().register() # Instantiate and register to Pcbnew

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -1,17 +0,0 @@
import pcbnew
import os
class TestPlugin(pcbnew.ActionPlugin):
def defaults(self):
self.name = "TestPlugin"
self.category = "A descriptive category name"
self.description = "A description of the plugin and what it does"
# self.pcbnew_icon_support = hasattr(self, "show_toolbar_button")
# self.show_toolbar_button = True
# icon_dir = os.path.dirname(os.path.dirname(__file__))
# self.icon_file_name = os.path.join(icon_dir, 'icon.png')
def Run(self):
# The entry function of the plugin that is executed on user action
print("Hello World - testplugin")

View File

@ -1,3 +0,0 @@
from .TestPlugin_action import TestPlugin
plugin = TestPlugin()
plugin.register()

Binary file not shown.

Before

Width:  |  Height:  |  Size: 761 B

View File

@ -1 +0,0 @@
from .TestPlugin import plugin