CAM: Convert tapping operation to experimental feature, Add tap pitch support, improve tapping logic, and update toolbit schema and legacy linuxcnc post

CAM/App/PathSegmentWalker.cpp
- Add G74 to drill/tap/bore G-code recognition for tapping cycles

CAM/InitGui.py
- Move CAM_Tapping command behind experimental feature flag
- Only group drilling/tapping commands if both are enabled

CAM/Path/Base/Generator/tapping.py
- Add pitch and spindle_speed parameters to tapping.generate
- Output S (spindle speed) and F (pitch) in generated G-code

CAM/Path/Op/Tapping.py
- Require Pitch property for tap tools and SpindleSpeed for tool controllers
- Pass pitch and spindle speed to tapping.generate
- Use SpindleDirection to determine right/left hand tap

CAM/Path/Post/scripts/linuxcnc_post.py
- Handle G84/G74 tapping cycles: convert pitch and spindle speed to feed rate
- Remove F and S from output and recalculate F as needed

CAM/Path/Tool/shape/models/tap.py
- Add Pitch property to ToolBitShapeTap schema
- CAM/Path/Tool/toolbit/models/tap.py
- Show pitch and rotation in tap tool summary
- Use is_imperial_pitch to format pitch as TPI or mm

CAM/Path/Tool/toolbit/util.py
- Add is_imperial_pitch utility to classify pitch as imperial or metric

CAM/Tools/Bit/375-16_Tap.fctb
- Remove unused parameters (Coating, Rotation, TPI, Type)
- Keep only relevant tap parameters for new schema
This commit is contained in:
Billy Huddleston
2025-09-22 16:28:45 -04:00
parent 39d39f34c3
commit cbeb67b509
10 changed files with 155 additions and 30 deletions

View File

@@ -147,13 +147,11 @@ class ObjectTapping(PathCircularHoleBase.ObjectOp):
Path.Log.track()
machine = PathMachineState.MachineState()
if not hasattr(obj.ToolController.Tool, "Pitch") or not hasattr(
obj.ToolController.Tool, "TPI"
):
if not hasattr(obj.ToolController.Tool, "Pitch"):
Path.Log.error(
translate(
"Path_Tapping",
"Tapping Operation requires a Tap tool with Pitch or TPI",
"Tapping Operation requires a Tap tool with Pitch",
)
)
return
@@ -192,7 +190,6 @@ class ObjectTapping(PathCircularHoleBase.ObjectOp):
# iterate the edgelist and generate gcode
for edge in edgelist:
Path.Log.debug(edge)
# move to hole location
@@ -222,11 +219,40 @@ class ObjectTapping(PathCircularHoleBase.ObjectOp):
repeat = 1 # technical debt: Add a repeat property for user control
# Get attribute from obj.tool, assign default and set to bool for passing to generate
isRightHand = getattr(obj.ToolController.Tool, "Rotation", "Right Hand") == "Right Hand"
isRightHand = (
getattr(obj.ToolController.Tool, "SpindleDirection", "Forward") == "Forward"
)
# Get pitch in mm as a float (no unit string)
pitch = getattr(obj.ToolController.Tool, "Pitch", None)
if pitch is None or pitch == 0:
Path.Log.error(
translate(
"Path_Tapping",
"Tapping Operation requires a Tap tool with non-zero Pitch",
)
)
continue
spindle_speed = getattr(obj.ToolController, "SpindleSpeed", None)
if spindle_speed is None or spindle_speed == 0:
Path.Log.error(
translate(
"Path_Tapping",
"Tapping Operation requires a ToolController with non-zero SpindleSpeed",
)
)
continue
try:
tappingcommands = tapping.generate(
edge, dwelltime, repeat, obj.RetractHeight.Value, isRightHand
edge,
dwelltime,
repeat,
obj.RetractHeight.Value,
isRightHand,
pitch,
spindle_speed,
)
except ValueError as e: # any targets that fail the generator are ignored