|
|
|
|
@ -1918,6 +1918,55 @@ class AutoRoutingTest(unittest.TestCase):
|
|
|
|
|
][0]
|
|
|
|
|
self.assertTrue(any(abs(point.y - 10.0) <= 0.001 for point in second_wire.Points[1:-1]))
|
|
|
|
|
|
|
|
|
|
def test_route_eplan_connections_auto_lane_axis_offsets_perpendicular_to_shared_segment(self):
|
|
|
|
|
_install_fake_freecad()
|
|
|
|
|
terminal_objects, _wiring_objects, routing_network, auto_routing = _reload_modules()
|
|
|
|
|
app = sys.modules["FreeCAD"]
|
|
|
|
|
doc = FakeDocument()
|
|
|
|
|
terminal_objects.ensure_root_group(doc, "project-1")
|
|
|
|
|
_terminal(doc, terminal_objects, "TerminalStartA", "terminal-start-a", app.Vector(0, 0, 0))
|
|
|
|
|
_terminal(doc, terminal_objects, "TerminalEndA", "terminal-end-a", app.Vector(0, 100, 0))
|
|
|
|
|
_terminal(doc, terminal_objects, "TerminalStartB", "terminal-start-b", app.Vector(0, 0, 0))
|
|
|
|
|
_terminal(doc, terminal_objects, "TerminalEndB", "terminal-end-b", app.Vector(0, 100, 0))
|
|
|
|
|
routing_network.create_route_carrier(
|
|
|
|
|
doc,
|
|
|
|
|
[app.Vector(0, 0, 20), app.Vector(0, 100, 20)],
|
|
|
|
|
project_uuid="project-1",
|
|
|
|
|
kind="WireDuct",
|
|
|
|
|
)
|
|
|
|
|
payload = {
|
|
|
|
|
"project_uuid": "project-1",
|
|
|
|
|
"wires": [
|
|
|
|
|
{
|
|
|
|
|
"wire_id": "wire-a",
|
|
|
|
|
"start_terminal_uuid": "terminal-start-a",
|
|
|
|
|
"end_terminal_uuid": "terminal-end-a",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"wire_id": "wire-b",
|
|
|
|
|
"start_terminal_uuid": "terminal-start-b",
|
|
|
|
|
"end_terminal_uuid": "terminal-end-b",
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
report = auto_routing.route_eplan_connections_from_payload(
|
|
|
|
|
doc,
|
|
|
|
|
payload,
|
|
|
|
|
options={"lane_spacing": 10.0},
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
self.assertEqual(1, report["routes"][1]["lane"]["index"])
|
|
|
|
|
self.assertEqual("x", report["routes"][1]["lane"]["axis"])
|
|
|
|
|
routed_group = doc.getObject("QETWiring_04_Routed")
|
|
|
|
|
second_wire = [
|
|
|
|
|
wire
|
|
|
|
|
for wire in list(getattr(routed_group, "Group", []) or [])
|
|
|
|
|
if getattr(wire, "QetWireUuid", "") == "wire-b"
|
|
|
|
|
][0]
|
|
|
|
|
self.assertTrue(any(abs(point.x - 10.0) <= 0.001 for point in second_wire.Points[1:-1]))
|
|
|
|
|
self.assertFalse(all(abs(point.x) <= 0.001 for point in second_wire.Points[1:-1]))
|
|
|
|
|
|
|
|
|
|
def test_route_eplan_connections_report_includes_collision_samples(self):
|
|
|
|
|
_install_fake_freecad()
|
|
|
|
|
terminal_objects, _wiring_objects, routing_network, auto_routing = _reload_modules()
|
|
|
|
|
|