|
|
|
|
@ -1771,6 +1771,49 @@ class AutoRoutingTest(unittest.TestCase):
|
|
|
|
|
self.assertEqual(14.0, report["routes"][1]["lane"]["spacing_mm"])
|
|
|
|
|
self.assertEqual(14.0, report["routes"][1]["lane"]["offset_mm"])
|
|
|
|
|
|
|
|
|
|
def test_auto_routing_controller_exposes_lane_axis(self):
|
|
|
|
|
_install_fake_freecad()
|
|
|
|
|
terminal_objects, _wiring_objects, routing_network, _auto_routing = _reload_modules()
|
|
|
|
|
auto_routing_panel = importlib.import_module("AutoRoutingPanel")
|
|
|
|
|
app = sys.modules["FreeCAD"]
|
|
|
|
|
doc = FakeDocument()
|
|
|
|
|
app.ActiveDocument = doc
|
|
|
|
|
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",
|
|
|
|
|
)
|
|
|
|
|
app._qet_exchange_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",
|
|
|
|
|
},
|
|
|
|
|
],
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
controller = auto_routing_panel.AutoRoutingController()
|
|
|
|
|
controller.set_lane_spacing(8.0)
|
|
|
|
|
controller.set_lane_axis("z")
|
|
|
|
|
report = controller.route_eplan_connections()
|
|
|
|
|
|
|
|
|
|
self.assertEqual("z", controller.routing_options()["lane_axis"])
|
|
|
|
|
self.assertEqual("z", report["routes"][1]["lane"]["axis"])
|
|
|
|
|
self.assertEqual(8.0, report["routes"][1]["lane"]["offset_mm"])
|
|
|
|
|
|
|
|
|
|
def test_eplan_connection_route_rejects_far_network_entry_to_avoid_huge_render_bbox(self):
|
|
|
|
|
_install_fake_freecad()
|
|
|
|
|
terminal_objects, _wiring_objects, routing_network, auto_routing = _reload_modules()
|
|
|
|
|
|