CAM: Add comprehensive TSP tunnel solver tests and wrapper function

Added extensive test coverage for the TSP tunnel solver including linear
 tunnels, pentagram diagonals, and complex wire geometries with various
 constraint combinations. Introduced a Python wrapper function for
 tunnel sorting that integrates with the C++ solver.

src/Mod/CAM/CAMTests/TestTSPSolver.py:
- Renumbered existing tests to run in sequential order
(test_01_simple_tsp, test_02_start_point, etc.)
- Added print_tunnels() helper function for displaying tunnel
information with original indices
- Added test_06_tunnels_tsp: Tests 7 linear tunnels with varying
lengths, connectivity, and flipping behavior
- Added test_07_pentagram_tunnels_tsp: Tests pentagram diagonal tunnels
 with no constraints, start+end constraints, and start-only constraints
- Added test_08_open_wire_end_only: Tests end-only constraint on complex
 wire with 8 tunnels including crossings and diagonals

src/Mod/CAM/PathScripts/PathUtils.py:
- Added sort_tunnels_tsp() wrapper function that interfaces with the C++
tsp_solver.solveTunnels()
- Supports allowFlipping, routeStartPoint, and routeEndPoint parameters
This commit is contained in:
Billy Huddleston
2025-12-14 15:51:16 -05:00
parent b6607a5472
commit 12106c1b30
5 changed files with 272 additions and 11 deletions

View File

@@ -329,7 +329,7 @@ std::vector<TSPTunnel> TSPSolver::solveTunnels(
// Set original indices
for (size_t i = 0; i < tunnels.size(); ++i) {
tunnels[i].originalIdx = static_cast<int>(i);
tunnels[i].index = static_cast<int>(i);
}
// STEP 1: Add the routeStartPoint (will be deleted at the end)