Added checkbox to ignore areas on other layers (implement #40)

This commit is contained in:
CGrassin
2023-02-14 11:38:28 +01:00
parent f9ead29ac2
commit f4230bbd70
4 changed files with 143 additions and 3 deletions

View File

@ -63,6 +63,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)
@ -129,6 +130,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:
@ -161,6 +163,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
@ -305,11 +311,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 (