|
Mach Modules Documentation
Lua Module API Documentation
|
Go to the source code of this file.
Functions | |
| GrinderDiskScreenV01 | MachineScreenLoadScript () |
| Initialize the grinder disk screen on load. | |
| GrinderDiskScreenV01 | MachineScreenUnloadScript () |
| Perform cleanup actions when the grinder disk screen is unloaded. | |
| GrinderDiskScreenV01 | MachineScreenPLCScript () |
| Periodic PLC update loop executed every Mach4 screen cycle. | |
| GrinderDiskScreenV01 | MachineScreenLowPriorityLoop () |
| Low-priority periodic update loop for the grinder disk screen. | |
| GrinderDiskScreenV01 | EnterTab (tab) |
| Perform setup actions when entering a grinder tab. | |
| GrinderDiskScreenV01 | ExitTab (tab) |
| Perform cleanup actions when leaving a grinder tab. | |
| GrinderDiskScreenV01 | IsManualModeActive () |
| Check whether the screen is currently in Manual mode. | |
| GrinderDiskScreenV01 | IsThruFeedModeActive () |
| Check whether the screen is currently in ThruFeed mode. | |
| GrinderDiskScreenV01 | IsOscillatorModeActive () |
| Check whether the screen is currently in Oscillator mode. | |
| GrinderDiskScreenV01 | IsDressModeActive () |
| Check whether the screen is currently in Dress mode. | |
| GrinderDiskScreenV01 | HideMachMenu () |
| Hide the Mach4 menu bar and persist the preference to the profile. | |
| GrinderDiskScreenV01 | ShowMachMenu () |
| Show the Mach4 menu bar and persist the preference to the profile. | |
| GrinderDiskScreenV01 | ConfigureMachMenu () |
| Apply the saved Mach menu visibility preference at startup. | |
| GrinderDiskScreenV01 | ToggleMachMenu () |
| Toggle the Mach4 menu bar between visible and hidden states. | |
| GrinderDiskScreenV01 | SetGrindAmount (Amount) |
| Set the grind amount by writing a value to pound variable #516. | |
| GrinderDiskScreenV01 | UpdateGrindAmountBtn () |
| Update the grind amount button highlight to reflect the current pound variable value. | |
| GrinderDiskScreenV01 | IsMDIModeActive () |
| Check whether the screen is currently in MDI mode. | |
| GrinderDiskScreenV01 | GetMDIControlName () |
| Return the name of the MDI input control used on the Operations page. | |
| GrinderDiskScreenV01 | LoadJob () |
| Load the last used job file at screen startup. | |
| GrinderDiskScreenV01 | JobOpen () |
| Open a job file selected by the operator via a file dialog. | |
| GrinderDiskScreenV01 | JobClose () |
| Close the current job file, optionally saving changes first. | |
| GrinderDiskScreenV01 | JobSave () |
| Save the current job file to its existing path. | |
| GrinderDiskScreenV01 | JobSaveAs () |
| Save the current job file under a new name via a Save As dialog. | |
| GrinderDiskScreenV01 ConfigureMachMenu | ( | ) |
Apply the saved Mach menu visibility preference at startup.
Reads the HideMachMenu integer from the MachMotion profile. If the stored value is 0 the menu is shown; otherwise it is hidden. Called during screen load to restore the operator's previous menu visibility preference.
| GrinderDiskScreenV01 EnterTab | ( | tab | ) |
Perform setup actions when entering a grinder tab.
For tabs 0 and 3 (Manual and Dress), sets ContBitData bit 2 via Modbus to enable the dresser jog buttons on the PLC side. For tabs 1 and 2 (ThruFeed and Oscillator), activates output signal OSIG_OUTPUT63. Displays a message box if the Modbus SetBit operation fails.
| tab | (number) The tab index being entered (0 = Manual, 1 = ThruFeed, 2 = Oscillator, 3 = Dress) |
| GrinderDiskScreenV01 ExitTab | ( | tab | ) |
Perform cleanup actions when leaving a grinder tab.
Resets the grind amount to 0 via SetGrindAmount(). For tabs 0 and 3 (Manual and Dress), clears ContBitData bit 2 to disable the dresser jog buttons on the PLC side. For tabs 1 and 2 (ThruFeed and Oscillator), deactivates output signal OSIG_OUTPUT63. Displays a message box if the Modbus ClearBit operation fails.
| tab | (number) The tab index being exited (0 = Manual, 1 = ThruFeed, 2 = Oscillator, 3 = Dress) |
| GrinderDiskScreenV01 GetMDIControlName | ( | ) |
Return the name of the MDI input control used on the Operations page.
| GrinderDiskScreenV01 HideMachMenu | ( | ) |
Hide the Mach4 menu bar and persist the preference to the profile.
Calls scr.ShowMenu(false) to hide the Mach4 menu bar, then writes 1 to the HideMachMenu key in the MachMotion profile so the preference is restored on the next screen load.
| GrinderDiskScreenV01 IsDressModeActive | ( | ) |
Check whether the screen is currently in Dress mode.
Returns true when the global CURRENT_MODE equals 3, which corresponds to the Dress tab (tab index 3) of the GrinderTabs control. CURRENT_MODE is updated every low-priority loop cycle from the active tab.
| GrinderDiskScreenV01 IsManualModeActive | ( | ) |
Check whether the screen is currently in Manual mode.
Returns true when the global CURRENT_MODE equals 0, which corresponds to the Manual tab (tab index 0) of the GrinderTabs control. CURRENT_MODE is updated every low-priority loop cycle from the active tab.
| GrinderDiskScreenV01 IsMDIModeActive | ( | ) |
Check whether the screen is currently in MDI mode.
Returns true only when the operator is on page 1 (Operations page) and has tab index 2 (MDI tab) selected in the OperationsTabs control. Both conditions must be satisfied simultaneously for MDI mode to be considered active.
| GrinderDiskScreenV01 IsOscillatorModeActive | ( | ) |
Check whether the screen is currently in Oscillator mode.
Returns true when the global CURRENT_MODE equals 2, which corresponds to the Oscillator tab (tab index 2) of the GrinderTabs control. CURRENT_MODE is updated every low-priority loop cycle from the active tab.
| GrinderDiskScreenV01 IsThruFeedModeActive | ( | ) |
Check whether the screen is currently in ThruFeed mode.
Returns true when the global CURRENT_MODE equals 1, which corresponds to the ThruFeed tab (tab index 1) of the GrinderTabs control. CURRENT_MODE is updated every low-priority loop cycle from the active tab.
| GrinderDiskScreenV01 JobClose | ( | ) |
Close the current job file, optionally saving changes first.
Screen entry point that wraps GrinderDiskScreenV01._JobClose() in a protected call. Prompts the operator to save any unsaved changes before closing, then closes the job and clears the LastJobName profile entry so no job is auto-loaded on the next screen load. If the protected call fails, an alarm message is raised.
| GrinderDiskScreenV01 JobOpen | ( | ) |
Open a job file selected by the operator via a file dialog.
Screen entry point that wraps GrinderDiskScreenV01._JobOpen() in a protected call. Prompts the operator to save any unsaved changes in the current job, then opens a file chooser dialog. After a new job is opened, the selected file path is written to the LastJobName profile entry so it is restored on the next screen load. Logs the open action to the operator log. If the protected call fails, an alarm message is raised.
| GrinderDiskScreenV01 JobSave | ( | ) |
Save the current job file to its existing path.
Screen entry point that wraps GrinderDiskScreenV01._JobSave() in a protected call. Saves the current job without prompting for a file name. If the protected call fails, an alarm message is raised instead of propagating the error.
| GrinderDiskScreenV01 JobSaveAs | ( | ) |
Save the current job file under a new name via a Save As dialog.
Screen entry point that wraps GrinderDiskScreenV01._JobSaveAs() in a protected call. Prompts the operator to choose a new file path, saves the job, and updates the LastJobName profile entry so the new path is remembered across sessions. If the protected call fails, an alarm message is raised instead of propagating the error.
| GrinderDiskScreenV01 LoadJob | ( | ) |
Load the last used job file at screen startup.
Screen entry point that wraps GrinderDiskScreenV01._LoadJob() in a protected call. Reads the LastJobName profile string and, if non-empty, loads that job into GrinderDiskScreenV01.CurrentJob. This is typically called during GrinderDiskScreenV01.MachineScreenLoadScript() to restore the operator's previous session. If the protected call fails, an alarm message is raised instead of propagating the error.
| GrinderDiskScreenV01 MachineScreenLoadScript | ( | ) |
Initialize the grinder disk screen on load.
Called by the Mach4 screen engine when the screen is first loaded. Performs the following initialization steps in order:
| GrinderDiskScreenV01 MachineScreenLowPriorityLoop | ( | ) |
Low-priority periodic update loop for the grinder disk screen.
Called repeatedly by the Mach4 screen engine at low priority. Performs the following updates each cycle:
| GrinderDiskScreenV01 MachineScreenPLCScript | ( | ) |
Periodic PLC update loop executed every Mach4 screen cycle.
Performs the following updates each cycle:
| GrinderDiskScreenV01 MachineScreenUnloadScript | ( | ) |
Perform cleanup actions when the grinder disk screen is unloaded.
Called by the Mach4 screen engine when the screen is being unloaded. If GrinderDiskScreenV01.CurrentJob is not nil, calls OptSaveChanges() on it to prompt the operator to save any unsaved job file changes before the screen closes.
| GrinderDiskScreenV01 SetGrindAmount | ( | Amount | ) |
Set the grind amount by writing a value to pound variable #516.
Writes the provided Amount to Mach4 pound variable #516 via mc.mcCntlSetPoundVar(), then immediately calls UpdateGrindAmountBtn() to refresh the button highlight state on screen.
| Amount | (number) The grind amount to set. Typical values are 0, 0.0005, 0.001, or 0.002 |
| GrinderDiskScreenV01 ShowMachMenu | ( | ) |
Show the Mach4 menu bar and persist the preference to the profile.
Calls scr.ShowMenu(true) to make the Mach4 menu bar visible, then writes 0 to the HideMachMenu key in the MachMotion profile so the preference is restored on the next screen load.
| GrinderDiskScreenV01 ToggleMachMenu | ( | ) |
Toggle the Mach4 menu bar between visible and hidden states.
Reads the current HideMachMenu profile value and calls either GrinderDiskScreenV01.HideMachMenu() or GrinderDiskScreenV01.ShowMachMenu() to invert the current state. The new state is persisted to the MachMotion profile automatically by the called function.
| GrinderDiskScreenV01 UpdateGrindAmountBtn | ( | ) |
Update the grind amount button highlight to reflect the current pound variable value.
Reads pound variable #516 to determine the active grind amount. Clears all four grind amount button highlights (GrindAmount0Btn through GrindAmount3Btn), then lights the button corresponding to the current value (0, 0.0005, 0.001, or 0.002). The update is skipped if the value has not changed since the last call, using the global LAST_GRIND_AMOUNT to track state.