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

Go to the source code of this file.

Functions

GrinderODIDScreenV01 MachineScreenLoadScript ()
 Initialize the grinder OD/ID screen on load and configure default DRO values.
GrinderODIDScreenV01 MachineScreenStartupScript ()
 Execute the startup script for the grinder OD/ID screen after the machine initializes.
GrinderODIDScreenV01 UpdateAxisDROs ()
 Update axis DROs for the grinder OD/ID screen.
GrinderODIDScreenV01 MachineScreenPLCScript ()
 Execute the PLC script loop for the grinder OD/ID screen.
GrinderODIDScreenV01 MachineScreenLowPriorityLoop ()
 Execute the low priority background loop for the grinder OD/ID screen.
GrinderODIDScreenV01 SetWheelData (fieldName, WheelData, CurrentTool)
 Set a wheel data field in the tool extended data for the current or specified tool.
GrinderODIDScreenV01 GetWheelAttributes ()
 Get the list of grinding wheel attributes with their associated pound variable indices.
GrinderODIDScreenV01 UpdateGrinderWheelAttributes ()
 Update all grinder wheel attribute DROs and pound variables from the current tool's extended data.
GrinderODIDScreenV01 UpdateSFMMode ()
 Update the commanded wheel RPM based on the active SFM mode setting for the current tool.
GrinderODIDScreenV01 ToggleSFMMode ()
 Toggle the Surface Feet per Minute (SFM) spindle speed mode on or off for the current tool.
GrinderODIDScreenV01 TouchOffTeachX ()
 Teach the X-axis touch-off position by capturing the current machine position.
GrinderODIDScreenV01 TouchOffTeachZ ()
 Teach the Z-axis touch-off position by capturing the current machine position.
GrinderODIDScreenV01 ExecuteCalibrationBtn ()
 Execute the tool calibration sequence using taught touch-off positions and measured dimensions.
GrinderODIDScreenV01 TeachDresser (fieldName)
 Teach a dresser position field by capturing the current machine axis position.
GrinderODIDScreenV01 TeachPoundVar (PoundVar, AxisID)
 Teach a pound variable by storing the current work coordinate position of the specified axis.
GrinderODIDScreenV01 TeachPoundVarMachinePos (PoundVar, AxisID)
 Teach a pound variable by storing the current machine position of the specified axis.
GrinderODIDScreenV01 SetToolRadius (OffsetNumber, Radius)
 Set the tip radius for a specified tool offset number.
GrinderODIDScreenV01 CompAll ()
 Apply X and Z compensation offsets to the current tool and reactivate the tool offsets.
GrinderODIDScreenV01 CompDressDiamond (AxisID, Direction, Diamond)
 Adjust a diamond dresser position pound variable by a coarse or fine compensation amount.
GrinderODIDScreenV01 IsMDIModeActive ()
 Check whether the screen is currently in MDI mode.
GrinderODIDScreenV01 ToggleMDI ()
 Toggle between MDI mode and G-code file view mode with password protection.
GrinderODIDScreenV01 MDIMode ()
 Switch the screen display to MDI input mode.
GrinderODIDScreenV01 GCodeMode ()
 Switch the screen display to G-code file view mode.
GrinderODIDScreenV01 StartWheelHead ()
 Start the active wheel head output signal after verifying no alarms or warnings are present.
GrinderODIDScreenV01 StopWheelHead ()
 Stop all enabled wheel heads by clearing their output signals.
GrinderODIDScreenV01 WheelHeadToggleBtn ()
 Toggle the wheel head on or off based on its current running state.
GrinderODIDScreenV01 UpdateWheelHead ()
 Update the wheel head button state, LED, speed output, and coolant control.
GrinderODIDScreenV01 GetWheelHeadCurrentRange (WheelHeadCurrentNumber)
 Get the current speed range index for the specified wheel head.
GrinderODIDScreenV01 GetWheelHeadCurrentRangeMaxRPM (WheelHeadCurrentNumber)
 Get the maximum RPM for the current speed range of the specified wheel head.
