|
|
|
|
@ -1499,6 +1499,55 @@ class AutoRoutingTest(unittest.TestCase):
|
|
|
|
|
self.assertEqual(2, result["wire_duct_open_end_carriers"])
|
|
|
|
|
self.assertEqual(0, result["terminal_access_carriers"])
|
|
|
|
|
|
|
|
|
|
def test_auto_routing_controller_exposes_terminal_access_max_distance(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, "TerminalStart", "terminal-start", app.Vector(0, 0, 0))
|
|
|
|
|
duct = doc.addObject("Part::Feature", "WireDuctFar")
|
|
|
|
|
duct.Label = "Wire Duct Far"
|
|
|
|
|
duct.Shape = FakeShape(FakeBoundBox(5000, 5100, -5, 5, 15, 25))
|
|
|
|
|
|
|
|
|
|
controller = auto_routing_panel.AutoRoutingController()
|
|
|
|
|
controller.set_terminal_access_max_distance(6000.0)
|
|
|
|
|
result = controller.generate_routing_paths()
|
|
|
|
|
|
|
|
|
|
self.assertEqual(1, result["terminal_access_carriers"])
|
|
|
|
|
self.assertEqual(6000.0, controller.routing_options()["terminal_access_max_distance"])
|
|
|
|
|
|
|
|
|
|
def test_auto_routing_controller_exposes_terminal_exit_length(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, "TerminalStart", "terminal-start", app.Vector(50, 0, 0))
|
|
|
|
|
duct = doc.addObject("Part::Feature", "WireDuctA")
|
|
|
|
|
duct.Label = "Wire Duct A"
|
|
|
|
|
duct.Shape = FakeShape(FakeBoundBox(0, 100, -5, 5, 15, 25))
|
|
|
|
|
|
|
|
|
|
controller = auto_routing_panel.AutoRoutingController()
|
|
|
|
|
controller.set_terminal_exit_length(40.0)
|
|
|
|
|
controller.generate_routing_paths()
|
|
|
|
|
access_carriers = [
|
|
|
|
|
carrier
|
|
|
|
|
for carrier in routing_network.collect_route_carriers(doc)
|
|
|
|
|
if getattr(carrier, "QetRouteCarrierKind", "") == "TerminalAccess"
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
self.assertEqual(1, len(access_carriers))
|
|
|
|
|
self.assertEqual(
|
|
|
|
|
(50.0, 0.0, 40.0),
|
|
|
|
|
tuple(getattr(access_carriers[0].Points[0], axis) for axis in ("x", "y", "z")),
|
|
|
|
|
)
|
|
|
|
|
self.assertEqual(40.0, controller.routing_options()["terminal_exit_length"])
|
|
|
|
|
|
|
|
|
|
def test_route_eplan_connections_prepares_layout_space_like_eplan_route(self):
|
|
|
|
|
_install_fake_freecad()
|
|
|
|
|
terminal_objects, _wiring_objects, _routing_network, _auto_routing = _reload_modules()
|
|
|
|
|
|