diff --git a/ViaStitching/FillArea.py b/ViaStitching/FillArea.py index 3ff9fdf..f472947 100644 --- a/ViaStitching/FillArea.py +++ b/ViaStitching/FillArea.py @@ -64,6 +64,7 @@ FillArea.FillArea().SetDebug().SetNetname("GND").SetStepMM(1.27).SetSizeMM(0.6). # with # SetDebug: Activate debug mode (print evolution of the board in ascii art) +# SetViaThroughAreas: Ignores areas on other layers # SetNetname: Change the netname to consider for the filling # (default is /GND or fallback to GND) # SetStepMM: Change step between Via (in mm) @@ -130,6 +131,7 @@ class FillArea: self.SetClearanceMM(0.2) self.only_selected_area = False self.delete_vias = False + self.via_through_areas = False if self.pcb is not None: for lnet in ["GND", "/GND"]: if self.pcb.FindNet(lnet) is not None: @@ -162,6 +164,10 @@ class FillArea: self.random = r return self + def SetViaThroughAreas(self, r): + self.via_through_areas = r + return self + def SetType(self, type): self.fill_type = type return self @@ -308,11 +314,11 @@ STEP = '-' if is_rule_exclude_via_area and (hit_test_area or hit_test_edge or hit_test_zone): return self.REASON_KEEPOUT # Collides with keepout/rules - elif (hit_test_area or hit_test_edge) and not is_rules_area: + elif (not self.via_through_areas) and (hit_test_area or hit_test_edge) and not is_rules_area: # Collides with another signal (e.g. on another layer) but not a rule zone return self.REASON_OTHER_SIGNAL - elif hit_test_zone and not is_rules_area: + elif (not self.via_through_areas) and hit_test_zone and not is_rules_area: # Check if the zone is higher priority than other zones of the target net in the same point # target_areas_on_same_layer = filter(lambda x: ((x.GetPriority() > area_priority) and (x.GetLayer() == area_layer) and (x.GetNetname().upper() == self.netname)), all_areas) target_areas_on_same_layer = filter(lambda x: ((x.GetPriority() > area_priority) and ( @@ -764,8 +770,9 @@ STEP = '-' ran_y = 0 if self.random: - ran_x = (random.random() * l_clearance / 2.0) - (l_clearance / 4.0) - ran_y = (random.random() * l_clearance / 2.0) - (l_clearance / 4.0) + max_offset = max(self.step - (self.clearance + self.size), 0) / 2.0 + ran_x = (random.random() * max_offset) - (max_offset / 2.0) + ran_y = (random.random() * max_offset) - (max_offset / 2.0) self.AddVia(wxPoint(via.PosX + ran_x, via.PosY + ran_y), via.X, via.Y) via_placed += 1 diff --git a/ViaStitching/FillAreaAction.py b/ViaStitching/FillAreaAction.py index 802d7de..8de119f 100644 --- a/ViaStitching/FillAreaAction.py +++ b/ViaStitching/FillAreaAction.py @@ -81,6 +81,7 @@ class FillAreaAction(pcbnew.ActionPlugin): if a.m_Debug.IsChecked(): fill.SetDebug() fill.SetRandom(a.m_Random.IsChecked()) + fill.SetViaThroughAreas(a.m_viaThroughAreas.IsChecked()) fill.SetType(a.m_cbFillType.GetStringSelection()) if a.m_only_selected.IsChecked(): fill.OnlyOnSelectedArea() diff --git a/ViaStitching/FillAreaDialog.py b/ViaStitching/FillAreaDialog.py index 1347fa1..e0a4d1c 100644 --- a/ViaStitching/FillAreaDialog.py +++ b/ViaStitching/FillAreaDialog.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- ########################################################################### -## Python code generated with wxFormBuilder (version 3.10.1) +## Python code generated with wxFormBuilder (version 3.10.1-0-g8feb16b) ## http://www.wxformbuilder.org/ ## ## PLEASE DO *NOT* EDIT THIS FILE! @@ -102,6 +102,14 @@ class FillAreaDialog ( wx.Dialog ): 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 ) + self.m_staticText71 = wx.StaticText( self, wx.ID_ANY, u"Ignore areas on other layers", wx.DefaultPosition, wx.DefaultSize, 0 ) + self.m_staticText71.Wrap( -1 ) + + fgSizer1.Add( self.m_staticText71, 0, wx.ALL, 5 ) + + self.m_viaThroughAreas = wx.CheckBox( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0 ) + fgSizer1.Add( self.m_viaThroughAreas, 0, wx.ALL, 5 ) + self.m_staticText7 = wx.StaticText( self, wx.ID_ANY, u"Debug mode", wx.DefaultPosition, wx.DefaultSize, 0 ) self.m_staticText7.Wrap( -1 ) diff --git a/ViaStitching/FillAreaTpl.fbp b/ViaStitching/FillAreaTpl.fbp index d11834f..be8e59e 100644 --- a/ViaStitching/FillAreaTpl.fbp +++ b/ViaStitching/FillAreaTpl.fbp @@ -1147,6 +1147,131 @@ + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + Ignore areas on other layers + 0 + + 0 + + + 0 + + 1 + m_staticText71 + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + + + -1 + + + + 5 + wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + + 0 + + + 0 + + 1 + m_viaThroughAreas + 1 + + + protected + 1 + + Resizable + 1 + + + + 0 + + + wxFILTER_NONE + wxDefaultValidator + + + + + + 5 wxALL|wxEXPAND