GrinderODIDScreenV01 RotaryDresserFWD ()
 Start the rotary dresser in the forward direction.
GrinderODIDScreenV01 RotaryDresserREV ()
 Start the rotary dresser in the reverse direction.
GrinderODIDScreenV01 RotaryDresserStop ()
 Stop the rotary dresser by clearing both forward and reverse output signals.
GrinderODIDScreenV01 RotaryDresserToggleFWDBtn ()
 Toggle the rotary dresser forward direction button.
GrinderODIDScreenV01 RotaryDresserToggleREVBtn ()
 Toggle the rotary dresser reverse direction button.
GrinderODIDScreenV01 UpdateRotaryDresser ()
 Update the rotary dresser button states, LEDs, and commanded speed.
GrinderODIDScreenV01 UpdateActiveToolBox ()
 Update the active tool display box with the current tool name and description.
GrinderODIDScreenV01 ToolPathViewTopBtn ()
 Set the tool path view to top perspective.
GrinderODIDScreenV01 ToolPathViewISOBtn ()
 Set the tool path view to ISO perspective.
GrinderODIDScreenV01 ToolPathViewBottomBtn ()
 Set the tool path view to bottom perspective.
GrinderODIDScreenV01 GetWheelAttributeNames ()
 Get the list of wheel attribute names used in the grinder wheel data table.
GrinderODIDScreenV01 OpenGrinderWheelDataTable ()
 Open a dialog to view and edit grinding wheel data for all tools in a grid.
GrinderODIDScreenV01 UpdateGrinderDressData ()
 Update the grinder dress data DROs and current dresser type display.
GrinderODIDScreenV01 GetCycleStateNumber ()
 Get the current grinding cycle state number from pound variable 550.
GrinderODIDScreenV01 GetCycleStateName ()
 Get the name of the current grinding cycle state.
GrinderODIDScreenV01 GetSpindleBtnNames ()
 Get the display label names for spindle control buttons.

Function Documentation

◆ CompAll()

GrinderODIDScreenV01 CompAll ( )

Apply X and Z compensation offsets to the current tool and reactivate the tool offsets.

Wraps the internal _CompAll() function using w.pcall() for protected execution. If an error occurs inside _CompAll(), displays an error message box with the error details. Reads the X compensation amount from the CompXOffsetDRO (halved for radius-to-diameter conversion) and the Z compensation amount from the CompZOffsetDRO. Adds these amounts to the current tool's X and Z lathe offsets respectively, then reactivates the tool offset index via mc.mcCntlSetOffsetIndex().

Returns
(nil) No meaningful return value on success
(boolean) Success flag - true if operation completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-03

◆ CompDressDiamond()

GrinderODIDScreenV01 CompDressDiamond ( AxisID ,
Direction ,
Diamond  )

Adjust a diamond dresser position pound variable by a coarse or fine compensation amount.

Determines the pound variable index from the AxisID and Diamond parameters using an offset formula (518 + offsetId + AxisID), where offsetId is 0 for diamond 1, 2 for diamond 2, and 4 for diamond 3. Reads the compensation amount from the OEM parameters "CoarseCompAmount" or "FineCompAmount" based on the Amount variable. Negates the amount if Direction is not 1. Reads the current pound variable value and adds the computed amount before writing it back.

Parameters
AxisID(number) The axis identifier (0 for X, values > 0 are clamped to 1 for Z)
Direction(number) Compensation direction: 1 for positive, any other value for negative
Diamond(number) The diamond dresser index (1, 2, or 3) determining the pound variable offset
Returns
(nil) No meaningful return value on success
(boolean) Success flag - true if operation completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
The Amount variable used to select coarse vs. fine mode must be set in the calling scope
Documentation generated by AI on 2026-03-03

◆ ExecuteCalibrationBtn()

GrinderODIDScreenV01 ExecuteCalibrationBtn ( )

Execute the tool calibration sequence using taught touch-off positions and measured dimensions.

Reads the taught X and Z machine positions from XTouchOffDRO and ZTouchOffDRO and the measured part dimensions from MeasuredXDRO and MeasuredZDRO. Validates that at least one touch-off position has been taught (non-zero). Computes new X and Z tool offsets by subtracting the work coordinate offset and the measured dimension (halved in diameter mode) from the machine touch-off position. Writes the computed offsets to MTOOL_LATHE_X and MTOOL_LATHE_Z and clears the corresponding wear offsets. Reactivates the tool offsets by issuing a T-code MDI command and resets the touch-off DROs to zero on completion.

Returns
(nil) No meaningful return value on success
(boolean) Success flag - true if validation or MDI command fails
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Warning
Both XTouchOffDRO and ZTouchOffDRO must be taught before calling this function
Note
Documentation generated by AI on 2026-03-03

◆ GCodeMode()

GrinderODIDScreenV01 GCodeMode ( )

Switch the screen display to G-code file view mode.

Hides the MDI input group by moving it off-screen and shows the G-code display group at the standard position. Updates the MDI toggle button label to "Go to MDI" and clears its background color to indicate inactive MDI mode.

Note
Documentation generated by AI on 2026-03-03

◆ GetCycleStateName()

GrinderODIDScreenV01 GetCycleStateName ( )

Get the name of the current grinding cycle state.

Retrieves the current cycle state number via GetCycleStateNumber() and maps it to a human-readable state name string. State names cover both grinding states (positioning, grinding, sparkout, finished) and dressing states (pullout, positioning, dressing, sparkout, returning, finished).

Returns
(string|nil) The name of the current cycle state, or nil if the state number is out of range
Note
Documentation generated by AI on 2026-03-03

◆ GetCycleStateNumber()

GrinderODIDScreenV01 GetCycleStateNumber ( )

Get the current grinding cycle state number from pound variable 550.

Reads pound variable 550 from the Mach4 controller, which stores the active grinding cycle state as a numeric index. This value is used by GetCycleStateName() to resolve the human-readable state name.

Returns
(number|nil) The current cycle state number, or nil on error
(boolean) Success flag - true if operation completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-03

◆ GetSpindleBtnNames()

GrinderODIDScreenV01 GetSpindleBtnNames ( )

Get the display label names for spindle control buttons.

Returns a table mapping spindle command states to their corresponding button label strings for the workhead spindle. The table keys are "Stop", "Forward", and "Reverse", each mapping to a human-readable button label used in the grinder screen UI.

Returns
(table) Table with keys "Stop", "Forward", and "Reverse" mapping to button label strings
Note
Documentation generated by AI on 2026-03-03

◆ GetWheelAttributeNames()

GrinderODIDScreenV01 GetWheelAttributeNames ( )

Get the list of wheel attribute names used in the grinder wheel data table.

Returns an ordered array of string attribute names representing each column of grinding wheel data displayed in the wheel data grid dialog. These names correspond to keys used when reading and writing tool extended data via mc.mcToolGetDataExStr() and mc.mcToolSetDataExDbl().

Returns
(table) Ordered array of wheel attribute name strings
Note
This function is commented out in the current codebase and is not actively used
Documentation generated by AI on 2026-03-03

◆ GetWheelAttributes()

GrinderODIDScreenV01 GetWheelAttributes ( )

Get the list of grinding wheel attributes with their associated pound variable indices.

Returns a two-dimensional table where each entry is a pair of {attributeName, poundVarIndex}. The attribute names correspond to keys used when reading and writing tool extended data via mc.mcToolGetDataExStr() and mc.mcToolSetDataExDbl(). The pound variable indices map each attribute to its corresponding Mach4 pound variable for real-time access by G-code programs.

Returns
(table) Ordered array of {attributeName (string), poundVarIndex (number)} pairs
Note
Documentation generated by AI on 2026-03-03

◆ GetWheelHeadCurrentRange()

