[Pather] Major pathing rework / Consolidate RenderPather, Pather, and Builder
This commit is contained in:
parent
338c123fb1
commit
c3581243c8
9 changed files with 1393 additions and 2558 deletions
|
|
@ -97,3 +97,25 @@ def test_renderpather_dead_ports() -> None:
|
|||
# Verify no geometry
|
||||
rp.render()
|
||||
assert not rp.pattern.has_shapes()
|
||||
|
||||
|
||||
def test_renderpather_rename_port(rpather_setup: tuple[RenderPather, PathTool, Library]) -> None:
|
||||
rp, tool, lib = rpather_setup
|
||||
rp.at("start").straight(10)
|
||||
# Rename port while path is planned
|
||||
rp.rename_ports({"start": "new_start"})
|
||||
# Continue path on new name
|
||||
rp.at("new_start").straight(10)
|
||||
|
||||
assert "start" not in rp.paths
|
||||
assert len(rp.paths["new_start"]) == 2
|
||||
|
||||
rp.render()
|
||||
assert rp.pattern.has_shapes()
|
||||
assert len(rp.pattern.shapes[(1, 0)]) == 1
|
||||
# Total length 20. start_port rot pi/2 -> 270 deg transform.
|
||||
# Vertices (0,0), (0,-10), (0,-20)
|
||||
path_shape = cast("Path", rp.pattern.shapes[(1, 0)][0])
|
||||
assert_allclose(path_shape.vertices, [[0, 0], [0, -10], [0, -20]], atol=1e-10)
|
||||
assert "new_start" in rp.ports
|
||||
assert_allclose(rp.ports["new_start"].offset, [0, -20], atol=1e-10)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue