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.
This commit is contained in:
MTronics
2025-12-23 12:48:14 +01:00
parent d15347d2ad
commit 3a7177764e

View File

@@ -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)