|
Mach Modules Documentation
Lua Module API Documentation
|
Go to the source code of this file.
Functions | |
| GrinderSurfaceGUIModuleV01 | ScreenLoadScript () |
| Initialize screen-level globals, signal library entries, and the GrindDressCycleStart input handler. | |
| GrinderSurfaceGUIModuleV01 | StartUpScript () |
| Initialize machine axis configuration and write axis type pound variables on screen startup. | |
| GrinderSurfaceGUIModuleV01 | GetWheelAttributes () |
| Return the list of wheel attribute definitions mapping tool table field names to pound variable numbers. | |
| GrinderSurfaceGUIModuleV01 | UpdateGrinderWheelAttributes () |
| Update grinding wheel tool table attributes from the current tool's extended data to pound variables. | |
| GrinderSurfaceGUIModuleV01 | ResetTotalCompBtn (AxisID) |
| Reset the accumulated total compensation value for a specified axis to zero. | |
| GrinderSurfaceGUIModuleV01 | CompMainGrindAxis (Direction, Amount) |
| Apply a compensation move to the main vertical grinding axis. | |
| GrinderSurfaceGUIModuleV01 | Comp (AxisID, Type, Direction, Amount) |
| Apply a compensation move to a specified axis by adjusting the work offset and optionally moving to zero. | |
| GrinderSurfaceGUIModuleV01 | StartHydraulics () |
| Start the hydraulics system by activating the HydraulicsOutput OEM parameter signal. | |
| GrinderSurfaceGUIModuleV01 | StopHydraulics () |
| Stop the hydraulics system by stopping the grinding wheel and deactivating the hydraulics output. | |
| GrinderSurfaceGUIModuleV01 | HydraulicsToggleBtn () |
| Toggle hydraulics on or off based on the current HydraulicsOutput signal state. | |
| GrinderSurfaceGUIModuleV01 | StartGrindingWheel () |
| Start the grinding wheel after verifying no alarms or warnings are active. | |
| GrinderSurfaceGUIModuleV01 | StopGrindingWheel () |
| Stop the grinding wheel by turning off the output signal and setting spindle direction to off. | |
| GrinderSurfaceGUIModuleV01 | GrindingWheelToggleBtn () |
| Toggle the grinding wheel on or off based on its current output signal state. | |
| GrinderSurfaceGUIModuleV01 | UpdateGrinderControls () |
| Update high-priority grinder UI controls including the total comp DRO and end-of-program handling. | |
| GrinderSurfaceGUIModuleV01 | UpdateLowPriorityGrinderControls () |
| Update low-priority grinder UI elements including hydraulics, grinding wheel, coolant, and comp buttons. | |
| GrinderSurfaceGUIModuleV01 | PLCScript () |
| Execute high-priority PLC script updates for the surface grinder screen. | |
| GrinderSurfaceGUIModuleV01 | LowPriorityLoop () |
| Execute low-priority periodic updates for grinder UI controls and wheel attributes. | |
| GrinderSurfaceGUIModuleV01 | ToggleMDI () |
| Toggle the MDI input group visibility, switching between the G-code view and the MDI line. | |
| GrinderSurfaceGUIModuleV01 | CycleStop () |
| Stop the current grind cycle, retract the grinding wheel, reset alarms, and turn off all outputs. | |
| GrinderSurfaceGUIModuleV01 | MachineCycleStartFinal () |
| Finalize cycle start by setting the current tab pound variable and triggering toolpath regeneration. | |
| GrinderSurfaceGUIModuleV01 | UpdatePoundVars () |
| Refresh pound variables #500-#550 by reading and re-writing each value to force screen DRO updates. | |
| GrinderSurfaceGUIModuleV01 | TeachDresser (fieldName) |
| Teach the dresser position for a given tool table field by reading current machine position. | |
| GrinderSurfaceGUIModuleV01 Comp | ( | AxisID | , |
| Type | , | ||
| Direction | , | ||
| Amount | ) |
Apply a compensation move to a specified axis by adjusting the work offset and optionally moving to zero.
Reads the compensation amount from pound variable #508 (Coarse Comp) or #509 (Fine Comp) based on the Amount parameter. Negates the amount if Direction is not 1. Warns if Feed Override or Rapid Override is less than 1%. Supports two compensation types:
| AxisID | (number) The Mach4 axis ID constant (e.g., mc.X_AXIS, mc.Y_AXIS, mc.Z_AXIS) |
| Type | (number) Compensation type: 1 = adjust offset only, 2 = adjust offset and move to zero |
| Direction | (number) Movement direction: 1 = positive, any other value = negative |
| Amount | (string) Compensation amount selector: "Coarse" reads #508, any other value reads #509 (Fine) |
| GrinderSurfaceGUIModuleV01 CompMainGrindAxis | ( | Direction | , |
| Amount | ) |
Apply a compensation move to the main vertical grinding axis.
Delegates to Comp() using the global VERTICAL_AXIS_ID and Type 1 (offset adjust only).
| Direction | (number) Movement direction: 1 = positive, any other value = negative |
| Amount | (string) Compensation amount selector: "Coarse" reads pound var #508, otherwise reads #509 (Fine) |
| GrinderSurfaceGUIModuleV01 CycleStop | ( | ) |
Stop the current grind cycle, retract the grinding wheel, reset alarms, and turn off all outputs.
Performs a full cycle stop sequence for the surface grinder:
| GrinderSurfaceGUIModuleV01 GetWheelAttributes | ( | ) |
Return the list of wheel attribute definitions mapping tool table field names to pound variable numbers.
Returns a two-dimensional table where each entry contains a tool table field name string and a corresponding pound variable number. This table is also used inside the t.mcs tool change macro and must be kept in sync with that file.
| GrinderSurfaceGUIModuleV01 GrindingWheelToggleBtn | ( | ) |
Toggle the grinding wheel on or off based on its current output signal state.
Reads the current state of the GrindingWheelOutput OEM parameter signal. If the output is currently active, calls StopGrindingWheel(); otherwise calls StartGrindingWheel().
| GrinderSurfaceGUIModuleV01 HydraulicsToggleBtn | ( | ) |
Toggle hydraulics on or off based on the current HydraulicsOutput signal state.
Reads the current state of the HydraulicsOutput OEM parameter signal. If the output is currently active, calls StopHydraulics(); otherwise calls StartHydraulics().
| GrinderSurfaceGUIModuleV01 LowPriorityLoop | ( | ) |
Execute low-priority periodic updates for grinder UI controls and wheel attributes.
Called on a low-priority timer loop. Delegates to UpdateLowPriorityGrinderControls() for UI updates (button labels, colors, signal states) and to UpdateGrinderWheelAttributes() to sync tool table dress position data to pound variables.
| GrinderSurfaceGUIModuleV01 MachineCycleStartFinal | ( | ) |
Finalize cycle start by setting the current tab pound variable and triggering toolpath regeneration.
Reads the currently active tab from the MainWindowTabs UI control, writes it to pound variable #514, and returns early if the active tab is not a grinder tab (3, 4, or 5). For grinder tabs, if the machine is IDLE and no M00 is active, it triggers a toolpath regeneration dialog.
| GrinderSurfaceGUIModuleV01 PLCScript | ( | ) |
Execute high-priority PLC script updates for the surface grinder screen.
Called on every PLC cycle. Performs the following updates in order:
| GrinderSurfaceGUIModuleV01 ResetTotalCompBtn | ( | AxisID | ) |
Reset the accumulated total compensation value for a specified axis to zero.
| AxisID | (number) The Mach4 axis ID constant. Used as a 0-based index into the TOTAL_COMP table |
| GrinderSurfaceGUIModuleV01 ScreenLoadScript | ( | ) |
Initialize screen-level globals, signal library entries, and the GrindDressCycleStart input handler.
Performs the following setup on screen load:
| GrinderSurfaceGUIModuleV01 StartGrindingWheel | ( | ) |
Start the grinding wheel after verifying no alarms or warnings are active.
Performs the following sequence:
| GrinderSurfaceGUIModuleV01 StartHydraulics | ( | ) |
Start the hydraulics system by activating the HydraulicsOutput OEM parameter signal.
| GrinderSurfaceGUIModuleV01 StartUpScript | ( | ) |
Initialize machine axis configuration and write axis type pound variables on screen startup.
Performs the following initialization sequence:
| GrinderSurfaceGUIModuleV01 StopGrindingWheel | ( | ) |
Stop the grinding wheel by turning off the output signal and setting spindle direction to off.
Deactivates the GrindingWheelOutput OEM parameter signal and then calls mc.mcSpindleSetDirection() with mc.MC_SPINDLE_OFF to stop the spindle.
| GrinderSurfaceGUIModuleV01 StopHydraulics | ( | ) |
Stop the hydraulics system by stopping the grinding wheel and deactivating the hydraulics output.
First calls StopGrindingWheel() to ensure the grinding wheel is stopped before hydraulics are disabled, then deactivates the HydraulicsOutput OEM parameter signal.
| GrinderSurfaceGUIModuleV01 TeachDresser | ( | fieldName | ) |
Teach the dresser position for a given tool table field by reading current machine position.
Determines the axis (X, Y, or Z) based on the field name provided, reads the current machine position for that axis, and stores it in the tool table under the given field name. Supports up to three dress positions per axis (e.g., X1DressPosition, X2DressPosition, X3DressPosition). After updating the tool table, the tool file is saved to disk.
| fieldName | (string) The tool table field name identifying the dress position to teach. Valid values include: "X1DressPosition", "X2DressPosition", "X3DressPosition", "Y1DressPosition", "Y2DressPosition", "Y3DressPosition", "Z1DressPosition", "Z2DressPosition", "Z3DressPosition" |
| GrinderSurfaceGUIModuleV01 ToggleMDI | ( | ) |
Toggle the MDI input group visibility, switching between the G-code view and the MDI line.
Requires password protection level 1 before toggling. Reads the current Left position of the MDIGroup panel to determine whether it is visible (Left == "105") or hidden (Left == "10000"). Swaps the MDI and GCode group positions accordingly and updates the MdiBtn label and background color.
| GrinderSurfaceGUIModuleV01 UpdateGrinderControls | ( | ) |
Update high-priority grinder UI controls including the total comp DRO and end-of-program handling.
Performs two updates on each PLC cycle:
| GrinderSurfaceGUIModuleV01 UpdateGrinderWheelAttributes | ( | ) |
Update grinding wheel tool table attributes from the current tool's extended data to pound variables.
Retrieves the current tool number and iterates through the wheel attribute definitions returned by GetWheelAttributes(). For each attribute, reads the value from the tool table using mc.mcToolGetDataExDbl(). If the machine is IDLE and the current tool is greater than 0, writes the tool data value to the corresponding pound variable. If the tool is 0, writes 0 to the pound variable instead. Only updates pound variables when the machine is in MC_STATE_IDLE.
| GrinderSurfaceGUIModuleV01 UpdateLowPriorityGrinderControls | ( | ) |
Update low-priority grinder UI elements including hydraulics, grinding wheel, coolant, and comp buttons.
Refreshes the following UI controls:
| GrinderSurfaceGUIModuleV01 UpdatePoundVars | ( | ) |
Refresh pound variables #500-#550 by reading and re-writing each value to force screen DRO updates.
Waits for the machine to reach IDLE state via w.PleaseWaitDialog(), then iterates through pound variables #500 through #550, reading each value with mc.mcCntlGetPoundVar() and immediately writing it back with mc.mcCntlSetPoundVar(). This forces the screen to refresh any DROs bound to these variables. The function blocks until the machine is idle before proceeding.