|
Mach Modules Documentation
Lua Module API Documentation
|
Go to the source code of this file.
Functions | |
| GrinderDiskGUIModule | ScreenLoadScript () |
| Initialize the GrinderDisk screen by loading required macro modules. | |
| GrinderDiskGUIModule | UpdateSignalLibraryArray () |
| Update the signal library array for the GrinderDisk screen. | |
| GrinderDiskGUIModule | PLCScript () |
| Execute PLC script tasks on each control cycle for the GrinderDisk screen. | |
| GrinderDiskGUIModule | LowPriorityLoop () |
| Execute low-priority periodic tasks for the GrinderDisk screen. | |
| GrinderDiskGUIModule | GetToolTableAttributes () |
| Return the list of tool table attribute names and their associated pound variable indices. | |
| GrinderDiskGUIModule | UpdateToolTableAttributes () |
| Update screen DROs and pound variables with tool table attribute values for the current tool. | |
| GrinderDiskGUIModule | PLCSeqBitData0Btn () |
| Button handler that triggers PLC sequence 0, with spindle interlock protection. | |
| GrinderDiskGUIModule | PLCSeqBitData1Btn () |
| Button handler that triggers PLC sequence 1. | |
| GrinderDiskGUIModule | PLCSeqBitData2Btn () |
| Button handler that triggers PLC sequence 2. | |
| GrinderDiskGUIModule | PLCSeqBitData3Btn () |
| Button handler that triggers PLC sequence 3. | |
| GrinderDiskGUIModule | PLCSeqBitData4Btn () |
| Button handler that triggers PLC sequence 4. | |
| GrinderDiskGUIModule | PLCSeqBitData5Btn () |
| Button handler that triggers PLC sequence 5. | |
| GrinderDiskGUIModule | PLCSeqBitData6Btn () |
| Button handler that triggers PLC sequence 6. | |
| GrinderDiskGUIModule | PLCSeqBitData7Btn () |
| Button handler that triggers PLC sequence 7. | |
| GrinderDiskGUIModule | PLCSeqBitData8Btn () |
| Button handler that triggers PLC sequence 8. | |
| GrinderDiskGUIModule | PLCSeqBitData9Btn () |
| Button handler that triggers PLC sequence 9. | |
| GrinderDiskGUIModule | PLCSeqBitData10Btn () |
| Button handler that triggers PLC sequence 10. | |
| GrinderDiskGUIModule | PLCSeqBitData11Btn () |
| Button handler that triggers PLC sequence 11. | |
| GrinderDiskGUIModule | PLCSeqBitData12Btn () |
| Button handler that triggers PLC sequence 12. | |
| GrinderDiskGUIModule | PLCSeqBitData13Btn () |
| Button handler that triggers PLC sequence 13. | |
| GrinderDiskGUIModule | ManualAutoBtn () |
| Toggle the machine operating mode between Manual (201) and Auto (202). | |
| GrinderDiskGUIModule | CalculateCenterlineOffsetBtn () |
| Calculate and store the centerline offset between the X and Y axis positions. | |
| GrinderDiskGUIModule | CompFineInBtn () |
| Apply a fine compensation move in the inward direction. | |
| GrinderDiskGUIModule | CompFineOutBtn () |
| Apply a fine compensation move in the outward direction. | |
| GrinderDiskGUIModule | Comp (CompAmount) |
| Apply a compensation move to the grinding axes by a specified amount. | |
| GrinderDiskGUIModule | ZeroTotalCompBtn () |
| Reset the cumulative compensation total to zero. | |
| GrinderDiskGUIModule | PLCBitData0Btn () |
| Toggle bit 0 of the ContBitData register on device 0. | |
| GrinderDiskGUIModule | PLCBitData1Btn () |
| Toggle bit 1 of the ContBitData register on device 0. | |
| GrinderDiskGUIModule | IncrementDecrementDRO (Var, Increment) |
| Increment or decrement a pound variable (# variable) by a specified amount. | |
| GrinderDiskGUIModule | SetDresserPosition (AxisID) |
| Set a dresser position for the specified axis by teaching the current machine position. | |
| GrinderDiskGUIModule | TeachDresserPosition (fieldName) |
| Teach (capture) the current machine position into a named dresser position field. | |
| GrinderDiskGUIModule | WriteToolData (fieldName, Data, CurrentTool) |
| Write a data value to a named field in the current tool's tool table entry. | |
| GrinderDiskGUIModule | ToggleOutput (OutputNumber) |
| Toggle the state of a machine output signal. | |
| GrinderDiskGUIModule | StartPLCSeq (SequenceNumber) |
| Execute a PLC sequence by sequence number via the Modbus interface. | |
| GrinderDiskGUIModule CalculateCenterlineOffsetBtn | ( | ) |
Calculate and store the centerline offset between the X and Y axis positions.
Reads the current X and Y axis positions, computes the midpoint offset as ((XPos + YPos) / 2) - XPos, negates the result, and stores it in pound variable #503.
| GrinderDiskGUIModule Comp | ( | CompAmount | ) |
Apply a compensation move to the grinding axes by a specified amount.
Checks for active GMS alarms and warnings before proceeding. Behavior depends on the active grinding mode:
| CompAmount | (number) The compensation distance to apply. Positive values move out, negative values move in |
| GrinderDiskGUIModule CompFineInBtn | ( | ) |
Apply a fine compensation move in the inward direction.
Reads the "CompFineAmount" OEM register to determine the step size, then calls Comp() with the negative absolute value of that amount to move inward (negative direction).
| GrinderDiskGUIModule CompFineOutBtn | ( | ) |
Apply a fine compensation move in the outward direction.
Reads the "CompFineAmount" OEM register to determine the step size, then calls Comp() with the absolute value of that amount to move outward (positive direction).
| GrinderDiskGUIModule GetToolTableAttributes | ( | ) |
Return the list of tool table attribute names and their associated pound variable indices.
Provides a fixed array of two-element tables, each containing a tool table extended data field name and its corresponding Mach4 pound variable index. Currently returns: {"X1DressPosition", 540} and {"Y1DressPosition", 541}.
| GrinderDiskGUIModule IncrementDecrementDRO | ( | Var | , |
| Increment | ) |
Increment or decrement a pound variable (# variable) by a specified amount.
Reads the current value of the Mach4 pound variable at the given index, adds the increment value (which may be negative to decrement), and writes the result back.
| Var | (number) The pound variable index to modify |
| Increment | (number) The amount to add to the current value. Use a negative value to decrement |
| GrinderDiskGUIModule LowPriorityLoop | ( | ) |
Execute low-priority periodic tasks for the GrinderDisk screen.
Called during the low-priority loop cycle. Currently delegates to UpdateToolTableAttributes() to refresh tool table DROs and pound variables.
| GrinderDiskGUIModule ManualAutoBtn | ( | ) |
Toggle the machine operating mode between Manual (201) and Auto (202).
Reads pound variable #563 to determine the current mode. If the value is 201 (Manual), it is changed to 202 (Auto). Otherwise it is set to 201 (Manual).
| GrinderDiskGUIModule PLCBitData0Btn | ( | ) |
Toggle bit 0 of the ContBitData register on device 0.
Reads the current state of bit 0 in the "ContBitData" register on Modbus device 0. If the bit is set, it is cleared; if it is clear, it is set. Displays a message box if the set or clear operation fails.
| GrinderDiskGUIModule PLCBitData1Btn | ( | ) |
Toggle bit 1 of the ContBitData register on device 0.
Reads the current state of bit 1 in the "ContBitData" register on Modbus device 0. If the bit is set, it is cleared; if it is clear, it is set. Displays a message box if the set or clear operation fails.
| GrinderDiskGUIModule PLCScript | ( | ) |
Execute PLC script tasks on each control cycle for the GrinderDisk screen.
Called periodically by the Mach4 PLC loop. If the LOAD_METER_ENABLED_2nd OEM parameter is set to "Yes", updates the spindle load meter display via m.UpdateSpindleLoadMeter(). Additional update functions (feedrate DRO labels, DRO positions, tool verify DRO) are currently commented out.
| GrinderDiskGUIModule PLCSeqBitData0Btn | ( | ) |
Button handler that triggers PLC sequence 0, with spindle interlock protection.
Before starting sequence 0, checks the PLCSeqBitData bit 0 on device 0 to determine if spindles are already on. If they are, returns an error immediately. Otherwise, checks bit 2 of the PLCBitData register; if that bit is clear, sequence 0 is started via StartPLCSeq(). If bit 2 is set, a warning message is displayed to wait for spindles to stop.
| GrinderDiskGUIModule PLCSeqBitData10Btn | ( | ) |
Button handler that triggers PLC sequence 10.
Delegates to GrinderDiskGUIModule.StartPLCSeq() with sequence index 10.
| GrinderDiskGUIModule PLCSeqBitData11Btn | ( | ) |
Button handler that triggers PLC sequence 11.
Delegates to GrinderDiskGUIModule.StartPLCSeq() with sequence index 11.
| GrinderDiskGUIModule PLCSeqBitData12Btn | ( | ) |
Button handler that triggers PLC sequence 12.
Delegates to GrinderDiskGUIModule.StartPLCSeq() with sequence index 12.
| GrinderDiskGUIModule PLCSeqBitData13Btn | ( | ) |
Button handler that triggers PLC sequence 13.
Delegates to GrinderDiskGUIModule.StartPLCSeq() with sequence index 13.
| GrinderDiskGUIModule PLCSeqBitData1Btn | ( | ) |
Button handler that triggers PLC sequence 1.
Delegates to GrinderDiskGUIModule.StartPLCSeq() with sequence index 1.
| GrinderDiskGUIModule PLCSeqBitData2Btn | ( | ) |
Button handler that triggers PLC sequence 2.
Delegates to GrinderDiskGUIModule.StartPLCSeq() with sequence index 2.
| GrinderDiskGUIModule PLCSeqBitData3Btn | ( | ) |
Button handler that triggers PLC sequence 3.
Delegates to GrinderDiskGUIModule.StartPLCSeq() with sequence index 3.
| GrinderDiskGUIModule PLCSeqBitData4Btn | ( | ) |
Button handler that triggers PLC sequence 4.
Delegates to GrinderDiskGUIModule.StartPLCSeq() with sequence index 4.
| GrinderDiskGUIModule PLCSeqBitData5Btn | ( | ) |
Button handler that triggers PLC sequence 5.
Delegates to GrinderDiskGUIModule.StartPLCSeq() with sequence index 5.
| GrinderDiskGUIModule PLCSeqBitData6Btn | ( | ) |
Button handler that triggers PLC sequence 6.
Delegates to GrinderDiskGUIModule.StartPLCSeq() with sequence index 6.
| GrinderDiskGUIModule PLCSeqBitData7Btn | ( | ) |
Button handler that triggers PLC sequence 7.
Delegates to GrinderDiskGUIModule.StartPLCSeq() with sequence index 7.
| GrinderDiskGUIModule PLCSeqBitData8Btn | ( | ) |
Button handler that triggers PLC sequence 8.
Delegates to GrinderDiskGUIModule.StartPLCSeq() with sequence index 8.
| GrinderDiskGUIModule PLCSeqBitData9Btn | ( | ) |
Button handler that triggers PLC sequence 9.
Delegates to GrinderDiskGUIModule.StartPLCSeq() with sequence index 9.
| GrinderDiskGUIModule ScreenLoadScript | ( | ) |
Initialize the GrinderDisk screen by loading required macro modules.
Configures the Lua package path to include the profile Macros directory, then force-reloads the m225 and m400 macro modules by clearing their cached entries in package.loaded before requiring them. This ensures the latest versions of these macros are active when the screen loads.
| GrinderDiskGUIModule SetDresserPosition | ( | AxisID | ) |
Set a dresser position for the specified axis by teaching the current machine position.
Verifies that the position display is in unlocked mode before allowing the teach operation. Delegates to TeachDresserPosition() using the appropriate field name based on the axis ID. Only X_AXIS and Y_AXIS are currently supported.
| AxisID | (number) The axis identifier for which to set the dresser position (e.g., mc.X_AXIS, mc.Y_AXIS) |
| GrinderDiskGUIModule StartPLCSeq | ( | SequenceNumber | ) |
Execute a PLC sequence by sequence number via the Modbus interface.
Updates the machine stop status before calling the PLC sequence. Uses mb.SeqCall() to trigger the specified sequence on device 0. If the sequence call fails, displays an error message dialog. Debugging is disabled by default.
| SequenceNumber | (number) The index of the PLC sequence to execute |
| GrinderDiskGUIModule TeachDresserPosition | ( | fieldName | ) |
Teach (capture) the current machine position into a named dresser position field.
Determines the relevant axis from the field name, optionally prompts the operator for confirmation (based on the ConfirmationDialogs OEM parameter), then reads the current machine position for that axis and writes it to the tool table via WriteToolData(). The tool file is saved after a successful write. Supports X, Y, and Z dresser position fields.
| fieldName | (string) The tool table field name identifying the dresser position to teach. Supported values include: "X1DressPosition", "X2DressPosition", "X3DressPosition", "XDresserOffset", "Y1DressPosition", "Y2DressPosition", "Y3DressPosition", "Z1DressPosition", "Z2DressPosition", "Z3DressPosition" |
| GrinderDiskGUIModule ToggleOutput | ( | OutputNumber | ) |
Toggle the state of a machine output signal.
Reads the current state of the specified output signal and inverts it. If the signal is currently active (true), it is deactivated, and vice versa.
| OutputNumber | (number) The output signal identifier (e.g., mc.OSIG_OUTPUT20) |
| GrinderDiskGUIModule UpdateSignalLibraryArray | ( | ) |
Update the signal library array for the GrinderDisk screen.
Currently a stub implementation that returns a success status without performing any signal library updates.
| GrinderDiskGUIModule UpdateToolTableAttributes | ( | ) |
Update screen DROs and pound variables with tool table attribute values for the current tool.
Retrieves the current tool number and iterates over the tool attributes defined by GetToolTableAttributes(). For each attribute, reads the extended tool data string from the tool table and writes it to the corresponding screen DRO (named "<AttributeName>DRO") and the associated pound variable. If the tool number is 0 or less, DROs are set to "0" and pound variables are set to 0.
| GrinderDiskGUIModule WriteToolData | ( | fieldName | , |
| Data | , | ||
| CurrentTool | ) |
Write a data value to a named field in the current tool's tool table entry.
Writes a numeric value to the specified extended tool data field for the given tool. If CurrentTool is nil, the function retrieves the currently active tool number. If the tool number is 0 or less, the write is rejected. On success, the tool file is saved automatically.
| fieldName | (string) The name of the tool table extended data field to write |
| Data | (number) The numeric value to store in the tool table field |
| CurrentTool | (number|nil) The tool number to write to. If nil, uses the current tool |
References CurrentTool().
| GrinderDiskGUIModule ZeroTotalCompBtn | ( | ) |
Reset the cumulative compensation total to zero.
Sets the "CompTotal" OEM register to 0, clearing the running total of all compensation amounts that have been applied.