|
|
|
|
@ -1028,6 +1028,49 @@ class AutoRoutingTest(unittest.TestCase):
|
|
|
|
|
self.assertEqual(report["total_length_mm"], report["routes"][0]["length_mm"])
|
|
|
|
|
self.assertIn("总长度", message)
|
|
|
|
|
|
|
|
|
|
def test_route_all_report_keeps_route_identity_and_diagnostics(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, "TerminalStart", "terminal-start", app.Vector(0, 0, 0))
|
|
|
|
|
_terminal(doc, terminal_objects, "TerminalEnd", "terminal-end", app.Vector(100, 0, 0))
|
|
|
|
|
routing_network.create_route_carrier(
|
|
|
|
|
doc,
|
|
|
|
|
[app.Vector(0, 0, 20), app.Vector(100, 0, 20)],
|
|
|
|
|
project_uuid="project-1",
|
|
|
|
|
kind="WireDuct",
|
|
|
|
|
)
|
|
|
|
|
payload = {
|
|
|
|
|
"project_uuid": "project-1",
|
|
|
|
|
"wires": [
|
|
|
|
|
{
|
|
|
|
|
"wire_id": "wire-1",
|
|
|
|
|
"wire_label": "N4111",
|
|
|
|
|
"wire_style_id": "42",
|
|
|
|
|
"start_terminal_uuid": "terminal-start",
|
|
|
|
|
"end_terminal_uuid": "terminal-end",
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
report = auto_routing.route_all_from_payload(
|
|
|
|
|
doc,
|
|
|
|
|
payload,
|
|
|
|
|
options={"lane_spacing": 12.0, "lane_axis": "y"},
|
|
|
|
|
)
|
|
|
|
|
route = report["routes"][0]
|
|
|
|
|
|
|
|
|
|
self.assertEqual("wire-1", route["wire_uuid"])
|
|
|
|
|
self.assertEqual("N4111", route["wire_label"])
|
|
|
|
|
self.assertEqual("42", route["wire_style_id"])
|
|
|
|
|
self.assertEqual("terminal-start", route["start_terminal_uuid"])
|
|
|
|
|
self.assertEqual("terminal-end", route["end_terminal_uuid"])
|
|
|
|
|
self.assertEqual(0, route["lane"]["index"])
|
|
|
|
|
self.assertEqual("network-dijkstra-v1", route["algorithm"])
|
|
|
|
|
self.assertEqual(1, route["network"]["carriers"])
|
|
|
|
|
|
|
|
|
|
def test_route_all_report_calls_out_local_unbound_terminals(self):
|
|
|
|
|
_install_fake_freecad()
|
|
|
|
|
terminal_objects, _wiring_objects, _routing_network, auto_routing = _reload_modules()
|
|
|
|
|
|