|
|
|
|
@ -889,6 +889,82 @@ class AutoRoutingTest(unittest.TestCase):
|
|
|
|
|
self.assertEqual(20.0, min(x_values))
|
|
|
|
|
self.assertEqual(140.0, max(x_values))
|
|
|
|
|
|
|
|
|
|
def test_auto_detect_support_surface_adds_missing_routing_range_lanes_after_resize(self):
|
|
|
|
|
_install_fake_freecad()
|
|
|
|
|
terminal_objects, _wiring_objects, routing_network, _auto_routing = _reload_modules()
|
|
|
|
|
doc = FakeDocument()
|
|
|
|
|
terminal_objects.ensure_root_group(doc, "project-1")
|
|
|
|
|
panel = doc.addObject("Part::Feature", "MountingPlateA")
|
|
|
|
|
panel.Label = "安装板A"
|
|
|
|
|
panel.Shape = FakeShape(FakeBoundBox(0, 120, 0, 5, 0, 100))
|
|
|
|
|
|
|
|
|
|
created = routing_network.create_surface_carriers_from_document(
|
|
|
|
|
doc,
|
|
|
|
|
project_uuid="project-1",
|
|
|
|
|
spacing=60.0,
|
|
|
|
|
offset=5.0,
|
|
|
|
|
margin=0.0,
|
|
|
|
|
)
|
|
|
|
|
panel.Shape = FakeShape(FakeBoundBox(0, 180, 0, 5, 0, 120))
|
|
|
|
|
created_again = routing_network.create_surface_carriers_from_document(
|
|
|
|
|
doc,
|
|
|
|
|
project_uuid="project-1",
|
|
|
|
|
spacing=60.0,
|
|
|
|
|
offset=5.0,
|
|
|
|
|
margin=0.0,
|
|
|
|
|
)
|
|
|
|
|
carriers = [
|
|
|
|
|
carrier
|
|
|
|
|
for carrier in routing_network.collect_route_carriers(doc)
|
|
|
|
|
if getattr(carrier, "QetRouteCarrierKind", "") == "RoutingRange"
|
|
|
|
|
]
|
|
|
|
|
x_values = [point.x for carrier in carriers for point in carrier.Points]
|
|
|
|
|
z_values = [point.z for carrier in carriers for point in carrier.Points]
|
|
|
|
|
|
|
|
|
|
self.assertEqual(6, len(created))
|
|
|
|
|
self.assertEqual(1, len(created_again))
|
|
|
|
|
self.assertEqual(7, len(carriers))
|
|
|
|
|
self.assertEqual(180.0, max(x_values))
|
|
|
|
|
self.assertEqual(120.0, max(z_values))
|
|
|
|
|
|
|
|
|
|
def test_auto_detect_support_surface_removes_stale_routing_range_lanes_after_resize(self):
|
|
|
|
|
_install_fake_freecad()
|
|
|
|
|
terminal_objects, _wiring_objects, routing_network, _auto_routing = _reload_modules()
|
|
|
|
|
doc = FakeDocument()
|
|
|
|
|
terminal_objects.ensure_root_group(doc, "project-1")
|
|
|
|
|
panel = doc.addObject("Part::Feature", "MountingPlateA")
|
|
|
|
|
panel.Label = "安装板A"
|
|
|
|
|
panel.Shape = FakeShape(FakeBoundBox(0, 120, 0, 5, 0, 100))
|
|
|
|
|
|
|
|
|
|
created = routing_network.create_surface_carriers_from_document(
|
|
|
|
|
doc,
|
|
|
|
|
project_uuid="project-1",
|
|
|
|
|
spacing=60.0,
|
|
|
|
|
offset=5.0,
|
|
|
|
|
margin=0.0,
|
|
|
|
|
)
|
|
|
|
|
panel.Shape = FakeShape(FakeBoundBox(0, 60, 0, 5, 0, 60))
|
|
|
|
|
created_again = routing_network.create_surface_carriers_from_document(
|
|
|
|
|
doc,
|
|
|
|
|
project_uuid="project-1",
|
|
|
|
|
spacing=60.0,
|
|
|
|
|
offset=5.0,
|
|
|
|
|
margin=0.0,
|
|
|
|
|
)
|
|
|
|
|
carriers = [
|
|
|
|
|
carrier
|
|
|
|
|
for carrier in routing_network.collect_route_carriers(doc)
|
|
|
|
|
if getattr(carrier, "QetRouteCarrierKind", "") == "RoutingRange"
|
|
|
|
|
]
|
|
|
|
|
x_values = [point.x for carrier in carriers for point in carrier.Points]
|
|
|
|
|
z_values = [point.z for carrier in carriers for point in carrier.Points]
|
|
|
|
|
|
|
|
|
|
self.assertEqual(6, len(created))
|
|
|
|
|
self.assertEqual(0, len(created_again))
|
|
|
|
|
self.assertEqual(4, len(carriers))
|
|
|
|
|
self.assertEqual(60.0, max(x_values))
|
|
|
|
|
self.assertEqual(60.0, max(z_values))
|
|
|
|
|
|
|
|
|
|
def test_eplan_connection_route_can_use_auto_detected_support_surface(self):
|
|
|
|
|
_install_fake_freecad()
|
|
|
|
|
terminal_objects, _wiring_objects, routing_network, auto_routing = _reload_modules()
|
|
|
|
|
|