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:
@@ -202,7 +202,6 @@ def export(objectslist, filename, argstring):
|
||||
gcode += linenumber() + UNITS + "\n"
|
||||
|
||||
for obj in objectslist:
|
||||
|
||||
# Skip inactive operations
|
||||
if not PathUtil.activeForOp(obj):
|
||||
continue
|
||||
@@ -321,7 +320,6 @@ def parse(pathobj):
|
||||
out += parse(p)
|
||||
return out
|
||||
else: # parsing simple path
|
||||
|
||||
# groups might contain non-path things like stock.
|
||||
if not hasattr(pathobj, "Path"):
|
||||
return out
|
||||
@@ -337,7 +335,6 @@ def parse(pathobj):
|
||||
#
|
||||
# for c in PathUtils.getPathWithPlacement(pathobj).Commands:
|
||||
for c in pathobj.Path.Commands:
|
||||
|
||||
outstring = []
|
||||
command = c.Name
|
||||
outstring.append(command)
|
||||
@@ -350,6 +347,34 @@ def parse(pathobj):
|
||||
if c.Name.startswith("(") and not OUTPUT_COMMENTS: # command is a comment
|
||||
continue
|
||||
|
||||
# Handle G84/G74 tapping cycles
|
||||
if command in ("G84", "G74") and "F" in c.Parameters:
|
||||
pitch_mm = float(c.Parameters["F"])
|
||||
c.Parameters.pop("F") # Remove F from output, we'll handle it
|
||||
|
||||
# Get spindle speed (from S param or last known value)
|
||||
spindle_speed = None
|
||||
if "S" in c.Parameters:
|
||||
spindle_speed = float(c.Parameters["S"])
|
||||
c.Parameters.pop("S")
|
||||
|
||||
# Convert pitch to inches if needed
|
||||
if UNITS == "G20": # imperial
|
||||
pitch = pitch_mm / 25.4
|
||||
else:
|
||||
pitch = pitch_mm
|
||||
|
||||
# Calculate feed rate
|
||||
if spindle_speed is not None:
|
||||
feed_rate = pitch * spindle_speed
|
||||
speed = Units.Quantity(feed_rate, UNIT_SPEED_FORMAT)
|
||||
outstring.append(
|
||||
"F" + format(float(speed.getValueAs(UNIT_SPEED_FORMAT)), precision_string)
|
||||
)
|
||||
else:
|
||||
# No spindle speed found, output pitch as F
|
||||
outstring.append("F" + format(pitch, precision_string))
|
||||
|
||||
# Now add the remaining parameters in order
|
||||
for param in params:
|
||||
if param in c.Parameters:
|
||||
@@ -428,8 +453,6 @@ def parse(pathobj):
|
||||
# append the line to the final output
|
||||
for w in outstring:
|
||||
out += w + COMMAND_SPACE
|
||||
# Note: Do *not* strip `out`, since that forces the allocation
|
||||
# of a contiguous string & thus quadratic complexity.
|
||||
out += "\n"
|
||||
|
||||
return out
|
||||
|
||||
Reference in New Issue
Block a user