|
|
|
|
@ -2035,6 +2035,68 @@ class AutoRoutingTest(unittest.TestCase):
|
|
|
|
|
self.assertIn("Alternate Duct", second_labels)
|
|
|
|
|
self.assertNotIn("Direct Duct", second_labels)
|
|
|
|
|
|
|
|
|
|
def test_route_eplan_connections_prefers_unused_segments_occupied_by_existing_wires(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(100, 0, 20)],
|
|
|
|
|
label="Direct Duct",
|
|
|
|
|
project_uuid="project-1",
|
|
|
|
|
kind="WireDuct",
|
|
|
|
|
)
|
|
|
|
|
routing_network.create_route_carrier(
|
|
|
|
|
doc,
|
|
|
|
|
[app.Vector(0, 0, 20), app.Vector(0, 40, 20)],
|
|
|
|
|
label="Left Bridge",
|
|
|
|
|
project_uuid="project-1",
|
|
|
|
|
kind="WireDuct",
|
|
|
|
|
)
|
|
|
|
|
routing_network.create_route_carrier(
|
|
|
|
|
doc,
|
|
|
|
|
[app.Vector(0, 40, 20), app.Vector(100, 40, 20)],
|
|
|
|
|
label="Alternate Duct",
|
|
|
|
|
project_uuid="project-1",
|
|
|
|
|
kind="WireDuct",
|
|
|
|
|
)
|
|
|
|
|
routing_network.create_route_carrier(
|
|
|
|
|
doc,
|
|
|
|
|
[app.Vector(100, 40, 20), app.Vector(100, 0, 20)],
|
|
|
|
|
label="Right Bridge",
|
|
|
|
|
project_uuid="project-1",
|
|
|
|
|
kind="WireDuct",
|
|
|
|
|
)
|
|
|
|
|
auto_routing.route_eplan_connection_between_terminals(
|
|
|
|
|
doc,
|
|
|
|
|
start,
|
|
|
|
|
end,
|
|
|
|
|
wire_uuid="existing-wire",
|
|
|
|
|
)
|
|
|
|
|
payload = {
|
|
|
|
|
"project_uuid": "project-1",
|
|
|
|
|
"wires": [
|
|
|
|
|
{
|
|
|
|
|
"wire_id": "new-wire",
|
|
|
|
|
"start_terminal_uuid": "terminal-start",
|
|
|
|
|
"end_terminal_uuid": "terminal-end",
|
|
|
|
|
}
|
|
|
|
|
],
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
report = auto_routing.route_eplan_connections_from_payload(doc, payload)
|
|
|
|
|
|
|
|
|
|
route_labels = [
|
|
|
|
|
segment["carrier"]["label"]
|
|
|
|
|
for segment in report["routes"][0]["route_track"]["segments"]
|
|
|
|
|
]
|
|
|
|
|
self.assertIn("Alternate Duct", route_labels)
|
|
|
|
|
self.assertNotIn("Direct Duct", route_labels)
|
|
|
|
|
|
|
|
|
|
def test_route_eplan_connections_report_includes_collision_samples(self):
|
|
|
|
|
_install_fake_freecad()
|
|
|
|
|
terminal_objects, _wiring_objects, routing_network, auto_routing = _reload_modules()
|
|
|
|
|
|