Mach Modules Documentation
Lua Module API Documentation
Loading...
Searching...
No Matches
GrinderODIDMCodeModule.lua File Reference

Go to the source code of this file.

Functions

GrinderODIDMCodeModule GetCurrentWheelHeadNumber ()
 Retrieve the currently active wheel head number from OEM parameters.
GrinderODIDMCodeModule FlaggingCalibration (AxisID, MachineCoordProbedPosition, CalibratePostion)
 Calibrate the active flagging tool offset for a given axis using a probed machine position.
GrinderODIDMCodeModule FlaggingFixtureCalibration (AxisID, ProbedPosition, CalibratePostion)
 Calibrate fixture offset using active flagging probe position for a given axis.

Function Documentation

◆ FlaggingCalibration()

GrinderODIDMCodeModule FlaggingCalibration ( AxisID ,
MachineCoordProbedPosition ,
CalibratePostion  )

Calibrate the active flagging tool offset for a given axis using a probed machine position.

Computes the new tool length or diameter offset for the current tool based on the machine coordinate of the probed position and the desired calibration target value. Behavior differs by axis:

For X_AXIS: Accounts for diameter mode (divides the measure value by 2), tool slide direction (positive or negative side), current work offset, work shift offset, and current wear offset to compute the corrected X tool offset (MTOOL_LATHE_X).

For Z_AXIS: Computes the Z tool offset (MTOOL_LATHE_Z) by subtracting the work offset, work shift, and calibration position from the machine-coordinate probed position.

After computing the new offset, the function applies it via mc.mcToolSetData, sets the active offset index to the current tool, saves the tool file, and logs the result to both the system log and the operator log.

Parameters
AxisID(number) The Mach4 axis constant (mc.X_AXIS or mc.Z_AXIS) specifying which axis to calibrate
MachineCoordProbedPosition(number) The machine coordinate position recorded at the probe strike
CalibratePostion(number) The known part dimension or reference position used to calculate the offset correction
Returns
(nil) No primary return value
(boolean) Success flag - true if calibration and tool file save succeeded, false on save error
(string) Status message from w.FunctionCompleted() or w.FunctionError() on error
-- Calibrate Z tool offset after flagging probe strike
local probedposition = mc.mcCntlGetPoundVar(inst, mc.SV_PROBE_MACH_POS_Z) + R_value
GrinderODIDMCodeModule.FlaggingCalibration(mc.Z_AXIS, probedposition, K_value)
-- Calibrate X tool offset (diameter mode, tool slide direction handled automatically)
GrinderODIDMCodeModule.FlaggingCalibration(mc.X_AXIS, probedMachX, knownDiameter)
See also
GrinderODIDMCodeModule.FlaggingFixtureCalibration() for fixture offset calibration
GrinderODIDMCodeModule._m9230() for the M-code that invokes this function
Note
Documentation generated by AI on 2026-03-03

◆ FlaggingFixtureCalibration()

GrinderODIDMCodeModule FlaggingFixtureCalibration ( AxisID ,
ProbedPosition ,
CalibratePostion  )

Calibrate fixture offset using active flagging probe position for a given axis.

Calculates the incremental distance between the probed position and the desired calibrate position, then applies a G10 L2 fixture offset correction via mcCntlGcodeExecuteWait. The axis letter is mapped from the Mach4 axis ID to the incremental G10 axis designator (X->U, Y->V, Z->W). The current fixture number is retrieved from the controller and adjusted relative to G54 (subtracting 53). After updating the fixture offset, the fixture table is saved to disk and the operation is logged to both the system log and the operator log.

Parameters
AxisID(number) The Mach4 axis constant (e.g., mc.X_AXIS, mc.Y_AXIS, mc.Z_AXIS) identifying which axis fixture offset to calibrate
ProbedPosition(number) The probed machine coordinate position used as the reference point
CalibratePostion(number) The known calibration target position; the difference from ProbedPosition determines the fixture offset correction to apply
Returns
(nil) No primary return value
(boolean) Success flag - true if fixture offset was applied and saved successfully, false if mcFixtureSaveFile failed
(string) Status message from w.FunctionCompleted() or w.FunctionError() on error
-- Calibrate Z fixture offset using flagging probe result
local probedposition = mc.mcCntlGetPoundVar(inst, mc.SV_PROBE_POS_Z) + gcodevars["R"]["value"]
GrinderODIDMCodeModule.FlaggingFixtureCalibration(mc.Z_AXIS, probedposition, gcodevars["K"]["value"])
See also
GrinderODIDMCodeModule.FlaggingCalibration() for tool offset calibration (non-fixture)
GrinderODIDMCodeModule._m9230() for the M-code that invokes this function
Note
Documentation generated by AI on 2026-03-03

◆ GetCurrentWheelHeadNumber()

GrinderODIDMCodeModule GetCurrentWheelHeadNumber ( )

Retrieve the currently active wheel head number from OEM parameters.

Parameters
None
Returns
(number) The current wheel head number as stored in the OEM parameter 'WheelHeadCurrentNumber'
Note
Documentation generated by AI on 2026-03-03