[AutoTool] fix exact s-bend validation
This commit is contained in:
parent
aa7007881f
commit
83ec64158a
2 changed files with 57 additions and 1 deletions
|
|
@ -1031,7 +1031,7 @@ class AutoTool(Tool, metaclass=ABCMeta):
|
|||
jog_remaining = jog - itrans_dxy[1] - otrans_dxy[1]
|
||||
if sbend.jog_range[0] <= jog_remaining < sbend.jog_range[1]:
|
||||
sbend_dxy = self._sbend2dxy(sbend, jog_remaining)
|
||||
success = numpy.isclose(length, sbend_dxy[0] + itrans_dxy[1] + otrans_dxy[1])
|
||||
success = numpy.isclose(length, sbend_dxy[0] + itrans_dxy[0] + otrans_dxy[0])
|
||||
if success:
|
||||
b_transition = None
|
||||
straight_length = 0
|
||||
|
|
|
|||
|
|
@ -108,6 +108,62 @@ def test_autotool_planS_double_L(multi_bend_tool) -> None:
|
|||
assert data.ldata1.straight_length == 0
|
||||
assert data.l2_length == 6
|
||||
|
||||
|
||||
def test_autotool_planS_pure_sbend_with_transition_dx() -> None:
|
||||
lib = Library()
|
||||
|
||||
def make_straight(length: float) -> Pattern:
|
||||
pat = Pattern()
|
||||
pat.ports["A"] = Port((0, 0), 0, ptype="core")
|
||||
pat.ports["B"] = Port((length, 0), pi, ptype="core")
|
||||
return pat
|
||||
|
||||
def make_sbend(jog: float) -> Pattern:
|
||||
pat = Pattern()
|
||||
pat.ports["A"] = Port((0, 0), 0, ptype="core")
|
||||
pat.ports["B"] = Port((10, jog), pi, ptype="core")
|
||||
return pat
|
||||
|
||||
trans_pat = Pattern()
|
||||
trans_pat.ports["EXT"] = Port((0, 0), 0, ptype="ext")
|
||||
trans_pat.ports["CORE"] = Port((5, 0), pi, ptype="core")
|
||||
lib["xin"] = trans_pat
|
||||
|
||||
tool = AutoTool(
|
||||
straights=[
|
||||
AutoTool.Straight(
|
||||
ptype="core",
|
||||
fn=make_straight,
|
||||
in_port_name="A",
|
||||
out_port_name="B",
|
||||
length_range=(1, 1e8),
|
||||
)
|
||||
],
|
||||
bends=[],
|
||||
sbends=[
|
||||
AutoTool.SBend(
|
||||
ptype="core",
|
||||
fn=make_sbend,
|
||||
in_port_name="A",
|
||||
out_port_name="B",
|
||||
jog_range=(0, 1e8),
|
||||
)
|
||||
],
|
||||
transitions={
|
||||
("ext", "core"): AutoTool.Transition(lib.abstract("xin"), "EXT", "CORE"),
|
||||
},
|
||||
default_out_ptype="core",
|
||||
)
|
||||
|
||||
p, data = tool.planS(15, 4, in_ptype="ext")
|
||||
|
||||
assert_allclose(p.offset, [15, 4])
|
||||
assert_allclose(p.rotation, pi)
|
||||
assert data.straight_length == 0
|
||||
assert data.jog_remaining == 4
|
||||
assert data.in_transition is not None
|
||||
|
||||
|
||||
def test_renderpather_autotool_double_L(multi_bend_tool) -> None:
|
||||
tool, lib = multi_bend_tool
|
||||
rp = RenderPather(lib, tools=tool)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue