* Changed circle pads into actual Vias
* Added Star Pattern for basic RF stiching * Changed Default Via sizes and drill to a more standard fab size.
This commit is contained in:
@ -77,9 +77,9 @@ class FillArea:
|
||||
# Step between via
|
||||
self.SetStepMM(2.54)
|
||||
# Size of the via (diameter of copper)
|
||||
self.SetSizeMM(0.35)
|
||||
self.SetSizeMM(0.46)
|
||||
# Size of the drill (diameter)
|
||||
self.SetDrillMM(0.30)
|
||||
self.SetDrillMM(0.20)
|
||||
# Isolation between via and other elements
|
||||
# ie: radius from the border of the via
|
||||
self.SetClearanceMM(0.2)
|
||||
@ -93,6 +93,7 @@ class FillArea:
|
||||
self.netname = None
|
||||
self.debug = False
|
||||
self.random = False
|
||||
self.star = False
|
||||
if self.netname is None:
|
||||
self.SetNetname("GND")
|
||||
|
||||
@ -112,6 +113,10 @@ class FillArea:
|
||||
self.random = True
|
||||
return self
|
||||
|
||||
def SetStar(self):
|
||||
self.star = True
|
||||
return self
|
||||
|
||||
def SetPCB(self, pcb):
|
||||
self.pcb = pcb
|
||||
if self.pcb is not None:
|
||||
@ -157,34 +162,7 @@ class FillArea:
|
||||
print()
|
||||
|
||||
def PrepareFootprint(self):
|
||||
"""Don't use via since it's not possible to force a Net.
|
||||
So use a fake footprint (only one THPad)
|
||||
"""
|
||||
self.tmp_dir = tempfile.mkdtemp(".pretty")
|
||||
module_txt = """(module VIA_MATRIX (layer F.Cu) (tedit 5862471A)
|
||||
(fp_text reference REF** (at 0 0) (layer F.SilkS) hide
|
||||
(effects (font (size 0 0) (thickness 0.0)))
|
||||
)
|
||||
(fp_text value VIA_MATRIX (at 0 0) (layer F.Fab) hide
|
||||
(effects (font (size 0 0) (thickness 0.0)))
|
||||
)
|
||||
(pad 1 thru_hole circle (at 0 0) (size 1.5 1.5) (drill 0.762) (layers *.Cu))
|
||||
)"""
|
||||
|
||||
# Create the footprint on a temp directory
|
||||
f = open(os.path.join(self.tmp_dir, "VIA_MATRIX.kicad_mod"), 'w')
|
||||
f.write(module_txt)
|
||||
f.close()
|
||||
|
||||
plugin = IO_MGR.PluginFind(
|
||||
IO_MGR.GuessPluginTypeFromLibPath(self.tmp_dir))
|
||||
module = plugin.FootprintLoad(self.tmp_dir, "VIA_MATRIX")
|
||||
module.FindPadByName("1").SetSize(wxSize(self.size, self.size))
|
||||
module.FindPadByName("1").SetDrillSize(wxSize(self.drill, self.drill))
|
||||
module.FindPadByName("1").SetLocalClearance(int(self.clearance))
|
||||
module.FindPadByName("1").SetNet(self.pcb.FindNet(self.netname))
|
||||
module.FindPadByName("1").SetZoneConnection(PAD_ZONE_CONN_FULL)
|
||||
return module
|
||||
return self
|
||||
|
||||
def CleanupFootprint(self):
|
||||
"""
|
||||
@ -194,15 +172,14 @@ class FillArea:
|
||||
shutil.rmtree(self.tmp_dir)
|
||||
|
||||
def AddModule(self, module, position, x, y):
|
||||
m = MODULE(module)
|
||||
m = VIA(self.pcb)
|
||||
m.SetPosition(position)
|
||||
m.SetReference("V%s_%s" % (x, y))
|
||||
m.SetValue("AUTO_VIA")
|
||||
m.SetLastEditTime()
|
||||
m.SetAttributes(MOD_VIRTUAL)
|
||||
m.thisown = 0
|
||||
self.pcb.AddNative(m, ADD_APPEND)
|
||||
m.SetFlag(IS_NEW)
|
||||
m.SetNet(self.pcb.FindNet("GND"))
|
||||
m.SetViaType(VIA_THROUGH)
|
||||
print(self.size)
|
||||
m.SetDrill(int(self.drill))
|
||||
m.SetWidth(int(self.size))
|
||||
self.pcb.Add(m)
|
||||
|
||||
def RefillBoardAreas(self):
|
||||
for i in range(self.pcb.GetAreaCount()):
|
||||
@ -265,7 +242,7 @@ class FillArea:
|
||||
for y in range(rectangle[0].__len__()):
|
||||
for x in range(rectangle.__len__()):
|
||||
testResult = not keepOutMode # = False if is Keepout
|
||||
offset = self.clearance + self.size / 2
|
||||
offset = (self.clearance) + self.size / 2
|
||||
# For keepout area: Deny Via
|
||||
# For same net area: Allow if not denied by keepout
|
||||
current_x = origin.x + (x * self.step)
|
||||
@ -404,9 +381,21 @@ class FillArea:
|
||||
(self.step / 4.0)
|
||||
ran_y = (random.random() * self.step / 2.0) - \
|
||||
(self.step / 4.0)
|
||||
self.AddModule(
|
||||
module, wxPoint(origin.x + (self.step * x) + ran_x,
|
||||
origin.y + (self.step * y) + ran_y), x, y)
|
||||
if self.star:
|
||||
if y%2:
|
||||
if ((x+1)%2):
|
||||
self.AddModule(
|
||||
module, wxPoint(origin.x + (self.step * x) + ran_x,
|
||||
origin.y + (self.step * y) + ran_y), x, y)
|
||||
else:
|
||||
if (x%2):
|
||||
self.AddModule(
|
||||
module, wxPoint(origin.x + (self.step * x) + ran_x,
|
||||
origin.y + (self.step * y) + ran_y), x, y)
|
||||
else:
|
||||
self.AddModule(
|
||||
module, wxPoint(origin.x + (self.step * x) + ran_x,
|
||||
origin.y + (self.step * y) + ran_y), x, y)
|
||||
|
||||
self.RefillBoardAreas()
|
||||
|
||||
|
@ -38,11 +38,12 @@ class FillAreaAction(pcbnew.ActionPlugin):
|
||||
|
||||
def Run(self):
|
||||
a = FillAreaDialogEx(None)
|
||||
a.m_SizeMM.SetValue("0.35")
|
||||
a.m_SizeMM.SetValue("0.46")
|
||||
a.m_StepMM.SetValue("2.54")
|
||||
a.m_DrillMM.SetValue("0.3")
|
||||
a.m_DrillMM.SetValue("0.2")
|
||||
a.m_Netname.SetValue("auto")
|
||||
a.m_ClearanceMM.SetValue("0.2")
|
||||
a.m_Star.SetValue(True)
|
||||
modal_result = a.ShowModal()
|
||||
if modal_result == wx.ID_OK:
|
||||
fill = FillArea.FillArea()
|
||||
@ -57,6 +58,8 @@ class FillAreaAction(pcbnew.ActionPlugin):
|
||||
fill.SetDebug()
|
||||
if a.m_Random.IsChecked():
|
||||
fill.SetRandom()
|
||||
if a.m_Star.IsChecked():
|
||||
fill.SetStar()
|
||||
if a.m_only_selected.IsChecked():
|
||||
fill.OnlyOnSelectedArea()
|
||||
fill.Run()
|
||||
|
@ -1,4 +1,4 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
###########################################################################
|
||||
## Python code generated with wxFormBuilder (version Feb 16 2016)
|
||||
@ -15,113 +15,118 @@ import wx.xrc
|
||||
###########################################################################
|
||||
|
||||
class FillAreaDialog ( wx.Dialog ):
|
||||
|
||||
|
||||
def __init__( self, parent ):
|
||||
wx.Dialog.__init__ ( self, parent, id = wx.ID_ANY, title = u"Fill Area parameters", pos = wx.DefaultPosition, size = wx.Size( 369,389 ), style = wx.DEFAULT_DIALOG_STYLE )
|
||||
|
||||
|
||||
self.SetSizeHintsSz( wx.DefaultSize, wx.DefaultSize )
|
||||
|
||||
|
||||
bSizer3 = wx.BoxSizer( wx.VERTICAL )
|
||||
|
||||
|
||||
fgSizer1 = wx.FlexGridSizer( 0, 2, 0, 0 )
|
||||
fgSizer1.SetFlexibleDirection( wx.BOTH )
|
||||
fgSizer1.SetNonFlexibleGrowMode( wx.FLEX_GROWMODE_SPECIFIED )
|
||||
|
||||
|
||||
self.m_staticText3 = wx.StaticText( self, wx.ID_ANY, u"Via copper size", wx.DefaultPosition, wx.DefaultSize, 0 )
|
||||
self.m_staticText3.Wrap( -1 )
|
||||
fgSizer1.Add( self.m_staticText3, 1, wx.ALL|wx.EXPAND, 5 )
|
||||
|
||||
|
||||
self.m_SizeMM = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
|
||||
self.m_SizeMM.SetMinSize( wx.Size( 1000,-1 ) )
|
||||
|
||||
|
||||
fgSizer1.Add( self.m_SizeMM, 1, wx.ALL|wx.EXPAND, 5 )
|
||||
|
||||
|
||||
self.m_staticText9 = wx.StaticText( self, wx.ID_ANY, u"Via drill size", wx.DefaultPosition, wx.DefaultSize, 0 )
|
||||
self.m_staticText9.Wrap( -1 )
|
||||
fgSizer1.Add( self.m_staticText9, 1, wx.ALL|wx.EXPAND, 5 )
|
||||
|
||||
|
||||
self.m_DrillMM = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
|
||||
fgSizer1.Add( self.m_DrillMM, 1, wx.ALL|wx.EXPAND, 5 )
|
||||
|
||||
|
||||
self.m_staticText5 = wx.StaticText( self, wx.ID_ANY, u"Via clearance", wx.DefaultPosition, wx.DefaultSize, 0 )
|
||||
self.m_staticText5.Wrap( -1 )
|
||||
fgSizer1.Add( self.m_staticText5, 1, wx.ALL|wx.EXPAND, 5 )
|
||||
|
||||
|
||||
self.m_ClearanceMM = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
|
||||
fgSizer1.Add( self.m_ClearanceMM, 1, wx.ALL|wx.EXPAND, 5 )
|
||||
|
||||
|
||||
self.m_staticText6 = wx.StaticText( self, wx.ID_ANY, u"Net name", wx.DefaultPosition, wx.DefaultSize, 0 )
|
||||
self.m_staticText6.Wrap( -1 )
|
||||
fgSizer1.Add( self.m_staticText6, 1, wx.ALL|wx.EXPAND, 5 )
|
||||
|
||||
|
||||
self.m_Netname = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
|
||||
fgSizer1.Add( self.m_Netname, 1, wx.ALL|wx.EXPAND, 5 )
|
||||
|
||||
|
||||
self.m_staticText2 = wx.StaticText( self, wx.ID_ANY, u"Step between via", wx.DefaultPosition, wx.DefaultSize, 0 )
|
||||
self.m_staticText2.Wrap( -1 )
|
||||
fgSizer1.Add( self.m_staticText2, 0, wx.ALL, 5 )
|
||||
|
||||
|
||||
self.m_StepMM = wx.TextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
|
||||
fgSizer1.Add( self.m_StepMM, 1, wx.ALL|wx.EXPAND, 5 )
|
||||
|
||||
|
||||
self.m_staticText7 = wx.StaticText( self, wx.ID_ANY, u"Debug mode", wx.DefaultPosition, wx.DefaultSize, 0 )
|
||||
self.m_staticText7.Wrap( -1 )
|
||||
fgSizer1.Add( self.m_staticText7, 1, wx.ALL|wx.EXPAND, 5 )
|
||||
|
||||
|
||||
self.m_Debug = wx.CheckBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
|
||||
fgSizer1.Add( self.m_Debug, 1, wx.ALL|wx.EXPAND, 5 )
|
||||
|
||||
|
||||
self.m_staticText8 = wx.StaticText( self, wx.ID_ANY, u"Random it", wx.DefaultPosition, wx.DefaultSize, 0 )
|
||||
self.m_staticText8.Wrap( -1 )
|
||||
fgSizer1.Add( self.m_staticText8, 0, wx.ALL, 5 )
|
||||
|
||||
|
||||
self.m_Random = wx.CheckBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
|
||||
fgSizer1.Add( self.m_Random, 0, wx.ALL, 5 )
|
||||
|
||||
|
||||
self.m_staticText42 = wx.StaticText( self, wx.ID_ANY, u"Star Pattern", wx.DefaultPosition, wx.DefaultSize, 0 )
|
||||
self.m_staticText42.Wrap( -1 )
|
||||
fgSizer1.Add( self.m_staticText42, 0, wx.ALL, 5 )
|
||||
|
||||
self.m_Star = wx.CheckBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
|
||||
fgSizer1.Add( self.m_Star, 0, wx.ALL, 5 )
|
||||
|
||||
self.m_staticText81 = wx.StaticText( self, wx.ID_ANY, u"Only under selected Zone", wx.DefaultPosition, wx.DefaultSize, 0 )
|
||||
self.m_staticText81.Wrap( -1 )
|
||||
fgSizer1.Add( self.m_staticText81, 0, wx.ALL, 5 )
|
||||
|
||||
|
||||
self.m_only_selected = wx.CheckBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
|
||||
fgSizer1.Add( self.m_only_selected, 0, wx.ALL, 5 )
|
||||
|
||||
|
||||
|
||||
|
||||
bSizer3.Add( fgSizer1, 1, wx.EXPAND, 5 )
|
||||
|
||||
|
||||
bSizer1 = wx.BoxSizer( wx.HORIZONTAL )
|
||||
|
||||
|
||||
self.m_staticText101 = wx.StaticText( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 )
|
||||
self.m_staticText101.Wrap( -1 )
|
||||
bSizer1.Add( self.m_staticText101, 1, wx.ALL, 5 )
|
||||
|
||||
|
||||
self.m_button1 = wx.Button( self, wx.ID_OK, u"Run", wx.DefaultPosition, wx.DefaultSize, 0 )
|
||||
self.m_button1.SetDefault()
|
||||
self.m_button1.SetDefault()
|
||||
bSizer1.Add( self.m_button1, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5 )
|
||||
|
||||
|
||||
self.m_button2 = wx.Button( self, wx.ID_CANCEL, u"Cancel", wx.DefaultPosition, wx.DefaultSize, 0 )
|
||||
bSizer1.Add( self.m_button2, 0, wx.ALL, 5 )
|
||||
|
||||
|
||||
self.m_button3_delete = wx.Button( self, wx.ID_DELETE, u"Delete Vias", wx.DefaultPosition, wx.DefaultSize, 0 )
|
||||
bSizer1.Add( self.m_button3_delete, 0, wx.ALL, 5 )
|
||||
|
||||
|
||||
|
||||
|
||||
bSizer3.Add( bSizer1, 0, wx.EXPAND|wx.ALIGN_RIGHT, 5 )
|
||||
|
||||
|
||||
|
||||
|
||||
self.SetSizer( bSizer3 )
|
||||
self.Layout()
|
||||
|
||||
|
||||
self.Centre( wx.BOTH )
|
||||
|
||||
|
||||
# Connect Events
|
||||
self.m_button3_delete.Bind( wx.EVT_BUTTON, self.onDeleteClick )
|
||||
|
||||
|
||||
def __del__( self ):
|
||||
pass
|
||||
|
||||
|
||||
|
||||
|
||||
# Virtual event handlers, overide them in your derived class
|
||||
def onDeleteClick( self, event ):
|
||||
event.Skip()
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user