Fixed pads and tracks processing (BOX2I and VECTOR2I)

This commit is contained in:
CGrassin
2023-02-19 21:57:48 +01:00
parent 6eb833e991
commit dd2e49e020

View File

@ -653,12 +653,12 @@ STEP = '-'
start_rect = wxPoint(origin.x + (l_clearance * x) - local_offset, start_rect = wxPoint(origin.x + (l_clearance * x) - local_offset,
origin.y + (l_clearance * y) - local_offset) origin.y + (l_clearance * y) - local_offset)
size_rect = wxSize(2 * local_offset, 2 * local_offset) size_rect = wxSize(2 * local_offset, 2 * local_offset)
if pad.HitTest(EDA_RECT(start_rect, size_rect), False): if pad.HitTest(BOX2I(VECTOR2I(start_rect), VECTOR2I(size_rect)), False):
rectangle[x][y] = self.REASON_PAD rectangle[x][y] = self.REASON_PAD
else: else:
# Hit test doesn't handle large pads. This following should fix that. # Hit test doesn't handle large pads. This following should fix that.
m = PCB_VIA(self.parent_area) m = PCB_VIA(self.parent_area)
m.SetPosition(wxPoint(origin.x + (l_clearance * x), origin.y + (l_clearance * y))) m.SetPosition(VECTOR2I(wxPoint(origin.x + (l_clearance * x), origin.y + (l_clearance * y))))
m.SetNet(self.target_net) m.SetNet(self.target_net)
m.SetViaType(VIATYPE_THROUGH) m.SetViaType(VIATYPE_THROUGH)
m.SetDrill(int(self.drill)) m.SetDrill(int(self.drill))
@ -714,7 +714,7 @@ STEP = '-'
start_rect = wxPoint(origin.x + (l_clearance * x) - clearance, start_rect = wxPoint(origin.x + (l_clearance * x) - clearance,
origin.y + (l_clearance * y) - clearance) origin.y + (l_clearance * y) - clearance)
size_rect = wxSize(2 * clearance, 2 * clearance) size_rect = wxSize(2 * clearance, 2 * clearance)
if track.HitTest(EDA_RECT(start_rect, size_rect), False): if track.HitTest(BOX2I(VECTOR2I(start_rect), VECTOR2I(size_rect)), False):
rectangle[x][y] = self.REASON_TRACK rectangle[x][y] = self.REASON_TRACK
except: except:
wxPrint("exception on Processing all tracks...") wxPrint("exception on Processing all tracks...")