GrinderODIDScreenV01 GetWheelHeadCurrentRange ( WheelHeadCurrentNumber )

Get the current speed range index for the specified wheel head.

Reads the OEM parameter "WheelHeadCurrentRange_{WheelHeadCurrentNumber}" to determine which speed range is active. If the returned value is outside the valid range of 0 to 3, it is clamped to 0.

Parameters
WheelHeadCurrentNumber(number) The wheel head index (1-4) to query
Returns
(number|nil) The current speed range index (0-3), or nil on error
(boolean) Success flag - true if operation completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-03

◆ GetWheelHeadCurrentRangeMaxRPM()

GrinderODIDScreenV01 GetWheelHeadCurrentRangeMaxRPM ( WheelHeadCurrentNumber )

Get the maximum RPM for the current speed range of the specified wheel head.

Retrieves the current speed range index via GetWheelHeadCurrentRange() and then reads the corresponding maximum speed OEM parameter using the pattern "WheelHeadMaxSpeedRange{Range}_{WheelHeadNumber}".

Parameters
WheelHeadCurrentNumber(number) The wheel head index (1-4) to query
Returns
(number|nil) The maximum RPM for the current speed range, or nil on error
(boolean) Success flag - true if operation completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-03

◆ IsMDIModeActive()

GrinderODIDScreenV01 IsMDIModeActive ( )

Check whether the screen is currently in MDI mode.

Reads the "Left" property of the MDIGroup screen object and compares it to the known visible position ("110"). Returns true if the MDI group is at the visible position, false otherwise.

Returns
(boolean) True if MDI mode is active, false if G-code mode is active
Note
Documentation generated by AI on 2026-03-03

◆ MachineScreenLoadScript()

GrinderODIDScreenV01 MachineScreenLoadScript ( )

Initialize the grinder OD/ID screen on load and configure default DRO values.

Called once when the screen script is first loaded. Sets the stage button color globals (BTN_COLOR_STAGE_1, BTN_COLOR_STAGE_2, BTN_COLOR_STAGE_3) for the three-state visual scheme used by wheel head and rotary dresser buttons. Switches the display to G-code mode via GCodeMode() and resets the touch-off, measured dimension, and compensation offset DROs (XTouchOffDRO, ZTouchOffDRO, MeasuredXDRO, MeasuredZDRO, CompXOffsetDRO, CompZOffsetDRO) to zero.

Note
Documentation generated by AI on 2026-03-03

◆ MachineScreenLowPriorityLoop()

GrinderODIDScreenV01 MachineScreenLowPriorityLoop ( )

Execute the low priority background loop for the grinder OD/ID screen.

Called periodically at low priority to refresh all dynamic screen elements. Sequentially updates the wheel head state, rotary dresser state, SFM mode, current tab register, active tool display box, and all grinder wheel attribute DROs and pound variables.

Note
Documentation generated by AI on 2026-03-03

◆ MachineScreenPLCScript()

GrinderODIDScreenV01 MachineScreenPLCScript ( )

Execute the PLC script loop for the grinder OD/ID screen.

Called on every PLC cycle to perform real-time screen updates. The current implementation is empty and serves as a placeholder for future PLC-driven logic.

Note
Documentation generated by AI on 2026-03-03

◆ MachineScreenStartupScript()

GrinderODIDScreenV01 MachineScreenStartupScript ( )

Execute the startup script for the grinder OD/ID screen after the machine initializes.

Called once when the machine screen starts up. Sets the tool path display to the bottom view perspective via ToolPathViewBottomBtn() to establish the default camera orientation for the grinding screen.

Note
Documentation generated by AI on 2026-03-03

◆ MDIMode()

GrinderODIDScreenV01 MDIMode ( )

Switch the screen display to MDI input mode.

Hides the G-code display group by moving it off-screen and shows the MDI input group at the standard position. Reads the current background color of the MDILine control and applies it to the MDI toggle button, defaulting to "#FFFFB3" if no color is set. Updates the button label to "Return\nto GCode" to indicate the active MDI mode.

