|
Mach Modules Documentation
Lua Module API Documentation
|
Go to the source code of this file.
Functions | |
| GrinderSurfaceScreenV02 | MachineCycleStop () |
| Stop the current machine cycle and reset the cycle state to idle. | |
| GrinderSurfaceScreenV02 | MachineScreenLoadScript () |
| Execute all one-time screen load initialization tasks for the Surface Grinder. | |
| GrinderSurfaceScreenV02 | CompileScripts () |
| Execute cleanup tasks when scripts are recompiled. | |
| GrinderSurfaceScreenV02 | MachineScreenStartupScript () |
| Execute all one-time startup initialization tasks for the Surface Grinder screen. | |
| GrinderSurfaceScreenV02 | MachineScreenPLCScript () |
| Execute all PLC-frequency screen update functions. | |
| GrinderSurfaceScreenV02 | MachineScreenLowPriorityLoop () |
| Execute all low-priority periodic screen update functions. | |
| GrinderSurfaceScreenV02 | MachineHomeAllEnd () |
| Execute post-home actions after homing all axes. | |
| GrinderSurfaceScreenV02 | CreateConversationalTabData () |
| Define all conversational tab data entries for the Surface Grinder job tree. | |
| GrinderSurfaceScreenV02 | InitializeJobTreeData () |
| Initialize job tree tab metadata and set up Add button labels and colors. | |
| GrinderSurfaceScreenV02 | CycleStart () |
| Determine the appropriate cycle start action based on the active tab and job tree state. | |
| GrinderSurfaceScreenV02 | MachineCycleStartFinal () |
| Perform final pre-cycle-start checks and optionally reset the controller. | |
| GrinderSurfaceScreenV02 | GetCurrentConversationalTab () |
| Get the label of the currently active conversational tab. | |
| GrinderSurfaceScreenV02 | OnJobTreeTimer () |
| Process incoming job tree file queue commands and dispatch edit or post operations. | |
| GrinderSurfaceScreenV02 | IsEditingJobTreeCycle () |
| Return whether a job tree cycle is currently being edited. | |
| GrinderSurfaceScreenV02 | SetIsEditingJobTreeCycle (state, data_table) |
| Enter or exit job tree cycle edit mode and update the UI accordingly. | |
| GrinderSurfaceScreenV02 | GetCurrentJobTreeEditTable () |
| Return the data table of the job tree item currently being edited. | |
| GrinderSurfaceScreenV02 | GetCurrentJobTreeTab () |
| Return the tab index of the job tree item currently being edited. | |
| GrinderSurfaceScreenV02 | GetJobTreeLFQPaths () |
| Return the input and output directory paths for the job tree file queue. | |
| GrinderSurfaceScreenV02 | SendDataToJobTree (tbl) |
| Serialize a job item data table and send it to the job tree process via the file queue. | |
| GrinderSurfaceScreenV02 | SetJobTreeHeader () |
| Send a command to the job tree to set the G-code header string. | |
| GrinderSurfaceScreenV02 | SetJobTreeFooter () |
| Send a command to the job tree to set the G-code footer string. | |
| GrinderSurfaceScreenV02 | GetJobTreeCount () |
| Query the job tree for the current item count via the file queue with a please-wait dialog. | |
| check () | |
| Poll the file queue for a reply to the pending GetJobTreeCount request. | |
| GrinderSurfaceScreenV02 | PostJobTree () |
| Post the entire job tree to generate G-code via the file queue. | |
| GrinderSurfaceScreenV02 | PostJobItem (data) |
| Post a single job item to the job tree via the file queue. | |
| GrinderSurfaceScreenV02 | SaveJobTree () |
| Send a save command to the job tree via the file queue. | |
| GrinderSurfaceScreenV02 | AddToJobTreeBtn () |
| Add the current conversational tab's data to the job tree. | |
| GrinderSurfaceScreenV02 | FillInScreenJobTreeData (tbl) |
| Look up the matching conversational tab metadata for a job tree data table and fill in screen fields. | |
| GrinderSurfaceScreenV02 | GetJobTreeSurfaceGrindData () |
| Collect current surface grinding job tree data from pound variables and return a structured table. | |
| GrinderSurfaceScreenV02 | PopulateSurfaceGrindFromJobTree (data) |
| Populate the screen with surface grinding job tree data and enter job tree edit mode. | |
| GrinderSurfaceScreenV02 | GetJobTreeSlotGrindData () |
| Collect current slot grinding job tree data from pound variables and return a structured table. | |
| GrinderSurfaceScreenV02 | PopulateSlotGrindFromJobTree (data) |
| Populate the screen with slot grinding job tree data and enter job tree edit mode. | |
| GrinderSurfaceScreenV02 | GetJobTreeFaceGrindData () |
| Collect current face grinding job tree data from pound variables and return a structured table. | |
| GrinderSurfaceScreenV02 | PopulateFaceGrindFromJobTree (data) |
| Populate the screen with face grinding job tree data and enter job tree edit mode. | |
| GrinderSurfaceScreenV02 | GetJobTreeDicingData () |
| Collect current dicing job tree data from pound variables and return a structured table. | |
| GrinderSurfaceScreenV02 | PopulateDicingFromJobTree (data) |
| Populate the screen with dicing job tree data and enter job tree edit mode. | |
| GrinderSurfaceScreenV02 | GetJobTreeDressingData () |
| Collect current dressing job tree data from pound variables and return a structured table. | |
| GrinderSurfaceScreenV02 | PopulateDressingFromJobTree (data) |
| Populate the screen with dressing job tree data and enter job tree edit mode. | |
| GrinderSurfaceScreenV02 | InitializeOperationGrindAdvancedBtn () |
| Initialize all advanced operation grind buttons from the last saved profile state. | |
| GrinderSurfaceScreenV02 | OperationGrindAdvancedBtn (grind_type, show_hide) |
| Toggle the advanced options group visibility for a specified grind type and persist the state. | |
| GrinderSurfaceScreenV02 | OperationGrindUseClearanceBtn (grind_type) |
| Update the clearance height DRO enabled state based on the use clearance toggle button. | |
| GrinderSurfaceScreenV02 | DicingTestCutBtn () |
| Update the test cut count DRO enabled state based on the dicing test cuts toggle button. | |
| GrinderSurfaceScreenV02 | IsRetracting () |
| Return whether a retraction is currently in progress. | |
| GrinderSurfaceScreenV02 | SetRetracting (new_state) |
| Set the IsRetracting interlock state and log the change. | |
| GrinderSurfaceScreenV02 | PreCycleStop () |
| Check whether a retraction is already in progress and abort the cycle stop if so. | |
| GrinderSurfaceScreenV02 | MoveToRetractPosition (CustomMode) |
| Execute a retract motion to a safe position with interlock protection. | |
| GrinderSurfaceScreenV02 | MachinePreCycleStop () |
| Capture the current grind state and cycle type pound variables before a cycle stop. | |
| GrinderSurfaceScreenV02 | StopHydraulicAxis () |
| Stop all hydraulic axis motion and update the stop status. | |
| GrinderSurfaceScreenV02 | MachineCycleStopFinal (CustomMode) |
| Execute the full cycle stop sequence including hydraulic stop, safety retract, and G-code rewind. | |
| GrinderSurfaceScreenV02 | MoveToCycleStopRetractPosition () |
| Execute the cycle stop retract move inside a protected call and return the result. | |
| GrinderSurfaceScreenV02 | InitializeRetractSafetyAmount () |
| Show or hide the retract safety amount group based on the OEM parameter setting. | |
| GrinderSurfaceScreenV02 | InitializeTableDirections () |
| Initialize the default table direction for X and Z hydraulic axes from OEM parameters. | |
| GrinderSurfaceScreenV02 | InitializeAxes () |
| Initialize PLC parameter bits for the X and Z axes based on their enabled state. | |
| GrinderSurfaceScreenV02 | InitializeAxisPositionGroup () |
| Initialize the axis position DRO group layout, visibility, and positioning for all axes. | |
| ShowHideHydraulicControls (AxisID, showhide) | |
| Show or hide all hydraulic control LEDs and axis text for a given axis. | |
| GrinderSurfaceScreenV02 | UpdateZeroButtons () |
| Update the visibility and label of axis text and zero buttons based on edit mode state. | |
| GrinderSurfaceScreenV02 | IsHydraulicTableEnabledOnAxis (AxisID) |
| Determine whether the specified axis is configured as a hydraulic table axis. | |
| GrinderSurfaceScreenV02 | HandleHomingForHydraulicAxes () |
| Prompt the operator to home hydraulic axes if required by the OEM register setting. | |
| GrinderSurfaceScreenV02 | GetWheelAttributes () |
| Retrieve the current grinding wheel attributes from the aux module. | |
| GrinderSurfaceScreenV02 | TeachZDistanceBtn () |
| Commented-out function for teaching the Z crossover distance pound variable. | |
| GrinderSurfaceScreenV02 | TeachPoundVar (PoundVar, AxisID, StartEnd) |
| Teach a pound variable by capturing the current position of the specified axis. | |
| GrinderSurfaceScreenV02 | TouchOffTeachY () |
| Teach the Y touch-off position from the current Y axis machine position. | |
| GrinderSurfaceScreenV02 | TouchOffTeachZ () |
| Teach the Z touch-off position from the current Z axis machine position. | |
| GrinderSurfaceScreenV02 | ExecuteCalibrationBtn () |
| Execute tool calibration by computing and applying X and Z tool offsets from touch-off positions. | |
| GrinderSurfaceScreenV02 | ScreenTabEnter (tab) |
| Handle tab enter events and update screen state based on the active tab. | |
| GrinderSurfaceScreenV02 | ScreenTabExit (tab) |
| Handle tab exit events for the OperationTabs notebook. | |
| GrinderSurfaceScreenV02 | ScreenPageChanging (notebook) |
| Intercept notebook page change events to prevent tab switching while editing a job tree cycle. | |
| GrinderSurfaceScreenV02 | InitializeToolTableFields () |
| Initialize the tool table user fields for the Surface Grinder screen. | |
| GrinderSurfaceScreenV02 CYCLE | Initialize () |
| Initialize the grind cycle state machine, state/type tables, and screen label update logic. | |
| cyc | UpdateCombLabels (dressing_passes, _type, type_passes) |
| Update the combined cycle label screen objects with the current state and type descriptions. | |
| cyc STATE | GetNumber () |
| Get the current cycle state number from pound variable 9080. | |
| GrinderSurfaceScreenV02 | ControlsGroupHideCycleStart () |
| Rearrange the controls group to hide the Cycle Start button and reposition the file group. | |
| GrinderSurfaceScreenV02 | ControlsGroupShowCycleStart () |
| Rearrange the controls group to show the Cycle Start button and reposition the file group. | |
| GrinderSurfaceScreenV02 | ControlsGroupShow () |
| Show the controls group and reposition the file group. | |
| GrinderSurfaceScreenV02 | ControlsGroupHide () |
| Hide the controls group and reposition the file group. | |
| GrinderSurfaceScreenV02 | GetFileGroupBottomPosition () |
| Return the fixed bottom pixel position of the file group container. | |
| GrinderSurfaceScreenV02 | UpdateGrindOverride () |
| Write the current feed rate override (FRO) to pound variable 999 for grind override tracking. | |
| GrinderSurfaceScreenV02 | TogglePlungeAxis () |
| Toggle the plunge axis between Y and Z and update the UI. | |
| GrinderSurfaceScreenV02 | UpdatePlungeAxis () |
| Update the plunge axis LED indicators to reflect the current axis selection. | |
| GrinderSurfaceScreenV02 | GetPlungeAxisID () |
| Get the current plunge axis ID from pound variable 532. | |
| GrinderSurfaceScreenV02 | TogglePlungeSide () |
| Toggle the plunge side between A-side (0) and B-side (1) and update the UI. | |
| GrinderSurfaceScreenV02 | TeachPlungeAxis (PoundVar) |
| Teach a pound variable from the current plunge axis position. | |
| GrinderSurfaceScreenV02 | TeachPlungeOtherAxis (PoundVar) |
| Teach a pound variable from the axis opposite to the current plunge axis. | |
| GrinderSurfaceScreenV02 | UpdatePlungeSide () |
| Update the plunge side LED indicators to reflect the current selection. | |
| GrinderSurfaceScreenV02 | GetPlungeSide () |
| Get the current plunge side selection from pound variable 531. | |
| GrinderSurfaceScreenV02 | FollowGrindDepthOn () |
| Enable the follow grind depth feature and update the UI. | |
| GrinderSurfaceScreenV02 | FollowGrindDepthOff () |
| Disable the follow grind depth feature and update the UI. | |
| GrinderSurfaceScreenV02 | IsFollowGrindDepthOn () |
| Check whether the follow grind depth feature is currently active. | |
| GrinderSurfaceScreenV02 | FollowGrindDepthToggle () |
| Toggle the follow grind depth feature between on and off states. | |
| GrinderSurfaceScreenV02 | UpdateFollowGrindDepthButtons () |
| Update the follow grind depth button background color to reflect the current state. | |
| GrinderSurfaceScreenV02 | ZFeedOnBoth () |
| Set the Z feed mode to feed on both strokes (mode 0) and update the UI. | |
| GrinderSurfaceScreenV02 | IsZFeedOnBoth () |
| Check whether the Z feed mode is set to feed on both strokes (mode 0). | |
| GrinderSurfaceScreenV02 | ZFeedOnNegative () |
| Set the Z feed mode to feed on negative stroke only (mode 1) and update the UI. | |
| GrinderSurfaceScreenV02 | IsZFeedOnNegative () |
| Check whether the Z feed mode is set to feed on negative only (mode 1). | |
| GrinderSurfaceScreenV02 | ZFeedOnPositive () |
| Set the Z feed mode to feed on positive stroke only (mode 2) and update the UI. | |
| GrinderSurfaceScreenV02 | IsZFeedOnPositive () |
| Check whether the Z feed mode is set to feed on positive only (mode 2). | |
| GrinderSurfaceScreenV02 | ZFeedContinuous () |
| Set the Z feed mode to continuous (mode 3) and update the UI. | |
| GrinderSurfaceScreenV02 | IsZFeedContinuous () |
| Check whether the Z feed mode is set to continuous (mode 3). | |
| GrinderSurfaceScreenV02 | ZFeedModeDropDown (...) |
| Handle a surface grinding Z feed mode selection event from the drop-down control. | |
| GrinderSurfaceScreenV02 | UpdateZFeedModeDropDown (value) |
| Synchronize the surface grinding Z feed mode drop-down control with a given mode value. | |
| GrinderSurfaceScreenV02 | UpdateZFeedMode () |
| Update the surface grinding tab background image, feed group visibility, and PLC IO states. | |
| GrinderSurfaceScreenV02 | YFeedModeDropDown_Slot (...) |
| Handle a slot grinding Y feed mode selection event from the drop-down control. | |
| GrinderSurfaceScreenV02 | UpdateYFeedModeDropDown_Slot (value) |
| Synchronize the slot grinding Y feed mode drop-down control with a given mode value. | |
| GrinderSurfaceScreenV02 | UpdateYFeedMode_Slot () |
| Update the slot grinding tab background image and show/hide feed mode UI groups. | |
| GrinderSurfaceScreenV02 | ZFeedModeDropDown_Face (...) |
| Handle a face grinding Z feed mode selection event from the drop-down control. | |
| GrinderSurfaceScreenV02 | UpdateZFeedModeDropDown_Face (value) |
| Synchronize the face grinding Z feed mode drop-down control with a given mode value. | |
| GrinderSurfaceScreenV02 | UpdateZFeedMode_Face () |
| Update the face grinding tab background image and show/hide feed mode UI groups. | |
| GrinderSurfaceScreenV02 | LoadJob () |
| Load the last opened job file from the Mach4 profile. | |
| GrinderSurfaceScreenV02 | JobOpen () |
| Open a file dialog to load a job file into the current job object. | |
| GrinderSurfaceScreenV02 | JobClose () |
| Close the current job after optionally prompting to save changes. | |
| GrinderSurfaceScreenV02 | JobSave () |
| Save the current job to its existing file path. | |
| GrinderSurfaceScreenV02 | JobSaveAs () |
| Open a file dialog to save the current job under a new name. | |
| GrinderSurfaceScreenV02 | GetPLCObjects () |
| Retrieve or initialize the cached PLC objects table from the aux module. | |
| GrinderSurfaceScreenV02 | CreatePLCIO () |
| Create all PLC IO points for hydraulic axes and control registers. | |
| GrinderSurfaceScreenV02 | UpdateHydraulicJogging () |
| Forward operator panel jog commands for hydraulic axes to the PLC IO points. | |
| GrinderSurfaceScreenV02 | UpdatePLCIO () |
| Synchronize all PLC IO bit states between the Mach device and the PLC hardware registers. | |
| GrinderSurfaceScreenV02 | UpdateControlRegisters () |
| Write OEM register values to PLC control registers with appropriate scaling. | |
| GrinderSurfaceScreenV02 | UpdatePLCRegisters () |
| Read PLC registers and write their scaled values to the corresponding OEM registers. | |
| GrinderSurfaceScreenV02 | UpdateGrindTableControls () |
| Update PLC control registers, hydraulic axis IO LEDs, and the jog speed register. | |
| GrinderSurfaceScreenV02 | IsElectromagnetEnabled () |
| Check whether the electromagnet feature is enabled via OEM register configuration. | |
| GrinderSurfaceScreenV02 | UpdateElectromagnet () |
| Update the electromagnet gauge display and clamp/unclamp status LEDs. | |
| GrinderSurfaceScreenV02 | ElectromagnetClampToggle () |
| Toggle the electromagnet clamp between clamped and unclamped states. | |
| GrinderSurfaceScreenV02 | ElectromagnetClamp () |
| Activate the electromagnet clamp output signal. | |
| GrinderSurfaceScreenV02 | ElectromagnetUnClamp () |
| Deactivate the electromagnet clamp output signal. | |
| GrinderSurfaceScreenV02 | ElectromagnetIsUnClamped () |
| Determine whether the electromagnet clamp is currently in the unclamped state. | |
| GrinderSurfaceScreenV02 | ElectromagnetIsClamped () |
| Determine whether the electromagnet clamp is currently in the clamped state. | |
| GrinderSurfaceScreenV02 | InitializeRotaryDresser () |
| Initialize the rotary dresser UI group visibility based on the OEM parameter setting. | |
| GrinderSurfaceScreenV02 | ShowHideSpindleGroup (groupname, showhide) |
| Show or hide a spindle group based on the rotary surface grinder mode parameter. | |
| GrinderSurfaceScreenV02 | InitializeTableView () |
| Initialize the table view layout based on the X axis servo/hydraulic configuration. | |
| GrinderSurfaceScreenV02 | DressInterrupt () |
| Trigger a dress interrupt during an active grinding cycle. | |
| GrinderSurfaceScreenV02 | IsDressInterruptActive () |
| Check whether a dress interrupt is currently active. | |
| GrinderSurfaceScreenV02 | DressingSelectionDropDown (...) |
| Handle a dressing mode selection event from the drop-down control. | |
| GrinderSurfaceScreenV02 | InitializeDressingSelectionDropDown () |
| Initialize the dressing selection drop-down to match the current pound variable value. | |
| GrinderSurfaceScreenV02 | UpdateDressingSelectionDropDown (value) |
| Synchronize the dressing selection drop-down control with a given dressing mode value. | |
| GrinderSurfaceScreenV02 | IsGCodeDisplayExtraLargeEnabled () |
| Return whether the extra-large G-code display mode is enabled. | |
| GrinderSurfaceScreenV02 | ShowInScreenGCodeEditor () |
| Hide the tool display and modals groups and show the in-screen G-code editor. | |
| GrinderSurfaceScreenV02 | HideInScreenGCodeEditor () |
| Show the in-screen G-code editor and hide the tool display and modals groups. | |
| GrinderSurfaceScreenV02 | EditModeGroupsButtons (Value) |
| Enable or disable all editable groups on the Fixture Offsets tab. | |
| GrinderSurfaceScreenV02 | UpdateDresserDiamondSelection () |
| Update the dresser diamond selection display and enable/disable related controls. | |
| GrinderSurfaceScreenV02 | GetSmallToolPathGroupHeight () |
| Return the pixel height of the small tool path group container. | |
| GrinderSurfaceScreenV02 | GetSmallToolPathGroupBgImageName () |
| Return the background image filename for the small tool path group. | |
| GrinderSurfaceScreenV02 | GetSmallToolPathPanelHeight () |
| Return the pixel height of the small tool path panel. | |
| GrinderSurfaceScreenV02 | GetLargeToolPathGroupHeight () |
| Return the pixel height of the large tool path group container. | |
| GrinderSurfaceScreenV02 | GetLargeToolPathGroupBgImageName () |
| Return the background image filename for the large tool path group. | |
| GrinderSurfaceScreenV02 | GetLargeToolPathPanelHeight () |
| Return the pixel height of the large tool path panel. | |
| GrinderSurfaceScreenV02 | MachineCreatePreCannedCommands () |
| Register all pre-canned machine commands for the Surface Grinder screen. | |
| GrinderSurfaceScreenV02 AddToJobTreeBtn | ( | ) |
Add the current conversational tab's data to the job tree.
Reads the currently active conversational tab label via GetCurrentConversationalTab(), retrieves the corresponding data via the tab's GetData() function, and sends it to the job tree via SendDataToJobTree().
| check | ( | ) |
Poll the file queue for a reply to the pending GetJobTreeCount request.
Poll the file queue for a reply to the pending _PostCommand request.
Calls queue:GetReply() with the command handle and stores the result in the upvalue variables got_reply and reply. Returns got_reply to indicate whether a reply has been received. This is a local closure defined inside GetJobTreeCount() for use with w.PleaseWaitDialog().
Calls queue:GetReply() with the command handle and stores the result in the upvalue variables got_reply and reply. Returns got_reply to indicate whether a reply has been received. This is a local closure defined inside _PostCommand() for use with w.PleaseWaitDialog().
| GrinderSurfaceScreenV02 CompileScripts | ( | ) |
Execute cleanup tasks when scripts are recompiled.
Closes the GMS notification associated with the job tree edit mode banner by calling w.CloseGMSNotification() with the stored JOBTREE_NOTIFICATIONHANDLE. This ensures the persistent notification is dismissed when the screen scripts are reloaded or recompiled.
| GrinderSurfaceScreenV02 ControlsGroupHide | ( | ) |
Hide the controls group and reposition the file group.
Sets the "ControlsGroup" screen object Hidden property to "1", then calls PositionFileGroup() to update the file group layout.
| GrinderSurfaceScreenV02 ControlsGroupHideCycleStart | ( | ) |
Rearrange the controls group to hide the Cycle Start button and reposition the file group.
Hides the "CycleStartBtn" screen object, then creates a vertical StackableCollection containing FeedHoldBtn, CycleStopBtn, and ResetBtn within the "ControlsGroup" container and stacks them. Updates the group background image to the 3-button vertical group background, repositions the group top to 613, and calls PositionFileGroup() to update the file group layout.
| GrinderSurfaceScreenV02 ControlsGroupShow | ( | ) |
Show the controls group and reposition the file group.
Sets the "ControlsGroup" screen object Hidden property to "0", then calls PositionFileGroup() to update the file group layout.
| GrinderSurfaceScreenV02 ControlsGroupShowCycleStart | ( | ) |
Rearrange the controls group to show the Cycle Start button and reposition the file group.
Creates a vertical StackableCollection containing CycleStartBtn, FeedHoldBtn, CycleStopBtn, and ResetBtn within the "ControlsGroup" container and stacks them. Updates the group background image to the 4-button vertical group background, repositions the group top to 559, and calls PositionFileGroup() to update the file group layout.
| GrinderSurfaceScreenV02 CreateConversationalTabData | ( | ) |
Define all conversational tab data entries for the Surface Grinder job tree.
Populates m.screen.ConversationalTabData with entries for all supported grinding operations: Surface Grinding, Slot Grinding, Face Grinding, Dicing, and Dressing. Each entry contains a Name, AddBtn control name, GetData function reference, and UpdateScreen function reference. After populating the table, calls m.RunHooks("AddAdditionalConversationalTabData") to allow external modules to register additional tab entries.
| GrinderSurfaceScreenV02 CreatePLCIO | ( | ) |
Create all PLC IO points for hydraulic axes and control registers.
Iterates over all axes defined in PLCObjects and calls w.CreateIO() for each bit and flag entry in the axis IO_0 table under the MachDeviceName device. Also creates IO points for all bits in the Control IO_0 and IO_1 tables. This must be called during screen load to ensure all IO points exist before the PLC script attempts to read or write them.
| GrinderSurfaceScreenV02 CycleStart | ( | ) |
Determine the appropriate cycle start action based on the active tab and job tree state.
Returns early without action if the machine is not idle or MDI mode is active. Prevents cycle start while a job tree cycle is being edited. On the "Grinding" tab, checks the active conversational sub-tab: if job tree items exist, posts the entire job tree via PostJobTree(); otherwise posts the single current tab item via PostJobItem(). On the "Service/Program" tab, takes no action. Displays a warning and returns false if no valid action is available for the current tab.
| GrinderSurfaceScreenV02 DicingTestCutBtn | ( | ) |
Update the test cut count DRO enabled state based on the dicing test cuts toggle button.
Checks whether the "TestCutsEnabledBtn_Dicing(1)" screen object exists. If it does, reads the toggle button state and enables or disables the "TestCutCountDRO_Dicing(1)" screen object accordingly. If the button object does not exist, no action is taken.
| GrinderSurfaceScreenV02 DressingSelectionDropDown | ( | ... | ) |
Handle a dressing mode selection event from the drop-down control.
Maps the selected text string from the dressing drop-down to a numeric dressing mode value and writes it to pound variable 9064. Supported modes: "Straight Dress 160" (160), "Roll/Crush Dress 167" (167), "Over Wheel Dress 168" (168), "Over Wheel Dress 169" (169), and "Table Dressing 170" (170). Calls w.FunctionCompleted() on success.
| ... | (any) Variadic arguments; the first argument is the selected drop-down text string |
| GrinderSurfaceScreenV02 DressInterrupt | ( | ) |
Trigger a dress interrupt during an active grinding cycle.
Logs the operator action and sets pound variable 998 to 1, signaling the running G-code program to execute a dress cycle at the next opportunity. This action is only permitted when the machine state is between 100 and 199 (grinding cycle active). If the machine is not in a grinding cycle, a warning message is displayed and no action is taken.
| GrinderSurfaceScreenV02 EditModeGroupsButtons | ( | Value | ) |
Enable or disable all editable groups on the Fixture Offsets tab.
Iterates over all child groups of "FixtureOffsetsTab(1)", excluding the "EditModeGroup", and sets their Enabled state to the provided value. This is used to lock or unlock the fixture offset controls when edit mode is toggled on or off.
| Value | (string) The enabled state to apply to groups: "1" to enable, "0" to disable |
| GrinderSurfaceScreenV02 ElectromagnetClamp | ( | ) |
Activate the electromagnet clamp output signal.
Sets the OEM parameter signal "ElectromagnetClampOutput" to true, engaging the electromagnet clamp. Logs a function error via w.FunctionError() if the operation fails.
| GrinderSurfaceScreenV02 ElectromagnetClampToggle | ( | ) |
Toggle the electromagnet clamp between clamped and unclamped states.
Checks the current clamp state via ElectromagnetIsClamped(). If clamped, calls ElectromagnetUnClamp(); otherwise calls ElectromagnetClamp().
| GrinderSurfaceScreenV02 ElectromagnetIsClamped | ( | ) |
Determine whether the electromagnet clamp is currently in the clamped state.
Checks multiple signal sources to determine the clamped state. If ElectromagnetClampOnInput is available, it is used as the primary indicator. If the clamp output is off but the on-input is active, the LED blinks (BLINK_OBJECT_ACTIVE). If only ElectromagnetClampOffInput is available, the clamped state is its logical inverse. If only ElectromagnetClampOutput is available, it is used directly. If no signals are configured or the electromagnet is not enabled, returns false.
| GrinderSurfaceScreenV02 ElectromagnetIsUnClamped | ( | ) |
Determine whether the electromagnet clamp is currently in the unclamped state.
Checks multiple signal sources to determine the unclamped state. If ElectromagnetClampOffInput is available, it is used as the primary indicator. If only ElectromagnetClampOnInput is available, the unclamped state is its logical inverse. If only ElectromagnetClampOutput is available, the unclamped state is its logical inverse. If no signals are configured or the electromagnet is not enabled, returns false.
| GrinderSurfaceScreenV02 ElectromagnetUnClamp | ( | ) |
Deactivate the electromagnet clamp output signal.
Sets the OEM parameter signal "ElectromagnetClampOutput" to false, releasing the electromagnet clamp. Logs a function error via w.FunctionError() if the operation fails.
| GrinderSurfaceScreenV02 ExecuteCalibrationBtn | ( | ) |
Execute tool calibration by computing and applying X and Z tool offsets from touch-off positions.
Reads the measured X and Z values from the MeasuredXDRO and MeasuredZDRO screen objects. Retrieves the current tool number, work offset, tool index, tool slide side, and machine positions from XTouchOffDRO and ZTouchOffDRO. Validates that touch-off positions are non-zero before proceeding. Applies diameter mode correction to the X measurement. Computes new X and Z tool offsets by subtracting the work offset and measurement from the machine position, then writes the new offsets and clears wear offsets via mc.mcToolSetData(). Activates the offsets with an MDI tool change command and resets the touch-off DROs to zero.
| GrinderSurfaceScreenV02 FillInScreenJobTreeData | ( | tbl | ) |
Look up the matching conversational tab metadata for a job tree data table and fill in screen fields.
Iterates over all entries in m.screen.ConversationalTabData. For the first entry whose Name matches tbl.Name, copies the AddBtn and TabIndex fields from the tab metadata into the data table and returns the updated table along with the matching key. If no match is found, returns the unmodified table and an empty string.
| tbl | (table) The job tree data table to fill in; must have a Name field matching a ConversationalTabData entry name |
| GrinderSurfaceScreenV02 FollowGrindDepthOff | ( | ) |
Disable the follow grind depth feature and update the UI.
Writes the value 0 to pound variable 9256 to deactivate follow grind depth mode, then calls UpdateFollowGrindDepthButtons() to synchronize the screen button appearance.
| GrinderSurfaceScreenV02 FollowGrindDepthOn | ( | ) |
Enable the follow grind depth feature and update the UI.
Writes the value 1 to pound variable 9256 to activate follow grind depth mode, then calls UpdateFollowGrindDepthButtons() to synchronize the screen button appearance.
| GrinderSurfaceScreenV02 FollowGrindDepthToggle | ( | ) |
Toggle the follow grind depth feature between on and off states.
Checks the current state via IsFollowGrindDepthOn(). If currently on, calls FollowGrindDepthOff(); otherwise calls FollowGrindDepthOn().
| GrinderSurfaceScreenV02 GetCurrentConversationalTab | ( | ) |
Get the label of the currently active conversational tab.
Reads the current tab index from "ConversationalTabs(1)" and retrieves the list of notebook page children. If the index is valid, returns the Label property of the matching tab control. Returns an empty string if the index is out of range.
| GrinderSurfaceScreenV02 GetCurrentJobTreeEditTable | ( | ) |
Return the data table of the job tree item currently being edited.
Reads and returns the JOBTREE_EDITTABLE field from m.screen, which contains the data table for the job tree cycle currently in edit mode.
| GrinderSurfaceScreenV02 GetCurrentJobTreeTab | ( | ) |
Return the tab index of the job tree item currently being edited.
Reads the TabIndex field from the JOBTREE_EDITTABLE stored in m.screen and returns it.
| GrinderSurfaceScreenV02 GetFileGroupBottomPosition | ( | ) |
Return the fixed bottom pixel position of the file group container.
| GrinderSurfaceScreenV02 GetJobTreeCount | ( | ) |
Query the job tree for the current item count via the file queue with a please-wait dialog.
Constructs a new LFQ queue using GetJobTreeLFQPaths() and sends the command "return JobTree.GetItemCount()" with reply requested. Displays a please-wait dialog (timeout 20000 ms) that polls via a local check() function until a reply is received. Returns the item count as a number if a reply was received, or 0 on timeout or failure.
| GrinderSurfaceScreenV02 GetJobTreeDicingData | ( | ) |
Collect current dicing job tree data from pound variables and return a structured table.
Retrieves the base job tree data via _GetJobTreeData("Dicing"). Reads the test cuts enabled toggle button state. Constructs a Post table containing G65 P186 and G65 P180 entries with multiple pound variable references (X, U, Z, C, K, Y, W, J, R, F). If test cuts are enabled, appends a T pound variable entry (9559) to the first Post block. Iterates over all Post entries and resolves each PoundVar field to its current value via mc.mcCntlGetPoundVar(). Returns the fully populated data table.
| GrinderSurfaceScreenV02 GetJobTreeDressingData | ( | ) |
Collect current dressing job tree data from pound variables and return a structured table.
Retrieves the base job tree data via _GetJobTreeData("Dressing"). Constructs a Post table containing a single G65 P entry whose P value is read from pound variable 9064 (the dressing selection). Iterates over all Post entries and resolves each PoundVar field to its current value via mc.mcCntlGetPoundVar(). Returns the fully populated data table.
| GrinderSurfaceScreenV02 GetJobTreeFaceGrindData | ( | ) |
Collect current face grinding job tree data from pound variables and return a structured table.
Retrieves the base job tree data via _GetJobTreeData("Face Grinding"). Reads the three dress timing toggle buttons (before, mid, after) and packs them into a single dress_value integer via w.SetValueBit(). Constructs a Post table with G90, G65 P181 (reciprocating axis start), and G65 P185 (face grind) blocks containing multiple pound variable references (Z, W, Y, J, R, Q, T, E, S, C, F, D). If use clearance is enabled, appends an I pound variable entry (9457) to the third Post block. Resolves all PoundVar fields to current values via mc.mcCntlGetPoundVar().
| GrinderSurfaceScreenV02 GetJobTreeLFQPaths | ( | ) |
Return the input and output directory paths for the job tree file queue.
Constructs the inpath and outpath strings using MACH_DIRECTORY and the standard job queue subdirectory ("Modules/Addons/FileQueue/jobqueue/in" and ".../out"). Returns both paths as separate return values.
| GrinderSurfaceScreenV02 GetJobTreeSlotGrindData | ( | ) |
Collect current slot grinding job tree data from pound variables and return a structured table.
Retrieves the base job tree data via _GetJobTreeData("Slot Grinding"). Reads the three dress timing toggle buttons (before, mid, after) and packs them into a single dress_value integer via w.SetValueBit(). Constructs a Post table with G90, G65 P181 (reciprocating axis start), G65 P182 (plunge grind slot), and G65 P180 (end of cycle) blocks containing multiple pound variable references (X, U, Y, V, Z, J, R, Q, T, E, S, C, F, D). If use clearance is enabled, appends an I pound variable entry (9457) to the fourth Post block. Resolves all PoundVar fields to current values via mc.mcCntlGetPoundVar().
| GrinderSurfaceScreenV02 GetJobTreeSurfaceGrindData | ( | ) |
Collect current surface grinding job tree data from pound variables and return a structured table.
Retrieves the base job tree data via _GetJobTreeData("Surface Grinding"). Reads the three dress timing toggle buttons (DressBeforeCycleBtn, DressBeforeFineBtn, DressAfterCycleBtn) and packs them into a single dress_value integer via w.SetValueBit(). Constructs a Post table with G90, G65 P181 (reciprocating axis start), and G65 P183 (surface grind Y plunge Z crossover) blocks containing multiple pound variable references (X, U, Y, V, Z, W, J, R, Q, K, T, E, S, C, F, D). If use clearance is enabled, appends an I pound variable entry (9407) to the third Post block. Resolves all PoundVar fields to current values via mc.mcCntlGetPoundVar().
| GrinderSurfaceScreenV02 GetLargeToolPathGroupBgImageName | ( | ) |
Return the background image filename for the large tool path group.
| GrinderSurfaceScreenV02 GetLargeToolPathGroupHeight | ( | ) |
Return the pixel height of the large tool path group container.
| GrinderSurfaceScreenV02 GetLargeToolPathPanelHeight | ( | ) |
Return the pixel height of the large tool path panel.
| cyc STATE GetNumber | ( | ) |
Get the current cycle state number from pound variable 9080.
Get the current remaining dressing passes count from pound variable 9082.
Calls w.api('mcCntlGetPoundVar') with the PoundVar field of the STATE table (9080) to read the current grind cycle state. If the result is nil (e.g., API failure), returns 0 as a safe default.
Uses w.pcall() to safely call w.api('mcCntlGetPoundVar') with pound variable 9082. If the call fails for any reason, returns 0 as a safe default. Otherwise returns the current pass count value.
| GrinderSurfaceScreenV02 GetPLCObjects | ( | ) |
Retrieve or initialize the cached PLC objects table from the aux module.
If GrinderSurfaceScreenV02.PLCObjects is false (not yet loaded), calls aux.GetPLCObjects() to populate it and caches the result. Subsequent calls return the cached table directly.
| GrinderSurfaceScreenV02 GetPlungeAxisID | ( | ) |
Get the current plunge axis ID from pound variable 532.
Reads pound variable 532 and returns its value, which corresponds to a Mach4 axis constant (mc.Y_AXIS or mc.Z_AXIS) indicating which axis is currently configured as the plunge axis.
| GrinderSurfaceScreenV02 GetPlungeSide | ( | ) |
Get the current plunge side selection from pound variable 531.
Reads pound variable 531 and returns its raw numeric value. A value of 0 indicates A-side grinding; any other value indicates B-side grinding.
| GrinderSurfaceScreenV02 GetSmallToolPathGroupBgImageName | ( | ) |
Return the background image filename for the small tool path group.
| GrinderSurfaceScreenV02 GetSmallToolPathGroupHeight | ( | ) |
Return the pixel height of the small tool path group container.
| GrinderSurfaceScreenV02 GetSmallToolPathPanelHeight | ( | ) |
Return the pixel height of the small tool path panel.
| GrinderSurfaceScreenV02 GetWheelAttributes | ( | ) |
Retrieve the current grinding wheel attributes from the aux module.
Delegates to aux.GetWheelAttributes() and returns its result directly.
| GrinderSurfaceScreenV02 HandleHomingForHydraulicAxes | ( | ) |
Prompt the operator to home hydraulic axes if required by the OEM register setting.
Reads the "HydraulicAxesNeedsToBeHomed" OEM register string. If its value is "Yes", sets ENABLE_HOME_DIALOG_ACTIVE to true and displays a non-modal cycle start dialog prompting the operator to enable and home all axes. The dialog is wired to m.EnableHomeDialog_CycleStart() and m.EnableHomeDialog_Cancel() callbacks.
| GrinderSurfaceScreenV02 HideInScreenGCodeEditor | ( | ) |
Show the in-screen G-code editor and hide the tool display and modals groups.
Hides the GCode display and tool path view, hides the ToolDisplayGroup and ModalsGroup, then repositions the GCodeEditor to its visible on-screen location (Left = 106).
| GrinderSurfaceScreenV02 CYCLE Initialize | ( | ) |
Initialize the grind cycle state machine, state/type tables, and screen label update logic.
Sets up the complete CYCLE sub-module for GrinderSurfaceScreenV02. Assigns pound variable indices for STATE (9080), TYPE (9081), and PASSES (9082). Calls SetStateToIdle() to reset the state on startup. Defines the CombLabels list and the UpdateCombLabels() method. Populates cyc.STATE with all known grind cycle states (Idle, Positioning, Grinding, Dressing, etc.) and their descriptions, plus an Unknown fallback factory. Populates cyc.TYPE with all known cycle types (dressing modes, grinding macros, etc.) and their descriptions. Initializes cyc.PASSES with its pound variable and GetNumber() method. Assigns cyc.TYPE.GetNumber as an alias of cyc.STATE.GetNumber.
| GrinderSurfaceScreenV02 InitializeAxes | ( | ) |
Initialize PLC parameter bits for the X and Z axes based on their enabled state.
Writes bit 0 of parameter register 1901 to 1 if the X axis is enabled in AXIS_ENABLED, or to 0 if not. Writes bit 0 of parameter register 1902 to 1 if the Z axis is enabled, or to 0 if not.
| GrinderSurfaceScreenV02 InitializeAxisPositionGroup | ( | ) |
Initialize the axis position DRO group layout, visibility, and positioning for all axes.
Hides DROs, load gauges, and zero buttons for disabled non-hydraulic axes. Shows hydraulic control LEDs in place of DROs for hydraulic axes. Hides hydraulic controls for non-hydraulic axes. Configures unit display on X, Y, and Z position DROs from the profile. Computes and applies vertical distribution positions for all enabled and hydraulic axes using w.Distribute(). Also repositions hydraulic park LEDs with a vertical offset. Calls UpdateZeroButtons() and InitializeHomeButtons() after layout is complete.
| GrinderSurfaceScreenV02 InitializeDressingSelectionDropDown | ( | ) |
Initialize the dressing selection drop-down to match the current pound variable value.
Reads the current dressing selection from pound variable 9064 and calls UpdateDressingSelectionDropDown() to synchronize the screen drop-down control.
| GrinderSurfaceScreenV02 InitializeJobTreeData | ( | ) |
Initialize job tree tab metadata and set up Add button labels and colors.
Calls CreateConversationalTabData() to populate m.screen.ConversationalTabData. Iterates over all notebook pages in "ConversationalTabs(1)" and writes each tab's zero-based index into the matching ConversationalTabData entry. Sets the Add button label to "Add" and the background color to BTN_COLOR_OFF for every registered tab. Calls SetJobTreeHeader() and SetJobTreeFooter() to configure the job tree G-code header and footer strings.
| GrinderSurfaceScreenV02 InitializeOperationGrindAdvancedBtn | ( | ) |
Initialize all advanced operation grind buttons from the last saved profile state.
Reads the saved "AdvancedButton" profile string for each of the four grind types (_Surface, _Slot, _Face, _Dicing) from the "SurfaceGrinder" profile section. Calls OperationGrindAdvancedBtn() for each type with the saved show/hide value to restore the button and group state from the previous session.
| GrinderSurfaceScreenV02 InitializeRetractSafetyAmount | ( | ) |
Show or hide the retract safety amount group based on the OEM parameter setting.
Reads the "MoveToSafetyPositionSelection" OEM parameter string. If its value is "Amount", sets the "RetractSafetyAmountGroup" Hidden property to "0" (visible); otherwise sets it to "1" (hidden).
| GrinderSurfaceScreenV02 InitializeRotaryDresser | ( | ) |
Initialize the rotary dresser UI group visibility based on the OEM parameter setting.
Reads the "RotaryDresserEnabled" OEM parameter string. If enabled ("Yes"), shows the DresserGroup, RotaryDresserWheelGroup, and repositions the WheelGroup to Left = 19 to make room. If not enabled, hides the DresserGroup and RotaryDresserWheelGroup, and centers the WheelGroup at Left = 233. Logs an error via w.FunctionError() if the OEM parameter cannot be read.
| GrinderSurfaceScreenV02 InitializeTableDirections | ( | ) |
Initialize the default table direction for X and Z hydraulic axes from OEM parameters.
Reads the "XDefaultDirection" and "ZDefaultDirection" OEM parameter strings. For each axis, calls the corresponding aux function (SetXDefaultDirectionPositive, SetXDefaultDirectionNegative, SetZDefaultDirectionPositive, or SetZDefaultDirectionNegative) based on the configured direction string. Returns an error triple if either OEM parameter cannot be read.
| GrinderSurfaceScreenV02 InitializeTableView | ( | ) |
Initialize the table view layout based on the X axis servo/hydraulic configuration.
Reads the X Axis Enabled In Program parameter (bit 0 of parameter 1901). If the X axis is enabled as a servo axis, hides both the HydraulicTableGroup and ReciprocationAxisGroup. If the X axis is configured as a hydraulic axis, hides only the ReciprocationAxisGroup and shows the HydraulicTableGroup.
| GrinderSurfaceScreenV02 InitializeToolTableFields | ( | ) |
Initialize the tool table user fields for the Surface Grinder screen.
Defines a field_table containing all custom tool table fields required by the Surface Grinder, including wheel geometry (diameter, width, phase heights), RPM and SFM settings, safety clearance positions, dress positions for up to three diamonds, over-wheel dresser positions, and rotary dresser parameters. If the tool table is initialized, checks whether all fields already exist via w.IsToolTableUserFieldList(). If any fields are missing, writes the defaults via w.AddToolTableUserFieldList(). If the tool table is not initialized, logs a warning and returns without error.
| GrinderSurfaceScreenV02 IsDressInterruptActive | ( | ) |
Check whether a dress interrupt is currently active.
Reads pound variable 998 and returns true if its value equals 1, indicating that a dress interrupt has been triggered during an active grinding cycle.
| GrinderSurfaceScreenV02 IsEditingJobTreeCycle | ( | ) |
Return whether a job tree cycle is currently being edited.
Reads and returns the JOBTREE_EDITMODE field from m.screen.
| GrinderSurfaceScreenV02 IsElectromagnetEnabled | ( | ) |
Check whether the electromagnet feature is enabled via OEM register configuration.
Reads the "ElectromagnetMeterEnabled" OEM register string and returns true if its value is "Yes". The result is cached using w.SetCache() / w.GetCache() under the key ("Electromagnet", "Enabled") so that subsequent calls do not re-read the OEM register.
| GrinderSurfaceScreenV02 IsFollowGrindDepthOn | ( | ) |
Check whether the follow grind depth feature is currently active.
Reads pound variable 9256 and returns true if its value equals 1, indicating that follow grind depth mode is enabled.
| GrinderSurfaceScreenV02 IsGCodeDisplayExtraLargeEnabled | ( | ) |
Return whether the extra-large G-code display mode is enabled.
Always returns false for the Surface Grinder screen. Override in a subclass or configuration to enable extra-large G-code display mode.
| GrinderSurfaceScreenV02 IsHydraulicTableEnabledOnAxis | ( | AxisID | ) |
Determine whether the specified axis is configured as a hydraulic table axis.
Results are cached using w.SetCache() / w.GetCache() under the key ("IsHydraulicTableEnabledOnAxis", AxisID). If the axis is enabled as a servo axis in AXIS_ENABLED, returns false immediately. Otherwise, reads the rotary surface grinder mode from cached parameter 1900 bit 0. Returns true for the X axis when rotary mode is off, and always true for the Z axis. All other axes return false.
| AxisID | (number) The Mach4 axis ID constant to check (e.g., mc.X_AXIS, mc.Z_AXIS) |
| GrinderSurfaceScreenV02 IsRetracting | ( | ) |
Return whether a retraction is currently in progress.
Reads the module-level GrinderSurfaceScreenV02._IsRetracting field and returns its value.
| GrinderSurfaceScreenV02 IsZFeedContinuous | ( | ) |
Check whether the Z feed mode is set to continuous (mode 3).
Reads pound variable 9251 and returns true if its value equals 3, indicating that the Z feed is set to continuous mode.
| GrinderSurfaceScreenV02 IsZFeedOnBoth | ( | ) |
Check whether the Z feed mode is set to feed on both strokes (mode 0).
Reads pound variable 9251 and returns true if its value equals 0, indicating that the Z feed is active on both positive and negative stroke directions.
| GrinderSurfaceScreenV02 IsZFeedOnNegative | ( | ) |
Check whether the Z feed mode is set to feed on negative only (mode 1).
Reads pound variable 9251 and returns true if its value equals 1, indicating that the Z feed is active only on the negative stroke direction.
| GrinderSurfaceScreenV02 IsZFeedOnPositive | ( | ) |
Check whether the Z feed mode is set to feed on positive only (mode 2).
Reads pound variable 9251 and returns true if its value equals 2, indicating that the Z feed is active only on the positive stroke direction.
| GrinderSurfaceScreenV02 JobClose | ( | ) |
Close the current job after optionally prompting to save changes.
Protected entry point that calls _JobClose() via w.pcall(). Logs the operator action, prompts the operator to save unsaved changes via OptSaveChanges(), closes the job, and clears the "MachMotion/LastJobName" profile entry. If an error occurs, displays an alarm message via w.AlarmMessage(). Calls w.FunctionCompleted() on success.
| GrinderSurfaceScreenV02 JobOpen | ( | ) |
Open a file dialog to load a job file into the current job object.
Protected entry point that calls _JobOpen() via w.pcall(). Logs the operator action, prompts to save unsaved changes via OptSaveChanges(), then opens the selected job file. Records the opened file path in the Mach4 profile under "MachMotion/LastJobName". If an error occurs, displays an alarm message via w.AlarmMessage(). Calls w.FunctionCompleted() on success.
| GrinderSurfaceScreenV02 JobSave | ( | ) |
Save the current job to its existing file path.
Protected entry point that calls _JobSave() via w.pcall(). Logs the operator action and calls the job object's Save() method. If an error occurs, displays an alarm message via w.AlarmMessage(). Calls w.FunctionCompleted() on success.
| GrinderSurfaceScreenV02 JobSaveAs | ( | ) |
Open a file dialog to save the current job under a new name.
Protected entry point that calls _JobSaveAs() via w.pcall(). Prompts the operator to choose a new file path, saves the job, and records the new file path in the Mach4 profile under "MachMotion/LastJobName". If an error occurs, displays an alarm message. Calls w.FunctionCompleted() on success.
| GrinderSurfaceScreenV02 LoadJob | ( | ) |
Load the last opened job file from the Mach4 profile.
Protected entry point that calls _LoadJob() via w.pcall(). Reads the "LastJobName" profile string from the "MachMotion" section. If a non-empty name is found, loads it into GrinderSurfaceScreenV02.CurrentJob. If an alarm occurs during loading, displays it via w.AlarmMessage(). Calls w.FunctionCompleted() on success.
| GrinderSurfaceScreenV02 MachineCreatePreCannedCommands | ( | ) |
Register all pre-canned machine commands for the Surface Grinder screen.
Creates and registers all operator panel commands for the Surface Grinder, including hydraulic table control (X and Z axes), electromagnet clamp control, dress interrupt, follow grind depth, Z feed mode, park position commands, and job queue operations. Each command is registered with an action option, an optional feedback option, a simple command entry, and button labels. This function is called via the CommandRegistrar and populates the operator panel command list.
| GrinderSurfaceScreenV02 MachineCycleStartFinal | ( | ) |
Perform final pre-cycle-start checks and optionally reset the controller.
If the machine is idle and the current G-code line number is greater than 1, checks whether single block mode is active and whether an M00 stop is pending. If neither condition is true, resets the controller via mc.mcCntlReset(). Returns an error triple if the reset fails.
| GrinderSurfaceScreenV02 MachineCycleStop | ( | ) |
Stop the current machine cycle and reset the cycle state to idle.
Calls GrinderSurfaceScreenV02.CYCLE.SetStateToIdle() to reset the grind cycle state machine, then returns a success pair indicating the cycle stop was handled.
| GrinderSurfaceScreenV02 MachineCycleStopFinal | ( | CustomMode | ) |
Execute the full cycle stop sequence including hydraulic stop, safety retract, and G-code rewind.
Stops the hydraulic axis via StopHydraulicAxis(). Reads the "MoveToSafetyPositionEnabled" and "RewindGCode" OEM parameter strings. If safety position is enabled, calls MoveToRetractPosition() with the provided CustomMode. If G-code rewind is enabled, calls mc.mcCntlRewindFile(). Resets the CYCLE state to idle via CYCLE.SetStateToIdle(). Returns an error triple if any OEM parameter read or API call fails.
| CustomMode | (number|nil) The retraction mode selector; defaults to 0 if nil. Mode 0 uses the standard cycle stop retract position |
| GrinderSurfaceScreenV02 MachineHomeAllEnd | ( | ) |
Execute post-home actions after homing all axes.
Calls aux.XHome() to home the X hydraulic axis after the home-all sequence completes.
| GrinderSurfaceScreenV02 MachinePreCycleStop | ( | ) |
Capture the current grind state and cycle type pound variables before a cycle stop.
Reads pound variable 9080 (grind state) and pound variable 9081 (grind cycle) from the Mach4 controller. Stores the retrieved values into GrinderSurfaceScreenV02.GrindStateOnCycleStop and GrinderSurfaceScreenV02.GrindCycleOnCycleStop for use by the subsequent cycle stop sequence. Returns an error triple if either pound variable read fails.
| GrinderSurfaceScreenV02 MachineScreenLoadScript | ( | ) |
Execute all one-time screen load initialization tasks for the Surface Grinder.
Calls CommonGrinderScreenLoadScript() for shared grinder initialization. Creates and connects a wxTimer (jobtree_handler/jobtree_timer) that polls the job tree file queue via OnJobTreeTimer(). The timer callback uses w.pcall() for error protection, tracks consecutive failures in jobtree_failurecount, and raises a fatal alarm after 10 failures. Calls InitializeAxes() and sets the stage button color constants. Initializes the CYCLE and STATUS sub-modules, hides the A, B, and C axes, and sets OEM parameters for WheelHeadSpeedOverride and RotaryDresserSpeedOverride to 100. Creates the CurrentJob m.JobFile object with G-code range 500-800 and appropriate header table. Registers MachineCreatePreCannedCommands via the CommandRegistrar. Reads and initializes the electromagnet meter averaging parameter, then calls InitializeTableView(), CreatePLCIO(), and InitializeJobTreeData() to complete setup.
| GrinderSurfaceScreenV02 MachineScreenLowPriorityLoop | ( | ) |
Execute all low-priority periodic screen update functions.
Called on each low-priority loop cycle to refresh UI elements and state that do not require real-time PLC frequency updates. Calls the following update functions in sequence: UpdateWheelHead(), UpdateRotaryDresser(), UpdateWheelHeadSpeed(), UpdateActiveToolBox(), UpdateGrinderWheelAttributes(), UpdateDresserDiamondSelection(), UpdatePlungeAxis(), UpdatePlungeSide(), UpdateElectromagnet(), UpdatePLCRegisters(), UpdateGrindOverride(), UpdateZFeedMode(), UpdateYFeedMode_Slot(), CYCLE.Update(), and UpdateControlRegisters().
| GrinderSurfaceScreenV02 MachineScreenPLCScript | ( | ) |
Execute all PLC-frequency screen update functions.
Called on each PLC script cycle to synchronize real-time IO and hydraulic axis state. Calls UpdatePLCIO() to synchronize PLC IO bit states, UpdateHydraulicJogging() to forward operator panel jog commands to the PLC, and UpdateGrindTableControls() to update control register values and hydraulic axis LED indicators.
| GrinderSurfaceScreenV02 MachineScreenStartupScript | ( | ) |
Execute all one-time startup initialization tasks for the Surface Grinder screen.
Sets the machine type name label to "Mach Grinder" and initializes the tool path view to the bottom position. Calls initialization functions for fixture offsets, tool table fields, table directions, wheel heads, rotary dresser, advanced grind operation buttons, clearance buttons for Surface/Slot/Face, dicing test cut button, retract safety amount, and dressing selection drop-down. Starts the job tree file queue timer and logs the result; raises an alarm if the timer was not created. Calls HandleHomingForHydraulicAxes() to prompt homing if required.
| GrinderSurfaceScreenV02 MoveToCycleStopRetractPosition | ( | ) |
Execute the cycle stop retract move inside a protected call and return the result.
Calls _MoveToCycleStopRetractPosition() via w.pcall() to safely execute the retract motion. If the protected call fails, returns an error triple with the formatted error message. On success, returns a nil primary value with a true success flag and w.FunctionCompleted().
| GrinderSurfaceScreenV02 MoveToRetractPosition | ( | CustomMode | ) |
Execute a retract motion to a safe position with interlock protection.
Checks whether a retraction is already in progress via IsRetracting(). If not, selects the appropriate retract function based on the CustomMode parameter. Currently only mode 0 is supported, which maps to MoveToCycleStopRetractPosition(). Sets the IsRetracting interlock to true before executing the retract function via w.pcall(), and clears the interlock after completion regardless of success or failure. Returns an error triple if the retract function raises an exception or if an unrecognized mode is provided.
| CustomMode | (number) The retraction mode selector. Mode 0 uses the standard cycle stop retract position. Any other value returns an error. |
| GrinderSurfaceScreenV02 OnJobTreeTimer | ( | ) |
Process incoming job tree file queue commands and dispatch edit or post operations.
Lazily initializes the jobtree_filequeue LFQ object using GetJobTreeLFQPaths() if not yet created. Polls for a pending command via GetCommand(). If a command is received, loads and executes it via load() inside w.pcall(). If execution returns a table, enters job tree edit mode by calling FillInScreenJobTreeData() and the matching tab's UpdateScreen() callback, but only when the machine is idle. Replies to the file queue with the result string. Alarm messages are raised for errors in the queue command. Errors in the outer pcall are logged but do not disable the queue.
| GrinderSurfaceScreenV02 OperationGrindAdvancedBtn | ( | grind_type | , |
| show_hide | ) |
Toggle the advanced options group visibility for a specified grind type and persist the state.
Checks whether the "ShowAdvancedBtn" toggle button exists for the given grind type. If a show_hide value is provided (e.g., during initialization), synchronizes the toggle button to match that value before applying it. Reads the resolved hide state and shows or hides the corresponding "SurfaceGrindAdvancedGroup" innards. Persists the current state to the Mach4 profile under "SurfaceGrinder/AdvancedButton{grind_type}" for restoration on next startup. If the button object does not exist, no action is taken.
| grind_type | (string|nil) The grind type suffix (e.g., "_Surface", "_Slot", "_Face", "_Dicing"). If nil, defaults to "_Surface" |
| show_hide | (string|nil) Optional forced state: "0" to show, "1" to hide. If nil, reads the current toggle button state |
| GrinderSurfaceScreenV02 OperationGrindUseClearanceBtn | ( | grind_type | ) |
Update the clearance height DRO enabled state based on the use clearance toggle button.
Checks whether the "UseClearanceHeightBtn" screen object for the given grind type exists. If it does, reads the toggle button state and enables or disables the corresponding "YClearanceHeightDRO" screen object. If the grind type is nil, defaults to "_Surface".
| grind_type | (string|nil) The grind type suffix (e.g., "_Surface", "_Slot", "_Face"). If nil, defaults to "_Surface" |
| GrinderSurfaceScreenV02 PopulateDicingFromJobTree | ( | data | ) |
Populate the screen with dicing job tree data and enter job tree edit mode.
Calls SetIsEditingJobTreeCycle(true, data) to enter edit mode for the dicing cycle. Iterates over all entries in data.Post and writes each pound variable value back to the Mach4 controller via mc.mcCntlSetPoundVar(). Also restores the test cuts toggle button state via h.SetMMToggleButton() and calls DicingTestCutBtn() to synchronize the dependent DRO control.
| data | (table) The dicing job tree data table containing a Post array of G-code entries and a test_cuts_enabled boolean field |
| GrinderSurfaceScreenV02 PopulateDressingFromJobTree | ( | data | ) |
Populate the screen with dressing job tree data and enter job tree edit mode.
Calls SetIsEditingJobTreeCycle(true, data) to enter edit mode for the dressing cycle. Iterates over all entries in data.Post and writes each pound variable value back to the Mach4 controller via mc.mcCntlSetPoundVar().
| data | (table) The dressing job tree data table containing a Post array of G-code entries with PoundVar and Value fields |
| GrinderSurfaceScreenV02 PopulateFaceGrindFromJobTree | ( | data | ) |
Populate the screen with face grinding job tree data and enter job tree edit mode.
Calls SetIsEditingJobTreeCycle(true, data) to enter edit mode for the face grinding cycle. Iterates over all entries in data.Post and writes each pound variable value back to the Mach4 controller via mc.mcCntlSetPoundVar(). Restores the clearance height toggle button state and calls SurfaceGrindUseClearanceBtn() to synchronize the dependent DRO. Also restores the three dress timing toggle button states (before, mid, after) from the packed dress_value bitfield using w.GetValueBit().
| data | (table) The face grinding job tree data table containing Post entries, use_clearance, and dress_value fields |
| GrinderSurfaceScreenV02 PopulateSlotGrindFromJobTree | ( | data | ) |
Populate the screen with slot grinding job tree data and enter job tree edit mode.
Calls SetIsEditingJobTreeCycle(true, data) to enter edit mode for the slot grinding cycle. Iterates over all entries in data.Post and writes each pound variable value back to the Mach4 controller via mc.mcCntlSetPoundVar(). Restores the clearance height toggle button state and calls SurfaceGrindUseClearanceBtn() to synchronize the dependent DRO. Also restores the three dress timing toggle button states (before, mid, after) from the packed dress_value bitfield using w.GetValueBit().
| data | (table) The slot grinding job tree data table containing Post entries, use_clearance, and dress_value fields |
| GrinderSurfaceScreenV02 PopulateSurfaceGrindFromJobTree | ( | data | ) |
Populate the screen with surface grinding job tree data and enter job tree edit mode.
Calls SetIsEditingJobTreeCycle(true, data) to enter edit mode for the surface grinding cycle. Iterates over all entries in data.Post and writes each pound variable value back to the Mach4 controller via mc.mcCntlSetPoundVar(). Restores the clearance height toggle button state and calls SurfaceGrindUseClearanceBtn() to synchronize the dependent DRO. Also restores the three dress timing toggle button states (before cycle, before fine pass, after cycle) from the packed dress_value bitfield using w.GetValueBit().
| data | (table) The surface grinding job tree data table containing Post entries, use_clearance, and dress_value fields |
| GrinderSurfaceScreenV02 PostJobItem | ( | data | ) |
Post a single job item to the job tree via the file queue.
Serializes the provided data table to a string representation via w.table.repr(). If serialization fails, logs the error and returns false. On success, sends the command "return JobTree.PostItem(<data>)" via _PostCommand() and returns its result.
| data | (table) The job item data table to serialize and post to the job tree |
| GrinderSurfaceScreenV02 PostJobTree | ( | ) |
Post the entire job tree to generate G-code via the file queue.
Delegates to _PostCommand() with the command "return JobTree.Post()" and returns the result directly.
| GrinderSurfaceScreenV02 PreCycleStop | ( | ) |
Check whether a retraction is already in progress and abort the cycle stop if so.
Returns false to abort the cycle stop sequence if IsRetracting() reports that a retraction is currently active. Returns true to allow the cycle stop to continue if no retraction is in progress.
| GrinderSurfaceScreenV02 SaveJobTree | ( | ) |
Send a save command to the job tree via the file queue.
Constructs a new LFQ queue using GetJobTreeLFQPaths() and adds the command "return JobTree.SaveJob()" without waiting for a reply.
| GrinderSurfaceScreenV02 ScreenPageChanging | ( | notebook | ) |
Intercept notebook page change events to prevent tab switching while editing a job tree cycle.
If the changing notebook is "ConversationalTabs(1)" and a job tree cycle is currently being edited, this function prevents navigation away from the edit tab unless the user is returning to the tab being edited. Returns false to cancel the page change when editing would be disrupted; returns true to allow all other page changes.
| notebook | (table) The notebook event object with fields: name (string), current (number), next (number) |
| GrinderSurfaceScreenV02 ScreenTabEnter | ( | tab | ) |
Handle tab enter events and update screen state based on the active tab.
Updates the current tab register via UpdateCurrentTabRegister(). For tabs under "OperationTabs(1)", refreshes edit mode group button state. Entering the "Diagnostics" tab triggers InitializeAxisPositionGroup(). Entering "Calibrate" or "Fixtures" tabs enables edit mode groups if edit mode is active, or auto-enables edit mode if it is not. Leaving "Calibrate"/"Fixtures" with edit mode active calls EditModeOff(). For tabs under "DiagnosticsTabGroup(1)", entering "Maintenance" calls InitializeHomeButtons().
| tab | (table) The tab event object with fields: parent (string), label (string), index (number) |
| GrinderSurfaceScreenV02 ScreenTabExit | ( | tab | ) |
Handle tab exit events for the OperationTabs notebook.
Records the exiting tab index in LAST_OPERATION_TAB when the exiting tab belongs to "OperationTabs(1)". If the exiting tab is not "Calibrate" or "Fixtures" and edit mode is currently active, calls EditModeOff() to deactivate edit mode on exit.
| tab | (table) The tab event object with fields: parent (string), index (number), label (string) |
| GrinderSurfaceScreenV02 SendDataToJobTree | ( | tbl | ) |
Serialize a job item data table and send it to the job tree process via the file queue.
Clears the job tree edit mode via SetIsEditingJobTreeCycle(false). If tbl is nil, logs an error and returns without sending. Otherwise, serializes tbl to a string via w.table.repr() wrapped in w.pcall(). If serialization succeeds, creates a new LFQ queue using GetJobTreeLFQPaths() and adds the command "return <serialized_table>" without waiting for a reply.
| tbl | (table|nil) The job item data table to send. If nil, logs an error and takes no action |
| GrinderSurfaceScreenV02 SetIsEditingJobTreeCycle | ( | state | , |
| data_table | ) |
Enter or exit job tree cycle edit mode and update the UI accordingly.
If data_table is nil or not a table, forces state to false. If already in edit mode, resets the previous cycle's Add button label and color before switching. Updates JOBTREE_EDITMODE and JOBTREE_EDITTABLE in m.screen. When entering edit mode, switches the ConversationalTabs notebook to the edited cycle's tab, changes the Add button label to "Update" with a blue background, and creates or updates a persistent GMS notification banner. When exiting edit mode, closes and clears the notification handle if present.
| state | (boolean) True to enter edit mode, false to exit edit mode |
| data_table | (table|nil) The job tree data table for the cycle to edit. If nil or not a table, state is forced to false |
| GrinderSurfaceScreenV02 SetJobTreeFooter | ( | ) |
Send a command to the job tree to set the G-code footer string.
Constructs the footer G-code string ("G65 P180 \n M9 (Coolant Off)") and sends it to the job tree via the file queue using the command "return JobTree.SetFooterString('<ftr>')". The command is sent without waiting for a reply.
| GrinderSurfaceScreenV02 SetJobTreeHeader | ( | ) |
Send a command to the job tree to set the G-code header string.
Constructs the header G-code string (conditional spindle start and coolant on commands) and sends it to the job tree via the file queue using the command "return JobTree.SetHeaderString('<hdr>')". The command is sent without waiting for a reply.
| GrinderSurfaceScreenV02 SetRetracting | ( | new_state | ) |
Set the IsRetracting interlock state and log the change.
Logs the new retraction state via w.LogF() and writes the value to the module-level GrinderSurfaceScreenV02._IsRetracting field. This interlock is used to prevent concurrent retraction attempts during a cycle stop.
| new_state | (boolean) The new retraction state to set (true = retracting, false = not retracting) |
| ShowHideHydraulicControls | ( | AxisID | , |
| showhide | ) |
Show or hide all hydraulic control LEDs and axis text for a given axis.
Sets the Hidden property on the axis text label, positive and negative stroke LEDs, positive and negative park LEDs, and positive and negative direction LEDs for the specified axis. This is a local nested function defined inside InitializeAxisPositionGroup().
| AxisID | (number) The Mach4 axis ID whose hydraulic UI elements should be shown or hidden |
| showhide | (string) The hidden state to apply: "0" to show, "1" to hide |
| GrinderSurfaceScreenV02 ShowHideSpindleGroup | ( | groupname | , |
| showhide | ) |
Show or hide a spindle group based on the rotary surface grinder mode parameter.
Reads the rotary surface grinder mode from cached parameter 1900 bit 0. If rotary mode is active (value == 1), applies the requested show/hide state to the specified group. If rotary mode is not active, the group is always hidden regardless of the showhide argument.
| groupname | (string) The name of the screen group object to show or hide |
| showhide | (string) The hidden state to apply: "0" to show, "1" to hide |
| GrinderSurfaceScreenV02 ShowInScreenGCodeEditor | ( | ) |
Hide the tool display and modals groups and show the in-screen G-code editor.
Calls HideGCodeDisplayAndToolPath() to collapse the G-code display area, then hides the ToolDisplayGroup and ModalsGroup, and repositions the GCodeEditor control to its active visible position (Left = 106).
| GrinderSurfaceScreenV02 StopHydraulicAxis | ( | ) |
Stop all hydraulic axis motion and update the stop status.
Calls w.SetStopStatus() to record the stop event, then calls aux.XAndZReset() to immediately halt motion on the X and Z hydraulic axes.
| GrinderSurfaceScreenV02 TeachPlungeAxis | ( | PoundVar | ) |
Teach a pound variable from the current plunge axis position.
Resolves the current plunge axis ID via GetPlungeAxisID() and delegates to TeachPoundVar() to capture the current position of the plunge axis into the specified pound variable.
| PoundVar | (number) The pound variable number to write the current plunge axis position into |
| GrinderSurfaceScreenV02 TeachPlungeOtherAxis | ( | PoundVar | ) |
Teach a pound variable from the axis opposite to the current plunge axis.
Determines the axis ID of the non-plunge axis: if the plunge axis is Y, uses axis ID 2 (Z); otherwise uses axis ID 1 (Y). Calls TeachPoundVar() with the resolved axis ID to capture the current position of the opposite axis into the specified pound variable.
| PoundVar | (number) The pound variable number to write the current axis position into |
| GrinderSurfaceScreenV02 TeachPoundVar | ( | PoundVar | , |
| AxisID | , | ||
| StartEnd | ) |
Teach a pound variable by capturing the current position of the specified axis.
Reads the current axis position via mc.mcAxisGetPos(). For hydraulic axes, substitutes the hydraulic table position register value instead of the servo encoder position. For the X hydraulic axis, also updates XStrokePositionPOS or XStrokePositionNEG OEM registers based on the StartEnd parameter, and warns if the positive stroke start is not greater than the negative stroke end. Writes the resolved position to the specified pound variable.
| PoundVar | (number) The pound variable number to write the current axis position into |
| AxisID | (number) The Mach4 axis ID constant (e.g., mc.X_AXIS, mc.Z_AXIS) |
| StartEnd | (string|nil) For X hydraulic axis only: "Start" to set XStrokePositionPOS, "End" to set XStrokePositionNEG |
| GrinderSurfaceScreenV02 TeachZDistanceBtn | ( | ) |
Commented-out function for teaching the Z crossover distance pound variable.
This function is currently disabled. It was intended to calculate the crossover distance from the current Z axis position and the crossover start pound variable (9401), then write the result back to pound variable 9401.
| GrinderSurfaceScreenV02 TogglePlungeAxis | ( | ) |
Toggle the plunge axis between Y and Z and update the UI.
Reads the current plunge axis via GetPlungeAxisID(). If the current plunge axis is mc.Y_AXIS, writes 2 to pound variable 532 to select the Z axis. Otherwise writes 1 to select the Y axis. Calls UpdatePlungeAxis() to synchronize the screen LED indicators.
| GrinderSurfaceScreenV02 TogglePlungeSide | ( | ) |
Toggle the plunge side between A-side (0) and B-side (1) and update the UI.
Reads the current plunge side via GetPlungeSide(). If the current value is 0 (A-side), writes 1 to pound variable 531 to select B-side. Otherwise writes 0 to select A-side. Calls UpdatePlungeSide() to synchronize the screen LED indicators.
| GrinderSurfaceScreenV02 TouchOffTeachY | ( | ) |
Teach the Y touch-off position from the current Y axis machine position.
Reads the current Y axis machine position via mc.mcAxisGetMachinePos() and writes it to the "YTouchOffDRO" screen object for later use during calibration.
| GrinderSurfaceScreenV02 TouchOffTeachZ | ( | ) |
Teach the Z touch-off position from the current Z axis machine position.
Reads the current Z axis machine position via mc.mcAxisGetMachinePos() and writes it to the "ZTouchOffDRO" screen object for later use during calibration.
| cyc UpdateCombLabels | ( | dressing_passes | , |
| _type | , | ||
| type_passes | ) |
Update the combined cycle label screen objects with the current state and type descriptions.
Formats the display string from the state description and type description. If the current state is the dressing state (200), appends the number of remaining dressing passes to the state description. Logs the combined state/type string via w.Log(). For each object listed in CombLabels, sets its Label property to the formatted string. Also writes the status text to the operator log via w.OperatorLog() unless the text is "Idle".
| state | (table) The current cycle state object with at least a Description field |
| dressing_passes | (number) The number of remaining dressing passes to display when in dressing state |
| _type | (table) The current cycle type object with at least a Description field |
| type_passes | (number) Reserved for future use; not currently used in formatting |
| GrinderSurfaceScreenV02 UpdateControlRegisters | ( | ) |
Write OEM register values to PLC control registers with appropriate scaling.
Iterates over all entries in PLCObjects["Control-Registers"]["Registers"]. For each entry with a non-empty OEMReg field, reads the OEM register value and writes it to the corresponding PLC register with scaling applied. Z pick registers (ZPositivePick, ZNegativePick) are multiplied by 100 and then scaled by the current FRO percentage. XTableSpeed is multiplied by 10. All other registers are multiplied by 100. Returns an error if any read or write fails.
| GrinderSurfaceScreenV02 UpdateDresserDiamondSelection | ( | ) |
Update the dresser diamond selection display and enable/disable related controls.
Updates the background images and button colors for the three diamond graphic groups based on the currently selected dresser diamond type. Diamonds 1, 2, and 3 are enabled progressively (type 1 enables only diamond 1; type 2 enables diamonds 1-2; type 3 enables all). Also enables or disables axis-specific diamond DRO controls for the X and Z axes based on whether those axes are enabled, and hides the Over Wheel Dresser group if neither the A nor B axis is enabled.
| GrinderSurfaceScreenV02 UpdateDressingSelectionDropDown | ( | value | ) |
Synchronize the dressing selection drop-down control with a given dressing mode value.
Maps the numeric dressing mode value to the corresponding drop-down text string and updates the "DressSelectionDropDown" screen object only if its current selection differs from the new text, preventing unnecessary UI updates.
| value | (number) The dressing mode numeric code (160, 167, 168, 169, or 170) |
| GrinderSurfaceScreenV02 UpdateElectromagnet | ( | ) |
Update the electromagnet gauge display and clamp/unclamp status LEDs.
If the electromagnet is enabled, reads the meter register name from OEM parameters, retrieves the current register value, and computes a percentage using the configured input scale min/max. The percentage is passed through a moving average filter (MagneticMeterAverage), clamped to [0, 150], and written to the "ElectromagnetGauge" screen object. Also updates the ClampLED (green) and UnClampLED (red) based on the clamped and unclamped state functions.
| GrinderSurfaceScreenV02 UpdateFollowGrindDepthButtons | ( | ) |
Update the follow grind depth button background color to reflect the current state.
Checks the current follow grind depth state via IsFollowGrindDepthOn(). If active, sets the "FollowGrindDepthBtn" background color to the configured On color from the screen color scheme; otherwise sets it to the Off color.
| GrinderSurfaceScreenV02 UpdateGrindOverride | ( | ) |
Write the current feed rate override (FRO) to pound variable 999 for grind override tracking.
Reads the current FRO percentage via mc.mcCntlGetFRO() and writes it to pound variable
| GrinderSurfaceScreenV02 UpdateGrindTableControls | ( | ) |
Update PLC control registers, hydraulic axis IO LEDs, and the jog speed register.
Passes the current feed rate override (FRO) to the OEM parameter "TableFeedrateOV", though only when the current grind state is 186 (Dice Grind); otherwise FRO is set to 100. Iterates over all hydraulic axes defined in PLCObjects and reads their IO bit states, updating the corresponding screen LEDs (muted green for direction bits, muted yellow for X/Z POS/NEG). Finally, writes the interpolated jog rate from the X15-14-21 panel to the "JogSpeed" OEM register.
| GrinderSurfaceScreenV02 UpdateHydraulicJogging | ( | ) |
Forward operator panel jog commands for hydraulic axes to the PLC IO points.
Identifies the active operator panel (X15-14-21, X15-14-22, or Software) from the configured panels. For each hydraulic axis in PLCObjects, reads the positive and negative jog IO states from the operator panel device and writes them to the corresponding PLC jog IO points (e.g., "X-Jog-POS", "X-Jog-NEG"). Returns an error triple if any IO read or write fails.
| GrinderSurfaceScreenV02 UpdatePLCIO | ( | ) |
Synchronize all PLC IO bit states between the Mach device and the PLC hardware registers.
For each hydraulic axis in PLCObjects, reads the axis IO_0 register value and maps each bit to its named IO point on the Mach device via w.SetIoState(). Then processes the Control IO_0 and IO_1 registers: reads the current register value, updates each bit from the corresponding named IO state on the Mach device, and writes the result back to the PLC register. Returns an error triple if any register read or write operation fails.
| GrinderSurfaceScreenV02 UpdatePLCRegisters | ( | ) |
Read PLC registers and write their scaled values to the corresponding OEM registers.
Iterates over all entries in PLCObjects["PLC-Registers"]["Registers"]. For each entry, reads the value from the PLC device register and divides non-zero values by 100 before writing to the corresponding OEM register via w.SetOEMRegValue(). Returns an error if any register read or write fails.
| GrinderSurfaceScreenV02 UpdatePlungeAxis | ( | ) |
Update the plunge axis LED indicators to reflect the current axis selection.
Reads pound variable 532 to determine the active plunge axis. If the value equals mc.Y_AXIS, illuminates the PlungeAxisIDYLED (green) and extinguishes the PlungeAxisIDZLED. Otherwise, extinguishes the PlungeAxisIDYLED and illuminates the PlungeAxisIDZLED.
| GrinderSurfaceScreenV02 UpdatePlungeSide | ( | ) |
Update the plunge side LED indicators to reflect the current selection.
Reads pound variable 531 to determine the active plunge side. If the value is 0, illuminates the ASideGrindText LED (green) and extinguishes the BSideGrindText LED. Otherwise, extinguishes the ASideGrindText LED and illuminates the BSideGrindText LED.
| GrinderSurfaceScreenV02 UpdateYFeedMode_Slot | ( | ) |
Update the slot grinding tab background image and show/hide feed mode UI groups.
Reads the current Y feed mode from pound variable 9461 and calls UpdateYFeedModeDropDown_Slot() to synchronize the drop-down control. Sets the "SlotGrindTab" background image to match the selected mode (Both, Negative, Positive, or Continuous). When mode 3 (Continuous) is active, shows "YContinuousFeedGroup_Slot" and hides "YStepFeedGroup_Slot"; for all other modes the groups are swapped.
| GrinderSurfaceScreenV02 UpdateYFeedModeDropDown_Slot | ( | value | ) |
Synchronize the slot grinding Y feed mode drop-down control with a given mode value.
Maps the numeric Y feed mode value to the corresponding drop-down text string and updates the "YFeedModeDropDown_Slot" screen object only if its current selection differs from the new text, preventing unnecessary UI updates.
| value | (number) The Y feed mode numeric code (0=Feed Both, 1=Feed On Negative, 2=Feed On Positive, 3=Feed Continuous) |
| GrinderSurfaceScreenV02 UpdateZeroButtons | ( | ) |
Update the visibility and label of axis text and zero buttons based on edit mode state.
Iterates over all axes. For each axis, determines whether it should be shown based on whether it is servo-enabled or hydraulic-table-enabled. Sets the font weight for axis label text. In edit mode with part coordinates active, hydraulic axes and extra-coordinate axes have their axis text shown and zero button hidden; other axes have axis text hidden and the zero button shown (if the axis is enabled). Outside edit mode or in machine coordinates, shows axis text and hides zero buttons for all shown axes.
| GrinderSurfaceScreenV02 UpdateZFeedMode | ( | ) |
Update the surface grinding tab background image, feed group visibility, and PLC IO states.
Reads the current Z feed mode from pound variable 9411 and calls UpdateZFeedModeDropDown() to synchronize the drop-down control. Sets the "SurfaceGrindTab" background image to match the selected mode (Both, Negative, Positive, or Continuous). When mode 3 (Continuous) is active, shows "ZContinuousFeedrateGroup_Surface" and hides "ZPickAmountGroup_Surface"; for all other modes the groups are swapped. Updates PLC IO points "Z-Feed-On-POS", "Z-Feed-On-NEG", and the step-mode IO point based on the active feed mode.
| GrinderSurfaceScreenV02 UpdateZFeedMode_Face | ( | ) |
Update the face grinding tab background image and show/hide feed mode UI groups.
Reads the current Z feed mode from pound variable 9511 and calls UpdateZFeedModeDropDown_Face() to synchronize the drop-down control. Sets the "FaceGrindTab" background image to match the selected mode (Both, Negative, Positive, or Continuous). When mode 3 (Continuous) is active, shows "ZContinuousFeedGroup_Face" and hides "ZStepFeedGroup_Face"; for all other modes the groups are swapped.
| GrinderSurfaceScreenV02 UpdateZFeedModeDropDown | ( | value | ) |
Synchronize the surface grinding Z feed mode drop-down control with a given mode value.
Maps the numeric Z feed mode value to the corresponding drop-down text string and updates the "ZFeedModeDropDown_Surface" screen object only if its current selection differs from the new text, preventing unnecessary UI updates. If the object does not exist, no action is taken.
| value | (number) The Z feed mode numeric code (0=Feed Both, 1=Feed On Negative, 2=Feed On Positive, 3=Feed Continuous) |
| GrinderSurfaceScreenV02 UpdateZFeedModeDropDown_Face | ( | value | ) |
Synchronize the face grinding Z feed mode drop-down control with a given mode value.
Maps the numeric Z feed mode value to the corresponding drop-down text string and updates the "ZFeedModeDropDown_Face" screen object only if its current selection differs from the new text, preventing unnecessary UI updates.
| value | (number) The Z feed mode numeric code (0=Feed Both, 1=Feed On Negative, 2=Feed On Positive, 3=Feed Continuous) |
| GrinderSurfaceScreenV02 YFeedModeDropDown_Slot | ( | ... | ) |
Handle a slot grinding Y feed mode selection event from the drop-down control.
Maps the selected text string from the slot grinding Y feed drop-down to a numeric mode value and writes it to pound variable 9461. Supported modes: "Feed Both" (0), "Feed On Negative" (1), "Feed On Positive" (2), and "Feed Continuous" (3). Calls UpdateYFeedMode_Slot() to synchronize the UI after the value is written. Calls w.FunctionCompleted() on success.
| ... | (any) Variadic arguments; the first argument is the selected drop-down text string |
| GrinderSurfaceScreenV02 ZFeedContinuous | ( | ) |
Set the Z feed mode to continuous (mode 3) and update the UI.
Writes the value 3 to pound variable 9251 and calls UpdateZFeedMode() to synchronize the screen controls with the new feed mode.
| GrinderSurfaceScreenV02 ZFeedModeDropDown | ( | ... | ) |
Handle a surface grinding Z feed mode selection event from the drop-down control.
Maps the selected text string from the surface grinding Z feed drop-down to a numeric mode value and writes it to pound variable 9411. Supported modes: "Feed Both" (0), "Feed On Negative" (1), "Feed On Positive" (2), and "Feed Continuous" (3). If "Feed Continuous" is selected but the X axis is not a hydraulic axis, displays a warning, restores the previous drop-down value, and returns without updating. Calls UpdateZFeedMode() and w.FunctionCompleted() on success.
| ... | (any) Variadic arguments; the first argument is the selected drop-down text string |
| GrinderSurfaceScreenV02 ZFeedModeDropDown_Face | ( | ... | ) |
Handle a face grinding Z feed mode selection event from the drop-down control.
Maps the selected text string from the face grinding Z feed drop-down to a numeric mode value and writes it to pound variable 9511. Supported modes: "Feed Both" (0), "Feed On Negative" (1), "Feed On Positive" (2), and "Feed Continuous" (3). Calls UpdateZFeedMode_Face() to synchronize the UI after the value is written.
| ... | (any) Variadic arguments; the first argument is the selected drop-down text string |
| GrinderSurfaceScreenV02 ZFeedOnBoth | ( | ) |
Set the Z feed mode to feed on both strokes (mode 0) and update the UI.
Writes the value 0 to pound variable 9251 and calls UpdateZFeedMode() to synchronize the screen controls with the new feed mode.
| GrinderSurfaceScreenV02 ZFeedOnNegative | ( | ) |
Set the Z feed mode to feed on negative stroke only (mode 1) and update the UI.
Writes the value 1 to pound variable 9251 and calls UpdateZFeedMode() to synchronize the screen controls with the new feed mode.
| GrinderSurfaceScreenV02 ZFeedOnPositive | ( | ) |
Set the Z feed mode to feed on positive stroke only (mode 2) and update the UI.
Writes the value 2 to pound variable 9251 and calls UpdateZFeedMode() to synchronize the screen controls with the new feed mode.