|
|
|
|
@ -1140,6 +1140,32 @@ class AutoRoutingTest(unittest.TestCase):
|
|
|
|
|
self.assertEqual(1, len(cut_out_carriers))
|
|
|
|
|
self.assertEqual("PassThrough", cut_out.QetRoutingObstacleMode)
|
|
|
|
|
|
|
|
|
|
def test_generate_routing_path_network_refreshes_wiring_cut_out_geometry(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")
|
|
|
|
|
cut_out = doc.addObject("Part::Feature", "WiringCutoutA")
|
|
|
|
|
cut_out.Label = "Wiring Cut-Out A"
|
|
|
|
|
cut_out.Shape = FakeShape(FakeBoundBox(45, 55, -2, 2, 15, 25))
|
|
|
|
|
|
|
|
|
|
first = auto_routing_panel.AutoRoutingController().generate_routing_paths()
|
|
|
|
|
cut_out.Shape = FakeShape(FakeBoundBox(65, 75, -2, 2, 15, 25))
|
|
|
|
|
second = auto_routing_panel.AutoRoutingController().generate_routing_paths()
|
|
|
|
|
cut_out_carriers = [
|
|
|
|
|
carrier
|
|
|
|
|
for carrier in routing_network.collect_route_carriers(doc)
|
|
|
|
|
if getattr(carrier, "QetRouteCarrierKind", "") == "WiringCutOut"
|
|
|
|
|
]
|
|
|
|
|
|
|
|
|
|
self.assertEqual(1, first["wiring_cut_out_carriers"])
|
|
|
|
|
self.assertEqual(0, second["wiring_cut_out_carriers"])
|
|
|
|
|
self.assertEqual(1, len(cut_out_carriers))
|
|
|
|
|
self.assertEqual([(70.0, -2.0, 20.0), (70.0, 2.0, 20.0)], [(p.x, p.y, p.z) for p in cut_out_carriers[0].Points])
|
|
|
|
|
|
|
|
|
|
def test_check_routing_path_network_writes_diagnostic_for_unconnected_terminal(self):
|
|
|
|
|
_install_fake_freecad()
|
|
|
|
|
terminal_objects, _wiring_objects, routing_network, auto_routing = _reload_modules()
|
|
|
|
|
|