regions module#
Work out what copper a layer’s filled shapes actually image.
A source object’s holes are not a description of the copper; they are an artifact of how the shape was authored. If a same-net shape overlaps another’s hole, the real copper has no hole there, and replaying that hole as a clear region asserts an absence that does not exist - dark(P), dark(O), clear(H) punches the hole straight back into copper O had correctly filled. Reordering cannot fix it in general: two same-net shapes can each hole the other, which has no valid order at all.
So the union is not a repair applied to awkward inputs, it is how the image is determined. Union the copper, and the holes that survive are the only holes that are real. Ordering runs on the result.
Two graphs over the same layer, not one. The connectivity graph holds everything conducting, including pads, because net attribution depends on what a shape touches and the canonical net tie touches pads and nothing else. The union takes region-imaged copper only: a pad contributes no region geometry, and its own holes live in its aperture, where they are transparent.
- GRID = 1e-06#
The 1 nm output grid, as a shapely grid_size.
Every predicate and every union runs on it, so adjacency is decided on the same grid the file is written on. Shapely is float-exact otherwise: two rectangles abutting at a shared edge intersect, the same pair with a 1e-12 gap do not, and the two answers give different connected components.
- class Piece(geom, nets=frozenset({}), tie=False, filled=True)[source]#
Bases:
objectOne piece of copper on one layer, as the region builder sees it.
- Parameters:
geom (
BaseGeometry) – the placed geometry, already snapped to the output grid.nets (
frozenset[str]) – the nets the design declares for it. Empty means the design has no net object for it, which is not the same as unknown - the exporter never promotes a shape to a neighbour’s net.tie (
bool) – the piece came from OverlappableCopper, so a cross-net contact through it is a declared bridge rather than a short.filled (
bool) – the piece images as a region and takes part in the union. Pads, vias and stroked traces are in the graph but not the union.
- geom: BaseGeometry#
- class Island(outer, holes, nets, tie)[source]#
Bases:
objectA resolved island of the layer image, with the holes that are real.
- Parameters:
nets (
frozenset[str]) – the nets to declare on it. A tie carries every net of the component it bridges, which is 5.6.13’s list form.tie (
bool) – the island is a net tie and carries TA.AperFunction, EtchedComponent. That attribute attaches to an object, which is why a tie cannot be merged away into the copper it bridges.outer (Polygon)
holes (tuple[Polygon, ...])
- outer: Polygon#
- class Report(shorts=0, overlaps=0, pairs=list())[source]#
Bases:
objectWhat the analysis found worth complaining about.