Note
Documentation generated by AI on 2026-03-03

◆ OpenGrinderWheelDataTable()

GrinderODIDScreenV01 OpenGrinderWheelDataTable ( )

Open a dialog to view and edit grinding wheel data for all tools in a grid.

Builds a GridTable configuration and populates it with wheel attribute data read from tool extended data for tools 1 through 3. Opens a generic grid dialog via m.GenericGridDialog() allowing the user to view and edit values. On dialog close, writes modified values back to tool extended data using mc.mcToolSetDataExDbl() and saves the tool file. If the dialog raises an error, displays an error message box.

Note
This function is commented out in the current codebase and is not actively used
Documentation generated by AI on 2026-03-03

◆ RotaryDresserFWD()

GrinderODIDScreenV01 RotaryDresserFWD ( )

Start the rotary dresser in the forward direction.

Clears the RotaryDresserREVOutput signal before activating the RotaryDresserFWDOutput signal, ensuring only one direction output is active at a time to prevent conflicting commands.

Note
Documentation generated by AI on 2026-03-03

◆ RotaryDresserREV()

GrinderODIDScreenV01 RotaryDresserREV ( )

Start the rotary dresser in the reverse direction.

Clears the RotaryDresserFWDOutput signal before activating the RotaryDresserREVOutput signal, ensuring only one direction output is active at a time to prevent conflicting commands.

Note
Documentation generated by AI on 2026-03-03

◆ RotaryDresserStop()

GrinderODIDScreenV01 RotaryDresserStop ( )

Stop the rotary dresser by clearing both forward and reverse output signals.

Sets both the RotaryDresserFWDOutput and RotaryDresserREVOutput OEM parameter signals to false, ensuring the dresser is fully stopped regardless of its current direction of rotation.

Returns
(nil) No meaningful return value on success
(boolean) Success flag - true if operation completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-03

◆ RotaryDresserToggleFWDBtn()

GrinderODIDScreenV01 RotaryDresserToggleFWDBtn ( )

Toggle the rotary dresser forward direction button.

Reads the current state of the RotaryDresserFWDOutput OEM signal. If the forward output is currently active, stops the dresser via RotaryDresserStop(). If it is inactive, starts the dresser in forward via RotaryDresserFWD(). Updates the rotary dresser UI state after the toggle by calling UpdateRotaryDresser().

Note
Documentation generated by AI on 2026-03-03

◆ RotaryDresserToggleREVBtn()

GrinderODIDScreenV01 RotaryDresserToggleREVBtn ( )

Toggle the rotary dresser reverse direction button.

Reads the current state of the RotaryDresserREVOutput OEM signal. If the reverse output is currently active, stops the dresser via RotaryDresserStop(). If it is inactive, starts the dresser in reverse via RotaryDresserREV(). Updates the rotary dresser UI state after the toggle by calling UpdateRotaryDresser().

Note
Documentation generated by AI on 2026-03-03

◆ SetToolRadius()

GrinderODIDScreenV01 SetToolRadius ( OffsetNumber ,
Radius  )

Set the tip radius for a specified tool offset number.

Writes the given radius value to the MTOOL_LATHE_TIPRAD tool data field for the specified offset number using mc.mcToolSetData().

Parameters
OffsetNumber(number) The tool offset index to update
Radius(number) The tip radius value to set
Returns
(nil) No meaningful return value on success
(boolean) Success flag - true if operation completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-03

◆ SetWheelData()

GrinderODIDScreenV01 SetWheelData ( fieldName ,
WheelData ,
CurrentTool  )

Set a wheel data field in the tool extended data for the current or specified tool.

Retrieves the current tool number via mc.mcToolGetCurrent() if CurrentTool is not provided. If the tool number is greater than zero, writes the WheelData value to the specified fieldName using mc.mcToolSetDataExDbl() and saves the tool file via mc.mcToolSaveFile().

