Commit Graph

23 Commits

Author SHA1 Message Date
Billy Huddleston
ec2a41b86b CAM: Fix ReferenceError when accessing deleted toolbit object
Prevent crash (CAMTests) in ToolBitRecomputeObserver when the toolbit object has been deleted/missing
by catching ReferenceError before accessing its Document attribute. This ensures slotRecomputedDocument
exits gracefully if the object is no longer valid.

src/Mod/CAM/Path/Tool/toolbit/models/base.py
- Wrapped access to self.toolbit_proxy.obj.Document in try/except to handle ReferenceError
if object is deleted/missing, preventing crash during document recompute.
2025-11-10 18:44:02 -06:00
Billy Huddleston
871ab6df64 CAM: Fix infinite recompute loop when ToolBit properties use expressions
A bug in the ToolBit model caused an infinite recompute loop and UI freeze when properties such as Diameter, Flutes, or CuttingEdgeHeight were set to expressions. The visual representation update was being triggered during document recompute, which could recursively trigger further recomputes. This fix defers visual updates by queuing them and processing only after the document recompute completes, using a document observer. The observer is cleaned up after use and on object deletion, preventing memory leaks and repeated recompute cycles.

src/Mod/CAM/Path/Tool/toolbit/models/base.py:
- ToolBitRecomputeObserver: Document observer class that triggers queued visual updates after recompute completes via slotRecomputedDocument.
- _queue_visual_update: Queues a visual update to be processed after document recompute.
- _setup_recompute_observer: Registers the document observer for recompute completion.
- _process_queued_visual_update: Processes the queued visual update and cleans up the observer.
- onChanged: Now queues visual updates instead of calling them directly.
- onDelete: Cleans up any pending document observer before object removal.
2025-11-10 10:43:15 -06:00
PhoneDroid
ba99bc5da4 [ CAM ]: Update SPDX License Identifiers 2025-10-31 17:00:32 -04:00
Billy Huddleston
906edf7078 Promote embedded toolbits to correct shape type during migration
- Enhance _promote_toolbit to handle embedded toolbits that still have a "Custom" shape type.
- If ShapeType is "Custom" but ShapeID is present, attempt to promote to the correct shape class using ShapeID.
- Log promotion for traceability.
- This improves migration of legacy embedded toolbits and ensures proper shape assignment.
2025-10-15 18:04:40 -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
Billy Huddleston
4a6991b771 CAM: Fix Topo recomputation by only updating when values change in Toolbits
- Use PathUtil.setProperty instead of direct setattr for schema properties to ensure proper FreeCAD notifications.
- Only update custom shape properties if the value has changed, reducing unnecessary recomputation.
- For SpindleDirection and Material, only update the property if the new value differs from the current value, and use PathUtil.setProperty for consistency.
- This prevents overwriting existing values with defaults and avoids triggering unwanted recomputation.
2025-10-02 18:56:53 -04:00
Billy Huddleston
695cb49345 CAM: Fix SpindleDirection and Material not updating from toolbit files; reduce log noise
- Change missing property log in shape/doc.py from warning to debug
- Ensure SpindleDirection property exists and is set, defaulting to "Forward"
- Ensure Material property exists and is set, defaulting to "HSS"
- Update SpindleDirection and Material from toolbit file parameters if provided
2025-09-25 13:21:57 -04:00
Billy
81faf7727c CAM: Remove hardcoded style for Tool Number, Fix TestPathToolBitSerializer
Fix issue with toolshapes
Renamed fillet to radius
Added Tool Type Filter to library
Fix units so that they honor user preference
Remove the QToolBox widget from the Shape Selector page and combine into a single page.
Fix issue with PropertyBag so that CustomPropertyGroups as a string is converted to enum and enums are handled correctly.
Update TestPathPropertyBag test for enum changes.
Update TestPathToolBitListWidget
Update TestPathToolLibrarySerializer to match new LinuxCNC output
Fix LinuxCNC export too handle ALL tool types, use user preferences for units, and include all lcnc fields
2025-09-12 14:18:33 -04:00
Samuel Abels
2168e3cd99 CAM: Add AssetManager.copy() and .deepcopy()
CAM: Add copy/paste support for the ToolBitBrowser

