* 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() | ||||
|  | ||||
| @ -78,6 +78,13 @@ class FillAreaDialog ( wx.Dialog ): | ||||
| 		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 ) | ||||
| @ -123,5 +130,3 @@ class FillAreaDialog ( wx.Dialog ): | ||||
| 	# Virtual event handlers, overide them in your derived class | ||||
| 	def onDeleteClick( self, event ): | ||||
| 		event.Skip() | ||||
| 	 | ||||
|  | ||||
|  | ||||
		Reference in New Issue
	
	Block a user