Parameters
fieldName(string) The name of the extended tool data field to set
WheelData(number) The numeric value to write to the specified field
CurrentTool(number|nil) The tool number to update. If nil, uses the current active tool
Returns
(nil) No meaningful return value on success
(boolean) Success flag - true if operation completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-03

References CurrentTool().

◆ StartWheelHead()

GrinderODIDScreenV01 StartWheelHead ( )

Start the active wheel head output signal after verifying no alarms or warnings are present.

First checks for active GMS alarms and warnings via w.GetGMSAlarms() and w.GetGMSWarnings(). If any alarm or warning is active, displays a warning message and returns without starting. Reads the WheelHeadCurrentNumber OEM parameter to identify the active wheel head and, if a valid wheel head number is found (non-zero), sets its WheelHeadOutput signal to true.

Returns
(nil) No meaningful return value on success
(boolean) Success flag - true if operation completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Warning
Will not start the wheel head if any GMS alarm or warning is active
Note
Documentation generated by AI on 2026-03-03

◆ StopWheelHead()

GrinderODIDScreenV01 StopWheelHead ( )

Stop all enabled wheel heads by clearing their output signals.

Iterates through up to four wheel head slots. For each slot, reads the WheelHeadEnabled OEM parameter string. If the wheel head is enabled ("Yes"), clears its corresponding WheelHeadOutput signal to false, stopping that wheel head.

Returns
(nil) No meaningful return value on success
(boolean) Success flag - true if operation completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-03

◆ TeachDresser()

GrinderODIDScreenV01 TeachDresser ( fieldName )

Teach a dresser position field by capturing the current machine axis position.

Determines the appropriate axis (X or Z) from the fieldName parameter. Field names containing "X1", "X2", or "X3" map to mc.X_AXIS; names containing "Z1", "Z2", or "Z3" map to mc.Z_AXIS. Reads the current machine position for the resolved axis and writes it to the specified wheel data field via m.screen.SetWheelData().

Parameters
fieldName(string) The dresser position field name to teach. Valid values are: "X1DressPosition", "X2DressPosition", "X3DressPosition", "Z1DressPosition", "Z2DressPosition", "Z3DressPosition"
Returns
(nil) No meaningful return value on success
(boolean) Success flag - true if operation completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-03

◆ TeachPoundVar()

GrinderODIDScreenV01 TeachPoundVar ( PoundVar ,
AxisID  )

Teach a pound variable by storing the current work coordinate position of the specified axis.

Reads the current work coordinate position of the given axis via mc.mcAxisGetPos() and writes the value to the specified pound variable using mc.mcCntlSetPoundVar().

Parameters
PoundVar(number) The pound variable index to write the axis position to
AxisID(number) The axis identifier (e.g., mc.X_AXIS, mc.Z_AXIS) to read position from
Returns
(nil) No meaningful return value on success
(boolean) Success flag - true if operation completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-03

◆ TeachPoundVarMachinePos()

GrinderODIDScreenV01 TeachPoundVarMachinePos ( PoundVar ,
AxisID  )

Teach a pound variable by storing the current machine position of the specified axis.

Reads the current machine position of the given axis via mc.mcAxisGetMachinePos() and writes the value to the specified pound variable using mc.mcCntlSetPoundVar().

Parameters
PoundVar(number) The pound variable index to write the machine position to
AxisID(number) The axis identifier (e.g., mc.X_AXIS, mc.Z_AXIS) to read position from
Returns
(nil) No meaningful return value on success
(boolean) Success flag - true if operation completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-03

◆ ToggleMDI()

GrinderODIDScreenV01 ToggleMDI ( )

Toggle between MDI mode and G-code file view mode with password protection.

Calls w.PasswordProtection(1) to verify the operator has sufficient access level before allowing the mode switch. If authentication fails, displays a warning message and returns an error. If the screen is currently in MDI mode (as determined by IsMDIModeActive()), switches to G-code mode via GCodeMode(). Otherwise switches to MDI mode via MDIMode().