CAM: Move library dropdown and sort order combo to dedicated row to give them more space

CAM: Fix: PathAssetManagerTest failed

CAM: Add YamlSerializer

[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

CAM: Fix CodeQL complaints

CAM: add LibraryProperties dialog

CAM: Replace the LibraryEditor

CAM: allow for editing tool number in the tool editor dialog

CAM: Remember last selected library and sort order in preferences

CAM: support natural sort order in tool and library lists

CAM: Fix CodeQL complaints

CAM: Fix: not all attributes included in YAML serialization

CAM: Fix: UTF8 chars not included in LinuxCNC export

Fix: tool library not displayed when loading it for the first time

CAM: Fix: custom shape class not found

CAM: Check dependencies on import for friendlier error messages

CAM: Open file dialogs in home by default

CAM: Show "All Tools" entry in library list in the library editor

CAM: fix: error on sorting tools with no tool number

CAM: Fix: traceback if library contained tool number as string

CAM: Fix: Linter errors in manager.py

CAM: Fix: separator between library and tool buttons

CAM: Add drag & drop support to the library editor

CAM: Fix numerous linter errors on the AssetManager

CAM: Show current library in library editor window title

CAM: Add dedicated icons for library add + remove

CAM: Support F2 key in library editor

CAM: library editor handles delete key when library list is in focus; focus search field by default

CAM: fix: tool list in dock initially not loading

CAM: Fix: library editor did not open from "all tools" list

CAM: Increase precision of parameters in tool summary to 3 digits

fix TestToolBitListWidget
2025-09-11 10:45:41 -05:00
Samuel Abels
16d90cfbb9 CAM: Fix: shape parameters coming from the attributes section in the fctb file were not normalized 2025-06-30 21:48:21 +02:00
Samuel Abels
da8eec5744 CAM: Fix: ToolBitShapeCustom properties not editable if they had no type specified in the schema 2025-06-29 21:34:06 +02:00
Samuel Abels
11d5707141 CAM: Fix: custom shape attributes not showing in toolbit editor 2025-06-29 01:30:06 +02:00
Samuel Abels
07d466e1fb CAM: move DetachedDocumentObject into a dedicated module for better reuse 2025-06-12 17:01:36 +02:00
Samuel Abels
d2f2befaa9 CAM: Handle import of unknown shape types gracefully; allow case insensitive filenames, and allow invalid tool ID data type 2025-05-29 19:50:51 +02:00
Samuel Abels
80bce9498f CAM: Fix: ShapeType not displayed correctly in property editor 2025-05-27 12:46:12 +02:00
Samuel Abels
857d7269ee CAM: Improved handling of toolbit shape type inference 2025-05-27 12:07:19 +02:00
Samuel Abels
7e635bed46 CAM: Refactor ToolBit.from_dict() for clarity and to generate more relevant warnings 2025-05-27 09:30:35 +02:00
Samuel Abels
57ca27c22f CAM: Fix: Only attach view if the Gui is up 2025-05-26 19:13:00 +02:00
Samuel Abels
107cbcac38 CAM: Fix: viewprovider not added when adding a tool to a document from the dock 2025-05-26 18:16:23 +02:00
pre-commit-ci[bot]
546e1cd1b9 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2025-05-19 22:45:31 +00:00
Samuel Abels
2f7bb39eb7 CAM: Handle shape schema violations gracefully (for now) 2025-05-20 00:07:26 +02:00
pre-commit-ci[bot]
9cb8cced38 [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
2025-05-19 18:31:11 +00:00
Samuel Abels
d749098dcb CAM: Replace complete tool management (PR 21425) 2025-05-19 20:27:28 +02:00