|
|
|
|
@ -1241,6 +1241,59 @@ class AutoRoutingTest(unittest.TestCase):
|
|
|
|
|
self.assertEqual(1, route["network"]["carriers"])
|
|
|
|
|
self.assertEqual("WireDuct", route["route_track"]["segments"][0]["carrier"]["kind"])
|
|
|
|
|
|
|
|
|
|
def test_route_eplan_connections_lane_index_is_per_terminal_pair(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(100, 0, 0))
|
|
|
|
|
_terminal(doc, terminal_objects, "TerminalStartB", "terminal-start-b", app.Vector(0, 100, 0))
|
|
|
|
|
_terminal(doc, terminal_objects, "TerminalEndB", "terminal-end-b", app.Vector(100, 100, 0))
|
|
|
|
|
routing_network.create_route_carrier(
|
|
|
|
|
doc,
|
|
|
|
|
[app.Vector(0, 0, 20), app.Vector(100, 0, 20)],
|
|
|
|
|
project_uuid="project-1",
|
|
|
|
|
kind="WireDuct",
|
|
|
|
|
)
|
|
|
|
|
routing_network.create_route_carrier(
|
|
|
|
|
doc,
|
|
|
|
|
[app.Vector(0, 100, 20), app.Vector(100, 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",
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
"wire_id": "wire-a-repeat",
|
|
|
|
|
"start_terminal_uuid": "terminal-start-a",
|
|
|
|
|
"end_terminal_uuid": "terminal-end-a",
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
report = auto_routing.route_eplan_connections_from_payload(
|
|
|
|
|
doc,
|
|
|
|
|
payload,
|
|
|
|
|
options={"lane_spacing": 10.0, "lane_axis": "y"},
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
self.assertEqual(0, report["routes"][0]["lane"]["index"])
|
|
|
|
|
self.assertEqual(0, report["routes"][1]["lane"]["index"])
|
|
|
|
|
self.assertEqual(1, report["routes"][2]["lane"]["index"])
|
|
|
|
|
|
|
|
|
|
def test_route_eplan_connections_report_includes_collision_samples(self):
|
|
|
|
|
_install_fake_freecad()
|
|
|
|
|
terminal_objects, _wiring_objects, routing_network, auto_routing = _reload_modules()
|
|
|
|
|
|