Returns
(nil) No meaningful return value on success
(boolean) Success flag - true if operation completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-03

◆ ToggleSFMMode()

GrinderODIDScreenV01 ToggleSFMMode ( )

Toggle the Surface Feet per Minute (SFM) spindle speed mode on or off for the current tool.

Reads the current value of the "SurfaceFeetPerMinModeActive" extended tool data field as a string. If the field is empty or non-string, defaults to "0". Toggles the value between "0" (disabled) and "1" (enabled) by writing the new state back via mc.mcToolSetDataExStr().

Returns
(nil) No meaningful return value on success
(boolean) Success flag - true if operation completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-03

◆ ToolPathViewBottomBtn()

GrinderODIDScreenV01 ToolPathViewBottomBtn ( )

Set the tool path view to bottom perspective.

Sets the ToolPathA display to the bottom view (mc.MC_TPVIEW_BOTTOM). If the current view is already set to bottom, it first resets to the default view before applying the bottom view, ensuring a view refresh occurs.

Note
Documentation generated by AI on 2026-03-03

◆ ToolPathViewISOBtn()

GrinderODIDScreenV01 ToolPathViewISOBtn ( )

Set the tool path view to ISO perspective.

Sets the ToolPathA display to the ISO view (mc.MC_TPVIEW_ISO). If the current view is already set to ISO, it first resets to the default view before applying the ISO view, ensuring a view refresh occurs.

Note
Documentation generated by AI on 2026-03-03

◆ ToolPathViewTopBtn()

GrinderODIDScreenV01 ToolPathViewTopBtn ( )

Set the tool path view to top perspective.

Sets the ToolPathA display to the top view (mc.MC_TPVIEW_TOP). If the current view is already set to top, it first resets to the default view before applying the top view, ensuring a view refresh occurs.

Note
Documentation generated by AI on 2026-03-03

◆ TouchOffTeachX()

GrinderODIDScreenV01 TouchOffTeachX ( )

Teach the X-axis touch-off position by capturing the current machine position.

Reads the current machine position of the X axis via mc.mcAxisGetMachinePos() and writes the value to the XTouchOffDRO screen object for use during calibration.

Returns
(nil) No meaningful return value on success
(boolean) Success flag - true if operation completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-03

◆ TouchOffTeachZ()

GrinderODIDScreenV01 TouchOffTeachZ ( )

Teach the Z-axis touch-off position by capturing the current machine position.

Reads the current machine position of the Z axis via mc.mcAxisGetMachinePos() and writes the value to the ZTouchOffDRO screen object for use during calibration.

Returns
(nil) No meaningful return value on success
(boolean) Success flag - true if operation completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-03

◆ UpdateActiveToolBox()

GrinderODIDScreenV01 UpdateActiveToolBox ( )

Update the active tool display box with the current tool name and description.

Retrieves the current tool number and looks up its name via w.GetToolName(). If the tool name is purely numeric it is replaced with "Unknown". Updates the ActiveToolText label only when the value has changed to avoid unnecessary redraws. Also updates the WheelGroup label with the tool description retrieved via mc.mcToolGetDesc().

Returns
(nil) No meaningful return value on success
(boolean) Success flag - true if operation completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-03

◆ UpdateAxisDROs()

GrinderODIDScreenV01 UpdateAxisDROs ( )

Update axis DROs for the grinder OD/ID screen.

This function is a placeholder for axis DRO updates. Axis DRO updates are not required for the turn/grinder screen configuration and no action is taken.

Note
Documentation generated by AI on 2026-03-03

◆ UpdateGrinderDressData()

GrinderODIDScreenV01 UpdateGrinderDressData ( )

Update the grinder dress data DROs and current dresser type display.

Reads tip radius data from tool offsets 21, 22, and 23 (corresponding to three diamond dressers) and updates the R1, R2, and R3 diamond radius DROs on screen. Also reads the current length index pound variable and highlights the active dresser type indicator if it falls within the valid dresser range (21-23).

