From 3a7177764e26065c7533fff2752ed8190b4f78be Mon Sep 17 00:00:00 2001 From: MTronics Date: Tue, 23 Dec 2025 12:48:14 +0100 Subject: [PATCH 1/2] Issue #26343: CAM Tasks panel ignores selected Stock The current code in \src\Mod\CAM\Path\Main\Gui\Job.py (line 719) ignores selected stock selections. In case of e.g. cloned stock objects it defaults to the first item in the combolist, showing a wrong stock selection. The cause lies in comparing different strings to find a label match, but one string object is generic (short name) while the other one has a suffix created during the clone process. The strings never match and the ridgid string comparison fails. I recommend using a partial (needle in haystack) string comparison. --- src/Mod/CAM/Path/Main/Gui/Job.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Mod/CAM/Path/Main/Gui/Job.py b/src/Mod/CAM/Path/Main/Gui/Job.py index 73430177fd..174431d14b 100644 --- a/src/Mod/CAM/Path/Main/Gui/Job.py +++ b/src/Mod/CAM/Path/Main/Gui/Job.py @@ -717,7 +717,13 @@ class StockFromExistingEdit(StockEdit): for i, solid in enumerate(self.candidates(obj)): self.form.stockExisting.addItem(solid.Label, solid) label = "{}-{}".format(self.StockLabelPrefix, solid.Label) - if label == stockName: + + # stockName has index suffix (since cloned), label has no index + # => ridgid string comparison fails + # Instead of ridgid string comparsion use partial (needle in haystack) + # string comparison + #if label == stockName: # ridgid string comparison + if label in stockName: # partial string comparison index = i self.form.stockExisting.setCurrentIndex(index if index != -1 else 0) From 1763f46abf0bebdb86276089640c06f665dee825 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 23 Dec 2025 12:07:36 +0000 Subject: [PATCH 2/2] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/Mod/CAM/Path/Main/Gui/Job.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Mod/CAM/Path/Main/Gui/Job.py b/src/Mod/CAM/Path/Main/Gui/Job.py index 174431d14b..509a5af80e 100644 --- a/src/Mod/CAM/Path/Main/Gui/Job.py +++ b/src/Mod/CAM/Path/Main/Gui/Job.py @@ -722,7 +722,7 @@ class StockFromExistingEdit(StockEdit): # => ridgid string comparison fails # Instead of ridgid string comparsion use partial (needle in haystack) # string comparison - #if label == stockName: # ridgid string comparison + # if label == stockName: # ridgid string comparison if label in stockName: # partial string comparison index = i