|
|
|
|
@ -362,6 +362,40 @@ class AutoRoutingTest(unittest.TestCase):
|
|
|
|
|
self.assertEqual("terminal-start-new", routed_wires[0].QetStartTerminalUuid)
|
|
|
|
|
self.assertEqual("terminal-end-new", routed_wires[0].QetEndTerminalUuid)
|
|
|
|
|
|
|
|
|
|
def test_eplan_connection_route_keeps_existing_wire_when_replacement_fails(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)],
|
|
|
|
|
project_uuid="project-1",
|
|
|
|
|
kind="WireDuct",
|
|
|
|
|
)
|
|
|
|
|
first = auto_routing.route_eplan_connection_between_terminals(
|
|
|
|
|
doc,
|
|
|
|
|
start,
|
|
|
|
|
end,
|
|
|
|
|
wire_uuid="wire-1",
|
|
|
|
|
)["wire"]
|
|
|
|
|
routing_network.clear_route_carriers(doc)
|
|
|
|
|
|
|
|
|
|
with self.assertRaises(auto_routing.AutoRoutingError):
|
|
|
|
|
auto_routing.route_eplan_connection_between_terminals(
|
|
|
|
|
doc,
|
|
|
|
|
start,
|
|
|
|
|
end,
|
|
|
|
|
wire_uuid="wire-1",
|
|
|
|
|
)
|
|
|
|
|
routed_wires = list(wiring_objects.iter_routed_wire_objects(doc))
|
|
|
|
|
|
|
|
|
|
self.assertEqual([first], routed_wires)
|
|
|
|
|
self.assertIsNotNone(doc.getObject(first.Name))
|
|
|
|
|
|
|
|
|
|
def test_route_carrier_styles_make_generated_objects_distinguishable(self):
|
|
|
|
|
_install_fake_freecad()
|
|
|
|
|
terminal_objects, _wiring_objects, routing_network, _auto_routing = _reload_modules()
|
|
|
|
|
|