|
Mach Modules Documentation
Lua Module API Documentation
|
Go to the source code of this file.
Functions | |
| CommonGrinderScreenV02 | MachineCycleStop () |
| Safely execute the machine cycle stop sequence with error protection. | |
| CommonGrinderScreenV02 | UpdateGrinderWheelAttributes () |
| Update grinder wheel attribute pound variables from the current tool table entry. | |
| CommonGrinderScreenV02 | SelectDresserDiamondBtn (diamond, ctrl_name, event_source,...) |
| Button handler that delegates to SelectDresserDiamond. | |
| CommonGrinderScreenV02 | SelectDresserDiamond (diamond) |
| Set the dresser diamond type in the tool table and update the screen selection. | |
| CommonGrinderScreenV02 | GetDresserDiamond () |
| Get the current dresser diamond type from the tool table. | |
| CommonGrinderScreenV02 | UpdateDresserDiamondSelection () |
| Update the dresser diamond selection button colors and group enable states. | |
| CommonGrinderScreenV02 | TouchOffTeachX () |
| Teach the X-axis touch-off position by capturing the current machine position. | |
| CommonGrinderScreenV02 | TouchOffTeachZ () |
| Teach the Z-axis touch-off position by capturing the current machine position. | |
| CommonGrinderScreenV02 | ExecuteCalibrationBtn () |
| Execute a tool calibration using touch-off positions and measured dimensions. | |
| CommonGrinderScreenV02 | SetNewWheelOffsetOn () |
| Enable the new wheel offset mode by setting pound variable #9057 to 1. | |
| CommonGrinderScreenV02 | SetNewWheelOffsetOff () |
| Disable the new wheel offset mode by clearing pound variable #9057. | |
| CommonGrinderScreenV02 | IsNewWheelOffsetOn () |
| Check whether the new wheel offset mode is currently active. | |
| CommonGrinderScreenV02 | NewWheelOffsetToggle () |
| Toggle the new wheel offset mode on or off based on its current state. | |
| CommonGrinderScreenV02 | UpdateNewWheelOffset () |
| Update the NewWheelOffsetBtn background color to reflect the current new-wheel offset state. | |
| CommonGrinderScreenV02 | IsWorkHeadEnableMapped () |
| Check whether the WorkHeadEnableOutput OEM parameter signal is mapped. | |
| CommonGrinderScreenV02 | IsWorkHeadEnableImmediateOff () |
| Check whether the work head enable output uses immediate-off behavior. | |
| CommonGrinderScreenV02 | UpdateWorkHeadEnable () |
| Update the work head enable output signal based on spindle and machine state. | |
| CommonGrinderScreenV02 | TeachDresserBtn (fieldName,...) |
| Button handler that delegates to TeachDresser. | |
| CommonGrinderScreenV02 ExecuteCalibrationBtn | ( | ) |
Execute a tool calibration using touch-off positions and measured dimensions.
Reads the measured X and Z values from the "MeasuredXDRO" and "MeasuredZDRO" screen controls and the previously taught touch-off positions from "XTouchOffDRO" and "ZTouchOffDRO". Validates that touch-off positions are non-zero, then calculates new X and Z tool offsets by subtracting the work offset and measured value from the machine touch-off position. In diameter mode, the X measured value is halved before use. Writes the calculated offsets to the tool table, clears wear offsets, activates the new offsets via an MDI T-command, and resets the touch-off DRO controls to zero.
| CommonGrinderScreenV02 GetDresserDiamond | ( | ) |
Get the current dresser diamond type from the tool table.
Reads the "DresserDiamondType" user value from the tool table via w.GetToolTableUserValue() and returns it.
| CommonGrinderScreenV02 IsNewWheelOffsetOn | ( | ) |
Check whether the new wheel offset mode is currently active.
Reads pound variable #9057 via mc.mcCntlGetPoundVar() and returns true if its value equals 1.
| CommonGrinderScreenV02 IsWorkHeadEnableImmediateOff | ( | ) |
Check whether the work head enable output uses immediate-off behavior.
Reads the "WorkHeadEnableImmediateOff" OEM parameter string and returns true if its value is "Yes". The result is cached under the key ("WorkHeadEnableImmediateOff", "Enabled") to avoid repeated OEM parameter reads on subsequent calls.
| CommonGrinderScreenV02 IsWorkHeadEnableMapped | ( | ) |
Check whether the WorkHeadEnableOutput OEM parameter signal is mapped.
Calls w.IsOEMParamSigMapped() for the "WorkHeadEnableOutput" signal and caches the result under the key ("WorkHeadEnable", "Mapped") to avoid repeated lookups on subsequent calls.
| CommonGrinderScreenV02 MachineCycleStop | ( | ) |
Safely execute the machine cycle stop sequence with error protection.
Calls m.screen._MachineCycleStop() inside a w.pcall() protected context. If an error occurs during the stop sequence, it is caught and returned as a failure rather than propagating to the caller. On success, returns the completion status from the inner function.
| CommonGrinderScreenV02 NewWheelOffsetToggle | ( | ) |
Toggle the new wheel offset mode on or off based on its current state.
Reads the current new-wheel offset state via m.screen.IsNewWheelOffsetOn(). If it is active, calls m.screen.SetNewWheelOffsetOff(). If it is inactive, calls m.screen.SetNewWheelOffsetOn().
| CommonGrinderScreenV02 SelectDresserDiamond | ( | diamond | ) |
Set the dresser diamond type in the tool table and update the screen selection.
Writes the given diamond type value to the "DresserDiamondType" tool table user value via w.SetToolTableUserValue(), then calls m.screen.UpdateDresserDiamondSelection() to refresh the button and image states on screen.
| diamond | (number) The dresser diamond type to select (1 = single, 2 = double, 3 = flat) |
| CommonGrinderScreenV02 SelectDresserDiamondBtn | ( | diamond | , |
| ctrl_name | , | ||
| event_source | , | ||
| ... ) |
Button handler that delegates to SelectDresserDiamond.
Extracts the diamond parameter and calls m.screen.SelectDresserDiamond() to write the selected diamond type to the tool table and refresh the button states on screen. Additional button event arguments (ctrl_name, event_source, ...) are accepted but ignored.
| diamond | (number) The dresser diamond type to select (1 = single, 2 = double, 3 = flat) |
| ctrl_name | (string) The name of the control that triggered this event (unused) |
| event_source | (any) The event source object (unused) |
| ... | (any) Additional event arguments (unused) |
| CommonGrinderScreenV02 SetNewWheelOffsetOff | ( | ) |
Disable the new wheel offset mode by clearing pound variable #9057.
Sets pound variable #9057 to 0 via mc.mcCntlSetPoundVar(), then calls m.screen.UpdateNewWheelOffset() to refresh the button display.
| CommonGrinderScreenV02 SetNewWheelOffsetOn | ( | ) |
Enable the new wheel offset mode by setting pound variable #9057 to 1.
Sets pound variable #9057 to 1 via mc.mcCntlSetPoundVar(), then calls m.screen.UpdateNewWheelOffset() to refresh the button display.
| CommonGrinderScreenV02 TeachDresserBtn | ( | fieldName | , |
| ... ) |
Button handler that delegates to TeachDresser.
Extracts the fieldName parameter and calls m.screen.TeachDresser() to store the current machine position for the dresser axis associated with fieldName. Additional button event arguments (...) are accepted but ignored.
| fieldName | (string) The tool table user value field name identifying the dresser position |
| ... | (any) Additional event arguments (unused) |
| CommonGrinderScreenV02 TouchOffTeachX | ( | ) |
Teach the X-axis touch-off position by capturing the current machine position.
Reads the current X-axis machine position via mc.mcAxisGetMachinePos() and writes it to the "XTouchOffDRO" screen control value.
| CommonGrinderScreenV02 TouchOffTeachZ | ( | ) |
Teach the Z-axis touch-off position by capturing the current machine position.
Reads the current Z-axis machine position via mc.mcAxisGetMachinePos() and writes it to the "ZTouchOffDRO" screen control value.
| CommonGrinderScreenV02 UpdateDresserDiamondSelection | ( | ) |
Update the dresser diamond selection button colors and group enable states.
Reads the current dresser diamond type from m.screen.GetDresserDiamond() and updates the appearance of three diamond selection buttons and their associated image controls. The selected button is highlighted with BTN_COLOR_ON and shows the enabled image; unselected buttons use BTN_COLOR_OFF and show the disabled image. Additionally, enables the input group controls (Diamond1Group, Diamond2Group, Diamond3Group) according to a cumulative rule: Diamond type 1 enables only group 1, type 2 enables groups 1 and 2, and type 3 enables all three groups.
| CommonGrinderScreenV02 UpdateGrinderWheelAttributes | ( | ) |
Update grinder wheel attribute pound variables from the current tool table entry.
Reads all wheel attributes defined by m.screen.GetWheelAttributes() for the currently active tool and synchronizes their values into the corresponding Mach4 pound variables via mc.mcCntlSetPoundVar(). The update is skipped if the machine is running or generating a tool path unless the "WheelParameterChanged" OEM parameter flag is set to 1, which forces an immediate update regardless of machine state. After processing, the "WheelParameterChanged" OEM parameter is reset to 0. If the current tool number is 0 (no tool loaded), all pound variables are set to 0 instead of the tool table values.
| CommonGrinderScreenV02 UpdateNewWheelOffset | ( | ) |
Update the NewWheelOffsetBtn background color to reflect the current new-wheel offset state.
Reads the current new-wheel offset state via m.screen.IsNewWheelOffsetOn() and sets the "NewWheelOffsetBtn" background color to BTN_COLOR_ON if active, or BTN_COLOR_OFF if inactive.
| CommonGrinderScreenV02 UpdateWorkHeadEnable | ( | ) |
Update the work head enable output signal based on spindle and machine state.
When the WorkHeadEnableOutput signal is mapped, reads the spindle on signal, SpindleDelayActive OEM parameter, and the current true spindle RPM to determine whether the work head enable output should be active. The output is set to true when: