|
|
|
|
@ -815,6 +815,34 @@ class AutoRoutingTest(unittest.TestCase):
|
|
|
|
|
self.assertEqual("network-dijkstra-v1", result["algorithm"])
|
|
|
|
|
self.assertEqual("Routed", result["route_status"])
|
|
|
|
|
|
|
|
|
|
def test_route_graph_bridges_adjoining_user_path_to_wire_duct_gap(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")
|
|
|
|
|
routing_network.create_route_carrier(
|
|
|
|
|
doc,
|
|
|
|
|
[app.Vector(0, 0, 20), app.Vector(50, 0, 20)],
|
|
|
|
|
project_uuid="project-1",
|
|
|
|
|
kind="WireDuct",
|
|
|
|
|
)
|
|
|
|
|
routing_network.create_route_carrier(
|
|
|
|
|
doc,
|
|
|
|
|
[app.Vector(60, 0, 20), app.Vector(100, 0, 20)],
|
|
|
|
|
project_uuid="project-1",
|
|
|
|
|
kind="UserPath",
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
network = routing_network.build_route_graph(doc, adjoining_duct_tolerance=15.0)
|
|
|
|
|
start_key, _start_distance = routing_network.nearest_node(network, app.Vector(0, 0, 20))
|
|
|
|
|
end_key, _end_distance = routing_network.nearest_node(network, app.Vector(100, 0, 20))
|
|
|
|
|
result = routing_network.shortest_path_with_carriers(network, start_key, end_key)
|
|
|
|
|
|
|
|
|
|
self.assertEqual(1, network["bridged_segment_count"])
|
|
|
|
|
self.assertIsNotNone(result)
|
|
|
|
|
self.assertIn("UserPath", result["carrier_kinds"])
|
|
|
|
|
|
|
|
|
|
def test_auto_routing_respects_adjoining_duct_tolerance_option(self):
|
|
|
|
|
_install_fake_freecad()
|
|
|
|
|
terminal_objects, _wiring_objects, routing_network, auto_routing = _reload_modules()
|
|
|
|
|
@ -846,6 +874,39 @@ class AutoRoutingTest(unittest.TestCase):
|
|
|
|
|
self.assertEqual("Routed", result["route_status"])
|
|
|
|
|
self.assertEqual(1, result["network"]["bridged_segments"])
|
|
|
|
|
|
|
|
|
|
def test_auto_routing_uses_bridged_user_path_to_wire_duct_gap(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")
|
|
|
|
|
start = _terminal(doc, terminal_objects, "TerminalStart", "terminal-start", app.Vector(0, 0, 0))
|
|
|
|
|
end = _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(50, 0, 20)],
|
|
|
|
|
project_uuid="project-1",
|
|
|
|
|
kind="WireDuct",
|
|
|
|
|
)
|
|
|
|
|
routing_network.create_route_carrier(
|
|
|
|
|
doc,
|
|
|
|
|
[app.Vector(60, 0, 20), app.Vector(100, 0, 20)],
|
|
|
|
|
project_uuid="project-1",
|
|
|
|
|
kind="UserPath",
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
result = auto_routing.route_eplan_connection_between_terminals(
|
|
|
|
|
doc,
|
|
|
|
|
start,
|
|
|
|
|
end,
|
|
|
|
|
options={"adjoining_duct_tolerance": 15.0},
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
self.assertEqual("Routed", result["route_status"])
|
|
|
|
|
self.assertEqual(1, result["network"]["bridged_segments"])
|
|
|
|
|
self.assertIn("WireDuct", result["route_track"]["carrier_kinds"])
|
|
|
|
|
self.assertIn("UserPath", result["route_track"]["carrier_kinds"])
|
|
|
|
|
|
|
|
|
|
def test_connect_point_to_network_replaces_bridged_edge_without_stale_reverse_edge(self):
|
|
|
|
|
_install_fake_freecad()
|
|
|
|
|
_terminal_objects, _wiring_objects, routing_network, _auto_routing = _reload_modules()
|
|
|
|
|
@ -1981,7 +2042,7 @@ class AutoRoutingTest(unittest.TestCase):
|
|
|
|
|
|
|
|
|
|
message = auto_routing.format_routing_path_network_report(diagnostic)
|
|
|
|
|
|
|
|
|
|
self.assertIn("桥接 1 段", message)
|
|
|
|
|
self.assertIn("桥接 1 段相邻主路径", message)
|
|
|
|
|
|
|
|
|
|
def test_check_routing_path_network_uses_adjoining_duct_tolerance_option(self):
|
|
|
|
|
_install_fake_freecad()
|
|
|
|
|
@ -3203,7 +3264,7 @@ class AutoRoutingTest(unittest.TestCase):
|
|
|
|
|
|
|
|
|
|
message = auto_routing.format_eplan_connection_route_report(report)
|
|
|
|
|
|
|
|
|
|
self.assertIn("路径网络:自动桥接 1 段相邻线槽,避障屏蔽 2 段。", message)
|
|
|
|
|
self.assertIn("路径网络:自动桥接 1 段相邻主路径,避障屏蔽 2 段。", message)
|
|
|
|
|
|
|
|
|
|
def test_route_report_includes_parallel_lane_summary(self):
|
|
|
|
|
_install_fake_freecad()
|
|
|
|
|
|