Keep ambiguous S-bend templates local to affected nets

This commit is contained in:
Jan Petykiewicz 2026-11-29 23:56:47 -08:00
commit 867aab8fa2

View file

@ -5,7 +5,7 @@ from typing import TYPE_CHECKING
from inire.geometry.components import (
ComponentPreparationError, build_component, component_endpoint, prepare_component_sampling,
)
from inire.model import resolve_bend_geometry
from inire.model import _AmbiguousSBendOutlineError, resolve_bend_geometry
from inire.seeds import Bend90Seed, SBendSeed, StraightSeed
if TYPE_CHECKING:
@ -29,14 +29,14 @@ def seed_preparation_error(seed: PathSeed, *, start: Port, net_width: float, sea
proxy, physical = resolve_bend_geometry(search)
for index, segment in enumerate(seed.segments, start=1):
kind, parameters = seed_move(segment)
template = search.sbend_template(segment.offset, segment.radius, net_width) if isinstance(segment, SBendSeed) else None
try:
template = search.sbend_template(segment.offset, segment.radius, net_width) if isinstance(segment, SBendSeed) else None
start = component_endpoint(start, kind, parameters)
prepare_component_sampling(
kind, parameters, net_width, collision_type=proxy, physical_geometry_type=physical,
dilation=clearance / 2, sbend_outline=template.polygon if template is not None else None,
)
except (ComponentPreparationError, OverflowError) as exc:
except (ComponentPreparationError, OverflowError, _AmbiguousSBendOutlineError) as exc:
return f"segment {index} ({type(segment).__name__}) {exc}"
return None
@ -68,8 +68,8 @@ def materialize_path_seed(
for index, segment in enumerate(seed.segments, start=1):
kind, parameters = seed_move(segment)
template = search.sbend_template(segment.offset, segment.radius, net_width) if isinstance(segment, SBendSeed) else None
try:
template = search.sbend_template(segment.offset, segment.radius, net_width) if isinstance(segment, SBendSeed) else None
component = build_component(
current,
net_width,
@ -83,7 +83,7 @@ def materialize_path_seed(
bounds=None if diagnostic else bounds,
physical_length=search.bend_physical_length if kind == "bend90" else (template.length if template else None),
)
except (ComponentPreparationError, OverflowError) as exc:
except (ComponentPreparationError, OverflowError, _AmbiguousSBendOutlineError) as exc:
if diagnostic:
raise SeedMaterializationError(f"segment {index} ({type(segment).__name__}) {exc}") from exc
return None