Note
This function is commented out in the current codebase and is not actively used
Documentation generated by AI on 2026-03-03

◆ UpdateGrinderWheelAttributes()

GrinderODIDScreenV01 UpdateGrinderWheelAttributes ( )

Update all grinder wheel attribute DROs and pound variables from the current tool's extended data.

Iterates over all wheel attributes returned by GetWheelAttributes(). For each attribute, reads the value from the current tool's extended data via mc.mcToolGetDataExStr(). If the tool number is greater than zero, writes the value to the corresponding DRO (named "{AttributeName}DRO") and to the mapped pound variable. If the tool number is zero or the value is empty, writes "0" to the DRO and 0 to the pound variable.

Returns
(nil) No meaningful return value on success
(boolean) Success flag - true if operation completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-03

◆ UpdateRotaryDresser()

GrinderODIDScreenV01 UpdateRotaryDresser ( )

Update the rotary dresser button states, LEDs, and commanded speed.

Checks the RotaryDresserEnabled OEM parameter to determine if the rotary dresser is configured. When enabled, reads the FWD output, REV output, and on-input signals to update button colors and LED states using a three-stage visual scheme (off, starting/yellow, running/green). Calculates the commanded RPM from the SFM pound variable (543) and dresser diameter (542), clamping to the MaxWheelRPM (544) and RotaryDresserMaxSpeed OEM parameter. Writes the computed RPM to the RotaryDresserSpeed OEM parameter and pound variable 545. If a speed register is mapped, also writes a percentage value (scaled to 1000) to the mapped register.

Returns
(nil) No meaningful return value on success
(boolean) Success flag - true if operation completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-03

◆ UpdateSFMMode()

GrinderODIDScreenV01 UpdateSFMMode ( )

Update the commanded wheel RPM based on the active SFM mode setting for the current tool.

Reads the "SurfaceFeetPerMinModeActive" and "MaxRPM" extended tool data fields for the current tool. If SFM mode is active (value == 1), computes the commanded RPM from the "SurfaceFeetPerMin" and "Diameter" tool data fields using the formula: RPM = SFM * (12 / pi) / Diameter, and sets the SFMModeBtn to BTN_COLOR_ON. If SFM mode is inactive, reads "CommandedRPM" directly from tool data and sets the button to BTN_COLOR_OFF. Clamps the result to MaxRPM and writes the final value to pound variable 540 if it is greater than zero.

Returns
(nil) No meaningful return value on success
(boolean) Success flag - true if operation completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-03

◆ UpdateWheelHead()

GrinderODIDScreenV01 UpdateWheelHead ( )

Update the wheel head button state, LED, speed output, and coolant control.

Determines the active wheel head by matching the current tool name against up to four WheelHeadToolGroupName OEM parameters and writes the result to the WheelHeadCurrentNumber OEM parameter. When a valid wheel head is found, reads the output and input signals to drive a three-stage button color scheme (off, starting/yellow, running/green) and updates the button label. Clamps the commanded RPM (pound variable 540) to the wheel head's maximum speed and writes it to the WheelHeadSpeed OEM parameter. If a speed register is mapped via WheelHeadSpeedRegister, converts the RPM to a percentage (scaled to 1000) and writes it to the register. Also mirrors the coolant output signal when a WheelHeadCoolantOutput is configured.

Returns
(nil) No meaningful return value on success
(boolean) Success flag - true if operation completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-03

◆ WheelHeadToggleBtn()

GrinderODIDScreenV01 WheelHeadToggleBtn ( )

Toggle the wheel head on or off based on its current running state.

Iterates through up to four wheel heads, checking each enabled wheel head's output signal. If any enabled wheel head output is found to be active, the wheel head is considered on and StopWheelHead() is called. Otherwise, StartWheelHead() is called to start the wheel head.

Returns
(nil) No meaningful return value on success
(boolean) Success flag - true if operation completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-03