Merge pull request #24234 from Connor9220/FixTooLibrarySpindleDirection

CAM: Fix SpindleDirection and Material not updating from toolbit files; reduce log noise
This commit is contained in:
sliptonic
2025-09-29 11:02:58 -05:00
committed by GitHub
2 changed files with 34 additions and 1 deletions

View File

@@ -127,7 +127,8 @@ def update_shape_object_properties(
f" ({obj.Name}) with value '{value}': {e}"
)
else:
Path.Log.warning(
# This simply means that the Shape File doesn't have this property in it.
Path.Log.debug(
f"Property '{name}' not found on object '{obj.Label}' ({obj.Name}). Skipping."
)

View File

@@ -711,6 +711,38 @@ class ToolBit(Asset, ABC):
PathUtil.setProperty(self.obj, name, value)
self.obj.setEditorMode(name, 0)
# 3. Ensure SpindleDirection property exists and is set
# Maybe this could be done with a global schema or added to each
# shape schema?
if not hasattr(self.obj, "SpindleDirection"):
self.obj.addProperty(
"App::PropertyEnumeration",
"SpindleDirection",
"Attributes",
QT_TRANSLATE_NOOP("App::Property", "Direction of spindle rotation"),
)
self.obj.SpindleDirection = ["Forward", "Reverse", "None"]
self.obj.SpindleDirection = "Forward" # Default value
spindle_value = self._tool_bit_shape.get_parameters().get("SpindleDirection")
if spindle_value in ("Forward", "Reverse", "None"):
self.obj.SpindleDirection = spindle_value
# 4. Ensure Material property exists and is set
if not hasattr(self.obj, "Material"):
self.obj.addProperty(
"App::PropertyEnumeration",
"Material",
"Attributes",
QT_TRANSLATE_NOOP("App::Property", "Tool material"),
)
self.obj.Material = ["HSS", "Carbide"]
self.obj.Material = "HSS" # Default value
material_value = self._tool_bit_shape.get_parameters().get("Material")
if material_value in ("HSS", "Carbide"):
self.obj.Material = material_value
def _update_visual_representation(self):
"""
Updates the visual representation of the tool bit based on the current