Commit Graph

22 Commits

Author SHA1 Message Date
Daniel Khodabakhsh
8d3c786656 Fix case when CAM operation start = stop and step down is zero. 2026-02-08 15:30:19 -08:00
Daniel-Khodabakhsh
1c90c1ec44 CAM: Fix case when CAM operation Safe height, Start depth, and Final depth are the same value. (#27258)
Co-authored-by: Daniel Khodabakhsh <d@niel.khodabakh.sh>
2026-02-02 18:03:59 +01:00
Billy Huddleston
095cdb14a7 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
2025-12-14 16:45:51 -05:00
Billy Huddleston
005cbb937d Rewrite TSP solver for improved path optimization and clarity
- Completely re-implemented the TSP algorithm in C++ for better path quality
- Added detailed comments and documentation to clarify each step
- Improved nearest neighbor, 2-opt, and relocation logic
- Enhanced handling of start/end point constraints
- Updated PathUtils.py docstring to accurately describe start point behavior
2025-12-12 19:39:29 -05:00
Billy Huddleston
428948699a Add startPoint and endPoint support to TSP solver and Python wrapper; add tests
- Enhanced the C++ TSP solver to accept optional start and end points, so the route can begin and/or end at the closest point to specified coordinates.
- Updated the Python pybind11 wrapper and PathUtils.sort_locations_tsp to support startPoint and endPoint as named parameters.
- Added a new Python test suite (TestTSPSolver.py) to verify correct handling of start/end points and integration with PathUtils.
- Registered the new test in TestCAMApp.py and CMakeLists.txt for automatic test discovery.
2025-12-12 19:39:28 -05:00
Billy Huddleston
f9347c781b Add 2-Opt TSP solver
This update introduces a new C++ 2-Opt TSP solver with Python bindings.

src/Mod/CAM/App/CMakeLists.txt:
- Add build and install rules for the new pybind11-based tsp_solver Python module

src/Mod/CAM/App/tsp_solver.cpp:
- Add new C++ implementation of a 2-Opt TSP solver with nearest-neighbor initialization

src/Mod/CAM/App/tsp_solver.h:
- Add TSPPoint struct and TSPSolver class with 2-Opt solve method

src/Mod/CAM/App/tsp_solver_pybind.cpp:
- Add pybind11 wrapper exposing the TSP solver to Python as tsp_solver.solve

src/Mod/CAM/PathScripts/PathUtils.py:
- Add sort_locations_tsp Python wrapper for the C++ TSP solver
- Use tsp_solver.solve for TSP-based
2025-12-12 19:39:28 -05:00
sliptonic
db65e44bca CAM: fixes bug with op creation/cancelation (#25800) 2025-12-01 10:59:49 -06:00
tarman3
ec5b9a808d CAM: SelectLoop improve 2025-11-13 23:29:17 +02:00
pre-commit-ci[bot]
f413a569b3 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2025-10-31 21:06:39 +00:00
PhoneDroid
ba99bc5da4 [ CAM ]: Update SPDX License Identifiers 2025-10-31 17:00:32 -04:00
ᴩʜᴏɴᴇᴅʀᴏɪᴅ
cab1261a42 CAM: Remove UTF-8 coding declarations (#24527)
These declarations are no longer needed for Python 3+.
2025-10-09 13:49:18 -05:00
sliptonic
4c04586d1e Merge pull request #21756 from papaathome/CAM-fix-for-3Dsurface,-rotational-path,-#21556
CAM: Update PathUtils.py
2025-09-23 09:21:41 -05:00
tarman3
0336185ec1 CAM: Improve SelectLoop (#23275) 2025-09-12 09:42:20 -05:00
David Kaufman
540ce39cb1 [CAM] Add UI elements for viewing and editing tool controller parameters from within the operation edit UI (#23180)
* [CAM] extract tool controller ui elements into their own file

* [CAM] make the changes in the tool controller UI only apply when ok is clicked

* [CAM] Add tool controller edit panel to the Profile operation

* [CAM] Add copy button to in-operation tool controller editor

* [CAM] clean up changes

* [CAM] Add tool controller edit UI to all operations

Notes on changes that were not a simple copy/paste job from the changes
I made for Profile:

- Deburr: changed TC/coolant rows from 1 and 2 to 0 and 1

- Probe: didn't work at all initially due to bug in main where ShapeName
  changed to ShapeType. I added a utility for reading either a ShapeType
or a ShapeName (check for both properties, convert ShapeType to lower
case) and applied it to probe and camotics

- Drilling: moved Keep Tool Down checkbox up from row 8 to row 2 (all
  intermediate rows were missing) and added the edit checkbox in row 3
below it

- VBit, Probe (or anything else that requires a specific tool type): in
  Base.py setupToolController(), I added a check to see if the currently
selected tool is an invalid type, and if so and there is a valid tool,
then change to that one. This fixes two UI bugs. Plausibly pre-existing,
if there is one valid tool and an invalid tool is selected, it's
impossible to switch to the valid one because you can't generate a combo
box change event for the new tool. Definitely new: if an invalid tool is
selected and there are no valid tools, the combo box will be empty but
the new tool controller edit utility will let you edit the current TC
anyway.

- Thread Milling: replaced the Tool Controller GroupBox with the
  standard QFrame layout, and added the checkbox. Note that this
operation doesn't have a UI element for coolant -- likely a bug, but I
didn't look into it

- Surface: Changed from form layout to grid layout. Deleted an old
  SurfaceEdit.ui file -- it was replaced with PageOpSurfaceEdit.ui in
2017 but not deleted (commit 8637831132)

- Waterline: Changed from form layout to grid layout

* [CAM] Bug fixes

setupUi() wasn't called on the tool controller editor, preventing
changes in its UI from being written back to the object immediately.
This caused weird behavior where if you edited a field twice it would
reset the second time it was focused

Added a hook to automatically update the TC combo box when the TC name
(or anything else about it, since that was easier) changes

* Fix usage of QSignalBlockers

* [CAM] Block scroll events on tool number and spindle direction when not
focused

Specifically, if you mouse over either of these UI elements and use the
scroll wheel, it used to focus the element and change its value. This
commit makes it do neither of those things, for these specific elements,
as a measure against users accidentally changing these values.

* disable tcNumber edit field in operations panel

* Add "New tool controller" option to TC combo box

When selected, it opens (toggles, technically) the tool bit dock and
returns to the previous selection. Adding a new tool controller using
the dock (already, before this commit) automatically switches the
operation's tool controller to the new one

* Add "Copy" option to tool controller combo box

* Copy TC function only in combo box, no button

* [CAM] update in-operation "new tool controller" function to use a dialog

* [CAM] make the tool selector always a dialog and never a dock

* remove spacer from ToolControllerEdit.ui to fix exces white space

* [CAM] change tool dialog default sizing/spacing

* [CAM] fix bug where copying tool controller doesn't copy all values
2025-09-02 10:19:33 -05:00
Balazs Nagy
2688f06dd1 find job in parent chain (#21742) 2025-06-22 09:18:07 -05:00
papaathome
fc92b2ba90 Update PathUtils.py
Removed typo ('.') at line 838
2025-06-04 17:28:46 +02:00
papaathome
047e39389f CAM: Update PathUtils.py
Proposed fix for `CAM: 3Dsurface, rotational path, difference between X/A and Y/B paths #21556`
2025-06-04 09:50:02 +02:00
pre-commit-ci[bot]
c8b72c144e [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2025-02-03 22:51:14 +00:00
Adrian Insaurralde Avalos
7274dac185 CAM: apply precommit 2024-09-03 14:54:36 -04:00
Max Wilfinger
7d21d9edb8 Fix source string typos mentioned on Crowdin (#15261) 2024-07-08 17:18:31 -05:00
sliptonic
7c3ca87e4a findParentJob will now return the original object if it is a job rather than None 2024-05-03 10:16:41 -05:00
Brad Collette
d041482ab7 move Path to CAM 2024-03-04 11:18:41 -06:00