Hole spacing to a fixed via measured from where it is, with its own drill
A fixed via sits anywhere, not on a cell centre, and may have a bigger drill than the router's via; checking hole spacing between cell centres with one drill let the flight controller's routed 0.2 mm via come 0.19 mm from a hand-placed 0.25 mm one. The board now carries each fixed via's drill (from KiCad's padstack name), and cells are checked against fixed vias exactly.
This commit is contained in:
@@ -268,6 +268,8 @@ class GridRouter:
|
||||
self._via_nets: dict[Cell, dict[int, int]] = {} # routed via centres
|
||||
self._via_centres: list[IntPoint] | None = None # cache for _hole_clear_at
|
||||
self._fixed_vias: dict[Cell, int] = {}
|
||||
# fixed vias sit anywhere, not on cell centres: exact hole checks
|
||||
self._fixed_holes: list[tuple[IntPoint, int]] = []
|
||||
self._fixed_via_points: set[tuple[int, IntPoint]] = set()
|
||||
|
||||
if layers is None:
|
||||
@@ -301,6 +303,9 @@ class GridRouter:
|
||||
if isinstance(item, Via) and item.fixed and item.net_nos:
|
||||
self._fixed_vias[self._cell_of(item.location)] = item.net_nos[0]
|
||||
self._fixed_via_points.add((item.net_nos[0], item.location))
|
||||
# its own drill, from KiCad's padstack name (Via[0-3]_500:250_um)
|
||||
reach = self._via_drill // 2 + (item.drill or self._via_drill) // 2 + self._hole_gap
|
||||
self._fixed_holes.append((item.location, reach))
|
||||
# Through-hole pads have holes too, and a route changes layer at one
|
||||
# for free, so no via (of any net) goes within hole spacing of one.
|
||||
# The DSN has no drill for a pad; its smaller half size stands in.
|
||||
@@ -545,6 +550,12 @@ class GridRouter:
|
||||
and no through-hole pad's hole within reach at all."""
|
||||
if cell in self._tht_block:
|
||||
return False
|
||||
if self._fixed_holes:
|
||||
here = self._cell_center(cell)
|
||||
for loc, reach in self._fixed_holes:
|
||||
d = math.hypot(loc.x - here.x, loc.y - here.y)
|
||||
if d < reach and d > self.step: # beyond its own cell: too close
|
||||
return False
|
||||
if self._via_nets_at(cell) - {net_no}:
|
||||
return False
|
||||
cx, cy = cell
|
||||
|
||||
Reference in New Issue
Block a user