Mach Modules Documentation
Lua Module API Documentation
Loading...
Searching...
No Matches
CommonGUIModule.lua File Reference

Go to the source code of this file.

Functions

CommonGUIModule RunHooks (hook_name,...)
 Run registered hook scripts for the specified hook event.
CommonGUIModule RunHooksSilent (hook_name,...)
 Run registered hook scripts silently without logging completion messages.
CommonGUIModule EnableBtn ()
 Enable the machine after verifying alarm, emergency stop, and safety relay preconditions.
CommonGUIModule ToggleEnableBtn ()
 Button handler to toggle the machine enable state on or off.
CommonGUIModule DisableBtn ()
 Disable the machine by setting the machine enable signal to false.
CommonGUIModule StartEnableSequence (async)
 Initiate the machine enable sequence with re-entrancy protection and jog inhibit management.
CommonGUIModule StartDisableSequence ()
 Initiate the machine disable sequence with re-entrancy protection.
CommonGUIModule IsMachEnabled (inst)
 Check whether the machine is currently enabled and update global enable state variables.
CommonGUIModule EmergencyStop ()
 Perform an emergency stop by disabling drives and turning off all active outputs.
CommonGUIModule CycleStartBtn ()
 Button handler to initiate a cycle start operation.
CommonGUIModule CycleStart (inst)
 Initiate a cycle start with re-entrancy protection and cycle start hold handling.
CommonGUIModule IsMSTAndDryRunActive ()
 Check whether MST lock or dry run is active and prompt the operator to confirm cycle start.
CommonGUIModule OpenExternalApplication ()
 Open the external conversational assistant application.
CommonGUIModule MDIBtn ()
 Button handler to execute MDI (Manual Data Input) G-code from the MDI input field.
CommonGUIModule FeedHoldBtn ()
 Button handler to initiate a feed hold to pause program execution.
CommonGUIModule FeedHold (inst)
 Initiate a feed hold to pause program execution with re-entrancy protection.
CommonGUIModule FeedHoldRetractBtn ()
 Button handler to initiate a feed hold retract operation.
CommonGUIModule FeedHoldRetract (inst)
 Initiate a feed hold retract operation with re-entrancy protection.
CommonGUIModule IsFeedHoldRetract ()
 Check whether the feed hold retract output signal is currently active.
CommonGUIModule CycleStopBtn ()
 Button handler to stop the currently running G-code program.
CommonGUIModule CycleStop (...)
 Stop the currently running G-code program with re-entrancy protection.
CommonGUIModule CycleStopRestoreGCodeLineNum (gcodeline, inst)
 Restore the G-code line number to the value recorded at the time of cycle stop.
CommonGUIModule ConvertIgnoreOutputsString (output_range)
 Convert a semicolon or comma-separated output range string to an array of output numbers.
CommonGUIModule StopAuxiliaries ()
 Stop all auxiliary outputs and signals after a cycle stop or disable event.
CommonGUIModule RewindBtn ()
 Button handler to rewind the currently loaded G-code file to the beginning.
CommonGUIModule Rewind ()
 Rewind the currently loaded G-code file to the beginning.
CommonGUIModule ResetBtn ()
 Button handler to reset the controller, running pre/post reset hooks.
CommonGUIModule EnableResetBtn ()
 Button handler to initiate the combined enable and reset sequence.
CommonGUIModule ToggleEnableResetBtn ()
 Button handler to toggle the enable/reset state based on current machine enable status.
CommonGUIModule EnableReset ()
 Perform a combined enable and reset operation with re-entrancy protection.
CommonGUIModule MotionControllerPreEnable ()
 Run the motion controller pre-enable sequence for all instances.
CommonGUIModule Reset ()
 Reset the Mach4 controller with re-entrancy protection.
CommonGUIModule ResetSafetyRelay ()
 Reset the safety relay circuit with re-entrancy protection.
CommonGUIModule IsSafetyRelayCleared ()
 Check whether the safety relay circuit is currently in the cleared (OK) state.
CommonGUIModule MotionInhibitStart ()
 Activate motion inhibit while the machine is running to pause program execution.
CommonGUIModule MotionInhibitEnd ()
 Release an active motion inhibit and allow program execution to continue.
CommonGUIModule IsMotionInhibitEnabled ()
 Check whether the motion inhibit interlock feature is configured and enabled.
CommonGUIModule IsMotionInhibitActive ()
 Check whether the motion inhibit signal is currently active.
CommonGUIModule UpdateMotionInhibit ()
 Release motion inhibit if the machine becomes idle.
CommonGUIModule InhibitJoggingWhenNotHomed ()
 Update jogging inhibit state for all instances based on homing status.
CommonGUIModule InhibitJoggingWhenNotHomedOverrideToggle (inst)
 Toggle the jog inhibit override state for the specified instance.
CommonGUIModule SetInhibitJoggingWhenNotHomedOverride (on_off, inst)
 Set the jog inhibit override state for the specified instance.
CommonGUIModule GetInhibitJoggingWhenNotHomedOverride (inst)
 Get the current jog inhibit override state for the specified instance.
CommonGUIModule IsPartCounterQuotaReached ()
 Check whether the required part counter quota has been reached.
CommonGUIModule GcodeRecentNoCBtn ()
 Button handler to open the recent G-code file list without the GC Adapter.
CommonGUIModule GcodeRecentBtn ()
 Button handler to open the Recent GCode file selector.
UI CloseDialog ()
 Close the Recent GCode dialog and release associated resources.
CommonGUIModule GcodeLoadBtn ()
 Button handler to load a G-code file.
CommonGUIModule GcodeEditBtn ()
 Button handler to open the currently loaded G-code file in an editor.
CommonGUIModule GcodeCloseBtn ()
 Button handler to close the currently loaded G-code file.
CommonGUIModule GcodeClose ()
 Close the currently loaded G-code file.
CommonGUIModule GcodeShortcutBtn (short_num, inst)
 Button handler to load a G-code shortcut file by index.
CommonGUIModule GcodeShortcut (short_num, inst)
 Load a G-code shortcut file by index for the specified instance.
CommonGUIModule DeReferenceAllBtn ()
 Button handler to dereference all axes on the current Mach4 instance.
CommonGUIModule DeReferenceAll ()
 Dereference all axes on the current Mach4 instance.
CommonGUIModule DeReferenceAllInstances (inst_list)
 Dereference all axes on each instance in the provided instance list.
CommonGUIModule DeReferenceAxis (Axis, _inst)
 Dereference (un-home) a single axis or all axes on the specified instance.
CommonGUIModule HomeOverrideAxes (main_axis, inst)
 Home override (OB/secondary) axes associated with the specified primary axis.
CommonGUIModule HomeAllBtn ()
 Button handler to home all axes using the configured HomeAllBtnOptions parameter.
CommonGUIModule HomeAllSelectedInstance (confirm_homing, only_dereferenced_axes)
 Home all axes on the currently selected Mach4 instance with optional confirmation.
CommonGUIModule HomeAll (confirm_homing, only_dereferenced_axes, inst_list)
 Home all axes on one or more Mach4 instances with full precondition checks and hook support.
CommonGUIModule HomeAllDereferencedAxes (confirm_homing, selected_inst)
 Home all dereferenced (unhomed) axes only, with optional confirmation.
CommonGUIModule HomeAxis (AxisID, use_confirmation)
 Home a single axis with optional confirmation dialog and comprehensive precondition checks.
CommonGUIModule HomeXBtn ()
 Button handler to home the X axis.
CommonGUIModule HomeYBtn ()
 Button handler to home the Y axis.
CommonGUIModule HomeZBtn ()
 Button handler to home the Z axis.
CommonGUIModule HomeABtn ()
 Button handler to home the A axis.
CommonGUIModule HomeBBtn ()
 Button handler to home the B axis.
CommonGUIModule HomeCBtn ()
 Button handler to home the C axis.
CommonGUIModule HomeOB1Btn ()
 Button handler to home the OB1 (AXIS6) axis.
CommonGUIModule HomeOB2Btn ()
 Button handler to home the OB2 (AXIS7) axis.
CommonGUIModule HomeOB3Btn ()
 Button handler to home the OB3 (AXIS8) axis.
CommonGUIModule HomeOB4Btn ()
 Button handler to home the OB4 (AXIS9) axis.
CommonGUIModule HomeOB5Btn ()
 Button handler to home the OB5 (AXIS10) axis.
CommonGUIModule HomeOB6Btn ()
 Button handler to home the OB6 (AXIS11) axis.
CommonGUIModule AutoEnableSoftlimits (inst)
 Automatically enable software limits after homing if configured to do so.
CommonGUIModule CycleStartSoftLimitRecovery (inst)
 Check and recover axes that are outside the software limit zone before cycle start.
CommonGUIModule WaitForHoming (AxisID, inst)
 Wait for the machine to return to IDLE state after a homing operation.
CommonGUIModule IsAxisHoming (AxisID)
 Check whether a specific axis is currently in the process of homing.
CommonGUIModule CreateLimitSwitchActiveMessage (message, title)
 Create a persistent GMS notification for a limit switch active condition.
CommonGUIModule ClearLimitSwitchActiveMessage (handle)
 Close and dismiss a limit switch active notification by handle.
CommonGUIModule SoftLimitToggleBtn ()
 Button handler to toggle software limits on or off.
CommonGUIModule OpenM00Notification (message, line, inst)
 Open an M00/M01 program stop notification and record the stop line number.
CommonGUIModule CloseM00Notification ()
 Close the M00/M01 stop notification and clear the optional stop active register.
CommonGUIModule IsM00Active (inst)
 Check whether a program stop (M00) is currently active at the current G-code line.
CommonGUIModule VerifyHoming (IgnoreSaftyCheck, inst)
 Verify that all required axes are homed - delegates to the wrapper module implementation.
CommonGUIModule IsAxisHomed (AxisID, IgnoreSaftyCheck, inst)
 Check whether a specific axis is homed - delegates to the wrapper module implementation.
CommonGUIModule ZeroAllBtn (IgnoreConfirmationDialogs, IgnoreEditMode)
 Button handler to zero all axis fixture offsets simultaneously.
CommonGUIModule ZeroAxis (AxisID, IgnoreConfirmationDialogs, IgnoreEditMode)
 Zero the fixture offset for a single axis with optional confirmation and edit mode checks.
CommonGUIModule ZeroMultipleAxes (AxisID, IgnoreConfirmationDialogs, IgnoreEditMode)
 Zero the fixture offset for one or more axes simultaneously.
CommonGUIModule ZeroXBtn (IgnoreConfirmationDialogs)
 Button handler to zero the X axis fixture offset.
CommonGUIModule ZeroYBtn (IgnoreConfirmationDialogs)
 Button handler to zero the Y axis fixture offset.
CommonGUIModule ZeroZBtn (IgnoreConfirmationDialogs)
 Button handler to zero the Z axis fixture offset.
CommonGUIModule ZeroABtn (IgnoreConfirmationDialogs)
 Button handler to zero the A axis fixture offset.
CommonGUIModule ZeroBBtn (IgnoreConfirmationDialogs)
 Button handler to zero the B axis fixture offset.
CommonGUIModule ZeroCBtn (IgnoreConfirmationDialogs)
 Button handler to zero the C axis fixture offset.
CommonGUIModule ZeroXYBtn (IgnoreConfirmationDialogs)
 Button handler to zero the X and Y axes fixture offsets simultaneously.
CommonGUIModule ZeroXY (IgnoreConfirmationDialogs, IgnoreEditMode)
 Zero the X and Y axes fixture offsets simultaneously.
CommonGUIModule ZeroXZBtn (IgnoreConfirmationDialogs)
 Button handler to zero the X and Z axes fixture offsets simultaneously.
CommonGUIModule ZeroXZ (IgnoreConfirmationDialogs, IgnoreEditMode)
 Zero the X and Z axes fixture offsets simultaneously.
CommonGUIModule ZeroYZBtn (IgnoreConfirmationDialogs)
 Button handler to zero the Y and Z axes fixture offsets simultaneously.
CommonGUIModule ZeroYZ (IgnoreConfirmationDialogs, IgnoreEditMode)
 Zero the Y and Z axes fixture offsets simultaneously.
CommonGUIModule ZeroXYZBtn (IgnoreConfirmationDialogs)
 Button handler to zero the X, Y, and Z axes fixture offsets simultaneously.
CommonGUIModule ZeroXYZ (IgnoreConfirmationDialogs, IgnoreEditMode)
 Zero the X, Y, and Z axes fixture offsets simultaneously.
CommonGUIModule ZeroABCBtn (IgnoreConfirmationDialogs)
 Button handler to zero the A, B, and C axes fixture offsets simultaneously.
CommonGUIModule ZeroABC (IgnoreConfirmationDialogs, IgnoreEditMode)
 Zero the A, B, and C axes fixture offsets simultaneously.
CommonGUIModule ModifyAxisPosition (AxisID, Position, SkipUpdating)
 Modify an axis position by setting a new fixture offset value.
CommonGUIModule SetCurrentFixtureOffsetDRO (value, AxisID,...)
 DRO callback to set the current fixture offset for the specified axis.
CommonGUIModule SetCurrentFixtureOffset (AxisID, value, inst)
 Set the current fixture offset value for the specified axis.
CommonGUIModule UpdateGlobalWithActiveFixtureIndex ()
 Update the global active fixture offset index variables from the current Mach4 state.
CommonGUIModule ActivateFixtureOffset (fixture)
 Activate a fixture offset by executing the corresponding G-code command via MDI.
CommonGUIModule IsFixtureOffset (fixture)
 Check whether the specified fixture offset index is currently active.
CommonGUIModule ReverseRunBtn ()
 Button handler to initiate a reverse run operation.
CommonGUIModule IsMistOn ()
 Check whether the mist coolant output is currently active.
CommonGUIModule MistOn ()
 Turn on the mist coolant output for the selected instance.
CommonGUIModule MistOff ()
 Turn off the mist coolant output for the selected instance.
CommonGUIModule MistToggleBtn ()
 Button handler to toggle mist coolant on or off.
CommonGUIModule FloodOn ()
 Turn on the flood coolant output for the selected instance.
CommonGUIModule FloodOff ()
 Turn off the flood coolant output for the selected instance.
CommonGUIModule IsFloodOn ()
 Check whether the flood coolant output is currently active.
CommonGUIModule CoolantToggleBtn ()
 Button handler to toggle flood coolant on or off.
CommonGUIModule AllCoolantOffBtn ()
 Button handler to turn off all coolant outputs (mist and flood).
CommonGUIModule SingleBlockToggleBtn (inst)
 Button handler to toggle single block mode on or off.
CommonGUIModule IsSingleBlockOn (inst)
 Check whether single block mode is currently active for the specified instance.
CommonGUIModule SingleBlockOn (inst)
 Turn on single block mode for the specified instance.
CommonGUIModule SingleBlockOff (inst)
 Turn off single block mode for the specified instance.
CommonGUIModule OptionalStopToggleBtn ()
 Button handler to toggle the optional stop (M1) feature on or off.
CommonGUIModule IsOptionalStopOn ()
 Check whether the optional stop (M1) feature is currently enabled.
CommonGUIModule OptionalStopOn ()
 Turn on the optional stop (M1) feature for the current instance.
CommonGUIModule OptionalStopOff ()
 Turn off the optional stop (M1) feature for the current instance.
CommonGUIModule MachineCoordToggleBtn ()
 Toggle the machine coordinate display mode on or off.
CommonGUIModule BlockDeleteToggleBtn ()
 Toggle block delete mode on or off, showing a level selection dialog if needed.
UI SetupDialog ()
 Initialize the block delete level checkboxes from the saved Mach4 profile values.
UI SaveSettings ()
 Save the current block delete level checkbox states to the Mach4 profile and apply them.
CommonGUIModule DistanceToGoToggleBtn ()
 Toggle the distance-to-go display mode on or off.
CommonGUIModule LimitOverrideToggle ()
 Toggle the limit override signal on or off with password protection.
CommonGUIModule RunFromHereBtn ()
 Button handler to initiate a run-from-here operation at the current G-code line.
OperatorLog (inst, "Run From Here Pressed")
 Write an operator action message to the Mach4 operator log.
CommonGUIModule FileResumeBtn ()
 Button handler to initiate the file resume sequence.
CommonGUIModule FileResume ()
 Execute the file resume sequence using the configured resume mode.
CommonGUIModule IsFileResumeActive ()
 Check whether a file resume or run-from-here operation is currently active.
CommonGUIModule FileResumeAdvancedBtn ()
 Button handler to initiate the advanced file resume sequence.
CommonGUIModule FileResumeAdvanced ()
 Execute the advanced file resume sequence to reposition and restart from the current G-code line.
CommonGUIModule FileResumeSimplifedBtn ()
 Button handler to initiate the simplified file resume sequence.
CommonGUIModule FileResumeSimplifed ()
 Execute the simplified file resume sequence to reposition and restart from the current G-code line.
CommonGUIModule FindToolChangeBtn ()
 Open the Find Tool Change dialog for the currently loaded G-code file.
CommonGUIModule SearchGCodeBtn ()
 Open the G-code search dialog for the currently loaded G-code file.
CommonGUIModule IsDryRunOn ()
 Check whether dry run mode is currently active for the selected instance.
CommonGUIModule SetDryRun (on_off)
 Set the dry run mode on or off for the selected instance.
CommonGUIModule DryRunToggleBtn ()
 Button handler to toggle dry run mode on or off.
CommonGUIModule DryRunToggle ()
 Toggle dry run mode on or off based on its current state.
CommonGUIModule IncludeCommentsInMessages (on_off)
 Enable or disable inclusion of G-code comments in message output.
CommonGUIModule SaveFixtureOffsets ()
 Save fixture offsets to disk for all idle Mach4 instances.
CommonGUIModule SaveToolOffsets ()
 Save tool offsets to disk for all idle Mach4 instances.
CommonGUIModule SaveSysVars ()
 Save system variables to disk for all idle Mach4 instances.
CommonGUIModule ManagePartZeros ()
 Record the current fixture offsets to the profile as a rolling history of up to 10 entries.
CommonGUIModule SetWarningMessage (Message, TimeOut, EveryWhere, Title, Size, inst)
 Display a warning message - delegates to the wrapper module implementation.
CommonGUIModule GetBlendedVelocity ()
 Calculate the blended (resultant) velocity across all enabled linear axes.
CommonGUIModule IsAxisRotary (AxisID, inst)
 Check whether a specified axis is configured as a rotary axis.
CommonGUIModule InitializeRotaryAxesFeedrateMode ()
 Initialize the feedrate mode for all configured rotary axes from OEM parameters.
CommonGUIModule SetRotaryAxisFeedrateMode (axis_id, val)
 Set the feedrate mode for a rotary axis.
CommonGUIModule IsRotaryAxisFeedrateModeConstantSurfaceSpeed (axis_id)
 Check whether a rotary axis feedrate mode is set to Constant Surface Speed.
CommonGUIModule GetAxisVelocity (AxisID)
 Get the current velocity of a single axis for the selected instance.
CommonGUIModule ManualMode (Active)
 Activate or deactivate manual mode for the current Mach4 instance.
CommonGUIModule ManualModeToggle ()
 Toggle manual mode on or off based on the current ManualModeActive register state.
CommonGUIModule ManualModeIsActive (AutoMessage)
 Check whether manual mode is currently active and optionally display a warning.
CommonGUIModule MSTLockToggleBtn ()
 Toggle the M-S-T lock on or off based on its current state.
CommonGUIModule IsMSTLockOn ()
 Check whether the M-S-T lock is currently active for the selected instance.
CommonGUIModule MSTLockOn ()
 Turn on the M-S-T lock for the selected instance if the machine is idle.
CommonGUIModule MSTLockOff ()
 Turn off the M-S-T lock for the selected instance.
CommonGUIModule ZAxisLockToggleBtn ()
 Button handler placeholder for Z-axis lock toggle.
CommonGUIModule MachineLockToggleBtn ()
 Button handler placeholder for machine lock toggle.
CommonGUIModule IsWorkLightEnabled ()
 Check whether the work light output signal is mapped and the feature is enabled.
CommonGUIModule InitializeWorkLight ()
 Initialize the work light feature and restore its previous on/off state.
CommonGUIModule WorkLightOn ()
 Turn on the work light output signal and save the on state.
CommonGUIModule WorkLightOff (dontsaveoutputstate)
 Turn off the work light output signal and optionally save the off state.
CommonGUIModule IsWorkLightOn ()
 Check whether the work light output signal is currently active.
CommonGUIModule WorkLightToggle ()
 Toggle the work light on or off based on its current state.
CommonGUIModule DisableLoggingOnOutputs ()
 Disable signal-change logging on high-frequency axis movement and deceleration output signals.
CommonGUIModule PLCSequenceDialogBtn ()
 Open the PLC Sequence dialog allowing the operator to manually trigger PLC sequences.
UI ClosePLCSeqDialog ()
 Close the PLC Sequence dialog and release associated resources.
CommonGUIModule CommandsDialogBtn ()
 Open the Commands dialog allowing the operator to browse and run user commands.
UI filter (search_term)
 Filter the commands list box to show only entries matching the search term.
UI CloseCommandsDialog ()
 Close the Commands dialog and release associated resources.
CommonGUIModule GoToPositionDialogBtn ()
 Open the GoTo Positions dialog allowing the operator to select and move to a named position.
UI CloseDialog (reason)
 Close the GoTo Positions dialog and release the cycle start hold.
CommonGUIModule MoveToGoToPosition (goto_position_name)
 Move the machine to the named GoTo position using a configured G-code string.
CommonGUIModule ToggleOnScreenJogBtn ()
 Toggle the on-screen jog buttons panel on or off.
CommonGUIModule InitializeSelectedSpindle (inst)
 Initialize the selected spindle to the configured default spindle number.
CommonGUIModule GetDefaultSpindleNumber (inst)
 Get the default spindle number for the specified Mach4 instance.
CommonGUIModule GetSelectedSpindleNumber (inst)
 Get the currently selected spindle number for the specified Mach4 instance.
CommonGUIModule IsSelectedSpindleNumber (inst, spindle)
 Check whether the specified spindle number is currently selected for the given instance.
CommonGUIModule SetSelectedSpindleNumber (inst, spindle)
 Set the selected spindle number for the specified Mach4 instance.
CommonGUIModule ToggleSpindleBrake (inst)
 Toggle the spindle brake on or off based on its current state.
CommonGUIModule ToggleSpindleFWD (use_confirmation, inst)
 Toggle the spindle between forward and stopped states.
CommonGUIModule ToggleSpindleREV (use_confirmation, inst)
 Toggle the spindle between reverse and stopped states.
CommonGUIModule IsSpindleOn (inst)
 Check whether the spindle is currently running in any direction.
CommonGUIModule SpindleSafetyCheck (inst)
 Verify that the machine is in a safe state to start the spindle.
CommonGUIModule SpindleFWDBtn (use_confirmation)
 Button handler to start the spindle in forward direction.
CommonGUIModule SpindleFWD (use_confirmation)
 Start the spindle in forward direction by executing the M3 M-code script.
CommonGUIModule SpindleREVBtn (use_confirmation)
 Button handler to start the spindle in reverse direction.
CommonGUIModule SpindleREV (use_confirmation)
 Start the spindle in reverse direction by executing the M4 M-code script.
CommonGUIModule SpindleStopBtn ()
 Button handler to stop the spindle.
CommonGUIModule SpindleStop ()
 Stop the spindle by executing the M5 M-code script.
CommonGUIModule StopSpindleDuringToolPathRegen (inst)
 Stop the spindle during a tool path regeneration operation.
CommonGUIModule SetSpindleOverride (percentage)
 Set the spindle override percentage with hook support and bounds clamping.
CommonGUIModule SpindleFWDWait (use_confirmation)
 Start the spindle in forward direction and wait for it to reach speed.
CommonGUIModule SpindleREVWait (use_confirmation)
 Start the spindle in reverse and wait for it to reach speed.
CommonGUIModule SpindleStopWait ()
 Stop the spindle and wait for the stop to complete.
CommonGUIModule CheckSpindleOverride (value,...)
 Clamp a spindle override percentage to the configured minimum and maximum bounds.
CommonGUIModule GetSpindleOverride ()
 Get the current spindle override percentage.
CommonGUIModule SpindleOverrideIncrement (increment)
 Increment the spindle override percentage by the configured or specified increment.
CommonGUIModule SpindleOverrideDecrement (increment)
 Decrement the spindle override percentage by the configured or specified increment.
CommonGUIModule SetFeedrateOverride (percentage)
 Set the feedrate override percentage with hook support and bounds clamping.
CommonGUIModule GetFeedrateOverride ()
 Get the current feedrate override percentage.
CommonGUIModule CheckFeedrateOverride (value,...)
 Clamp a feedrate override percentage to the configured minimum and maximum bounds.
CommonGUIModule FeedrateOverrideIncrementAmount (amount, increment)
 Increment the feedrate override by repeatedly calling FeedrateOverrideIncrement.
CommonGUIModule FeedrateOverrideIncrement (increment)
 Increment the feedrate override percentage by the configured or specified increment.
CommonGUIModule FeedrateOverrideDecrementAmount (amount, increment)
 Decrement the feedrate override by repeatedly calling FeedrateOverrideDecrement.
CommonGUIModule FeedrateOverrideDecrement (increment)
 Decrement the feedrate override percentage by the configured or specified increment.
CommonGUIModule SpindleOrientBtn ()
 Button handler to orient the spindle.
CommonGUIModule SpindleOrient (use_confirmation)
 Orient the spindle to its home position using M19.
CommonGUIModule SpindleOrientToggleBtn (use_confirmation)
 Toggle spindle orient on or off based on current orient state.
CommonGUIModule IsSpindleOriented ()
 Check whether the spindle is currently in the oriented position.
CommonGUIModule IsSpindleOrientedBtn ()
 Get the spindle orient state for use by a button indicator, including blink behavior.
CommonGUIModule SpindleBrakeOnBtn ()
 Button handler to apply the spindle brake.
CommonGUIModule SpindleBrakeOn ()
 Apply the spindle brake by executing the SpindleBrakeOn M-code script.
CommonGUIModule SpindleBrakeOffBtn ()
 Button handler to release the spindle brake.
CommonGUIModule SpindleBrakeOff ()
 Release the spindle brake by executing the SpindleBrakeOff M-code script.
CommonGUIModule SpindleWarmUpBtn ()
 Button handler to start the spindle warm-up sequence.
CommonGUIModule SpindleWarmUp ()
 Execute a spindle warm-up sequence at the configured idle speed.
CommonGUIModule IsSpindleWarmUpNeeded ()
 Check whether a spindle warm-up is currently needed.
CommonGUIModule SpindleWarmUpInterLockWithCycleStart ()
 Interlock spindle warm-up with cycle start to prevent running without completing warm-up.
CommonGUIModule SkipSpindleWarmUpBtn ()
 Button handler for skipping the spindle warm-up cycle.
CommonGUIModule SkipSpindleWarmUp ()
 Skip an active spindle warm-up cycle and mark warm-up as completed.
CommonGUIModule IsGangSpindleEnabled ()
 Check whether the gang spindle feature is enabled.
CommonGUIModule IsGangSpindleControlSourceCommandTypeRPM ()
 Check whether the gang spindle control source command type is RPM.
CommonGUIModule IsGangSpindleInGroup (idx)
 Check whether a gang spindle at the given index is part of an active group.
CommonGUIModule GetGangSpindleMaxRPM ()
 Get the maximum RPM for the gang spindle control source.
CommonGUIModule GetGangSpindleCount ()
 Get the total number of configured gang spindles for the current instance.
CommonGUIModule IsGangSpindleEngaged (idx)
 Check whether a specific gang spindle index is currently engaged.
CommonGUIModule UpdateGangSpindles ()
 Update all gang spindle command registers, feedback aggregation, and control signals.
CommonGUIModule StepIntoSubPrograms ()
 Set single-block execution to step into sub-programs.
CommonGUIModule StepOverSubPrograms ()
 Set single-block execution to step over (not into) sub-programs.
CommonGUIModule IsStepIntoSubPrograms ()
 Check whether step-into sub-programs mode is currently active.
CommonGUIModule StepIntoSubProgramsToggle ()
 Toggle between step-into and step-over sub-program execution modes.
CommonGUIModule CutterCompensationType_A (on_off)
 Enable or disable cutter compensation type A.
CommonGUIModule IsCutterCompensationType_A ()
 Check whether cutter compensation type A is currently enabled.
CommonGUIModule CutterCompensationToggleType_A ()
 Toggle cutter compensation type A on or off.
CommonGUIModule CutterCompensationType_B (on_off)
 Enable or disable cutter compensation type B.
CommonGUIModule IsCutterCompensationType_B ()
 Check whether cutter compensation type B is currently enabled.
CommonGUIModule CutterCompensationToggleType_B ()
 Toggle cutter compensation type B on or off.
CommonGUIModule CutterCompensationType_C (on_off)
 Enable or disable cutter compensation type C (tool nose radius compensation vector correction).
CommonGUIModule IsCutterCompensationType_C ()
 Check whether cutter compensation type C is currently enabled.
CommonGUIModule CutterCompensationToggleType_C ()
 Toggle cutter compensation type C on or off.
CommonGUIModule CompileScriptsBtn ()
 Recompile all M-code scripts and reload the screen configuration.
CommonGUIModule InitializeSpindleRanges ()
 Initialize the spindle gear range for all Mach4 instances from the PLC or profile.
CommonGUIModule InitializeTools ()
 Initialize tool and pocket tracking for all Mach4 instances on startup.
CommonGUIModule UpdateCurrentToolAndPocketGlobals ()
 Update the global current tool number and tool pocket number arrays for all instances.
CommonGUIModule OpenToolPocketsDialogBtn ()
 Open the tool pockets dialog by setting the trigger register.
CommonGUIModule NextToolBtn (use_confirmation)
 Change to the next tool number in the tool changer.
CommonGUIModule PreviousToolBtn (use_confirmation)
 Change to the previous tool number in the tool changer.
CommonGUIModule ParkToolBtn (use_confirmation)
 Park the current tool by changing to tool number 0.
CommonGUIModule PreviousPocketBtn (use_confirmation)
 Change to the previous tool pocket in the tool changer carousel.
CommonGUIModule NextPocketBtn (use_confirmation)
 Change to the next tool pocket in the tool changer carousel.
CommonGUIModule IsCurrentTool (toolIndex, inst)
 Check whether the specified tool index matches the currently loaded tool.
CommonGUIModule ToolChangeToTool (toolIndex, inst)
 Execute a tool change to a specific tool number.
CommonGUIModule JogToolMagazineToPreviousPocket (spindle)
 Jog the tool magazine to the previous pocket position.
CommonGUIModule JogToolMagazineToNextPocket (spindle)
 Jog the tool magazine to the next pocket position.
CommonGUIModule JogToolMagazineToNearestPocket (pocket_increment, spindle, inst)
 Move the tool magazine to the nearest pocket, optionally advancing by one pocket increment.
CommonGUIModule EnableHomeDialog ()
 Display the enable and home startup dialog if the machine has not yet been homed.
CommonGUIModule EnableHomeDialog_CycleStart ()
 Execute the enable and home sequence when the operator confirms via cycle start.
CommonGUIModule EnableHomeDialog_Cancel ()
 Cancel the enable and home startup dialog without performing any action.
CommonGUIModule CheckEnableAndHomeFlag ()
 Check whether the enable and home startup dialog is currently active.
CommonGUIModule EnableAndHome ()
 Enable the machine and home all dereferenced axes in a single operation.
CommonGUIModule EdgeFinderXPlusBtn ()
 Apply a negative X-axis fixture offset using the configured edge finder diameter.
CommonGUIModule EdgeFinderXMinusBtn ()
 Apply a positive X-axis fixture offset using the configured edge finder diameter.
CommonGUIModule EdgeFinderYPlusBtn ()
 Apply a positive Y-axis fixture offset using the configured edge finder diameter.
CommonGUIModule EdgeFinderYMinusBtn ()
 Apply a negative Y-axis fixture offset using the configured edge finder diameter.
CommonGUIModule LoadConversational ()
 Open the conversational (mill wizard) dialog by setting the trigger register.
CommonGUIModule RunToolSetterHeightWizard (settername)
 Run the tool setter height wizard to calculate and store the tool setter height.
CommonGUIModule RunToolSetterZPositionWizard (settername, auto_setter, manual_setter_height)
 Run the tool setter Z position wizard to calculate and store the tool setter Z machine position.
CommonGUIModule CalibrateToolSetters ()
 Open the Calibrate Tool Setters dialog for managing tool setter configurations.
UI format_number (number)
 Format a number to a fixed 4-decimal-place string.
UI GetSelectedToolSetterIndex ()
 Get the zero-based index of the currently selected item in the setter_list listbox.
UI GetSelectedToolSetter ()
 Get the name of the currently selected tool setter from the setter_list listbox.
UI OnAddNewClick ()
 Add a new tool setter entry with default values to the list and in-memory table.
UI OnRemoveClick ()
 Remove the currently selected tool setter from the list and the in-memory table.
UI OnRenameToolSetter ()
 Rename the currently selected tool setter via a modal rename dialog.
UI OnToolSetterListSelected ()
 Populate all detail fields in the tool setter configuration panel for the selected setter.
UI OnToolSetterTypeChanged ()
 Update the tool setter type and enable or disable related controls when the radio button changes.
UI OnProbeInputChanged ()
 Update the probe input selection for the selected tool setter when the dropdown changes.
UI OnToolSetterHeightChanged ()
 Validate and store the tool setter height value from the height_dro text field.
UI OnLaunchHeightWizardClick ()
 Launch the tool setter height wizard and apply the result to the selected setter.
UI OnZPositionChanged ()
 Validate and store the Z position value from the zpos_dro text field for the selected tool setter.
UI OnCaptureZPositionClick ()
 Capture the current Z machine position as the tool setter Z position.
UI OnLaunchZPosWizardClick ()
 Launch the tool setter Z position wizard and apply the result to the selected setter.
UI OnSoftlimitsChanged ()
 Update the disable softlimits flag for the selected tool setter when the toggle changes.
UI OnFixturesOffsetsChanged ()
 Update the fixture offsets toggle state for the selected tool setter and enable or disable the mode dropdown.
UI OnFixtureOffsetModeChanged ()
 Update the fixture offset mode for the selected tool setter when the dropdown selection changes.
UI GetGoToPositionSelection ()
 Find the list index of the start GoTo position stored for the selected tool setter.
UI GetEndGoToPositionSelection ()
 Find the list index of the end GoTo position stored for the selected tool setter.
UI OnGoToPositionChanged ()
 Update the start GoTo position for the selected tool setter when the dropdown selection changes.
UI OnEndGoToPositionChanged ()
 Update the end GoTo position for the selected tool setter when the dropdown selection changes.
UI OnCancel ()
 Stop the calibrate tool setters dialog timer and destroy the dialog window.
UI Save ()
 Persist all tool setter configurations to the Mach4 profile.
UI OnSave ()
 Save all tool setter data and close the calibrate tool setters dialog.
UI Initialize ()
 Populate the tool setter list and pre-select the currently configured setter.
CommonGUIModule ToolSetterSelection (FilterToolSetterTypes, OffsetTypes)
 Display the tool setter selection dialog for choosing the active manual or auto setter.
UI GetCurrentToolSetterName ()
 Get the name of the currently active tool setter from the appropriate OEM register.
UI OnClose ()
 Stop the tool setter selection dialog timer and destroy the dialog window.
CommonGUIModule CalculateManualToolSetterPosition (IgnoreConfirmationDialogs)
 Manually measure and store the tool setter Z position from the current machine position.
CommonGUIModule CalculateAutoToolSetterPosition (IgnoreConfirmationDialogs)
 Measure and store the auto tool setter position by executing M901 via MDI.
CommonGUIModule CalculateToolLengthManualBtn (IgnoreConfirmationDialogs)
 Manually measure and set the tool length offset using the manual tool setter.
CommonGUIModule CalculateZWorkOffsetManualBtn (IgnoreConfirmationDialogs)
 Manually measure the Z work (fixture) offset using the manual tool setter position.
CommonGUIModule CalculateZWorkOffsetAutoBtn (IgnoreConfirmationDialogs)
 Automatically measure the Z fixture offset using the auto tool setter.
CommonGUIModule CalculateToolLengthAutoBtn (IgnoreConfirmationDialogs)
 Automatically measure tool lengths for one or more tools using the auto tool setter.
CommonGUIModule OpenToolTable ()
 Open the tool table dialog if the screen is in edit mode.
CommonGUIModule LaserPointerInitialize ()
 Initialize the laser pointer by adding its output signal to the ignore lists.
CommonGUIModule IsLaserPointerOn ()
 Check whether the laser pointer output signal is currently active.
CommonGUIModule LaserPointerOn ()
 Turn the laser pointer output signal on and apply the stored laser pointer offsets.
CommonGUIModule LaserPointerOff ()
 Turn the laser pointer output signal off and reset the laser pointer offsets.
CommonGUIModule LaserPointerToggle ()
 Toggle the laser pointer between on and off states.
CommonGUIModule SetLaserPointerOffset ()
 Apply the stored laser pointer X and Y offsets to the corresponding pound variables.
CommonGUIModule ResetLaserPointerOffset ()
 Clear the laser pointer X and Y offset pound variables back to zero.
CommonGUIModule GetLaserPointerOffsetVars ()
 Get the Mach4 pound variable indices used for laser pointer X and Y offsets.
CommonGUIModule TeachLaserPointerOffsets ()
 Capture the current X and Y axis positions as the laser pointer offset values.
CommonGUIModule LaserPointerCycleStartCheck ()
 Check if the laser pointer is active before cycle start and prompt the operator to confirm.
CommonGUIModule GetCurrentGearRange ()
 Get the current spindle gear range from the PLC, register, or profile.
CommonGUIModule SendToolTable ()
 Serialize and send the tool name table to the MachMotion plugin via register command.
CommonGUIModule GetCurrentTool ()
 Get the current tool number from the PLC, file, or Mach4 tool changer memory.
CommonGUIModule CommonScreenUnloadScript (MachEnable)
 Wrapper entry point for the screen unload script; delegates to the protected implementation.
CommonGUIModule CommonPLCScript ()
 Entry point for the Mach4 PLC script; executes the main PLC loop with error protection.
CommonGUIModule StartScreenTimers ()
 Start all screen-managed blink timers for normal and slow blink rates.
CommonGUIModule CommonTimerScript (timer)
 Entry point for Mach4 timer events; dispatches to machine-type and screen timer handlers.
CommonGUIModule CommonSignalScript (sig, sig_state)
 Entry point for Mach4 signal change events; converts signal state and dispatches to handler.
CommonGUIModule CommonMessageScript (inst, msg_type, param1, param2)
 Entry point for Mach4 message events; validates and dispatches supported message types.
CommonGUIModule RegisterForMachMessage (inst, msg_type, callback_func, param1, param2)
 Register a callback function to be called when a specific Mach4 message event occurs.
CommonGUIModule HandleMachMessages (inst, msg_type, param1, param2)
 Dispatch incoming Mach4 messages to all registered callback functions.
CommonGUIModule AddToRunScriptQueue (func)
 Add a function or Lua code string to the RUN_SCRIPT_QUEUE for deferred execution.
CommonGUIModule ExecuteRunScriptQueue ()
 Execute and remove the first queued item from RUN_SCRIPT_QUEUE.
CommonGUIModule ClearRunScriptQueue ()
 Clear all pending items from the RUN_SCRIPT_QUEUE.
CommonGUIModule CommonSelectedInstanceChanged ()
 Handle a change in the selected Mach4 instance and notify all registered listeners.
CommonGUIModule DemoModeWarning ()
 Display a warning dialog if the software is running in demo mode (unlicensed).
CommonGUIModule OpenMachMotionPluginConfig ()
 Open the MachMotion plugin configuration dialog for the selected Mach4 instance.
CommonGUIModule OpenGMSPluginConfig ()
 Open the GMS plugin configuration dialog.
CommonGUIModule OpenMachMotionModbusPluginConfig ()
 Open the MachMotion Modbus plugin configuration dialog.
CommonGUIModule OpenMachineCalibrationPluginConfig ()
 Open the MachineCalibration plugin configuration dialog.
CommonGUIModule OpenMachineCalibrationPluginManualConfig ()
 Open the MachineCalibration plugin manual calibration configuration dialog.
CommonGUIModule OpenMachineCalibrationPluginAutomaticConfig ()
 Open the MachineCalibration plugin automatic calibration configuration dialog.
CommonGUIModule OpenMachineCalibrationPluginScrewMappingConfig ()
 Open the MachineCalibration plugin screw mapping configuration dialog.
CommonGUIModule OpenSetupWizard ()
 Open the MachMotion setup wizard via the plugin command interface.
CommonGUIModule OpenGCodeNestingBtn ()
 Log the operator action and open the G-code nesting interface.
CommonGUIModule OpenGCodeNesting ()
 Open the G-code nesting interface module.
CommonGUIModule OpenMotionControllerConfig ()
 Open the motion controller configuration dialog for the selected Mach4 instance.
CommonGUIModule ResetCurrentPocket ()
 Reset the current tool pocket number to a user-specified value.
CommonGUIModule AutoUpdaterManualCheck ()
 Trigger a manual check of the auto-updater via the MachMotion plugin register.
CommonGUIModule IsLimitSwitchActive (inst)
 Check whether any limit switch is currently active.
CommonGUIModule JogOffHomeSwitchDialog (homing_axis, inst)
 Display a modal dialog allowing the operator to jog an axis off its home switch.
UI StartJog (axis, direction)
 Start a velocity jog on the specified axis at the current slider rate and direction.
UI StopJog ()
 Stop all currently active jog motions on all axes.
UI CloseDialog (CloseWindow)
 Stop all active jogs, destroy the jog timer, and mark the jog-off home switch dialog as closed.
CommonGUIModule IsHomeSwitchActive (homing_axis, inst)
 Check whether any home switch (or a specific axis home switch) is currently active.
CommonGUIModule CheckHomeSwitchesForHoming (homing_axis, inst)
 Check if any home switch is active before homing and prompt the operator to jog off if needed.
CommonGUIModule CycleStartInhibitDialog ()
 Display a modal dialog listing all active cycle start inhibit messages.
UI UpdateRows (MessageArray, RowNum)
 Populate the alarms grid with the provided alarm message array.
CommonGUIModule SetToolDiameterDRO (ToolDiameterOffset,...)
 Set the tool diameter (or radius) offset for the current tool and save the tool file.
CommonGUIModule SetToolLengthDRO (ToolLengthOffset,...)
 Set the tool length offset for the current tool and optionally enable it.
CommonGUIModule SetSelectedToolDRO (SelectedTool,...)
 Set the currently selected tool number pound variable.
CommonGUIModule SetCurrentToolDRO (selectedtool,...)
 Set the current tool number, updating pocket assignments and tool length offset as configured.
CommonGUIModule SetFeedrateDRO (FeedRate,...)
 Set the active feedrate via MDI command when the machine is idle and enabled.
CommonGUIModule SetSpindleSpeedDRO (Speed,...)
 Set the spindle speed via MDI command when the machine is idle and enabled.
CommonGUIModule ToolLengthVerifyToggle ()
 Toggle tool length verification mode on or off.
CommonGUIModule ToolLengthVerifyOn ()
 Enable tool length verification mode.
CommonGUIModule ToolLengthVerifyOff ()
 Disable tool length verification mode and reset the verify DRO display.
CommonGUIModule UpdateSpindleControls ()
 Update spindle control button states when spindle direction or delay state changes.
CommonGUIModule IsSubSpindleEnabled (inst)
 Check whether the sub-spindle feature is enabled for the specified instance.
CommonGUIModule SubSpindleForwardToggle (use_confirmation)
 Toggle the sub-spindle between forward and stopped states.
CommonGUIModule SubSpindleReverseToggle (use_confirmation)
 Toggle the sub-spindle between reverse and stopped states.
CommonGUIModule IsSubSpindleOn ()
 Check whether the sub-spindle is currently running in either direction.
CommonGUIModule SubSpindleForward (use_confirmation)
 Run the sub-spindle in the forward direction, optionally prompting for confirmation.
CommonGUIModule SubSpindleReverse (use_confirmation)
 Run the sub-spindle in reverse direction, optionally prompting for confirmation.
CommonGUIModule SubSpindleStop ()
 Stop the sub-spindle by executing the M105 M-code script.
CommonGUIModule SubSpindleUpdate ()
 Update sub-spindle analog output speed for all enabled instances.
CommonGUIModule UpdateToolVerifyDRO ()
 Update the tool length verify DRO display if tool length verification is active.
CommonGUIModule MotionControllerInitialization ()
 Initialize all motion controller objects for each Mach4 instance.
CommonGUIModule SpindleSpeedCheck ()
 Configure and apply the spindle speed check enable state and tolerance percentage.
CommonGUIModule OpenGMSDiagnosticsDialog ()
 Open the GMS diagnostics dialog via the GMS plugin command interface.
CommonGUIModule ScanWarningsAlarms ()
 Update the alarm dialog button icon based on current GMS alarm and warning state.
CommonGUIModule DisplayModelNumber ()
 Display the machine model number in the screen warning message area.
CommonGUIModule UpdateScreenLayout ()
 Enforce single rotary axis constraint for V1 screens by disabling conflicting axes.
CommonGUIModule LoadAllModules ()
 Load and initialize all required Lua modules for the CommonGUIModule screen environment.
 loader_handler (err)
 Error handler for module loading that appends a stack traceback to the error message.
CommonGUIModule InitializeAllModules ()
 Initialize all hardware interface module objects for all Mach4 instances.
CommonGUIModule loadrequire (modulename, PrintError)
 Attempt to require a Lua module by name with optional error dialog on failure.
CommonGUIModule MonitorFixtureOffsets ()
 Save fixture offsets and optionally regenerate the tool path when offsets are modified.
CommonGUIModule UpdateLubeTimer ()
 Update the lube system timer and trigger lube cycles based on configured mode and action.
CommonGUIModule RunLubeCycle ()
 Execute the lube system M-code script if the lube system is enabled and not already cycling.
CommonGUIModule RunLubeCycleOnStartup ()
 Run the lube cycle once on startup if configured and not yet run.
CommonGUIModule UpdateScreenWarningMessage ()
 Placeholder function stub for updating the screen warning message area (currently disabled).
CommonGUIModule UpdateLastGCodeFileName ()
 Monitor the loaded G-code filename and trigger header processing when the file changes.
CommonGUIModule ReadGcodeHeaderParameters ()
 Read G-code header parameters from the currently loaded G-code file.
CommonGUIModule ZeroDROBtn (Axis)
 Zero a single axis DRO by computing an offset from the current machine position.
CommonGUIModule ZeroAllDROBtn ()
 Zero all axis DROs by computing offsets from current machine positions.
CommonGUIModule AuxiliaryBtn (AuxButton, MouseUp, MouseDn)
 Handle auxiliary button press and release events, toggling or pulsing configured output signals.
CommonGUIModule IsToolSizeEntryDiameterMode (mode)
 Check if the tool size entry mode is configured for diameter mode.
CommonGUIModule SetToolSizeEntryMode (mode)
 Configure the tool size entry mode for the Tool Offsets dialog and screen display.
CommonGUIModule GetSpindleBrakeOutputSignalId ()
 Get the signal ID for the spindle brake output, or -1 if not enabled.
CommonGUIModule CreateLimitSwitchAlarm (msg)
 Create a GMS alarm message for a limit switch activation event.
CommonGUIModule CommonUpdateSignalLibraryArray ()
 Rebuild the signal library arrays and update auxiliary button configuration.
CommonGUIModule UpdateSignalLibraryArray ()
 Build the signal library arrays for limit switches, home signals, and special signals for all instances.
CommonGUIModule CommonLowPriorityLoop ()
 Execute the common low-priority PLC loop tasks at a reduced scan rate.
CommonGUIModule CycleStartDialog (Message, Title, inst)
 Display a modal Cycle Start confirmation dialog and wait for operator confirmation.
CommonGUIModule CycleStartDialog_NotModal (Message, Title, CmdOnStart, CmdOnCancel)
 Display a non-modal Cycle Start confirmation dialog with optional on-start and on-cancel callbacks.
UI clean_up ()
 Release the cycle start hold and close the Cycle Start dialog.
CommonGUIModule GetAndSortCutRecovery (Sections, FileFilter, ZeroFilter, RotationFilter)
 Read and sort cut recovery position records from the Mach4 profile.
CommonGUIModule GoToLine (LineNumber, IsMachineCoords, X, Y, Z, A, B, C, Tag)
 Move the machine to a specified G-code line number using a dry run.
CommonGUIModule GoToLastLostCut ()
 Move to the position of the most recent lost cut or cycle stop event.
CommonGUIModule GetCheckPoint (name)
 Return the module DbgCheckPoint object, creating a new one if it does not exist.
CommonGUIModule MonitorMachFileRunTime ()
 Monitor the G-code file run time and update history when a part is completed.
CommonGUIModule UpdateMachFileRunTimeHistory (run_time)
 Shift the G-code file run time history registers and store a new run time entry.
CommonGUIModule UpdateEnabledAxesCache ()
 Refresh the cached enabled state flags for all instances and axes.
CommonGUIModule UpdateHomedAxesCache ()
 Refresh the cached homed state flags for all instances and axes.
CommonGUIModule UpdateRotaryAxesCache ()
 Refresh the cached rotary axis flags for all instances and axes.
CommonGUIModule UpdateAxesArrayCache ()
 Refresh the cached axis letter and short name arrays for all instances and axes.
CommonGUIModule GetAxisLetterName (AxisID, inst)
 Get the letter label for the specified axis, accounting for instance count and rotary configuration.
CommonGUIModule GetAxisShortName (AxisID, inst)
 Get the short display name for the specified axis, accounting for instance count and rotary configuration.
CommonGUIModule CommonScreenLoadScript ()
 Protected entry point for the Mach4 screen load script.
 myfunc_wrapper ()
 Example wrapper function showing how to profile a specific function call-tree.
CommonGUIModule _LuaProfiling Configure ()
 Perform one-time setup for the Lua profiling facility.
CommonGUIModule _LuaProfiling CreateCommands ()
 Register user commands for starting, stopping, and timed screen profiling.
CommonGUIModule _LuaProfiling UpdateTimedProfiling ()
 Check whether a timed profiling session has expired and stop the profiler if so.
CommonGUIModule _LuaProfiling IsProfiling ()
 Check whether the Lua profiler is currently active.
CommonGUIModule _LuaProfiling StartProfiler (context)
 Start the Lua profiler with an optional context label.
CommonGUIModule _LuaProfiling StartProfilerTimed (context, seconds)
 Start the Lua profiler for a fixed duration in seconds.
CommonGUIModule _LuaProfiling PauseProfiler (logpath)
 Temporarily pause an active Lua profiling session without losing collected data.
CommonGUIModule _LuaProfiling ResumeProfiler (logpath)
 Resume a previously paused Lua profiling session.
CommonGUIModule _LuaProfiling StopProfiler (logpath)
 Stop the Lua profiler and generate a profiling report file.
CommonGUIModule OnFileQueueTimer ()
 Timer callback that processes the Lua file queue with function tracing.
CommonGUIModule ProcessFileQueue ()
 Process one command from the Lua file queue, handling errors and stop status.
CommonGUIModule ScreenIsLoadedScript ()
 Entry point called when the Mach4 screen has finished loading all controls.
CommonGUIModule CommonStartUpScript ()
 Protected wrapper for the common CNC startup initialization sequence.
CommonGUIModule AutoLoadLastGCode (inst)
 Protected wrapper that auto-loads the last G-code file for all instances on startup.
CommonGUIModule LoadGCode (GcodeFileName)
 Load a G-code file into the current Mach4 instance if it is not already loaded.
CommonGUIModule OverrideLimits ()
 Validate and swap spindle and feedrate override min/max OEM parameters if inverted.
CommonGUIModule ResetAllOverrideAxes (inst)
 Reset all override (OB1-OB6) axes to zero position and restore their override mappings.
CommonGUIModule StartJogging (Axis, Direction, inst)
 Start jogging the specified axis in the given direction using external jog parameters.
CommonGUIModule StopJogging (Axis)
 Stop jogging on the specified axis or all axes.
CommonGUIModule IsAxisJogging (Axis)
 Check whether the specified axis is currently jogging.
CommonGUIModule SetJogModeIncremental ()
 Set the jog mode to incremental stepping.
CommonGUIModule IsJogModeIncremental ()
 Check whether the current jog mode is incremental.
CommonGUIModule SetJogModeContinuous ()
 Set the jog mode to continuous velocity jogging.
CommonGUIModule IsJogModeContinuous ()
 Check whether the current jog mode is continuous.
CommonGUIModule ConfigureTLMMode ()
 Configure the Tool Length Management (TLM) mode so that the T word on the M6 line is used as the selected tool.
CommonGUIModule StackLight NewStackLight ()
 Create and initialize a new StackLight object for the given Mach4 instance.
CommonGUIModule StackLight UpdateStackLight ()
 Update all configured stack light outputs based on current machine state and alarm conditions.
CommonGUIModule StackLight GetRedStackLightState ()
 Get the desired state for the red stack light based on alarm and machine enable conditions.
CommonGUIModule StackLight GetYellowStackLightState ()
 Get the desired state for the yellow stack light based on warning conditions and machine state.
CommonGUIModule StackLight GetGreenStackLightState ()
 Get the desired state for the green stack light based on machine state and alarm conditions.
CommonGUIModule StackLight GetWhiteStackLightState ()
 Get the desired state for the white stack light based on machine state transitions.
CommonGUIModule InstallerUpdateModule ()
 Run the installer update module script if the MachMotion build number has changed.
CommonGUIModule UpdateDoorInterlock ()
 Monitor and update the door interlock output based on machine state.
CommonGUIModule IsDoorInterlockActive ()
 Check whether the door interlock is currently active.
CommonGUIModule ToggleCapturingToolPathMousePositions ()
 Toggle tool path mouse position capture on or off.
CommonGUIModule StartCapturingToolPathMousePositions ()
 Start capturing tool path mouse positions on all tool path panels.
CommonGUIModule StopCapturingToolPathMousePositions ()
 Stop capturing tool path mouse positions on all tool path panels.
CommonGUIModule IsCapturingToolPathMousePositions ()
 Check whether the tool path panel is currently capturing mouse positions.
CommonGUIModule PartCounterDialog ()
 Open the Part Counter dialog for viewing and editing part count parameters.
UI SetPartsCurrentProgram ()
 Write the current program parts value from the numeric control to the Mach4 parameter.
UI SetPartsTotal ()
 Write the total parts value from the numeric control to the Mach4 parameter.
UI SetPartsRequired ()
 Write the parts required value from the numeric control to the Mach4 parameter.
UI SetMcodeNumber ()
 Write the M-code number value from the numeric control to the Mach4 parameter.
UI SetMCodeCounter ()
 Write the M-code counter enable/disable selection to the Mach4 parameter.
UI SetParameter (param, value)
 Set a Mach4 parameter to the specified value with logging.
UI UpdatePartCounters ()
 Refresh all Part Counter numeric controls with the current Mach4 parameter values.
UI ClosePartCounterDialog ()
 Stop the Part Counter timer and destroy the Part Counter dialog.
CommonGUIModule GenericGridDialog (GridTable)
 Display a resizable modal grid dialog for viewing and editing tabular data.
UI CloseGenericGridDialog ()
 Close the Generic Grid dialog and release its timer resources.
UI CellChangedGenericGridDialog (row, col)
 Handle a cell value change event in the Generic Grid dialog.
UI UpdateGenericGridDialog ()
 Timer callback to keep the Generic Grid dialog alive and handle shutdown.
CommonGUIModule YesNoDialog (yes_no_table)
 Display a modal Yes/No dialog with bitmap buttons for binary user decisions.
CommonGUIModule IsSchedulerActive (inst)
 Check whether the file scheduler is currently active.
CommonGUIModule LoadNextSheduledFile (inst)
 Load the next file in the schedule after the current G-code file finishes running.
CommonGUIModule Scheduler New ()
 Create and initialize a new Scheduler object, disabling any previously active scheduler.
CommonGUIModule Scheduler CheckName ()
 Check whether the given file name matches the top scheduled file, accounting for GCAdapter naming.
CommonGUIModule Scheduler GetSchedule ()
 Get the in-memory schedule table for a given instance.
CommonGUIModule Scheduler GetLastSchedule ()
 Load the schedule table with file data from the OEM register for a given instance.
CommonGUIModule Scheduler ToggleEnable ()
 Toggle the scheduler active state when the machine is idle.
CommonGUIModule Scheduler Enable ()
 Enable the scheduler and load the top scheduled file into Mach4.
CommonGUIModule Scheduler ClearSchedule (leave_reg)
 Clear all scheduled file entries for a given instance, optionally preserving the register.
CommonGUIModule Scheduler PopSchedule ()
 Decrement the quantity of the current top scheduled file and advance the schedule.
CommonGUIModule Scheduler GetTopFile ()
 Return the file path of the first (top) entry in the schedule for a given instance.
CommonGUIModule Scheduler Edit ()
 Open the Schedule Editor dialog to view and modify the current schedule.
CommonGUIModule Scheduler CreateEditControls ()
 Create and display the Schedule Editor dialog with list control and management buttons.
self UI DestroyGauge ()
 Destroy the Schedule Editor dialog and release its reference.
CommonGUIModule Scheduler SetColumns ()
 Create and insert the column headers for the Schedule Editor list control.
CommonGUIModule Scheduler SetColumnsWidth ()
 Recalculate and apply column widths for the Schedule Editor list control.
CommonGUIModule Scheduler SendFilesToRegister (inst)
 Serialize all scheduled files to an OEM register string for persistence.
CommonGUIModule Scheduler GetSchedFiles ()
 Read all file entries from the Schedule Editor list control into a formatted table.
CommonGUIModule Scheduler SaveSchedule (inst)
 Save a table of scheduled file entries to the in-memory schedule for a given instance.
CommonGUIModule Scheduler InsertFiles ()
 Insert an array of file entries into the Schedule Editor list control.
CommonGUIModule Scheduler GetItemData ()
 Retrieve the file path and quantity data for a specific item in the Schedule Editor list control.
CommonGUIModule Scheduler GetSelectedItem ()
 Get the item data for the currently selected item in the Schedule Editor list control.
CommonGUIModule Scheduler ChangeQty (qty)
 Set the quantity column value of an item in the Schedule Editor list control.
CommonGUIModule Scheduler SwapItems (idx2)
 Swap the display data of two items in the Schedule Editor list control.
CommonGUIModule Scheduler ClearSelection ()
 Clear the selection state of all selected items in the Schedule Editor list control.
CommonGUIModule Scheduler MoveItemUp ()
 Move the currently selected scheduled item up one position in the schedule list.
CommonGUIModule Scheduler MoveItemDown ()
 Move the currently selected scheduled item down one position in the schedule list.
CommonGUIModule Scheduler DeleteItem ()
 Delete the currently selected item from the Schedule Editor list control.
CommonGUIModule Scheduler Clear ()
 Delete all items from the Schedule Editor list control.
CommonGUIModule Scheduler MoveToTop ()
 Move the currently selected scheduled item to the top of the schedule list.
CommonGUIModule Scheduler MoveToBot ()
 Move the currently selected scheduled item to the bottom of the schedule list.
CommonGUIModule Scheduler Load ()
 Open a file browser dialog and return the selected G-code file paths for scheduling.
CommonGUIModule Scheduler OnSize ()
 Handle resize events for the Schedule Editor dialog.
CommonGUIModule Scheduler EditQty ()
 Open a dialog allowing the user to edit the quantity of the selected scheduled item.
CommonGUIModule JobFile New (job_name)
 Create and initialize a new JobFile object with the given configuration table and job name.
CommonGUIModule JobFile Open ()
 Open a file browser dialog to select and load a job file, then apply it to Mach4.
CommonGUIModule JobFile ReLoad ()
 Reload the last loaded job file from the path stored in the MachMotionOEMParameters register.
CommonGUIModule JobFile OptSaveChanges ()
 Optionally prompt the user to save changes to the job file if any edits are detected.
CommonGUIModule JobFile Close ()
 Close the currently loaded job file, prompting to save if there are unsaved edits.
CommonGUIModule JobFile SaveAs ()
 Save the job file to a new location chosen by the user, with password protection.
CommonGUIModule JobFile HasEdits ()
 Check whether the current Mach4 state differs from the values stored in the job file.
CommonGUIModule JobFile UpdateNotesOnlyToJobFile ()
 Write only the Notes section of the job file to disk, leaving all other fields unchanged.
CommonGUIModule JobFile ReadDataFromMach ()
 Read current Mach4 state (pound variables, registers, notes) and write to the job file on disk.
CommonGUIModule JobFile GetFileVersion ()
 Read the job file version number from the CSV file header.
CommonGUIModule JobFile WriteDataToMach ()
 Dispatch job file data writing to the appropriate version handler.
CommonGUIModule JobFile ClearValues ()
 Reset all pound variables and registers tracked by the job file to their stored values.
CommonGUIModule JobFile GetFilePath ()
 Get the full file path of the currently loaded job file.
CommonGUIModule JobFile GetFileName ()
 Get the file name (without path) of the currently loaded job file.
CommonGUIModule JobFile HasFileLoaded ()
 Check whether a job file is currently loaded.
CommonGUIModule JobFile CheckPassword ()
 Verify that the operator has the required password level to save the job file.
CommonGUIModule CleanJobFiles ()
 Remove the JobFiles section from the Mach4 profile for the current instance.
CommonGUIModule JobFile GetPoundVarTable ()
 Retrieve the complete pound variable table from the job file's in-memory data.
CommonGUIModule JobFile GetPoundVarValue ()
 Retrieve a pound variable value from the job file's in-memory pound variable table.
CommonGUIModule JobFile GetRegisterValue ()
 Retrieve a register value from the job file's in-memory register table.
CommonGUIModule JobFile GetNotesCount ()
 Get the number of notes stored in the job file's in-memory notes table.
CommonGUIModule JobFile GetAllNotes ()
 Retrieve all notes from the job file's in-memory notes table.
CommonGUIModule JobFile GetNote ()
 Retrieve a specific note line from the job file's in-memory notes table.
CommonGUIModule JobFile GetTableRecordCount ()
 Count the number of key-value pairs in a table.
CommonGUIModule JobFile NotesDialog ()
 Open the Job Notes dialog for viewing and editing job file notes.
UI LoadNotes ()
 Build the full notes string from the job file's in-memory notes table.
UI CancelButtonClick ()
 Handle the Cancel button click in the Job Notes dialog.
UI OkButtonClick ()
 Handle the OK button click in the Job Notes dialog.
UI StoreNotes ()
 Store the current notes from the dialog editor into the job file's in-memory notes table.
UI SaveNotesToFile ()
 Save the current notes from the dialog to the job file on disk.
UI ConstructNotesString ()
 Construct the full notes string from all lines in the multi-line notes text control.
CommonGUIModule DefaultJob ()
 Create and initialize the default job file object for the screen.
CommonGUIModule SearchGCode Initialize (inst)
 Initialize the GCode Search object, read the loaded file, and open the search dialog.
CommonGUIModule SearchGCode CreateSearchDialog ()
 Create and display the GCode Search dialog with search bar, grid, and navigation buttons.
CommonGUIModule SearchGCode ReadLoadedFile (inst)
 Read the currently loaded G-code file line by line into an internal table.
CommonGUIModule SearchGCode GoToSelectedLine ()
 Navigate to the G-code line selected in the GCode Search grid.
CommonGUIModule SearchGCode InitializeGrid ()
 Set default settings and column labels for the GCode Search grid.
CommonGUIModule SearchGCode EmptyGrid ()
 Clear all values from the GCode Search grid and delete all rows except the first.
CommonGUIModule SearchGCode Search ()
 Search the loaded G-code file for lines matching a keyword.
CommonGUIModule SearchGCode UpdateGrid ()
 Insert search matches into the GCode Search grid.
CommonGUIModule GetRemainingDwellTime (inst)
 Get the remaining dwell time for the current dwell operation.
CommonGUIModule GetTargetDwellTime (inst)
 Get the target dwell time for the current dwell operation.
CommonGUIModule TeachWorkShiftOffsets (AxisID)
 Teach the work shift offset for a single axis from the current machine position.
CommonGUIModule StoreLastValueWorkShiftOffsets ()
 Save work shift offsets for all instances where the mode is "Restore Last Value".
CommonGUIModule StoreWorkShiftOffsets (inst)
 Save the work shift offsets for all coordinate axes to OEM parameter storage.
CommonGUIModule StoreWorkShiftOffsetsAxis (AxisID, inst)
 Save the work shift offset for a single axis to the OEM parameter store.
CommonGUIModule RestoreWorkShiftOffsets ()
 Restore saved work shift offsets to all axes for all instances based on OEM parameter mode.
CommonGUIModule StoreLastValueHeadShiftOffsets ()
 Save head shift offsets for all instances where the mode is "Restore Last Value".
CommonGUIModule StoreHeadShiftOffsets (inst)
 Save the head shift offsets for all coordinate axes to OEM parameter storage.
CommonGUIModule StoreHeadShiftOffsetsAxis (AxisID, inst)
 Save the head shift offset for a single axis to the OEM parameter store.
CommonGUIModule RestoreHeadShiftOffsets ()
 Restore saved head shift offsets to all axes for all instances based on OEM parameter mode.
CommonGUIModule StoreMachOverrides ()
 Save the current Mach4 speed overrides to the profile for later restoration.
CommonGUIModule ReStoreMachOverrides ()
 Restore previously saved Mach4 speed overrides from the profile.
CommonGUIModule EmergencyStopNotification ()
 Show or close a GMS notification for an active Emergency Stop signal.
CommonGUIModule MDIDialog ()
 Open the MDI (Manual Data Input) command dialog.
UI ConstructMDIString ()
 Build the complete MDI command string from all lines in the multi-line text control.
UI UpdateHistoryBtns ()
 Update the enabled state of the MDI history navigation buttons.
UI SaveToHistory (gcode)
 Save the current MDI command text to the MDI history file.
CommonGUIModule GetMDIHistoryFilename ()
 Get the full file path for the MDI history file.
CommonGUIModule ClearToolChangeState ()
 Clear the tool change state for the currently selected spindle.
CommonGUIModule ManualToolChangeDialog (tool_number, auto_tc_override, inst)
 Display the manual tool change dialog prompting the operator to install the requested tool.
CommonGUIModule ModifyZOffsetsInToolChangeDialog (inst)
 Display a dialog allowing the operator to choose a method for modifying Z head shift offsets during a tool change.
CommonGUIModule ModifyZOffsetsInToolChangeFinalDialog (modify_type, inst)
 Display the final safety-check dialog after modifying Z offsets during a tool change.
CommonGUIModule InitializeToolPathZoomLimits ()
 Initialize the tool path zoom limits from OEM parameters.
CommonGUIModule InitializeEnabledAxes (GCodeParameterNumber)
 Write the enabled axis configuration to a G-code parameter bit field.
CommonGUIModule PowerOffBtn ()
 Button handler that delegates to CommonGUIModule.PowerOffControl().
CommonGUIModule UPSPowerOffControl ()
 Initiate a delayed power-off sequence triggered by UPS loss of power.
CommonGUIModule PowerOffControl (skip_confirmation)
 Prompt the user to confirm a power-off request and then shut down the control.
CommonGUIModule PowerOff ()
 Save critical data and shut down the Windows operating system.
CommonGUIModule CloseMach (showwarningmessage)
 Close the Mach4 CNC software, optionally prompting the user for confirmation.
CommonGUIModule RunLuaScriptFromDialog ()
 Open the Run Lua Script dialog for interactive Lua code execution.
UI DebugOutputAppend (msg)
 Append a timestamped message to the debug output text control.
UI print (...)
 Redirect Lua print() calls from executed scripts to the debug output window.
UI SetErrorStyle (is_error)
 Set the debug output background color to indicate error or normal state.
UI GetRawLuaString ()
 Return the raw, unmodified Lua text as typed by the user in the editor.
UI ConstructLuaString ()
 Build the full Lua execution string wrapping the user's script.
UI SaveToHistory ()
 Save the current editor content to the Lua script history file.
UI RunLuaCode ()
 Execute the Lua code currently in the Run Lua Script dialog editor.
CommonGUIModule AppendRunLuaDebugMessage (...)
 Append a message to the Run Lua Script dialog's Debug Output window.
CommonGUIModule DebugPrint (...)
 Convenience alias for AppendRunLuaDebugMessage.
CommonGUIModule RunLuaPrint (...)
 Convenience alias for AppendRunLuaDebugMessage.
CommonGUIModule MachMenuDialog ()
 Open the Mach menu configuration dialog.
UI CloseMachMenuDialog ()
 Close the Mach Menu configuration dialog and save the hide-on-startup preference.
CommonGUIModule HideMachMenu ()
 Hide the Mach4 menu bar and persist the setting to the profile.
CommonGUIModule ShowMachMenu ()
 Show the Mach4 menu bar and persist the setting to the profile.
CommonGUIModule InitializeMachMenu ()
 Initialize the Mach4 menu bar visibility based on the saved profile setting.
CommonGUIModule ToggleMachMenu ()
 Toggle the Mach4 menu bar between hidden and visible.
CommonGUIModule EndOfProgram (inst)
 Handle the end-of-program event (M30 macro entry point).
CommonGUIModule UpdateEndOfProgramTimeOn ()
 Check and reset the end-of-program output signal for all instances when its timer expires.
CommonGUIModule ResetEndOfProgramOutput (inst)
 Reset the end-of-program output signal and clear the EndOfProgram register.
CommonGUIModule IsGCodeFileRepeatEnabled ()
 Check whether the G-code file repeat feature is enabled in OEM parameters.
CommonGUIModule IsGCodeFileRepeatOn ()
 Check whether the G-code file repeat mode is currently active.
CommonGUIModule GCodeFileRepeatOn ()
 Turn on the G-code file repeat mode.
CommonGUIModule GCodeFileRepeatOff ()
 Turn off the G-code file repeat mode.
CommonGUIModule GCodeFileRepeatToggle ()
 Toggle the G-code file repeat mode on or off.
CommonGUIModule GCodeFileRepeatCycleStart ()
 Execute a G-code file repeat cycle start sequence.
CommonGUIModule SupportBtn ()
 Open the MachMotion support web page in the default browser.
CommonGUIModule OnlineManualsBtn ()
 Open the MachMotion online manuals web page in the default browser.
CommonGUIModule RemoteSupportBtn ()
 Open the MachMotion remote support tool.
CommonGUIModule ShowMachineStats ()
 Show machine statistics (currently commented out/disabled).
CommonGUIModule CreatePreCannedCommands ()
 Register all pre-canned machine commands, feedback options, and button configurations.
CommonGUIModule AddToolPathColorsToToolTable ()
 Add a TpColor user field to the tool table if not already present.
CommonGUIModule AddSpindleRotationToToolTable ()
 Add a SpindleRotation user field to the tool table if not already present.
CommonGUIModule AddIgnoreAutoToolSetterToToolTable ()
 Add an IgnoreAutoToolSetter user field to the tool table if not already present.
CommonGUIModule AddToolSetterOffsetToToolTable ()
 Add a ToolSetterOffset user field to the tool table if configured.
CommonGUIModule AddToolChangerOverrideToToolTable ()
 Add a ToolChangerOverride user field to the tool table if using auto tool changer.
CommonGUIModule AddToolSizeToToolTable ()
 Add a ToolSize user field to the tool table and migrate legacy oversized tool data.
CommonGUIModule ApplyToolpathSettings ()
 Apply saved toolpath display settings to all active tool path panels.
CommonGUIModule StartCannedReciprocatingAxis (axis_id, position_a, position_b, dwell, feedrate)
 Start a canned reciprocating axis cycle between two positions.
CommonGUIModule StopCannedReciprocatingAxis (axis_id, stop_type)
 Stop a canned reciprocating axis cycle.
CommonGUIModule IsCannedReciprocatingAxisRunning (axis_id)
 Check whether a canned reciprocating axis cycle is currently running.
CommonGUIModule PositionDisplayUnLocked ()
 Delegate to unlock the position display.
CommonGUIModule PositionDisplayLocked ()
 Delegate to lock the position display.
CommonGUIModule PositionDisplayDROMode ()
 Delegate to set the position display to DRO mode.
CommonGUIModule OnScreenJogButtonsOn ()
 Delegate to show the on-screen jog buttons.
CommonGUIModule OnScreenJogButtonsOff ()
 Delegate to hide the on-screen jog buttons.
CommonGUIModule ModifyAxisDROPosition (AxisID)
 Delegate to modify the DRO position for the specified axis.
CommonGUIModule ScreenConfigurationDialog ()
 Delegate to open the screen configuration dialog.
CommonGUIModule GetPositionDisplayUnlocked ()
 Delegate to get whether the position display is unlocked.
CommonGUIModule RegenerateToolPathDialog ()
 Delegate to regenerate the tool path dialog via the wrapper module.

Function Documentation

◆ ActivateFixtureOffset()

CommonGUIModule ActivateFixtureOffset ( fixture )

Activate a fixture offset by executing the corresponding G-code command via MDI.

Converts the fixture index to a G-code string. For fixture indices 1-6, generates a standard G54-G59 command (fixture + 53). For indices >= 7, generates an extended G54.1 P command (fixture - 6). Executes the command via w.MDICommand() and regenerates the tool path via w.RegenerateToolPathDialog().

Parameters
fixture(number) The fixture offset index to activate (1-6 for G54-G59, 7+ for G54.1 P commands)
Note
Documentation generated by AI on 2026-03-04

◆ AddIgnoreAutoToolSetterToToolTable()

CommonGUIModule AddIgnoreAutoToolSetterToToolTable ( )

Add an IgnoreAutoToolSetter user field to the tool table if not already present.

Checks if the 'IgnoreAutoToolSetter' user field exists in the tool table. If not, creates the field with choices: No=0, Yes=1. Has no effect if the tool table is not initialized.

Returns
(nil) No meaningful return value on success
(boolean) Success flag - true if operation completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ AddSpindleRotationToToolTable()

CommonGUIModule AddSpindleRotationToToolTable ( )

Add a SpindleRotation user field to the tool table if not already present.

Checks if the 'SpindleRotation' user field exists in the tool table. If not, creates the field with choices: Any=0, FWD Rotation=1, REV Rotation=2, No Rotation=3. Has no effect if the tool table is not initialized.

Returns
(nil) No meaningful return value on success
(boolean) Success flag - true if operation completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ AddToolChangerOverrideToToolTable()

CommonGUIModule AddToolChangerOverrideToToolTable ( )

Add a ToolChangerOverride user field to the tool table if using auto tool changer.

Checks the OEM parameter 'ToolChangerMethod'. If set to "Auto", and the tool table is initialized, adds a 'ToolChangerOverride' user field with choices: None=0, Manual=1. Has no effect if ToolChangerMethod is not "Auto" or the tool table is not initialized.

Returns
(nil) No meaningful return value on success
(boolean) Success flag - true if operation completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ AddToolPathColorsToToolTable()

CommonGUIModule AddToolPathColorsToToolTable ( )

Add a TpColor user field to the tool table if not already present.

Checks if the 'TpColor' user field exists in the tool table. If not, creates the field as a String type with description "ToolPath Color (HTML #RRGGBB)". This field allows per-tool toolpath color customization using HTML hex color codes. Has no effect if the tool table is not initialized.

Returns
(nil) No meaningful return value on success
(boolean) Success flag - true if operation completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ AddToolSetterOffsetToToolTable()

CommonGUIModule AddToolSetterOffsetToToolTable ( )

Add a ToolSetterOffset user field to the tool table if configured.

Checks the OEM parameter 'AutoToolSetterAlignToolEdgeOffset'. If set to "Tool Setter Offset", and the tool table is initialized, adds a 'ToolSetterOffset' user field of type Float with 4 decimal places. Has no effect if the OEM parameter is not set to "Tool Setter Offset" or the tool table is not initialized.

Returns
(nil) No meaningful return value on success
(boolean) Success flag - true if operation completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ AddToolSizeToToolTable()

CommonGUIModule AddToolSizeToToolTable ( )

Add a ToolSize user field to the tool table and migrate legacy oversized tool data.

Checks if the 'ToolSize' user field exists in the tool table. If not, it creates the field with choices: Normal=0, Oversized=1. Additionally, it scans all tool pockets for the legacy oversized-tool encoding (pocket >= 1000) and converts those entries to the new user field format by dividing the pocket number by 1000 and setting ToolSize to "1".

Returns
(nil) No meaningful return value on success
(boolean) Success flag - true if operation completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Only adds the field and migrates data if the tool table is initialized
Documentation generated by AI on 2026-03-04

◆ AddToRunScriptQueue()

CommonGUIModule AddToRunScriptQueue ( func )

Add a function or Lua code string to the RUN_SCRIPT_QUEUE for deferred execution.

param func - A function reference or string containing Lua code to execute

Initializes RUN_SCRIPT_QUEUE as an empty table if it does not exist, then appends the provided function reference or Lua code string to the end of the queue via table.insert(). The queued item will be executed on the GUI thread during the next call to ExecuteRunScriptQueue(), avoiding cross-thread conflicts with REST API requests.

Parameters
func(function|string) A function reference or string containing Lua code to execute
Note
Documentation generated by AI on 2026-03-04

References func().

◆ AllCoolantOffBtn()

CommonGUIModule AllCoolantOffBtn ( )

Button handler to turn off all coolant outputs (mist and flood).

Logs the button press via w.OperatorLog(). If either the mist (OSIG_MISTON) or flood (OSIG_COOLANTON) output signal is currently active for the selected instance, sets both signals to false via w.SetSignalState() to turn off all coolant.

Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the operation completed successfully
(string) Status message from w.FunctionCompleted()
Note
Documentation generated by AI on 2026-03-04

◆ AppendRunLuaDebugMessage()

CommonGUIModule AppendRunLuaDebugMessage ( ...)

Append a message to the Run Lua Script dialog's Debug Output window.

If the Run Lua Script dialog is currently open (CommonGUIModule._RunLuaUIRef is set), formats the provided arguments into a single string and appends it to the debug output panel. If more than one argument is provided, they are concatenated with a space separator. Has no effect if the dialog is not open, to avoid UI popups or logging side effects.

Parameters
...(any) One or more values to display; will be converted via tostring()
Note
This function is safe to call at any time; it silently does nothing if the dialog is closed
See also
CommonGUIModule.RunLuaScriptFromDialog() for the dialog that hosts the debug output
Note
Documentation generated by AI on 2026-03-04

◆ ApplyToolpathSettings()

CommonGUIModule ApplyToolpathSettings ( )

Apply saved toolpath display settings to all active tool path panels.

Reads toolpath color, line width, and slider settings from the Mach4 profile and applies them to all registered tool path panel objects. Settings applied include background colors, rapid/line/arc colors, highlight color, axis line color, soft limit color, path and axis line widths, follow mode, draw limits, draw triad, and left-click mouse function (rotate vs. pan based on DisableRotate profile value).

Note
Has no effect if no tool path panels are registered
Documentation generated by AI on 2026-03-04

◆ AutoEnableSoftlimits()

CommonGUIModule AutoEnableSoftlimits ( inst )

Automatically enable software limits after homing if configured to do so.

Reads the AutoEnableSoftlimits OEM parameter string via w.GetOEMParamValueString(). If the parameter is not "No", enables software limits via w.SetSoftLimits(true) for the specified instance.

Parameters
inst(number) The Mach4 instance handle. If not provided, uses current instance
Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the operation completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ AutoLoadLastGCode()

CommonGUIModule AutoLoadLastGCode ( inst )

Protected wrapper that auto-loads the last G-code file for all instances on startup.

Delegates to CommonGUIModule._AutoLoadLastGCode() via w.Protected() for error handling. The inner function iterates over all Mach4 instances and, for each instance where AutoLoadLastGcode OEM parameter is "Yes", checks if the last loaded G-code file still exists and is not already loaded in another instance. If conditions are met, loads the file via w.LoadGCodeFile() and runs header parameter processing hooks. After loading, updates the tool path panels and runs PostAutoLoadLastGCode hooks.

Parameters
inst(number) The Mach4 instance handle. If not provided, uses current instance
Note
Documentation generated by AI on 2026-03-04

◆ AutoUpdaterManualCheck()

CommonGUIModule AutoUpdaterManualCheck ( )

Trigger a manual check of the auto-updater via the MachMotion plugin register.

Sets the mm_AutoUpdaterManualCheck register to 1 via w.SetRegValue(). If the register write fails, logs the error via w.OperatorLog(). Returns success after the command is sent.

Returns
(nil) No meaningful primary return value
(boolean) Success flag - always true
(string) Status message from w.FunctionCompleted()
Note
Documentation generated by AI on 2026-03-04

◆ AuxiliaryBtn()

CommonGUIModule AuxiliaryBtn ( AuxButton ,
MouseUp ,
MouseDn  )

Handle auxiliary button press and release events, toggling or pulsing configured output signals.

Executes user-defined callback (UserAuxiliaryBtn1-6) if configured for the specified button. On mouse down (MouseDn), if the button is in toggle mode (AUX_BTN_TOGGLE == 1), activates the assigned output signal. On mouse up (MouseUp), handles both toggle and momentary (pulse) modes: in momentary mode, toggles the signal state; in toggle mode, deactivates the signal. User callbacks can short-circuit the default behavior by returning false as the primary value.

Parameters
AuxButton(number) The auxiliary button index (1-6)
MouseUp(boolean) True if this is a mouse button release event
MouseDn(boolean) True if this is a mouse button press event
Note
Documentation generated by AI on 2026-03-04

◆ BlockDeleteToggleBtn()

CommonGUIModule BlockDeleteToggleBtn ( )

Toggle block delete mode on or off, showing a level selection dialog if needed.

Logs the button press via w.OperatorLog(). Reads the BlockDeleteLevelsEnabled OEM parameter to determine which behavior to use. If block delete is currently active (OSIG_BLOCK_DELETE is true), turns off all block delete levels (0 through MC_MAX_BLOCKDELETE) and regenerates the tool path if ToolPathAutoRegen is enabled. If BlockDeleteLevelsEnabled equals "Level 0", activates only level 0 and regenerates if needed. Otherwise, if no dialog is already open (DIALOG_IS_OPEN[2]), presents a dialog with checkboxes for levels 0-9, an OK button, and a timer to handle shutdown. On OK or close, saves the selections and regenerates if configured.

Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the operation completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ CalculateAutoToolSetterPosition()

CommonGUIModule CalculateAutoToolSetterPosition ( IgnoreConfirmationDialogs )

Measure and store the auto tool setter position by executing M901 via MDI.

Checks manual mode. If a user override exists (user.UserCalculateAutoToolSetterPosition), calls it instead. Otherwise verifies that an auto tool setter is configured and the screen is in edit mode. Sets CALCULATE_SETTER_POSITION to true and enables the AutoCalculateToolLengthBtn screen object. Presents a CycleStartDialog; on confirmation, executes "m901" via mc.mcCntlMdiExecute() to run the auto tool setter position measurement cycle.

Parameters
IgnoreConfirmationDialogs(boolean|nil) If true, skips edit mode check. Defaults to false
Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if operation completed or was skipped successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ CalculateManualToolSetterPosition()

CommonGUIModule CalculateManualToolSetterPosition ( IgnoreConfirmationDialogs )

Manually measure and store the tool setter Z position from the current machine position.

Checks manual mode. If a user override exists (user.UserCalculateManualToolSetterPosition), calls it instead. Otherwise verifies edit mode and that a manual tool setter is enabled. With confirmation (unless IgnoreConfirmationDialogs is true), computes the tool setter position via w.GetCalculatedManualToolSetterPosition() and stores it via w.SetToolSetterPosition(). Sets CALCULATE_SETTER_POSITION to true and enables the ManualCalculateToolLengthBtn screen object. Logs the resulting position via w.OperatorLog().

Parameters
IgnoreConfirmationDialogs(boolean|nil) If true, skips edit mode and confirmation dialogs. Defaults to false
Returns
(number|nil) The calculated tool setter position on success, or nil on error
(boolean) Success flag - true if operation completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ CalculateToolLengthAutoBtn()

CommonGUIModule CalculateToolLengthAutoBtn ( IgnoreConfirmationDialogs )

Automatically measure tool lengths for one or more tools using the auto tool setter.

Checks manual mode and tool setter availability. If a user override function exists (user.UserCalculateToolLengthAutoBtn), calls it instead. Otherwise reads the ConfirmationDialogs OEM parameter and verifies that an auto tool setter is configured and the screen is in edit mode. Builds a G-code comment from the screen's tool range text string or the current tool number, interprets it as a range, and presents a CycleStartDialog listing the tools to be measured. On confirmation, executes "M900 (Data:...)" via mc.mcCntlMdiExecute() to run the auto tool length measurement cycle.

Parameters
IgnoreConfirmationDialogs(boolean|nil) If true, skips edit mode and confirmation checks. Defaults to false
Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if operation completed or was skipped successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ CalculateToolLengthManualBtn()

CommonGUIModule CalculateToolLengthManualBtn ( IgnoreConfirmationDialogs )

Manually measure and set the tool length offset using the manual tool setter.

Checks manual mode. If a user override exists (user.UserCalculateToolLengthManualBtn), calls it instead. Otherwise verifies edit mode and that a manual tool setter is configured. Reads the tool setter name, height, and Z position. Gets the current tool number and Z machine position. Computes the tool length as Z - (ToolSetterPosition + ManualToolSetterHeight) and writes it to the tool table via mc.mcToolSetData(). Activates the tool length offset via mc.mcCntlSetOffsetIndex() and saves the tool file via mc.mcToolSaveFile().

Parameters
IgnoreConfirmationDialogs(boolean|nil) If true, skips edit mode and confirmation checks. Defaults to false
Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if operation completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ CalculateZWorkOffsetAutoBtn()

CommonGUIModule CalculateZWorkOffsetAutoBtn ( IgnoreConfirmationDialogs )

Automatically measure the Z fixture offset using the auto tool setter.

Checks manual mode and tool setter availability. If a user override exists (user.UserCalculateZWorkOffsetAutoBtn), calls it instead. Otherwise verifies that an auto tool setter is configured and the screen is in edit mode. Presents a CycleStartDialog asking the operator to confirm auto measurement of the Z fixture offset. On confirmation, executes "M902" via mc.mcCntlMdiExecute() to run the auto Z fixture offset measurement cycle.

Parameters
IgnoreConfirmationDialogs(boolean|nil) If true, skips edit mode check. Defaults to false
Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if operation completed or was skipped successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ CalculateZWorkOffsetManualBtn()

CommonGUIModule CalculateZWorkOffsetManualBtn ( IgnoreConfirmationDialogs )

Manually measure the Z work (fixture) offset using the manual tool setter position.

Checks manual mode. If a user override exists (user.UserCalculateZWorkOffsetManualBtn), calls it instead. Otherwise verifies edit mode and that a manual tool setter is configured. Reads the ToolSetterFixtureOffsetMode to determine how to apply the offset: mode 0 calls m.ModifyAxisPosition() on Z; mode 1 sets SV_WORK_SHIFT_Z; mode 2 sets SV_HEAD_SHIFT_Z; mode 3 iterates G54-G59 fixtures and applies the offset to each. Reads ManualToolSetterHeight from the selected fixture setter and uses it as the offset amount.

Parameters
IgnoreConfirmationDialogs(boolean|nil) If true, skips edit mode and confirmation checks. Defaults to false
Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if operation completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ CalibrateToolSetters()

CommonGUIModule CalibrateToolSetters ( )

Open the Calibrate Tool Setters dialog for managing tool setter configurations.

Creates and displays a non-modal dialog allowing the operator to add, remove, rename, and configure tool setters. Each tool setter has properties including type (manual/auto), probe input selection, height, Z position, softlimit disable flag, fixture offset usage, fixture offset mode, and start/end GoTo positions. Provides wizard launch buttons for guided height and Z position calibration. A 100ms timer monitors for Mach shutdown and closes the dialog automatically. Changes are saved to the Mach4 profile via w.WriteToolSetter() when the Save button is pressed. Reloads the screen tool setter configuration via m.screen.InitializeToolSetters() after saving if available.

Warning
Requires password level to access depending on screen configuration
Note
Documentation generated by AI on 2026-03-04

◆ CancelButtonClick()

UI CancelButtonClick ( )

Handle the Cancel button click in the Job Notes dialog.

Displays a Yes/No confirmation dialog asking the user to confirm cancellation without saving. If the user selects Yes, calls UI.CloseDialog() to close the dialog.

Note
This is a closure defined inside CommonGUIModule._NotesDialog()
Documentation generated by AI on 2026-03-04

◆ CellChangedGenericGridDialog()

UI CellChangedGenericGridDialog ( row ,
col  )

Handle a cell value change event in the Generic Grid dialog.

Updates the GridTable.Data table at [row+1][col+1] with the new cell value retrieved from the wxGrid via GetCellValue(). Initializes GridTable.Data[row+1] as an empty table if it does not already exist.

Parameters
row(number) The zero-based row index of the changed cell
col(number) The zero-based column index of the changed cell
Note
This is a closure defined inside CommonGUIModule.GenericGridDialog()
Documentation generated by AI on 2026-03-04

◆ ChangeQty()

CommonGUIModule Scheduler ChangeQty ( qty )

Set the quantity column value of an item in the Schedule Editor list control.

Updates column 1 (quantity) of the item at the specified zero-based index in the wxListCtrl (self.UI.m_listCtrl2) using SetItem(). Does nothing if idx is out of bounds.

Parameters
idx(number) The zero-based index of the item to update
qty(string|number) The new quantity value to display in the quantity column
Note
Documentation generated by AI on 2026-03-04

◆ CheckEnableAndHomeFlag()

CommonGUIModule CheckEnableAndHomeFlag ( )

Check whether the enable and home startup dialog is currently active.

If ENABLE_HOME_DIALOG_ACTIVE is true and the emergency stop signal is not active, resets ENABLE_HOME_DIALOG_ACTIVE to false. Returns true if the dialog is active, false otherwise.

Returns
(boolean) True if the enable and home dialog is currently open, false otherwise
Note
Documentation generated by AI on 2026-03-04

◆ CheckFeedrateOverride()

CommonGUIModule CheckFeedrateOverride ( value ,
... )

Clamp a feedrate override percentage to the configured minimum and maximum bounds.

Reads FeedrateOverrideMaxPercent and FeedrateOverrideMinPercent OEM parameters. If value is nil, reads the current feedrate override via mc.mcCntlGetFRO(). Clamps value to the [min, max] range and returns the clamped result.

Parameters
value(number|nil) The feedrate override percentage to check. If nil, uses the current override value
...(any) Additional arguments (unused, reserved for hook compatibility)
Returns
(number) The clamped feedrate override percentage
(boolean) Success flag - true if operation completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ CheckHomeSwitchesForHoming()

CommonGUIModule CheckHomeSwitchesForHoming ( homing_axis ,
inst  )

Check if any home switch is active before homing and prompt the operator to jog off if needed.

Calls CommonGUIModule.IsHomeSwitchActive() to check the specified axis (or all axes if nil). If a home switch is active and the corresponding axis is enabled (AXIS_ENABLED_INST), opens the JogOffHomeSwitchDialog for the operator to jog off the switch. After the dialog closes, checks again; if the switch is still active, raises an error via w.Error().

Parameters
homing_axis(number|nil) The axis index to check, or nil to check all axes
inst(number) The Mach4 instance handle. If not provided, uses current instance
Note
Documentation generated by AI on 2026-03-04

◆ CheckName()

CommonGUIModule Scheduler CheckName ( )

Check whether the given file name matches the top scheduled file, accounting for GCAdapter naming.

Compares f_name against the top scheduled file path (self:GetTopFile()). If the EnableGCAdapter OEM parameter is "Yes", also constructs an adapted file name using the GCAdapterConfig.lua settings and compares against that. Returns true if neither the raw file name nor the adapted file name matches the top scheduled file. Delegates the actual work to self:_CheckName() via w.pcall() for error protection.

Parameters
f_name(string) The file path to check against the top of the schedule
Returns
(boolean) True if f_name does NOT match the top scheduled file, false if it matches
Note
Documentation generated by AI on 2026-03-04

◆ CheckPassword()

CommonGUIModule JobFile CheckPassword ( )

Verify that the operator has the required password level to save the job file.

If jb.Password is nil, returns true immediately (no protection). If jb.Password is between 1 and 3 inclusive, calls w.PasswordProtection() with that level and returns the result. All other password values return true (no protection).

Returns
(boolean) True if the password check passes or is not required, false if the password is incorrect
Note
Documentation generated by AI on 2026-03-04

◆ CheckSpindleOverride()

CommonGUIModule CheckSpindleOverride ( value ,
... )

Clamp a spindle override percentage to the configured minimum and maximum bounds.

Reads SpindleOverrideMaxPercent and SpindleOverrideMinPercent OEM parameters. If value is nil, reads the current spindle override via m.GetSpindleOverride(). Clamps value to the [min, max] range and returns the clamped result.

Parameters
value(number|nil) The spindle override percentage to check. If nil, uses the current override value
...(any) Additional arguments (unused, reserved for hook compatibility)
Returns
(number) The clamped spindle override percentage
(boolean) Success flag - true if operation completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ clean_up()

UI clean_up ( )

Release the cycle start hold and close the Cycle Start dialog.

Stops and destroys the dialog timer (UI.dlg_timer). Calls w.Formatting.CloseDialog() to close the cycle start dialog window and releases the cycle start hold via w.ReleaseCycleStartHold(). This function is defined as a closure inside CommonGUIModule._CycleStartDialog() and is called on both normal close and cancel paths.

Note
This is a closure defined inside CommonGUIModule._CycleStartDialog()
Documentation generated by AI on 2026-03-04

◆ CleanJobFiles()

CommonGUIModule CleanJobFiles ( )

Remove the JobFiles section from the Mach4 profile for the current instance.

Calls mc.mcProfileDeleteSection() to delete the entire "JobFiles" section from the Mach4 profile, clearing all registered job file entries.

Note
Documentation generated by AI on 2026-03-04

◆ Clear()

CommonGUIModule Scheduler Clear ( )

Delete all items from the Schedule Editor list control.

Calls DeleteAllItems() on the Schedule Editor's wxListCtrl (self.UI.m_listCtrl2) to remove all scheduled file entries from the UI.

Note
Documentation generated by AI on 2026-03-04

◆ ClearLimitSwitchActiveMessage()

CommonGUIModule ClearLimitSwitchActiveMessage ( handle )

Close and dismiss a limit switch active notification by handle.

Delegates to w.CloseGMSNotification() to close the GMS notification referenced by the provided handle. Used to dismiss limit switch warning messages created by CommonGUIModule.CreateLimitSwitchActiveMessage().

Parameters
handle(any) The notification handle returned by CreateLimitSwitchActiveMessage()
Returns
(any) The return value from w.CloseGMSNotification()
See also
CommonGUIModule.CreateLimitSwitchActiveMessage() for creating the notification
Note
Documentation generated by AI on 2026-03-04

◆ ClearRunScriptQueue()

CommonGUIModule ClearRunScriptQueue ( )

Clear all pending items from the RUN_SCRIPT_QUEUE.

Iterates the RUN_SCRIPT_QUEUE in reverse order (from last to first) and sets each element to nil, effectively emptying the queue. Used to purge the queue during error recovery or shutdown. Does nothing if RUN_SCRIPT_QUEUE is nil.

Note
Documentation generated by AI on 2026-03-04

◆ ClearSchedule()

CommonGUIModule Scheduler ClearSchedule ( leave_reg )

Clear all scheduled file entries for a given instance, optionally preserving the register.

Removes all entries from the in-memory schedule table (self.scheduled_files[_inst]). If leave_reg is false (the default), also clears the OEM register identified by self.FILE_REG via w.SetOEMParamValueString(). If leave_reg is true, the register is left unchanged. Delegates the actual work to self:_ClearSchedule() via w.pcall() for error protection.

Parameters
inst(number) The Mach4 instance handle. If not provided, uses current instance
leave_reg(boolean|nil) If true, do not clear the OEM register. Defaults to false
Note
Documentation generated by AI on 2026-03-04

◆ ClearSelection()

CommonGUIModule Scheduler ClearSelection ( )

Clear the selection state of all selected items in the Schedule Editor list control.

Iterates through all selected items in the wxListCtrl (self.UI.m_listCtrl2) using GetNextItem() with wxLIST_STATE_SELECTED, and deselects each one by calling SetItemState() with a state of 0. Continues until no more selected items are found (index == -1).

Note
Documentation generated by AI on 2026-03-04

◆ ClearToolChangeState()

CommonGUIModule ClearToolChangeState ( )

Clear the tool change state for the currently selected spindle.

Retrieves the selected instance and the selected spindle for that instance, then calls w.SetToolChangeStatus() with a value of 0 to reset the "ToolChangeState" status. Useful for recovering after a failed tool change.

Note
Documentation generated by AI on 2026-03-04

◆ ClearValues()

CommonGUIModule JobFile ClearValues ( )

Reset all pound variables and registers tracked by the job file to their stored values.

Iterates over all pound variables in the configured range (jb.RangeString) and sets each to its value stored in jb.FileTable.PoundVars via mc.mcCntlSetPoundVar(). Then iterates over jb.RegTable and resets each register to its stored value via w.SetRegValueString(). Uses 0 as a fallback if a stored value is nil.

Parameters
value(number|nil) Currently unused; reserved for a clear value. Defaults to 0 if nil or non-numeric
Note
This function is marked "NOT CURRENTLY CALLED" in the source and resets to stored values, not the passed value
Documentation generated by AI on 2026-03-04

◆ Close()

CommonGUIModule JobFile Close ( )

Close the currently loaded job file, prompting to save if there are unsaved edits.

Calls jb:HasEdits() to check for unsaved changes. If changes exist, displays a Yes/No dialog asking whether to save before closing. If the user chooses Yes, calls jb:Save(). Then delegates to jb:_Close() to clear the file state and call close callbacks.

Note
Documentation generated by AI on 2026-03-04

◆ CloseCommandsDialog()

UI CloseCommandsDialog ( )

Close the Commands dialog and release associated resources.

Stops and clears the CommandsDialog_Timer if active. Destroys the CommandsDialog window. Sets DIALOG_IS_OPEN["CommandsDialog"] to false to allow the dialog to be reopened.

Note
Documentation generated by AI on 2026-03-04

◆ CloseDialog() [1/3]

UI CloseDialog ( )

Close the Recent GCode dialog and release associated resources.

Close the Run Lua Script dialog and save state.

Close the Modify Z Offsets In Tool Change Final dialog and send selection data.

Close the Modify Z Offsets In Tool Change Final dialog and send selection data across a register.

Close the Modify Z Offsets In Tool Change dialog and send the operator's selection across a register.

Close the MDI dialog, save history, and clear the MDI active output signal.

Close the Job Notes dialog and release its global handle.

Stop the dialog timer and mark the cycle start inhibit dialog as closed.

Close the Block Delete dialog and release associated resources.

Stops the dialog's timer if active. Saves the dialog's staged position and size via w.Formatting.SaveStagedDialog(). Destroys the recent_dialog window. This function is defined as a local closure within CommonGUIModule.GcodeRecentBtn() and is called from both the timer shutdown handler and the close window event.

Note
This function is defined as a local closure within CommonGUIModule.GcodeRecentBtn()
Documentation generated by AI on 2026-03-04

Stops and clears the BlockDeleteTimer if active. Sets DIALOG_IS_OPEN[2] to false to allow the dialog to be reopened. Destroys the BlockDelete dialog window. This function is defined as a local closure within CommonGUIModule.BlockDeleteToggleBtn() and is called from both the OK button handler and the close window event.

Note
Documentation generated by AI on 2026-03-04

Stops and clears the ListAlarmMessageTimer, then sets DIALOG_IS_OPEN[5] to false to allow the dialog to be reopened in the future. This is a closure defined inside CommonGUIModule.CycleStartInhibitDialog().

Note
This is a closure defined inside CommonGUIModule.CycleStartInhibitDialog()
Documentation generated by AI on 2026-03-04

Checks that JOB_NOTES_DIALOG_HANDLE is set, clears it to nil, stops the dialog timer if active, then closes the dialog via w.Formatting.CloseDialog() with the key "JobNotesDialog".

Note
This is a closure defined inside CommonGUIModule._NotesDialog()
Documentation generated by AI on 2026-03-04

Calls UI.ConstructMDIString() to get the current MDI text and saves it to history via UI.SaveToHistory(). Clears the "MDI" I/O state via w.SetIoState() to turn off the MDI button indicator. Stops and clears the dialog timer, then closes the dialog via w.Formatting.CloseDialog() with the key "MDIDialog". Clears the MDI_DIALOG_HANDLE global.

Note
This is a closure defined inside CommonGUIModule.MDIDialog()
Documentation generated by AI on 2026-03-04

Reads the current radio-box selection and position input value, maps them to a normalized selection index (0=continue, 1=manual jog, 2=manual tool setter, 3=auto tool setter), and packages both into a Lua table sent via w.SendTableAcrossRegister(). Does not send if Mach is shutting down. Stops the dialog timer and closes via w.Formatting.CloseDialog() with the key "ModifyZHeadShiftOffset".

Note
This is a closure defined inside CommonGUIModule.ModifyZOffsetsInToolChangeDialog()
Documentation generated by AI on 2026-03-04

Packages the modify_type value captured in the enclosing closure into a Lua table and sends it via w.SendTableAcrossRegister() so the M-code waiting on the dialog can read the user's implicit selection. Does not send across the register if Mach is shutting down. Stops the dialog timer and closes the dialog via w.Formatting.CloseDialog() with the key "ModifyZHeadShiftOffsetFinal".

Note
This is a closure defined inside CommonGUIModule.ModifyZOffsetsInToolChangeFinalDialog()
Documentation generated by AI on 2026-03-04

Packages the modify_type value into a Lua table and sends it across a register via w.SendTableAcrossRegister() so the M-code waiting on the dialog can read the user's selection. Stops the dialog timer and closes the dialog via w.Formatting.CloseDialog() with the key "ModifyZHeadShiftOffsetFinal". Does not send across the register if Mach is shutting down.

Note
This is a closure defined inside CommonGUIModule.ModifyZOffsetsInToolChangeFinalDialog()
Documentation generated by AI on 2026-03-04

Saves the current editor content to history, stops and clears the dialog timer, persists the splitter sash position to the Mach4 profile, saves the dialog size/position via w.Formatting.SaveStagedDialog(), clears the external UI reference from both CommonGUIModule._RunLuaUIRef and _G._RunLuaUIRef, then destroys the dialog window.

Note
This is a closure defined inside CommonGUIModule.RunLuaScriptFromDialog()
Documentation generated by AI on 2026-03-04

◆ CloseDialog() [2/3]

UI CloseDialog ( CloseWindow )

Stop all active jogs, destroy the jog timer, and mark the jog-off home switch dialog as closed.

Calls UI.StopJog() to halt any active jog motion on all axes. Stops and clears the JogOffHomeSwitchTimer, then sets DIALOG_IS_OPEN[4] to false to allow the dialog to be reopened. This is a closure defined inside CommonGUIModule.JogOffHomeSwitchDialog().

Parameters
CloseWindow(any) Unused parameter, accepted for event handler compatibility
Note
This is a closure defined inside CommonGUIModule.JogOffHomeSwitchDialog()
Documentation generated by AI on 2026-03-04

◆ CloseDialog() [3/3]

UI CloseDialog ( reason )

Close the GoTo Positions dialog and release the cycle start hold.

Saves the current radio box selection to the MachMotion profile. Resets GOTO_POSITION_MODE to 0. Stops and destroys the goto_timer if active. Destroys the dialog. Calls w.ReleaseCycleStartHold() with the provided reason string.

Parameters
reason(string) Description of why the dialog is being closed, passed to w.ReleaseCycleStartHold()
Note
Documentation generated by AI on 2026-03-04

◆ CloseGenericGridDialog()

UI CloseGenericGridDialog ( )

Close the Generic Grid dialog and release its timer resources.

Stops and clears the UI.GenericGridDialogTimer if it is active, then ends the modal dialog with return code 1 via EndModal().

Note
This is a closure defined inside CommonGUIModule.GenericGridDialog()
Documentation generated by AI on 2026-03-04

◆ CloseM00Notification()

CommonGUIModule CloseM00Notification ( )

Close the M00/M01 stop notification and clear the optional stop active register.

Calls w.CloseGMSNotification() to dismiss the active stop notification referenced by m.M00_NotificationHandle. Sets the OptionalStopActive OEM register to 0 via w.SetOEMRegValue(). Clears m.M00_NotificationHandle and m.M00LineNumber to nil.

Returns
(nil) No meaningful primary return value
(boolean) Success flag - false if the register write failed
(string) Status message from w.FunctionError() on failure
Note
Documentation generated by AI on 2026-03-04

◆ CloseMach()

CommonGUIModule CloseMach ( showwarningmessage )

Close the Mach4 CNC software, optionally prompting the user for confirmation.

If showwarningmessage is true, displays a Yes/No dialog asking the user to confirm before closing. If confirmed (or skipped), saves the tool table via mc.mcToolSaveFile() and the fixture offsets via mc.mcFixtureSaveFile(), then exits Mach4 via scr.Exit(true).

Parameters
showwarningmessage(boolean) If true, shows a confirmation dialog before closing
Returns
(nil|nil) No return on success; returns triple on error from table or fixture save
(boolean) Success flag - false if a save operation fails
(string) Status message from w.FunctionError() on failure
Note
Documentation generated by AI on 2026-03-04

◆ CloseMachMenuDialog()

UI CloseMachMenuDialog ( )

Close the Mach Menu configuration dialog and save the hide-on-startup preference.

Stops the dialog timer, reads the current state of the "Hide Menu On Startup" checkbox, and writes HideMachMenu=1 or HideMachMenu=0 to the MachMotion profile accordingly. Then destroys the dialog and clears the DIALOG_IS_OPEN["MachMenu"] flag.

Note
Documentation generated by AI on 2026-03-04

◆ ClosePartCounterDialog()

UI ClosePartCounterDialog ( )

Stop the Part Counter timer and destroy the Part Counter dialog.

Stops UI.PartCounterTimer if it is active and sets it to nil, then calls Destroy() on UI.PartCounterDialog to free the wx dialog. Sets the DIALOG_IS_OPEN flag for "PartCounterDialog" to false.

Note
This is a closure defined inside CommonGUIModule._PartCounterDialog()
Documentation generated by AI on 2026-03-04

◆ ClosePLCSeqDialog()

UI ClosePLCSeqDialog ( )

Close the PLC Sequence dialog and release associated resources.

Stops and clears the PLCSeqTimer if active. Destroys the PLC_Seq_Dialog window. Sets DIALOG_IS_OPEN["PLC_SEQ"] to false to allow the dialog to be reopened.

Note
Documentation generated by AI on 2026-03-04

◆ CommandsDialogBtn()

CommonGUIModule CommandsDialogBtn ( )

Open the Commands dialog allowing the operator to browse and run user commands.

Guards against duplicate opens via DIALOG_IS_OPEN["CommandsDialog"]. Requires password level 3. Retrieves all user commands via w.GetAllCommands() and sorts them alphabetically. Builds a resizable dialog with a search field, a list box of command names, and a Run Command button. A timer polls for machine shutdown and updates the button feedback color based on the selected command's state. Running a command calls w.RunUserCommand() and saves the last selection to the profile.

Returns
(nil) No meaningful primary return value
(boolean) Success flag - false if dialog is already open
(string) Status message from w.FunctionError() if dialog is already open
Note
Documentation generated by AI on 2026-03-04

◆ CommonLowPriorityLoop()

CommonGUIModule CommonLowPriorityLoop ( )

Execute the common low-priority PLC loop tasks at a reduced scan rate.

-------------------— Common Low Priority PLC Loop ----------------------—

Called periodically from _CommonPLCScript() when LOW_PRIORITY_LOOP_COUNTER reaches LOW_PRIORITY_LOOP_SCANS. Executes the following tasks in order: user.UserPLCLowPriorityScript(), UpdateGlobalWithActiveFixtureIndex(), UpdateCurrentToolAndPocketGlobals(), _LuaProfiling.UpdateTimedProfiling(), UpdateLubeTimer(), UpdateLastGCodeFileName(), UpdateDoorInterlock(), SubSpindleUpdate(), UpdateMotionInhibit(), InhibitJoggingWhenNotHomed(), a stuck-state check (E-stops if machine is in a run state while disabled), LowPriorityLoop() (machine type), and screen.LowPriorityLoop(). Errors from user.UserPLCLowPriorityScript() are caught and logged via w.FunctionError().

Note
Documentation generated by AI on 2026-03-04

◆ CommonMessageScript()

CommonGUIModule CommonMessageScript ( inst ,
msg_type ,
param1 ,
param2  )

Entry point for Mach4 message events; validates and dispatches supported message types.

Checks whether msg_type is present in CommonGUIModule.MachMsg["Supported Types"]. If the message type is not supported, returns immediately. Otherwise calls CommonGUIModule.HandleMachMessages() via w.pcall() for error protection. If an error occurs, logs it via w.FunctionError().

Parameters
inst(number) The Mach4 instance handle that generated the message
msg_type(number) The Mach4 message type constant (e.g., mc.MSG_REG_CHANGED)
param1(number|string) First message parameter (register handle, IO handle, or pound var index)
param2(number|string) Second message parameter (new value or state)
Note
Documentation generated by AI on 2026-03-04

◆ CommonPLCScript()

CommonGUIModule CommonPLCScript ( )

Entry point for the Mach4 PLC script; executes the main PLC loop with error protection.

Checks ENABLE_MAIN_PLC_SCRIPT and returns immediately if it is false. Calls CommonGUIModule._CommonPLCScript() via w.pcall() for error protection. If an error occurs, logs it via w.Log() and displays a warning message box via w.wxMessageBox() up to 5 times (tracked by PLC_SCRIPT_ERROR counter) to prevent infinite error dialogs. Sets FIRST_RUN to true after each PLC cycle.

Warning
Errors in the PLC script will display a message box up to 5 times before being silently logged
Note
Documentation generated by AI on 2026-03-04

◆ CommonScreenLoadScript()

CommonGUIModule CommonScreenLoadScript ( )

Protected entry point for the Mach4 screen load script.

Wraps CommonGUIModule._CommonScreenLoadScript() via pcall() for top-level error handling. If an error occurs, attempts to retrieve the checkpoint object via CommonGUIModule.GetCheckPoint() and includes its stringified context in the error message displayed via wx.wxMessageBox(). After the load script completes (successfully or not), calls h.StartScreenLoadedCheck() if the GUIModule (h) is available.

Warning
This is the top-level screen load entry point. Errors here are displayed directly to the user via a message box since the wrapper module may not be fully initialized.
Note
Documentation generated by AI on 2026-03-04

◆ CommonScreenUnloadScript()

CommonGUIModule CommonScreenUnloadScript ( MachEnable )

Wrapper entry point for the screen unload script; delegates to the protected implementation.

Calls CommonGUIModule._CommonScreenUnloadScript() via w.Protected() to execute the full screen unload sequence (save vars, save offsets, disable hardware, stop timers, etc.) with error protection. The MachEnable parameter controls whether the machine is disabled as part of the unload sequence.

Parameters
MachEnable(boolean|nil) If true, skips machine disable and hardware shutdown steps. Defaults to false if not provided, causing a full disable sequence on unload
Note
Documentation generated by AI on 2026-03-04

◆ CommonSelectedInstanceChanged()

CommonGUIModule CommonSelectedInstanceChanged ( )

Handle a change in the selected Mach4 instance and notify all registered listeners.

Calls w.UpdateSelectedInstance() to synchronize the internal selected instance state. Calls m.screen.CommonSelectedInstanceChanged() if it is defined. Runs the "SelectedInstanceChanged" hooks via m.RunHooks(). Updates the SELECTED_INSTANCE global variable to the newly selected instance.

Note
Documentation generated by AI on 2026-03-04

◆ CommonSignalScript()

CommonGUIModule CommonSignalScript ( sig ,
sig_state  )

Entry point for Mach4 signal change events; converts signal state and dispatches to handler.

Converts sig_state to a boolean via w.ToBoolean(). Calls CommonGUIModule._CommonSignalScript() via w.Protected() for error protection, passing the signal ID, converted state, and current instance handle.

Parameters
sig(number) The Mach4 signal ID that changed state
sig_state(number|boolean) The new signal state (converted to boolean internally)
Note
Documentation generated by AI on 2026-03-04

◆ CommonStartUpScript()

CommonGUIModule CommonStartUpScript ( )

Protected wrapper for the common CNC startup initialization sequence.

Delegates all startup work to CommonGUIModule._CommonStartUpScript() via w.Protected() for error handling. Handles initialization that can only be done after Mach4 is fully initialized, including starting the file queue timer, running machine-type and user startup scripts, configuring lube timers, enabling soft limits, sending the tool table, running the installer update module, and waiting for motion controller initialization.

Note
Documentation generated by AI on 2026-03-04

◆ CommonTimerScript()

CommonGUIModule CommonTimerScript ( timer )

Entry point for Mach4 timer events; dispatches to machine-type and screen timer handlers.

Calls m.TimerScript(timer) if it is defined, then calls m.screen.TimerScript(timer) if it is defined. Handles the BlinkObjectNomal timer by toggling BLINK_OBJECT_ACTIVE and running the "BlinkObjects" hooks via m.RunHooks(). Handles the BlinkObjectSlow timer by toggling BLINK_OBJECT_SLOW_ACTIVE and running the "BlinkObjectsSlow" hooks.

Parameters
timer(number) The timer ID that fired, compared against SCREEN_TIMERS entries
Note
Documentation generated by AI on 2026-03-04

◆ CommonUpdateSignalLibraryArray()

CommonGUIModule CommonUpdateSignalLibraryArray ( )

Rebuild the signal library arrays and update auxiliary button configuration.

-------------------— Signal Library Array ----------------------—

Calls CommonGUIModule.UpdateSignalLibraryArray() if it exists to rebuild the base signal handlers. Then iterates over all AUX_BTN_QUANTITY auxiliary buttons, reading each button's output signal assignment and toggle mode from the Mach4 profile (AuxiliaryOutputButton# and AuxiliaryOutputButton#Toggle keys under MachMotion section). Updates AUX_OUTPUT_ARRAY and AUX_BTN_TOGGLE for each button, and enables or disables the corresponding screen button object ("Aux#Btn") based on whether a valid output signal is assigned. Runs the "UpdateSignalLibrary" hooks via m.RunHooks() on completion.

Note
Documentation generated by AI on 2026-03-04

◆ CompileScriptsBtn()

CommonGUIModule CompileScriptsBtn ( )

Recompile all M-code scripts and reload the screen configuration.

Checks that the machine is idle before proceeding. Disables the main PLC script, runs hooks via m.RunHooks("CompileScripts"), stores machine overrides, and recompiles M-code scripts for all instances via mc.mcCntlCompileScripts(). Unloads the common screen, removes cached Lua bytecode files, reinitializes the scheduler, and sets configuration registers to trigger a full reload. Re-enables the main PLC script on completion.

Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if compilation completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Warning
Machine must be in IDLE state before calling this function
Note
Documentation generated by AI on 2026-03-04

◆ Configure()

CommonGUIModule _LuaProfiling Configure ( )

Perform one-time setup for the Lua profiling facility.

Sets the active flag to false. Clears any previously loaded profiler module and attempts to require() the 'profiler' module via pcall(). If loading fails for any reason, sets prof.profiler to nil and logs the error via mc.mcCntlLog(). If loading succeeds, stores the profiler module reference in prof.profiler for later use by StartProfiler().

Note
Documentation generated by AI on 2026-03-04

◆ ConfigureTLMMode()

CommonGUIModule ConfigureTLMMode ( )

Configure the Tool Length Management (TLM) mode so that the T word on the M6 line is used as the selected tool.

Reads bit PV_TLM2_M6E_BIT from the PV_TLM2 parameter. If the bit is 0, sets it to 1 via w.SetParameterBit(). This causes Mach4 to treat the T word on the current M6 line as the tool to activate rather than queuing it as the next tool.

Note
Documentation generated by AI on 2026-03-04

◆ ConstructLuaString()

UI ConstructLuaString ( )

Build the full Lua execution string wrapping the user's script.

Prepends a header that locally overrides print() and UI.print() to redirect output to the debug output panel, wraps the user's raw code in a protected function, and appends a footer containing an xpcall error handler that appends the traceback to the debug output and sets the error background style on failure. The user's code is obtained via UI._GetEditorText() and is not modified.

Returns
(string) The complete Lua source string ready for execution via w.RunLuaString()
Note
This is a closure defined inside CommonGUIModule.RunLuaScriptFromDialog()
Documentation generated by AI on 2026-03-04

◆ ConstructMDIString()

UI ConstructMDIString ( )

Build the complete MDI command string from all lines in the multi-line text control.

Iterates over all lines in the MDI text control (UI.mdi_line) and concatenates them with newline separators. The first line has no leading newline; subsequent lines are joined with "\n".

Returns
(string) The full MDI G-code string as currently typed in the dialog editor
Note
This is a closure defined inside CommonGUIModule.MDIDialog()
Documentation generated by AI on 2026-03-04

◆ ConstructNotesString()

UI ConstructNotesString ( )

Construct the full notes string from all lines in the multi-line notes text control.

Iterates over all lines in UI.notes_line using GetNumberOfLines() and GetLineText(). Lines are concatenated with newline separators; the first line has no leading newline.

Returns
(string) The complete notes text as a single string with newline-separated lines
Note
This is a closure defined inside CommonGUIModule._NotesDialog()
Documentation generated by AI on 2026-03-04

◆ ConvertIgnoreOutputsString()

CommonGUIModule ConvertIgnoreOutputsString ( output_range )

Convert a semicolon or comma-separated output range string to an array of output numbers.

Normalizes semicolons to commas via string.gsub(). Strips any trailing comma from the string. Delegates to w.InterpretRangeString() to expand range expressions (e.g., "1-5,7") into a flat array of output numbers. Returns the resulting array directly.

Parameters
output_range(string) A semicolon or comma-separated string of output numbers or ranges (e.g., "1;3;5-8")
Returns
(table) An array of output numbers parsed from the range string
Note
Documentation generated by AI on 2026-03-04

◆ CoolantToggleBtn()

CommonGUIModule CoolantToggleBtn ( )

Button handler to toggle flood coolant on or off.

Logs the button press via w.OperatorLog(). Checks the current flood state via m.IsFloodOn(). If flood is currently on, calls m.FloodOff() to turn it off. Otherwise calls m.FloodOn() to turn it on.

Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the toggle completed successfully
(string) Status message from w.FunctionCompleted()
Note
Documentation generated by AI on 2026-03-04

◆ CreateCommands()

CommonGUIModule _LuaProfiling CreateCommands ( )

Register user commands for starting, stopping, and timed screen profiling.

Creates two user commands using w.CreateCommandActionOption(), w.CreateCommandFeedbackOption(), w.CreateSimpleCommand(), and w.SetCommandButtonLabels():

  1. "Screen Profiling Toggle" - toggles profiling on/off via _LuaProfiling.StartProfiler/StopProfiler
  2. "Screen Profiling For 60 Seconds" - starts a 60-second timed profiling session via StartProfilerTimed Both commands provide feedback indicating whether profiling is currently active.
    Note
    Documentation generated by AI on 2026-03-04

◆ CreateEditControls()

CommonGUIModule Scheduler CreateEditControls ( )

Create and display the Schedule Editor dialog with list control and management buttons.

Builds the complete Schedule Editor UI including a wxListCtrl showing scheduled files with File and Qty columns, navigation buttons (Up, Down, Delete, Clear, To Top, To Bottom), and Load/Save/Close action buttons. Loads the current schedule into the list via self:InsertFiles(), connects all button event handlers, and shows the dialog via w.Formatting.ShowDialog(). Registers a resize event to maintain correct column widths.

Parameters
inst(number) The Mach4 instance handle. If not provided, uses current instance
Note
Documentation generated by AI on 2026-03-04

◆ CreateLimitSwitchActiveMessage()

CommonGUIModule CreateLimitSwitchActiveMessage ( message ,
title  )

Create a persistent GMS notification for a limit switch active condition.

Calls w.CreateGMSNotification() with instance 0, a timeout of -1 (persistent), sticky=true, visible=true, and priority -3. Uses black foreground color (Red=0, Green=0, Blue=0). Returns the notification handle for later dismissal via ClearLimitSwitchActiveMessage().

Parameters
message(string) The warning message text to display in the notification
title(string) The title of the notification
Returns
(any) The notification handle returned by w.CreateGMSNotification()
See also
CommonGUIModule.ClearLimitSwitchActiveMessage() for dismissing the notification
Note
Documentation generated by AI on 2026-03-04

◆ CreateLimitSwitchAlarm()

CommonGUIModule CreateLimitSwitchAlarm ( msg )

Create a GMS alarm message for a limit switch activation event.

If the machine was previously enabled (MACH_WAS_ENABLED is true), checks whether a GMS message with the given title already exists via w.GetGMSHandleFromTitle(). If no existing message is found and the LimitSwitchAlarmEnabled OEM parameter is "Yes", creates a new GMS Alarm message with title "Limit Switch Active!" and the provided msg as the description, with a Notification action via w.CreateSystemGlobalMessage().

Parameters
msg(string) The limit switch alarm description text (e.g., "X++ Limit Switch Active")
Note
Documentation generated by AI on 2026-03-04

◆ CreatePreCannedCommands()

CommonGUIModule CreatePreCannedCommands ( )

Register all pre-canned machine commands, feedback options, and button configurations.

This function creates a comprehensive set of machine commands that can be assigned to operator panel buttons, screen buttons, or keyboard shortcuts. It registers action options, feedback options, and simple commands for the following categories:

  • Input/Output signals (all enabled inputs and outputs with toggle/on/off variants)
  • Configuration dialogs (Setup Wizard, MachMotion Config, Modbus, Calibration)
  • Homing (individual axes, Home All, Home All Dereferenced, per-instance)
  • Inhibit Jogging when not homed
  • Zeroing (individual axes, Zero All, Zero XY, with Edit Offsets variants)
  • Enable/Disable machine
  • Cycle Start, Feed Hold, Feed Hold Retract, Cycle Stop, Rewind, Reset (per-instance)
  • DeReference axes (individual and all)
  • Teach Work Shift Offsets (per axis)
  • Auto Measure Tool Length
  • Soft Limits (toggle, on, off)
  • Coolant/Mist (toggle)
  • Single Block (toggle, on, off)
  • Optional Stop (toggle, on, off)
  • Block Delete (toggle)
  • Limit Override (toggle)
  • File Resume (standard, simplified, advanced)
  • Find Tool Changes
  • Search GCode
  • Dry Run (toggle)
  • Save Fixture Offsets
  • Activate Fixture Offsets (1 through MC_FIXTURES_MAX)
  • Manual Mode (toggle)
  • MST Lock (toggle)
  • GCode CNTL 1 MST (toggle, set, reset)
  • Laser Pointer (toggle, teach offsets)
  • PLC Sequence Diagnostics
  • Goto Positions (selection dialog + individual configured positions)
  • Spindle Brake (toggle, on, off)
  • Spindle Forward/Reverse/Stop/Orient (with toggle variants)
  • Selected Spindle (1-4 per instance)
  • Spindle Override (reset, increment, decrement)
  • Feedrate Override (reset, increment, decrement)
  • Spindle Warm Up / Skip Spindle Warm Up
  • Sub Spindle (if enabled: forward, reverse, stop with toggle variants)
  • Register Tools (tool pockets dialog)
  • Tool Changes (previous/next tool, previous/next pocket, magazine jog, tool change to tool#)
  • Park Tool
  • Part Counters
  • Tool Group Table
  • Spindle Ranges (all configured ranges)
  • Compile Scripts
  • Power Off / Power Off Immediate / UPS Power Off
  • Close CNC Software
  • Support / Remote Support
  • Regen ToolPath
  • Dry Run To Line
  • Recent/Load/Edit/Close GCode
  • GCode Shortcuts 1-3 (per instance)
  • Inhibit Axis Jogging (per axis toggle)
  • Enable/Disable Axis (per axis toggle)
  • M00 Active feedback
  • Axis movement feedback (moving positive/negative/not moving/moving, per axis)
  • Work Light (on/off/toggle, if enabled)
  • Step Into/Over Sub Programs (toggle)
  • Cutter Compensation Type A/B/C (toggle)
  • Run Lua Script
  • Open Commands Dialog
  • Spindle Speed Variation (toggle)
  • Clear Tool Change State
  • GCode File Repeat (on/off/toggle)
  • Scheduler functions (edit/enable/clear per instance)
  • OP Zone App QR Code
  • GCode Nesting
  • Surface Mapping
  • Blum Probing
  • Motion Controller pre-canned commands
  • Lua Profiling commands
Note
This function is typically called once during module initialization
Documentation generated by AI on 2026-03-04

◆ CreateSearchDialog()

CommonGUIModule SearchGCode CreateSearchDialog ( )

Create and display the GCode Search dialog with search bar, grid, and navigation buttons.

Builds the full GCode Search UI including a text search bar (with Enter-key handler), a resizable wxGrid showing line numbers and G-code content, and Go To / Close buttons. Registers event handlers for search, grid double-click (go to line), close button, window close, and resize events. Shows the dialog via w.Formatting.ShowDialog().

Parameters
inst(number) The Mach4 instance handle. If not provided, uses current instance
Note
Documentation generated by AI on 2026-03-04

◆ CutterCompensationToggleType_A()

CommonGUIModule CutterCompensationToggleType_A ( )

Toggle cutter compensation type A on or off.

If type A is currently active (IsCutterCompensationType_A() returns true), calls m.CutterCompensationType_A(false) to disable it. Otherwise calls m.CutterCompensationType_A(true) to enable it. Uses the PV_CCT_BIT_SUP bit of the PV_CCT (parameter 5003) Mach4 parameter.

Note
Documentation generated by AI on 2026-03-04

◆ CutterCompensationToggleType_B()

CommonGUIModule CutterCompensationToggleType_B ( )

Toggle cutter compensation type B on or off.

If type B is currently active (IsCutterCompensationType_B() returns true), calls m.CutterCompensationType_B(false) to disable it. Otherwise calls m.CutterCompensationType_B(true) to enable it. Uses the PV_CCT_BIT_SUP bit of the PV_CCT (parameter 5003) Mach4 parameter.

Note
Documentation generated by AI on 2026-03-04

◆ CutterCompensationToggleType_C()

CommonGUIModule CutterCompensationToggleType_C ( )

Toggle cutter compensation type C on or off.

If type C is currently active (IsCutterCompensationType_C() returns true), calls m.CutterCompensationType_C(false) to disable it. Otherwise calls m.CutterCompensationType_C(true) to enable it. Uses the PV_CCT_BIT_SUV bit of the PV_CCT (parameter 5003) Mach4 parameter.

Note
Documentation generated by AI on 2026-03-04

◆ CutterCompensationType_A()

CommonGUIModule CutterCompensationType_A ( on_off )

Enable or disable cutter compensation type A.

Sets or clears the PV_CCT_BIT_SUP bit (bit 0) of the PV_CCT parameter (5003) via w.SetParameterBit(). If on_off is true, clears the bit to 0 (type A enabled); if false or nil, sets the bit to 1. Initializes PV_CCT_BIT_SUP and PV_CCT to their default values if they are nil. Type A is the default compensation mode when the SUP bit is 0.

Parameters
on_off(boolean|nil) True to enable cutter compensation type A, false or nil to disable
Note
Documentation generated by AI on 2026-03-04

◆ CutterCompensationType_B()

CommonGUIModule CutterCompensationType_B ( on_off )

Enable or disable cutter compensation type B.

Sets or clears the PV_CCT_BIT_SUP bit (bit 0) of the PV_CCT parameter (5003) via w.SetParameterBit(). If on_off is true, sets the bit to 1 (type B enabled); if false or nil, clears the bit to 0. Initializes PV_CCT_BIT_SUP and PV_CCT to their default values if they are nil. Type B compensation differs from type A in the direction of cutter radius compensation.

Parameters
on_off(boolean|nil) True to enable cutter compensation type B, false or nil to disable
Note
Documentation generated by AI on 2026-03-04

◆ CutterCompensationType_C()

CommonGUIModule CutterCompensationType_C ( on_off )

Enable or disable cutter compensation type C (tool nose radius compensation vector correction).

Sets or clears the PV_CCT_BIT_SUV bit (bit 1) of the PV_CCT parameter (5003) via w.SetParameterBit(). If on_off is true, sets the bit to 1 (type C enabled); if false or nil, clears the bit to 0 (type C disabled). Initializes PV_CCT_BIT_SUV and PV_CCT to their default values if they are nil.

Parameters
on_off(boolean|nil) True to enable cutter compensation type C, false or nil to disable
Note
Documentation generated by AI on 2026-03-04

◆ CycleStart()

CommonGUIModule CycleStart ( inst )

Initiate a cycle start with re-entrancy protection and cycle start hold handling.

If a cycle start hold is currently active, releases it via w.ReleaseCycleStartHold() and returns. Guards against concurrent execution using w.FuncTracing["m.CycleStart"]. If already in progress, logs a skip message and returns an error. Otherwise calls m._CycleStart() via w.pcall() for protected execution. On error, returns a formatted error via w.FunctionError().

Parameters
inst(number) The Mach4 instance handle. If not provided, uses selected instance
Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the cycle start sequence completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ CycleStartBtn()

CommonGUIModule CycleStartBtn ( )

Button handler to initiate a cycle start operation.

Delegates to m.CycleStart() to perform the full cycle start sequence. This is the primary UI entry point for the Cycle Start button on the screen.

Note
Documentation generated by AI on 2026-03-04

◆ CycleStartDialog()

CommonGUIModule CycleStartDialog ( Message ,
Title ,
inst  )

Display a modal Cycle Start confirmation dialog and wait for operator confirmation.

Sets the active Mach4 instance, then delegates to CommonGUIModule._CycleStartDialog() with ShowModal set to true via w.pcall() for error protection. If an error occurs, logs it via w.FunctionError() and returns false. The dialog displays a green-background prompt with a Cycle Start button (if no hardware operator panel is configured) and a Cancel button. Blocks until the operator presses Cycle Start, Cancel, or the machine is disabled.

Parameters
Message(string) The prompt message to display in the dialog
Title(string) The dialog title bar text
inst(number) The Mach4 instance handle. If not provided, uses current instance
Returns
(boolean) True if Cycle Start was pressed, false if cancelled or an error occurred
Warning
This function blocks execution until the operator responds. Ensure it is not called from a context that cannot be blocked (e.g., the PLC script main loop).
Note
Documentation generated by AI on 2026-03-04

◆ CycleStartDialog_NotModal()

CommonGUIModule CycleStartDialog_NotModal ( Message ,
Title ,
CmdOnStart ,
CmdOnCancel  )

Display a non-modal Cycle Start confirmation dialog with optional on-start and on-cancel callbacks.

Delegates to CommonGUIModule._CycleStartDialog() with ShowModal set to false via w.pcall() for error protection. If an error occurs, logs it via w.FunctionError() and returns false. The dialog displays a green-background prompt and waits for the hardware or software cycle start button. When confirmed or cancelled, executes the corresponding callback command via w.PostToFileQueue().

Parameters
Message(string) The prompt message to display in the dialog
Title(string) The dialog title bar text
CmdOnStart(string|nil) Lua code string to post to the file queue when Cycle Start is pressed
CmdOnCancel(string|nil) Lua code string to post to the file queue when Cancel is pressed
Returns
(boolean) True if dialog was created successfully, false on error
Note
Documentation generated by AI on 2026-03-04

◆ CycleStartInhibitDialog()

CommonGUIModule CycleStartInhibitDialog ( )

Display a modal dialog listing all active cycle start inhibit messages.

Reads the mm_FaultMessages register and parses it as a CSV string. Strips leading spaces and "Inhibit Cycle Start: " or "Inhibit Cycle Start (Enabled): " prefixes from each message. If no messages are found or if the dialog is already open (DIALOG_IS_OPEN[5]), returns an error. Otherwise creates and displays a modal dialog containing a grid of inhibit messages with an OK button. Uses a timer to monitor for Mach shutdown.

Returns
(nil) No meaningful return value on success
(boolean) False with error message if no messages exist or dialog is already open
(string) Status message from w.FunctionError() on failure
Warning
This function blocks execution until the operator closes the dialog
Note
Documentation generated by AI on 2026-03-04

◆ CycleStartSoftLimitRecovery()

CommonGUIModule CycleStartSoftLimitRecovery ( inst )

Check and recover axes that are outside the software limit zone before cycle start.

Only active when the CycleStartSoftLimitRecovery OEM parameter is "Yes" and software limits are enabled. Iterates over all enabled coordinate axes and collects any that are outside the soft limit zone via w.IsAxisInSideSoftLimitsZone(). If any axes are out of limits, presents a CycleStartDialog listing the axis names and prompting the operator to confirm. On confirmation, calls w.MoveAxisIntoSoftLimitZone() for each out-of-limits axis with a step of 0.01. If the operator cancels, returns false.

Parameters
inst(number) The Mach4 instance handle. If not provided, uses current instance
Returns
(boolean) True if all axes are within limits or recovery was confirmed and applied
(boolean) Success flag - false if the operator canceled the recovery
(string) Status message from w.FunctionCompleted() or "User cancelled"
Note
Documentation generated by AI on 2026-03-04

◆ CycleStop()

CommonGUIModule CycleStop ( ...)

Stop the currently running G-code program with re-entrancy protection.

Guards against concurrent execution using w.FuncTracing["m.CycleStop"]. If already in progress, logs a skip message and returns false. Otherwise calls m._CycleStop() via w.pcall() with all provided arguments for protected execution. Accepts a variadic argument list that is passed through to _CycleStop to indicate the stop mode (0=CycleStop, 1=Reset, 2=EnableReset, 10=Custom).

Parameters
...(any) Optional stop mode number passed to _CycleStop (0=CycleStop, 1=Reset, 2=EnableReset, 10=Custom)
Returns
(boolean) Valid stop flag - false if the stop could not be completed safely (e.g., during homing)
(boolean) Success flag - true if the cycle stop sequence completed
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ CycleStopBtn()

CommonGUIModule CycleStopBtn ( )

Button handler to stop the currently running G-code program.

Calls m.CycleStop(0) to initiate a standard cycle stop sequence and returns a successful completion status. This is the primary UI entry point for the Cycle Stop button.

Returns
(nil) No meaningful primary return value
(boolean) Success flag - always true
(string) Status message from w.FunctionCompleted()
Note
Documentation generated by AI on 2026-03-04

◆ CycleStopRestoreGCodeLineNum()

CommonGUIModule CycleStopRestoreGCodeLineNum ( gcodeline ,
inst  )

Restore the G-code line number to the value recorded at the time of cycle stop.

Calls mc.mcCntlSetGcodeLineNbr() to set the G-code line number back to the value that was captured when cycle stop was pressed. This ensures the G-code editor and line counter reflect the correct resume point after a stop.

Parameters
gcodeline(number) The G-code line number to restore
inst(number) The Mach4 instance handle. If not provided, uses current instance
Note
Documentation generated by AI on 2026-03-04

◆ DebugOutputAppend()

UI DebugOutputAppend ( msg )

Append a timestamped message to the debug output text control.

Formats the message with the current local time (HH:MM:SS) and appends it as a new line to the debug output wxTextCtrl. Has no effect if the dialog or debug output control is not available.

Parameters
msg(any) The message to append; will be converted via tostring()
Note
This is a closure defined inside CommonGUIModule.RunLuaScriptFromDialog()
Documentation generated by AI on 2026-03-04

◆ DebugPrint()

CommonGUIModule DebugPrint ( ...)

Convenience alias for AppendRunLuaDebugMessage.

Forwards all arguments to CommonGUIModule.AppendRunLuaDebugMessage(). Appends a message to the Run Lua Script dialog's Debug Output window if it is open. Has no effect if the dialog is not currently visible.

Parameters
...(any) One or more values to display in the debug output window
See also
CommonGUIModule.AppendRunLuaDebugMessage()
Note
Documentation generated by AI on 2026-03-04

◆ DefaultJob()

CommonGUIModule DefaultJob ( )

Create and initialize the default job file object for the screen.

Instantiates a new JobFile object via m.JobFile:New() with a pound variable range of 500-999, no registers, overwrite enabled, show-notes-on-open enabled, and a standard header. Assigns the result to m.screen.DefaultJob and registers it under the job name "m.screen.DefaultJob".

Note
Documentation generated by AI on 2026-03-04

◆ DeleteItem()

CommonGUIModule Scheduler DeleteItem ( )

Delete the currently selected item from the Schedule Editor list control.

Retrieves the currently selected item index via self:GetSelectedItem(). If a valid item is selected (index ~= -1), deletes it from the wxListCtrl and moves the selection to the item above it. The optional item_idx parameter is accepted but defaults to idx+1 if nil.

Parameters
item_idx(number|nil) Optional override for the item index to delete. Defaults to the current selection index + 1
Note
Documentation generated by AI on 2026-03-04

◆ DemoModeWarning()

CommonGUIModule DemoModeWarning ( )

Display a warning dialog if the software is running in demo mode (unlicensed).

Checks the m.__DemoModeWarningIssued flag to avoid issuing the warning twice. Calls w.CheckIfLicensed() to determine the current license status of the MACHMOTION_PLUGIN. If the license status is -1 (unknown), starts a 1-second recurring timer to retry later. If the software is unlicensed, sets m.__DemoModeWarningIssued to true and displays a modal warning message box informing the user that the software will randomly timeout in demo mode. Does nothing if the software is properly licensed.

Note
Documentation generated by AI on 2026-03-04

◆ DeReferenceAll()

CommonGUIModule DeReferenceAll ( )

Dereference all axes on the current Mach4 instance.

Delegates to CommonGUIModule.DeReferenceAxis(-1) to dereference all axes on the current instance. This marks all axes as unhomed, requiring a new homing sequence before the machine can run G-code.

Returns
(nil) No meaningful primary return value
(boolean) Success flag - always true
(string) Status message from w.FunctionCompleted()
Note
Documentation generated by AI on 2026-03-04

◆ DeReferenceAllBtn()

CommonGUIModule DeReferenceAllBtn ( )

Button handler to dereference all axes on the current Mach4 instance.

Logs the button press via w.OperatorLog() and delegates to m.DeReferenceAll() to dereference all axes. Returns a successful completion status after the operation.

Returns
(nil) No meaningful primary return value
(boolean) Success flag - always true
(string) Status message from w.FunctionCompleted()
Note
Documentation generated by AI on 2026-03-04

◆ DeReferenceAllInstances()

CommonGUIModule DeReferenceAllInstances ( inst_list )

Dereference all axes on each instance in the provided instance list.

Retrieves the list of instances via w.GetInstancesTable(inst_list). For each instance in the list, calls CommonGUIModule.DeReferenceAxis(-1, _inst) to dereference all axes on that instance.

Parameters
inst_list(number|table|nil) An instance handle, table of instance handles, or nil to use all instances
Returns
(nil) No meaningful primary return value
(boolean) Success flag - always true
(string) Status message from w.FunctionCompleted()
Note
Documentation generated by AI on 2026-03-04

◆ DeReferenceAxis()

CommonGUIModule DeReferenceAxis ( Axis ,
_inst  )

Dereference (un-home) a single axis or all axes on the specified instance.

Logs the dereference action via w.Log(). If Axis is nil, -1, greater than mc.MC_MAX_AXES, or less than mc.X_AXIS, calls mc.mcAxisDerefAll() to dereference all axes on the instance. Otherwise calls mc.mcAxisDeref() to dereference only the specified axis.

Parameters
Axis(number|nil) The axis identifier to dereference, or -1 (or nil) to dereference all axes
_inst(number|nil) The instance to operate on. If not provided, uses the selected instance
Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the dereference operation completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ DestroyGauge()

self UI DestroyGauge ( )

Destroy the Schedule Editor dialog and release its reference.

Destroy the GCode Search dialog and release its reference.

Destroy the quantity entry dialog and release its reference.

Calls Destroy() on self.UI.MyFrame1 to free the wx dialog window and sets self.UI.MyFrame1 to nil to prevent dangling references.

Note
This is a closure defined inside CommonGUIModule.Scheduler:_CreateEditControls()
Documentation generated by AI on 2026-03-04

Calls Destroy() on QUI.QtyDialog to free the wx dialog window and sets QUI.QtyDialog to nil to prevent dangling references.

Note
This is a closure defined inside CommonGUIModule.Scheduler:_EditQty()
Documentation generated by AI on 2026-03-04

Calls Destroy() on self.UI.m_Dialog1 to free the wx dialog and sets self.UI.m_Dialog1 to nil to prevent dangling references.

Note
This is a closure defined inside CommonGUIModule.SearchGCode:_CreateEditControls()
Documentation generated by AI on 2026-03-04

◆ DisableBtn()

CommonGUIModule DisableBtn ( )

Disable the machine by setting the machine enable signal to false.

Calls w.SetMachEnable(false) to disable the machine for the current instance. This is a simple, immediate disable with no pre-disable hooks or sequencing.

Note
Documentation generated by AI on 2026-03-04

◆ DisableLoggingOnOutputs()

CommonGUIModule DisableLoggingOnOutputs ( )

Disable signal-change logging on high-frequency axis movement and deceleration output signals.

Iterates over all Mach4 instances and a predefined list of high-frequency output signals (OSIG_MOVING_X through OSIG_MOVING_OB6 and OSIG_GCODE_DECEL). For each signal, retrieves the signal handle and, if logging is currently enabled, disables it via mc.mcSignalSetLogEnable(). This reduces log file noise from signals that toggle at high frequency during motion.

Note
Documentation generated by AI on 2026-03-04

◆ DisplayModelNumber()

CommonGUIModule DisplayModelNumber ( )

Display the machine model number in the screen warning message area.

Reads the control configuration string via w.GetControlConfiguration() and displays it prefixed with "Model:" in the screen warning message area via CommonGUIModule.SetWarningMessage() with the temporary flag set to false and the persistent flag set to true.

Note
Documentation generated by AI on 2026-03-04

◆ DistanceToGoToggleBtn()

CommonGUIModule DistanceToGoToggleBtn ( )

Toggle the distance-to-go display mode on or off.

Logs the button press via w.OperatorLog(). If the OSIG_DIST_TOGO signal is currently false, sets it to true via w.SetSignalState(). Otherwise sets it to false. This toggles whether the DRO displays the remaining distance to the target position or the current machine position.

Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the toggle completed successfully
(string) Status message from w.FunctionCompleted()
Note
Documentation generated by AI on 2026-03-04

◆ DryRunToggle()

CommonGUIModule DryRunToggle ( )

Toggle dry run mode on or off based on its current state.

Checks manual mode via m.ManualModeIsActive(). If manual mode is active or the check fails, returns an error. Otherwise calls m.SetDryRun() with the inverse of the current dry run state as returned by m.IsDryRunOn().

Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the toggle completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ DryRunToggleBtn()

CommonGUIModule DryRunToggleBtn ( )

Button handler to toggle dry run mode on or off.

Logs the button press via w.OperatorLog() and delegates to CommonGUIModule.DryRunToggle() to perform the actual toggle operation.

Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the toggle completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ EdgeFinderXMinusBtn()

CommonGUIModule EdgeFinderXMinusBtn ( )

Apply a positive X-axis fixture offset using the configured edge finder diameter.

Logs the button press, updates stop status, and optionally displays a confirmation dialog if the ConfirmationDialogs OEM parameter is set to "Yes". Reads the EdgeFinderDiameter OEM parameter and calls m.ModifyAxisPosition() to offset the X axis by +(EdgeFinderDiameter/2), accounting for the edge finder contacting the negative X side of the workpiece.

Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if completed, false if confirmation was denied or a parameter error occurred
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ EdgeFinderXPlusBtn()

CommonGUIModule EdgeFinderXPlusBtn ( )

Apply a negative X-axis fixture offset using the configured edge finder diameter.

Logs the button press, updates stop status, and optionally displays a confirmation dialog if the ConfirmationDialogs OEM parameter is set to "Yes". Reads the EdgeFinderDiameter OEM parameter and calls m.ModifyAxisPosition() to offset the X axis by -(EdgeFinderDiameter/2), accounting for the edge finder contacting the positive X side of the workpiece.

Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if completed, false if confirmation was denied or a parameter error occurred
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ EdgeFinderYMinusBtn()

CommonGUIModule EdgeFinderYMinusBtn ( )

Apply a negative Y-axis fixture offset using the configured edge finder diameter.

Logs the button press, updates stop status, and optionally displays a confirmation dialog if the ConfirmationDialogs OEM parameter is set to "Yes". Reads the EdgeFinderDiameter OEM parameter and calls m.ModifyAxisPosition() to offset the Y axis by +(EdgeFinderDiameter/2), accounting for the edge finder contacting the positive Y side of the workpiece.

Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if completed, false if confirmation was denied or a parameter error occurred
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ EdgeFinderYPlusBtn()

CommonGUIModule EdgeFinderYPlusBtn ( )

Apply a positive Y-axis fixture offset using the configured edge finder diameter.

Logs the button press, updates stop status, and optionally displays a confirmation dialog if the ConfirmationDialogs OEM parameter is set to "Yes". Reads the EdgeFinderDiameter OEM parameter and calls m.ModifyAxisPosition() to offset the Y axis by -(EdgeFinderDiameter/2), accounting for the edge finder contacting the negative Y side of the workpiece.

Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if completed, false if confirmation was denied or a parameter error occurred
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ Edit()

CommonGUIModule Scheduler Edit ( )

Open the Schedule Editor dialog to view and modify the current schedule.

Loads the last saved schedule from the OEM register via self:GetLastSchedule(), then opens the Schedule Editor UI via self:CreateEditControls(). Delegates the actual work to self:_Edit() via w.pcall() for error protection.

Parameters
inst(number) The Mach4 instance handle. If not provided, uses current instance
Note
Documentation generated by AI on 2026-03-04

◆ EditQty()

CommonGUIModule Scheduler EditQty ( )

Open a dialog allowing the user to edit the quantity of the selected scheduled item.

Creates a small dialog with a numeric input control and an OK button for entering a new quantity value. On confirmation (OK button or Enter key), reads the current selection index via self:GetSelectedItem() and updates the quantity via self:ChangeQty(). The dialog position and size are saved and restored via w.Formatting.ShowDialog() and w.Formatting.SaveStagedDialog() with key "QtyConfig".

Note
Documentation generated by AI on 2026-03-04

◆ EmergencyStop()

CommonGUIModule EmergencyStop ( )

Perform an emergency stop by disabling drives and turning off all active outputs.

For each Mach4 instance, disables the drive enable and hardware enable outputs via w.SetDriveEnable() and w.SetHardwareEnable(). Reads the IgnoreOutputsOnEmergencyStop OEM parameter and converts it to an array via m.ConvertIgnoreOutputsString(). Iterates all active output signals and turns off any that are not the spindle brake output and not listed in the ignore array. Also turns off Spindle Speed Variation (SSV) mode via w.SpindleSpeedVariation().

Warning
This function immediately disables all drives and outputs. Use only for emergency conditions.
Note
Documentation generated by AI on 2026-03-04

◆ EmergencyStopNotification()

CommonGUIModule EmergencyStopNotification ( )

Show or close a GMS notification for an active Emergency Stop signal.

Checks the state of the mc.ISIG_EMERGENCY signal. If the signal is active (true), creates a persistent GMS notification window with the message "Emergency Stop Is Active!" using w.CreateGMSNotification() and stores the handle in EMERGENCYSTOP_NOTIFICATION_HANDLE. If the signal is not active, closes the existing notification via w.CloseGMSNotification(). Intended to be called periodically from a screen timer.

Note
Documentation generated by AI on 2026-03-04

◆ EmptyGrid()

CommonGUIModule SearchGCode EmptyGrid ( )

Clear all values from the GCode Search grid and delete all rows except the first.

Calls ClearGrid() to blank all cell values, then deletes all rows after the first using DeleteRows() if the grid has more than one row.

Note
Documentation generated by AI on 2026-03-04

◆ Enable()

CommonGUIModule Scheduler Enable ( )

Enable the scheduler and load the top scheduled file into Mach4.

Sets the scheduler state to active via w.SetOEMParamValue() if not already active. If the in-memory schedule is empty, attempts to reload it from the OEM register via self:GetLastSchedule(). If the schedule has at least one entry and the top file is not already loaded in another instance, closes the current G-code file, verifies the machine is IDLE, and loads the top file via w.LoadGCodeFile(). Raises an error if the machine is not idle when attempting to load. Delegates the actual work to self:_Enable() via w.pcall() for error protection.

Parameters
inst(number) The Mach4 instance handle. If not provided, uses current instance
Warning
Machine must be in IDLE state before this function attempts to load a file
Note
Documentation generated by AI on 2026-03-04

◆ EnableAndHome()

CommonGUIModule EnableAndHome ( )

Enable the machine and home all dereferenced axes in a single operation.

First ensures the safety relay is cleared via m.ResetSafetyRelay() if needed. Calls m.Reset() to clear alarms. Checks for active emergency stop or GMS alarms and warnings; if any are present, cancels the operation with a warning message. If the machine is not already enabled, sets the GUIEnableBtn register and calls w.SetMachEnable(true) followed by m.StartEnableSequence(0). If the machine is enabled after the enable sequence, calls m.HomeAllDereferencedAxes(false) to home all axes that have not yet been referenced. Sets MachineEnableStatus register on success.

Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the operation completed or was partially completed
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Warning
Machine must be free of alarms and emergency stop before this function will proceed
Note
Documentation generated by AI on 2026-03-04

◆ EnableBtn()

CommonGUIModule EnableBtn ( )

Enable the machine after verifying alarm, emergency stop, and safety relay preconditions.

Calls w.SetStopStatusAll() to update stop status. Runs the EnableBtn hook scripts. Reads GMS alarm status via w.GetGMSAlarms(); if alarms are active, displays a warning and returns an error. Checks for active emergency stop via w.GetSignalState(mc.ISIG_EMERGENCY); if active, displays a warning and returns an error. Calls m.MotionControllerPreEnable() to perform motion controller pre-enable checks. Calls m.ResetSafetyRelay() to reset the safety relay circuit; if that fails, displays a warning and returns an error. If all preconditions pass, calls w.SetMachEnable(true) to enable the machine.

Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the machine was enabled successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ EnableHomeDialog()

CommonGUIModule EnableHomeDialog ( )

Display the enable and home startup dialog if the machine has not yet been homed.

Checks the EnableAndHomeDialog OEM parameter to determine if the dialog is enabled. If already open (ENABLE_HOME_DIALOG_ACTIVE == true), returns immediately. Calls m.VerifyHoming() to check homing status; if the machine is already homed, cancels the dialog. Sets ENABLE_HOME_DIALOG_ACTIVE to true and shows a non-modal CycleStartDialog prompting the operator to enable and home all axes, with callbacks to m.EnableHomeDialog_CycleStart() and m.EnableHomeDialog_Cancel().

Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if dialog was shown or skipped due to preconditions
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ EnableHomeDialog_Cancel()

CommonGUIModule EnableHomeDialog_Cancel ( )

Cancel the enable and home startup dialog without performing any action.

Resets the ENABLE_HOME_DIALOG_ACTIVE global flag to false, effectively dismissing the enable and home dialog without enabling the machine or homing any axes.

Note
Documentation generated by AI on 2026-03-04

◆ EnableHomeDialog_CycleStart()

CommonGUIModule EnableHomeDialog_CycleStart ( )

Execute the enable and home sequence when the operator confirms via cycle start.

Resets the ENABLE_HOME_DIALOG_ACTIVE global flag to false and calls m.EnableAndHome() to perform the full enable and home sequence for all dereferenced axes.

Note
Documentation generated by AI on 2026-03-04

◆ EnableReset()

CommonGUIModule EnableReset ( )

Perform a combined enable and reset operation with re-entrancy protection.

Guards against concurrent execution using w.FuncTracing for m.EnableReset, m.StartEnableSequence, and m.StartDisableSequence. If any of these are already in progress, logs a skip message and returns an error. Otherwise calls m._EnableReset() via w.pcall() for protected execution. On error, returns a formatted error via w.FunctionError().

Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the enable-reset sequence completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ EnableResetBtn()

CommonGUIModule EnableResetBtn ( )

Button handler to initiate the combined enable and reset sequence.

Delegates to m.EnableReset() to perform the combined enable and reset operation. This button handler is the primary UI entry point for the Enable/Reset button on the screen.

Note
Documentation generated by AI on 2026-03-04

◆ EndOfProgram()

CommonGUIModule EndOfProgram ( inst )

Handle the end-of-program event (M30 macro entry point).

Records the end-of-program start time, runs the "EndOfProgram" hooks, handles G-code file repeat (if active), and loads the next scheduled file in the scheduler queue. Called from the Lua File Queue when an M30 macro completes.

Parameters
inst(number) The Mach4 instance handle. If not provided, uses current instance
Returns
(nil) No meaningful return value on success
(boolean) Success flag - true if operation completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ ExecuteRunScriptQueue()

CommonGUIModule ExecuteRunScriptQueue ( )

Execute and remove the first queued item from RUN_SCRIPT_QUEUE.

If RUN_SCRIPT_QUEUE is non-nil and contains at least one item, removes the first item via table.remove(). If the item is a function, calls it directly. If the item is a string, compiles it via load() and executes the resulting function. If compilation fails, logs the error via w.Log(). Should be called periodically from the GUI thread to process REST API requests in a non-blocking manner.

Note
Documentation generated by AI on 2026-03-04

◆ FeedHold()

CommonGUIModule FeedHold ( inst )

Initiate a feed hold to pause program execution with re-entrancy protection.

Guards against concurrent execution using w.FuncTracing["m.FeedHold"]. If already in progress, logs a skip message and returns an error. Otherwise calls m._FeedHold() via w.pcall() for protected execution. On error, returns a formatted error via w.FunctionError().

Parameters
inst(number) The Mach4 instance handle. If not provided, uses selected instance
Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the feed hold sequence completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ FeedHoldBtn()

CommonGUIModule FeedHoldBtn ( )

Button handler to initiate a feed hold to pause program execution.

Delegates to m.FeedHold() to perform the feed hold sequence. This is the primary UI entry point for the Feed Hold button on the screen.

Note
Documentation generated by AI on 2026-03-04

◆ FeedHoldRetract()

CommonGUIModule FeedHoldRetract ( inst )

Initiate a feed hold retract operation with re-entrancy protection.

Guards against concurrent execution using w.FuncTracing["m.FeedHoldRetract"]. If already in progress, logs a skip message and returns an error. Otherwise calls m._FeedHoldRetract() via w.pcall() for protected execution. On error, returns a formatted error via w.FunctionError().

Parameters
inst(number) The Mach4 instance handle. If not provided, uses selected instance
Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the retract sequence completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ FeedHoldRetractBtn()

CommonGUIModule FeedHoldRetractBtn ( )

Button handler to initiate a feed hold retract operation.

Delegates to m.FeedHoldRetract() to perform the feed hold retract sequence. This is the primary UI entry point for the Feed Hold Retract button on the screen.

Note
Documentation generated by AI on 2026-03-04

◆ FeedrateOverrideDecrement()

CommonGUIModule FeedrateOverrideDecrement ( increment )

Decrement the feedrate override percentage by the configured or specified increment.

Reads the current feedrate override and rounds it to the nearest integer. If no increment is provided, selects the SmallIncrement (< 10%) or LargeIncrement (>= 10%) from OEM parameters. Runs registered hooks via m.RunHooks("FeedrateOverrideDecrement"). Subtracts the increment from the current percentage and delegates to m.SetFeedrateOverride() to apply the clamped new value.

Parameters
increment(number|nil) Amount to decrement. If nil, uses the configured small or large increment
Returns
(number|nil) The new feedrate override percentage, or nil on error
(boolean) Success flag - true if the override was updated successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ FeedrateOverrideDecrementAmount()

CommonGUIModule FeedrateOverrideDecrementAmount ( amount ,
increment  )

Decrement the feedrate override by repeatedly calling FeedrateOverrideDecrement.

Treats amount as a positive quantity regardless of sign. If amount exceeds 100, logs a warning and aborts. Otherwise calls m.FeedrateOverrideDecrement(increment) once for each unit of amount, allowing the increment logic to adapt to the current percentage on each iteration.

Parameters
amount(number) The total number of decrement steps to apply. Must be <= 100
increment(number|nil) The per-step decrement amount passed to FeedrateOverrideDecrement. If nil, uses configured increment
Note
Documentation generated by AI on 2026-03-04

◆ FeedrateOverrideIncrement()

CommonGUIModule FeedrateOverrideIncrement ( increment )

Increment the feedrate override percentage by the configured or specified increment.

Reads the current feedrate override and rounds it to the nearest integer. If no increment is provided, selects the SmallIncrement (< 10%) or LargeIncrement (>= 10%) from OEM parameters. Runs registered hooks via m.RunHooks("FeedrateOverrideIncrement"). Adds the increment to the current percentage and delegates to m.SetFeedrateOverride() to apply the clamped new value.

Parameters
increment(number|nil) Amount to increment. If nil, uses the configured small or large increment
Returns
(number|nil) The new feedrate override percentage, or nil on error
(boolean) Success flag - true if the override was updated successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ FeedrateOverrideIncrementAmount()

CommonGUIModule FeedrateOverrideIncrementAmount ( amount ,
increment  )

Increment the feedrate override by repeatedly calling FeedrateOverrideIncrement.

Treats amount as a positive quantity regardless of sign. If amount exceeds 100, logs a warning and aborts. Otherwise calls m.FeedrateOverrideIncrement(increment) once for each unit of amount, allowing the increment logic to adapt to the current percentage on each iteration.

Parameters
amount(number) The total number of increment steps to apply. Must be <= 100
increment(number|nil) The per-step increment amount passed to FeedrateOverrideIncrement. If nil, uses configured increment
Note
Documentation generated by AI on 2026-03-04

◆ FileResume()

CommonGUIModule FileResume ( )

Execute the file resume sequence using the configured resume mode.

Sets the FileResumeIsActive OEM parameter to 1 to indicate a resume is in progress. Calls w.Protected(m._FileResume) to execute the internal resume logic with error protection. Resets FileResumeIsActive to 0 when complete. The internal _FileResume function reads the FileResumeMode OEM register and delegates to either m.FileResumeAdvanced() or m.FileResumeSimplifed() based on the configured mode.

Note
Documentation generated by AI on 2026-03-04

◆ FileResumeAdvanced()

CommonGUIModule FileResumeAdvanced ( )

Execute the advanced file resume sequence to reposition and restart from the current G-code line.

Reads the current file name and G-code line number (incremented by 1). If no file is loaded or the line is <= 1, returns early. Checks if the mm_RunFromHereDialog register is already set and clears it if so. Updates stop status and checks manual mode. If a user FileResume script is defined, calls it. Otherwise sets the mm_RunFromHereDialog register to 1 to trigger the advanced run-from-here dialog.

Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the sequence was initiated or canceled
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ FileResumeAdvancedBtn()

CommonGUIModule FileResumeAdvancedBtn ( )

Button handler to initiate the advanced file resume sequence.

Logs the button press via w.OperatorLog(). Sets the FileResumeIsActive OEM parameter to 1, calls w.Protected(m.FileResumeAdvanced) to execute the advanced resume sequence with error protection, then resets FileResumeIsActive to 0.

Note
Documentation generated by AI on 2026-03-04

◆ FileResumeBtn()

CommonGUIModule FileResumeBtn ( )

Button handler to initiate the file resume sequence.

Logs the button press via w.OperatorLog() and delegates to CommonGUIModule.FileResume() to perform the actual file resume operation.

Note
Documentation generated by AI on 2026-03-04

◆ FileResumeSimplifed()

CommonGUIModule FileResumeSimplifed ( )

Execute the simplified file resume sequence to reposition and restart from the current G-code line.

Reads the current file name and G-code line number. If no file is loaded or the line is <= 1, returns early. Updates stop status and checks manual mode. Calls the user FileResumeSimplifed script if defined. Otherwise performs a dry run to the current line, optionally executes a tool change if the required tool differs from the current tool, prompts the operator via CycleStartDialog at each stage, repositions all enabled axes via MDI commands (XY then Z separately), restores spindle direction and coolant state, and then calls mcCntlCycleStart to resume execution.

Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the resume sequence was completed or canceled by operator
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Warning
This function blocks execution through multiple wait operations and MDI commands
Note
Documentation generated by AI on 2026-03-04

◆ FileResumeSimplifedBtn()

CommonGUIModule FileResumeSimplifedBtn ( )

Button handler to initiate the simplified file resume sequence.

Logs the button press via w.OperatorLog(). Sets the FileResumeIsActive OEM parameter to 1, calls w.Protected(m.FileResumeSimplifed) to execute the simplified resume sequence with error protection, then resets FileResumeIsActive to 0.

Note
Documentation generated by AI on 2026-03-04

◆ filter()

UI filter ( search_term )

Filter the commands list box to show only entries matching the search term.

If the search term is empty, restores the full Commands_List in the list box. Otherwise converts both the search term and each command name to lowercase and performs a substring match. Clears and repopulates the Commands_ListBox with matching entries. Preserves the current selection if it remains in the filtered list.

Parameters
search_term(string) The text to search for within the command names
Note
Documentation generated by AI on 2026-03-04

Referenced by GetAllDevices().

◆ FindToolChangeBtn()

CommonGUIModule FindToolChangeBtn ( )

Open the Find Tool Change dialog for the currently loaded G-code file.

Logs the button press via w.OperatorLog(). Reads the currently loaded G-code file name via mc.mcCntlGetGcodeFileName(). If a file is loaded, updates the stop status and checks manual mode via m.ManualModeIsActive(). Calls the user script UserFindToolChange if defined; otherwise sets the mm_FindToolChangeDialog register to 1 to trigger the built-in dialog. If no file is loaded, logs a cancellation message.

Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the dialog was triggered or operation was skipped
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ FloodOff()

CommonGUIModule FloodOff ( )

Turn off the flood coolant output for the selected instance.

Runs registered hooks via m.RunHooks("FloodOff"). If hooks allow continuation, updates stop status and sets the OSIG_COOLANTON output signal to false via w.SetSignalState() for the selected instance.

Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the flood was turned off or hooks cancelled the operation
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ FloodOn()

CommonGUIModule FloodOn ( )

Turn on the flood coolant output for the selected instance.

Runs registered hooks via m.RunHooks("FloodOn"). Checks the MSTLock and DryRun OEM registers; if either is active, displays a warning and skips the flood command. If neither lock is active, updates stop status and sets the OSIG_COOLANTON output signal to true via w.SetSignalState() for the selected instance.

Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the flood was turned on or skipped due to lock
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ format_number()

UI format_number ( number )

Format a number to a fixed 4-decimal-place string.

Uses string.format with "%0.4f" to convert the provided number to a string with exactly four decimal places. This is a closure defined inside CommonGUIModule.CalibrateToolSetters().

Parameters
number(number) The numeric value to format
Returns
(string) The number formatted to 4 decimal places (e.g., "1.2346")
Note
This is a closure defined inside CommonGUIModule.CalibrateToolSetters()
Documentation generated by AI on 2026-03-04

Uses string.format with "%0.4f" to convert the provided number to a string with exactly four decimal places. This is a closure defined inside CommonGUIModule.ToolSetterSelection().

Parameters
number(number) The numeric value to format
Returns
(string) The number formatted to 4 decimal places (e.g., "1.2346")
Note
This is a closure defined inside CommonGUIModule.ToolSetterSelection()
Documentation generated by AI on 2026-03-04

Referenced by tonumber(), and tostring().

◆ GcodeClose()

CommonGUIModule GcodeClose ( )

Close the currently loaded G-code file.

Runs registered hooks via m.RunHooks("GcodeClose"). Requires password level 1 via m.screen.CheckPassword(). If preconditions pass, closes the file via h.DoFunctionNameInst() and resets GCAdapter rotation tracking via m.screen.ResetGCRotate(). Runs the PostGcodeClose hook on completion.

Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the file was closed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ GcodeCloseBtn()

CommonGUIModule GcodeCloseBtn ( )

Button handler to close the currently loaded G-code file.

Logs the button press via w.OperatorLog() and delegates to m.GcodeClose() to perform the actual file close operation.

Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the file was closed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ GcodeEditBtn()

CommonGUIModule GcodeEditBtn ( )

Button handler to open the currently loaded G-code file in an editor.

Logs the button press via w.OperatorLog(). Requires password level 2 via m.screen.CheckPassword(). Calls mc.mcCntlReset() to ensure Mach4 has exited any subroutines and returned to the main program before editing. Opens the editor via h.DoFunctionNameInst(). Runs the PostGcodeEdit hook on completion.

Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the edit operation completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ GCodeFileRepeatCycleStart()

CommonGUIModule GCodeFileRepeatCycleStart ( )

Execute a G-code file repeat cycle start sequence.

Runs the "PreGCodeFileRepeatCycleStart" hooks, then waits for the machine to reach IDLE state using w.WaitOnCondition(). Once idle, verifies the machine is not already running before calling mc.mcCntlCycleStart(). Also runs the "GCodeFileRepeatCycleStart" hooks which can cancel the cycle start by returning nil or false.

Returns
(nil) No meaningful return value on success
(boolean) Success flag - true if cycle start completed, false on error
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Warning
This function blocks until the machine reaches IDLE state before starting the cycle
Note
Documentation generated by AI on 2026-03-04

◆ GCodeFileRepeatOff()

CommonGUIModule GCodeFileRepeatOff ( )

Turn off the G-code file repeat mode.

Sets the OEM parameter 'GCodeFileRepeatActive' to 0 for the current instance. Has no effect if G-code file repeat is not enabled via the OEM parameter.

Returns
(nil) No meaningful return value on success
(boolean) Success flag - true if operation completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Has no effect if IsGCodeFileRepeatEnabled() returns false
Documentation generated by AI on 2026-03-04

◆ GCodeFileRepeatOn()

CommonGUIModule GCodeFileRepeatOn ( )

Turn on the G-code file repeat mode.

Sets the OEM parameter 'GCodeFileRepeatActive' to 1 for the current instance. Has no effect if G-code file repeat is not enabled via the OEM parameter.

Returns
(nil) No meaningful return value on success
(boolean) Success flag - true if operation completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Has no effect if IsGCodeFileRepeatEnabled() returns false
Documentation generated by AI on 2026-03-04

◆ GCodeFileRepeatToggle()

CommonGUIModule GCodeFileRepeatToggle ( )

Toggle the G-code file repeat mode on or off.

If G-code file repeat is not enabled via the OEM parameter, does nothing. Otherwise, calls GCodeFileRepeatOff() if currently on, or GCodeFileRepeatOn() if currently off.

Note
Has no effect if IsGCodeFileRepeatEnabled() returns false
Documentation generated by AI on 2026-03-04

◆ GcodeLoadBtn()

CommonGUIModule GcodeLoadBtn ( )

Button handler to load a G-code file.

Logs the button press via w.OperatorLog(). Runs registered hooks via m.RunHooks("GcodeLoad"). Requires password level 1 via m.screen.CheckPassword(). If the EnableGCAdapter OEM parameter is "Yes", loads the file through the GC Adapter via m.GCACaller.AdaptFiles(); otherwise uses h.DoFunctionNameInst() to open a standard file load dialog. Resets GCAdapter rotation tracking and runs the PostGcodeLoad hook on completion.

Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the file was loaded successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ GcodeRecentBtn()

CommonGUIModule GcodeRecentBtn ( )

Button handler to open the Recent GCode file selector.

Logs the button press via w.OperatorLog(). If the EnableGCAdapter OEM parameter is "No", delegates to m.GcodeRecentNoCBtn() for the standard recent file dialog. Otherwise runs registered hooks via m.RunHooks("GcodeRecentConverter") and presents a custom Recent GCode dialog populated with up to 10 recently used files from the Mach4 profile (MRU1-MRU10). Provides OK and Cancel buttons and handles double-click selection. On selection, passes the chosen file through m.GCACaller.AdaptFiles() and resets GCAdapter rotation tracking. A timer monitors for Mach4 shutdown and closes the dialog if detected.

Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the operation completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ GcodeRecentNoCBtn()

CommonGUIModule GcodeRecentNoCBtn ( )

Button handler to open the recent G-code file list without the GC Adapter.

Logs the button press via w.OperatorLog(). Runs registered hooks via m.RunHooks("GcodeRecent"). Requires password level 1 via m.screen.CheckPassword(). Opens the standard Recent File dialog via h.DoFunctionName(). Resets GCAdapter rotation tracking via m.screen.ResetGCRotate(). Runs the PostGcodeRecent hook on completion.

Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the operation completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ GcodeShortcut()

CommonGUIModule GcodeShortcut ( short_num ,
inst  )

Load a G-code shortcut file by index for the specified instance.

Reads up to three configured shortcut G-code file paths from OEM parameters (GCodeShorcut1, GCodeShorcut2, GCodeShorcut3). Selects the file corresponding to the provided short_num index and loads it via w.LoadGCodeFile(). Resets the GCAdapter rotation tracking via m.screen.ResetGCRotate() after loading.

Parameters
short_num(number) The shortcut index (1, 2, or 3) selecting which configured file to load
inst(number|nil) The Mach4 instance handle. If not provided, uses current instance
Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the file was loaded successfully
(string) Status message from w.FunctionCompleted()
Note
Documentation generated by AI on 2026-03-04

◆ GcodeShortcutBtn()

CommonGUIModule GcodeShortcutBtn ( short_num ,
inst  )

Button handler to load a G-code shortcut file by index.

Logs the button press via w.OperatorLog() and delegates to m.GcodeShortcut() with the provided shortcut number and instance handle to perform the actual file load.

Parameters
short_num(number) The shortcut index (1, 2, or 3) selecting which configured file to load
inst(number|nil) The Mach4 instance handle. If not provided, uses current instance
Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the shortcut file was loaded successfully
(string) Status message from w.FunctionCompleted()
Note
Documentation generated by AI on 2026-03-04

◆ GenericGridDialog()

CommonGUIModule GenericGridDialog ( GridTable )

Display a resizable modal grid dialog for viewing and editing tabular data.

Creates a wxGrid-based modal dialog populated with data from GridTable. Supports configurable column and row labels, font sizes, cell alignment, and format strings. Connects event handlers for cell changes, close button, dialog close, and a periodic timer that monitors for Mach4 shutdown. On close, returns the modified GridTable with any user edits reflected in GridTable.Data.

Parameters
GridTable(table) Configuration and data table with keys:
  • 'Title' (string|nil): Dialog title. Defaults to ""
  • 'ColLabelSize' (number|nil): Column header height in pixels. Defaults to 30
  • 'RowLabelSize' (number|nil): Row label width in pixels. Defaults to 80
  • 'ColMinimalWidth' (number|nil): Minimum column width. Defaults to 0
  • 'RowMinimalHeight' (number|nil): Minimum row height. Defaults to 0
  • 'GridFontSize' (number|nil): Cell font size. Defaults to 10
  • 'LabelFontSize' (number|nil): Label font size. Defaults to 12
  • 'FormatString' (string|nil): Cell value format string. Defaults to "%0.4f"
  • 'ColumnNames' (table): Array of column header label strings
  • 'RowNames' (table): Array of row label strings
  • 'Data' (table): Two-dimensional array of numeric cell values
Returns
(table) The GridTable with Data updated to reflect any user edits
Note
Documentation generated by AI on 2026-03-04

◆ GetAllNotes()

CommonGUIModule JobFile GetAllNotes ( )

Retrieve all notes from the job file's in-memory notes table.

Returns the entire jb.FileTable.Notes table. Returns nil and raises an error if FileTable or FileTable.Notes is nil.

Returns
(table|nil) The notes table with string keys (line numbers) and string values, or nil on error
Note
Documentation generated by AI on 2026-03-04

◆ GetAndSortCutRecovery()

CommonGUIModule GetAndSortCutRecovery ( Sections ,
FileFilter ,
ZeroFilter ,
RotationFilter  )

Read and sort cut recovery position records from the Mach4 profile.

Reads cut recovery data from one or more profile sections (default: CutRecoveryCycleStop and CutRecoveryLostArc). Each record contains position, tool, unit system, line number, G-code line, filename, zero key, and rotation data. Applies optional filters: FileFilter (match current file), ZeroFilter (match current fixture zero key), and RotationFilter (match current G68 rotation). Records passing all active filters are collected and sorted in descending order by timestamp (most recent first). The returned table contains only matching, valid records.

Parameters
Sections(table|string|nil) Profile section name(s) to read. Defaults to both CutRecoveryCycleStop and CutRecoveryLostArc
FileFilter(boolean|nil) If true, only return records matching the currently loaded G-code file. Defaults to true
ZeroFilter(boolean|nil) If true, only return records matching the current fixture zero key. Defaults to true if a zero key exists
RotationFilter(boolean|nil) If true, only return records matching the current G68 rotation. Defaults to true
Returns
(table) Array of matching cut recovery record tables, sorted newest first. Each record contains keys: 'Type', 'Time', 'XPos', 'YPos', 'ZPos', 'APos', 'BPos', 'CPos', 'UnitSystem', 'LineNum', 'GcodeLine', 'FileName', 'Tool', 'ZeroKey', 'Rotation'
Note
Documentation generated by AI on 2026-03-04

◆ GetAxisLetterName()

CommonGUIModule GetAxisLetterName ( AxisID ,
inst  )

Get the letter label for the specified axis, accounting for instance count and rotary configuration.

Returns a formatted axis letter string used next to axes and on homing or zero buttons. If multiple instances are active, prefixes the letter with the instance number (e.g., "0X", "1Z"). When the DefaultAxisLabels OEM parameter is "No", delegates to mc.mcAxisGetLabel() for the label. Otherwise uses default label logic: A/B/C axes return rotary or linear labels based on AXIS_IS_ROTARY_INST, and OB axes (AXIS6 and above) return "OB#" formatted strings. Calls the "GetAxisLetterName" hook first to allow user override.

Parameters
AxisID(number) The axis index constant (e.g., mc.X_AXIS, mc.A_AXIS)
inst(number) The Mach4 instance handle. If not provided, uses current instance
Returns
(string) The axis letter label string (e.g., "X", "1Z", "A", "U", "OB2")
Note
Documentation generated by AI on 2026-03-04

◆ GetAxisShortName()

CommonGUIModule GetAxisShortName ( AxisID ,
inst  )

Get the short display name for the specified axis, accounting for instance count and rotary configuration.

Returns a formatted axis name string used on longer messages describing the axes. If multiple instances are active, prefixes the name with the instance number (e.g., "0X", "1Y"). For A/B/C axes, checks AXIS_IS_ROTARY_INST to determine whether to return the rotary label (A/B/C) or linear label (U/V/W). For OB axes (AXIS6 and above), returns a formatted "OB#" string. Calls the "GetAxisShortName" hook first to allow user override of the returned name.

Parameters
AxisID(number) The axis index constant (e.g., mc.X_AXIS, mc.A_AXIS)
inst(number) The Mach4 instance handle. If not provided, uses current instance
Returns
(string) The short axis name string (e.g., "X", "1Y", "A", "U", "OB1")
Note
Documentation generated by AI on 2026-03-04

◆ GetAxisVelocity()

CommonGUIModule GetAxisVelocity ( AxisID )

Get the current velocity of a single axis for the selected instance.

Reads the axis velocity via mc.mcAxisGetVel() for the selected instance. For non-rotary axes, converts from setup units to current machine units via w.ConvertUnits(). If a moving average filter is configured for the axis (AXIS_VELOCITY_AVERAGE_INST), applies the filter and returns the absolute (directionless) averaged velocity.

Parameters
AxisID(number) The axis identifier (e.g., mc.X_AXIS, mc.Y_AXIS)
Returns
(number) The current axis velocity in current machine units (or degrees/min for rotary)
(boolean) Success flag - true if velocity was read successfully
(string) Status message describing the result
Note
Documentation generated by AI on 2026-03-04

◆ GetBlendedVelocity()

CommonGUIModule GetBlendedVelocity ( )

Calculate the blended (resultant) velocity across all enabled linear axes.

Reads the velocity for each enabled axis via mc.mcAxisGetVel() for the selected instance. For non-rotary axes, converts from setup units to current machine units via w.ConvertFromSetupUnits(). Computes the Euclidean (RMS) magnitude across all contributing axes. If a blended velocity moving average filter is configured (BLENDED_VELOCITY_AVERAGE_INST), applies the filter and returns the absolute averaged value.

Returns
(number) The blended velocity magnitude in current machine units
(boolean) Success flag - always true
(string) Status message describing the result
Note
Documentation generated by AI on 2026-03-04

◆ GetCheckPoint()

CommonGUIModule GetCheckPoint ( name )

Return the module DbgCheckPoint object, creating a new one if it does not exist.

Checks if CommonGUIModule.__chk already exists and returns it if so. If the wrapper module (w) is available, creates a new DbgCheckPoint object via w.DbgCheckPoint:new() using the provided name (or 'Main GUI Module' as the default). Stores the result in CommonGUIModule.__chk for subsequent calls. Returns nil if w is not yet loaded.

Parameters
name(string|nil) Optional name for the checkpoint object. Defaults to 'Main GUI Module'
Returns
(table|nil) The DbgCheckPoint object, or nil if w is not available
Note
Documentation generated by AI on 2026-03-04

References name().

◆ GetCurrentGearRange()

CommonGUIModule GetCurrentGearRange ( )

Get the current spindle gear range from the PLC, register, or profile.

Reads the SpindleGearShifterType OEM parameter. If set to "Auto", calls user.UserGetCurrentGearRange() if defined; otherwise reads the gear range from the SpindleGearShifterRegister OEM parameter signal if mapped, or falls back to reading LastGearRange from the MachMotion profile. For non-Auto types, always reads LastGearRange from the profile. Returns 0 if the result is not a number.

Returns
(number|nil) The current gear range index, or 0 if not determinable
(boolean) Success flag - true if gear range was retrieved successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ GetCurrentTool()

CommonGUIModule GetCurrentTool ( )

Get the current tool number from the PLC, file, or Mach4 tool changer memory.

Reads the ToolChangerMethod OEM parameter to determine how to retrieve the current tool. For "Auto" tool changers, uses CURRENT_TOOL_POCKET_NUMBER_INST to look up the tool by pocket assignment. Handles Lathe control mode, Random Memory ATC, and standard ATC differently. For "Manual" tool changers, reads the current tool from the tool change status file. Validates that the returned tool number is within range (0 to MaxTools). Returns 0 and an error if the tool number cannot be determined.

Returns
(number|nil) The current tool number, or 0 on error
(boolean) Success flag - true if tool number was retrieved successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ GetCurrentToolSetterName()

UI GetCurrentToolSetterName ( )

Get the name of the currently active tool setter from the appropriate OEM register.

Reads the current tool setter name based on the OffsetTypes and FilterToolSetterTypes closure variables. For Fixture offset types, reads ManualSetterFixtureSelection or AutoSetterFixtureSelection. For Tool offset types, reads ManualSetterSelection or AutoSetterSelection via w.GetOEMRegValueString(). Logs errors via w.Error(). This is a closure defined inside CommonGUIModule.ToolSetterSelection().

Returns
(string) The name of the currently active tool setter, or empty string on error
Note
This is a closure defined inside CommonGUIModule.ToolSetterSelection()
Documentation generated by AI on 2026-03-04

◆ GetDefaultSpindleNumber()

CommonGUIModule GetDefaultSpindleNumber ( inst )

Get the default spindle number for the specified Mach4 instance.

Reads the TC_DefaultSpindleNumber OEM parameter via w.eGetOEMParamValue() and returns the configured default spindle number for the instance.

Parameters
inst(number|nil) The Mach4 instance handle. If not provided, uses current instance
Returns
(number) The default spindle number as configured in the TC_DefaultSpindleNumber OEM parameter
Note
Documentation generated by AI on 2026-03-04

◆ GetEndGoToPositionSelection()

UI GetEndGoToPositionSelection ( )

Find the list index of the end GoTo position stored for the selected tool setter.

Searches UI.endgotoposition_choiceChoices for the string matching UI.tool_setters[name].EndGoToPosition. Returns the zero-based index of the matching entry, or 0 if no match is found. This is a closure defined inside CommonGUIModule.CalibrateToolSetters().

Returns
(number) Zero-based index of the matching end GoTo position in the choice list, or 0 if not found
Note
This is a closure defined inside CommonGUIModule.CalibrateToolSetters()
Documentation generated by AI on 2026-03-04

◆ GetFeedrateOverride()

CommonGUIModule GetFeedrateOverride ( )

Get the current feedrate override percentage.

Reads the feedrate override from Mach4 via mc.mcCntlGetFRO() for the selected instance. Returns the raw value as reported by Mach4 (0-100 scale).

Returns
(number) The current feedrate override percentage
Note
Documentation generated by AI on 2026-03-04

◆ GetFileName()

CommonGUIModule JobFile GetFileName ( )

Get the file name (without path) of the currently loaded job file.

Return the file name of a path (the last item in the path, either file or directory).

Returns jb.FileName if it is non-nil, otherwise returns " " (a single space sentinel value indicating no file is loaded).

Returns
(string) The job file name, or " " if no file is loaded
Note
Documentation generated by AI on 2026-03-04

Return the file name of a path including its extension

Resolves the path to an absolute path first, then returns the last component of the path (file or directory name) with any extension intact. Delegates to the FileHelper module.

Parameters
path(string) Full or relative path from which to extract the file name
Returns
(string) The file name of the last path component, including any extension
Note
Documentation generated by AI on 2026-03-03

◆ GetFilePath()

CommonGUIModule JobFile GetFilePath ( )

Get the full file path of the currently loaded job file.

Returns jb.FileNamePath if it is non-nil, otherwise returns " " (a single space sentinel value indicating no file is loaded).

Returns
(string) The full file path, or " " if no file is loaded
Note
Documentation generated by AI on 2026-03-04

◆ GetFileVersion()

CommonGUIModule JobFile GetFileVersion ( )

Read the job file version number from the CSV file header.

Reads the CSV file at jb.FileNamePath and searches each row for a key matching jb.EndOfHeader. When found, returns the corresponding value as a number (the file version). If the end-of-header marker cannot be found, logs a warning and returns 1 (version 1 default).

Returns
(number) The job file version number, or 1 if the version marker is not found
Note
Documentation generated by AI on 2026-03-04

◆ GetGangSpindleCount()

CommonGUIModule GetGangSpindleCount ( )

Get the total number of configured gang spindles for the current instance.

Returns a cached value if available. Otherwise counts gang spindles by iterating from 1 upward and checking whether GangSpindleEngaged OEM parameter signals are mapped and contiguous. Stores the result in both m.__gang_spindle_count and the cache for subsequent calls.

Returns
(number) The total number of configured and mapped gang spindles
Note
Documentation generated by AI on 2026-03-04

◆ GetGangSpindleMaxRPM()

CommonGUIModule GetGangSpindleMaxRPM ( )

Get the maximum RPM for the gang spindle control source.

Returns a cached value if available. If the GangSpindleControlSource OEM parameter is not "Mach", reads the maximum RPM from the GangSpindleControlSourceAuxiliaryMaxRPM OEM parameter. Otherwise reads the motor maximum RPM from Mach via mc.mcSpindleGetMotorMaxRPM(). Caches and returns the result.

Returns
(number) The maximum RPM of the gang spindle control source
Note
Documentation generated by AI on 2026-03-04

◆ GetGoToPositionSelection()

UI GetGoToPositionSelection ( )

Find the list index of the start GoTo position stored for the selected tool setter.

Searches UI.gotoposition_choiceChoices for the string matching UI.tool_setters[name].GoToPosition. Returns the zero-based index of the matching entry, or 0 if no match is found. This is a closure defined inside CommonGUIModule.CalibrateToolSetters().

Returns
(number) Zero-based index of the matching start GoTo position in the choice list, or 0 if not found
Note
This is a closure defined inside CommonGUIModule.CalibrateToolSetters()
Documentation generated by AI on 2026-03-04

◆ GetGreenStackLightState()

CommonGUIModule StackLight GetGreenStackLightState ( )

Get the desired state for the green stack light based on machine state and alarm conditions.

Calls the "UserGetGreenStackLightState" hook to allow user override. If not overridden, the green light is on when neither the red nor yellow light is active. The green light blinks (if GreenBlink is configured) when the machine is in a feed hold, macro hold, retract, or probe feed hold state, or when the machine is idle (mach_state < MC_STATE_FRUN).

Returns
(table) Light control table with keys: 'state' (boolean), 'blink' (boolean), 'active' (boolean)
Note
Documentation generated by AI on 2026-03-04

◆ GetInhibitJoggingWhenNotHomedOverride()

CommonGUIModule GetInhibitJoggingWhenNotHomedOverride ( inst )

Get the current jog inhibit override state for the specified instance.

Retrieves the current value of INHIBIT_JOGGING_WHEN_NOT_HOMED_OVERRIDE_INST for the specified instance (resolved via w.GetUTI()). Returns true if the override is active (jogging allowed even when not homed), false otherwise.

Parameters
inst(number|nil) The Mach4 instance handle. If not provided, uses selected instance
Returns
(boolean) True if the jog-inhibit override is active, false otherwise
Note
Documentation generated by AI on 2026-03-04

◆ GetItemData()

CommonGUIModule Scheduler GetItemData ( )

Retrieve the file path and quantity data for a specific item in the Schedule Editor list control.

Reads column 0 (file path) and column 1 (quantity) from the wxListCtrl (self.UI.m_listCtrl2) at the given zero-based index using wxListItem. Returns empty strings for both values if the index is out of bounds (< 0 or >= item count).

Parameters
index(number) The zero-based index of the item to retrieve
Returns
(number) The index that was passed in
(string) The file path from column 0, or empty string if out of bounds
(string) The quantity from column 1, or empty string if out of bounds
Note
Documentation generated by AI on 2026-03-04

◆ GetLaserPointerOffsetVars()

CommonGUIModule GetLaserPointerOffsetVars ( )

Get the Mach4 pound variable indices used for laser pointer X and Y offsets.

Reads the LaserPointerOffsetType OEM register string. If the value is "Work Shift Offsets", returns mc.SV_WORK_SHIFT_X and mc.SV_WORK_SHIFT_Y. Otherwise defaults to mc.SV_HEAD_SHIFT_X and mc.SV_HEAD_SHIFT_Y. Logs an error via w.FunctionError() if the register read fails.

Returns
(number) The pound variable index for the X axis laser pointer offset
(number) The pound variable index for the Y axis laser pointer offset
Note
Documentation generated by AI on 2026-03-04

◆ GetLastSchedule()

CommonGUIModule Scheduler GetLastSchedule ( )

Load the schedule table with file data from the OEM register for a given instance.

Clears the in-memory schedule via self:ClearSchedule() (with leave_reg=true to preserve the register), then reads the serialized schedule string from the OEM parameter identified by self.FILE_REG. Splits the string by "/" to get individual file entries, then splits each entry by "|" to extract the path and quantity fields. Rebuilds the in-memory schedule table from the parsed data. Delegates the actual work to self:_GetLastSchedule() via w.pcall() for error protection.

Parameters
inst(number) The Mach4 instance handle. If not provided, uses current instance
Note
Documentation generated by AI on 2026-03-04

◆ GetMDIHistoryFilename()

CommonGUIModule GetMDIHistoryFilename ( )

Get the full file path for the MDI history file.

Constructs the MDI history file path using the Mach4 installation directory and the current profile name. The file is located at: MACH_DIRECTORY/Profiles/MACH_PROFILE_NAME/MDIHistory.txt

Returns
(string) The full path to the MDI history text file
Note
Documentation generated by AI on 2026-03-04

◆ GetNote()

CommonGUIModule JobFile GetNote ( )

Retrieve a specific note line from the job file's in-memory notes table.

Looks up jb.FileTable.Notes[tostring(_lineno)] and returns its value. Returns an empty string and raises an error if FileTable or FileTable.Notes is nil.

Parameters
_lineno(number) The 1-based line number of the note to retrieve
Returns
(string) The note text at the specified line number, or empty string if not found
Note
Documentation generated by AI on 2026-03-04

◆ GetNotesCount()

CommonGUIModule JobFile GetNotesCount ( )

Get the number of notes stored in the job file's in-memory notes table.

Calls jb:GetTableRecordCount() on jb.FileTable.Notes to count all entries. Returns "0" (as a string from w.Error) and raises an error if FileTable or FileTable.Notes is nil.

Returns
(number) The count of note entries in jb.FileTable.Notes
Note
Documentation generated by AI on 2026-03-04

◆ GetPositionDisplayUnlocked()

CommonGUIModule GetPositionDisplayUnlocked ( )

Delegate to get whether the position display is unlocked.

This is a deprecated forwarding function. It delegates to CommonGUIModule.screen.GetPositionDisplayUnlocked(). Use CommonGUIModule.screen.GetPositionDisplayUnlocked() in new code.

Returns
(boolean) True if the position display is unlocked, false otherwise
Note
Documentation generated by AI on 2026-03-04

◆ GetPoundVarTable()

CommonGUIModule JobFile GetPoundVarTable ( )

Retrieve the complete pound variable table from the job file's in-memory data.

Returns jb.FileTable.PoundVars directly. Raises an error via w.Error() if FileTable or FileTable.PoundVars is nil.

Returns
(table) The pound variable table with string keys (pound var numbers) and numeric values
Note
Documentation generated by AI on 2026-03-04

◆ GetPoundVarValue()

CommonGUIModule JobFile GetPoundVarValue ( )

Retrieve a pound variable value from the job file's in-memory pound variable table.

Converts _poundvar to a string key and delegates to jb:_GetPoundVarValue(). The internal implementation looks up jb.FileTable.PoundVars[tostring(_poundvar)]. Returns nil and logs a warning if the pound variable is not found in the table. Raises an error if FileTable or FileTable.PoundVars is nil.

Parameters
_poundvar(number|string) The pound variable number to look up
Returns
(number|nil) The stored pound variable value, or nil if not found
Note
Documentation generated by AI on 2026-03-04

◆ GetRawLuaString()

UI GetRawLuaString ( )

Return the raw, unmodified Lua text as typed by the user in the editor.

Calls UI._GetEditorText() which safely handles both wxTextCtrl and wxStyledTextCtrl editor controls. Returns an empty string if neither control is available.

Returns
(string) The raw text content of the Lua script editor
Note
This is a closure defined inside CommonGUIModule.RunLuaScriptFromDialog()
Documentation generated by AI on 2026-03-04

◆ GetRedStackLightState()

CommonGUIModule StackLight GetRedStackLightState ( )

Get the desired state for the red stack light based on alarm and machine enable conditions.

Calls the "UserGetRedStackLightState" hook to allow user override. If not overridden, the red light is on when a GMS alarm is present or the machine is disabled (MACH_ENABLED_INST[self._inst] == false). Blink behavior is enabled when RedBlink is configured and an alarm is active. Always sets light_cntl.active to true.

Returns
(table) Light control table with keys: 'state' (boolean), 'blink' (boolean), 'active' (boolean)
Note
Documentation generated by AI on 2026-03-04

◆ GetRegisterValue()

CommonGUIModule JobFile GetRegisterValue ( )

Retrieve a register value from the job file's in-memory register table.

Looks up _register in jb.FileTable.Registers and returns its stored value. Returns "0" and raises an error if FileTable or FileTable.Registers is nil. Returns an empty string and logs a warning if the register key is not found.

Parameters
_register(string) The register key in "Device/RegisterName" format
Returns
(string) The stored register value, or empty string if not found, or "0" on error
Note
Documentation generated by AI on 2026-03-04

◆ GetRemainingDwellTime()

CommonGUIModule GetRemainingDwellTime ( inst )

Get the remaining dwell time for the current dwell operation.

Reads the dwell target time via m.GetTargetDwellTime() and the current elapsed dwell time via mc.mcCntlGetValue() using mc.VAL_DWELL_TIME_CURRENT. Returns the difference (target - current). Returns 0 if either read fails.

Parameters
inst(number) The Mach4 instance handle. If not provided, uses current instance
Returns
(number) The remaining dwell time in seconds, or 0 on error
Note
Documentation generated by AI on 2026-03-04

◆ GetSchedFiles()

CommonGUIModule Scheduler GetSchedFiles ( )

Read all file entries from the Schedule Editor list control into a formatted table.

Iterates over all items in the wxListCtrl (self.UI.m_listCtrl2) using GetItemCount() and retrieves each item's path and quantity via self:GetItemData(). Returns the collected entries as an array of tables, each with fields 'path' and 'qty'.

Returns
(table) Array of file entry tables, each with fields 'path' (string) and 'qty' (string)
Note
Documentation generated by AI on 2026-03-04

◆ GetSchedule()

CommonGUIModule Scheduler GetSchedule ( )

Get the in-memory schedule table for a given instance.

Returns self.scheduled_files[_inst] where _inst is resolved via w.GetUTI(inst). This is the authoritative in-memory representation of the schedule for the given instance. Delegates the actual work to self:_GetSchedule() via w.pcall() for error protection.

Parameters
inst(number) The Mach4 instance handle. If not provided, uses current instance
Returns
(table) Array of scheduled file entry tables, each with fields 'path' (string) and 'qty' (string|number)
Note
Documentation generated by AI on 2026-03-04

◆ GetSelectedItem()

CommonGUIModule Scheduler GetSelectedItem ( )

Get the item data for the currently selected item in the Schedule Editor list control.

Retrieves the zero-based index of the currently selected item via GetNextItem() with wxLIST_STATE_SELECTED, then delegates to self:GetItemData() to retrieve the item's index, file path, and quantity.

Returns
(number) The zero-based index of the selected item, or -1 if no item is selected
(string) The file path stored in column 0 of the selected item
(string) The quantity stored in column 1 of the selected item
Note
Documentation generated by AI on 2026-03-04

◆ GetSelectedSpindleNumber()

CommonGUIModule GetSelectedSpindleNumber ( inst )

Get the currently selected spindle number for the specified Mach4 instance.

Parameters
inst(number|nil) The Mach4 instance handle. If not provided, uses current instance
Returns
(number) The currently selected spindle number
Note
Documentation generated by AI on 2026-03-04

◆ GetSelectedToolSetter()

UI GetSelectedToolSetter ( )

Get the name of the currently selected tool setter from the setter_list listbox.

If the setter_list UI element is not nil, returns the string selection from it via UI.setter_list:GetStringSelection(). Returns an empty string if the list is nil. This is a closure defined inside CommonGUIModule.CalibrateToolSetters().

Returns
(string) The name of the selected tool setter, or empty string if none selected
Note
This is a closure defined inside CommonGUIModule.CalibrateToolSetters()
Documentation generated by AI on 2026-03-04

If the setter_list UI element is not nil, returns the string selection from it via UI.setter_list:GetStringSelection(). Returns an empty string if the list is nil. This is a closure defined inside CommonGUIModule.ToolSetterSelection().

Returns
(string) The name of the selected tool setter, or empty string if none selected
Note
This is a closure defined inside CommonGUIModule.ToolSetterSelection()
Documentation generated by AI on 2026-03-04

◆ GetSelectedToolSetterIndex()

UI GetSelectedToolSetterIndex ( )

Get the zero-based index of the currently selected item in the setter_list listbox.

Returns the current selection index from the setter_list UI element via UI.setter_list:GetSelection(). This is a closure defined inside CommonGUIModule.CalibrateToolSetters().

Returns
(number) The zero-based index of the currently selected tool setter in the list
Note
This is a closure defined inside CommonGUIModule.CalibrateToolSetters()
Documentation generated by AI on 2026-03-04

Returns the current selection index from the setter_list UI element via UI.setter_list:GetSelection(). This is a closure defined inside CommonGUIModule.ToolSetterSelection().

Returns
(number) The zero-based index of the currently selected tool setter in the list
Note
This is a closure defined inside CommonGUIModule.ToolSetterSelection()
Documentation generated by AI on 2026-03-04

◆ GetSpindleBrakeOutputSignalId()

CommonGUIModule GetSpindleBrakeOutputSignalId ( )

Get the signal ID for the spindle brake output, or -1 if not enabled.

Reads the SpindleBrakeEnabled OEM parameter. If enabled ("Yes"), retrieves the IO signal object for SpindleBrakeOutput via w.GetOEMParamIOSigObject() and returns its sigid. If the spindle brake is not enabled, returns -1.

Returns
(number) The spindle brake output signal ID, or -1 if the feature is not enabled
(boolean) Success flag - always true on normal completion
(string) Status message from w.FunctionCompleted()
Note
Documentation generated by AI on 2026-03-04

◆ GetSpindleOverride()

CommonGUIModule GetSpindleOverride ( )

Get the current spindle override percentage.

Reads the spindle override from Mach4 via mc.mcSpindleGetOverride() for the selected instance. Converts from Mach4's internal representation to a 0-100 percentage scale by multiplying by 100.

Returns
(number) The current spindle override percentage (0-100 scale)
(boolean) Success flag - true if the override was read successfully
(string) Status message describing the result
Note
Documentation generated by AI on 2026-03-04

◆ GetTableRecordCount()

CommonGUIModule JobFile GetTableRecordCount ( )

Count the number of key-value pairs in a table.

Iterates over all keys in the provided table using pairs() and increments a counter for each entry. Works for both array-style and hash-style tables.

Parameters
_table(table) The table whose entries are to be counted
Returns
(number) The total number of key-value pairs in the table
Note
Documentation generated by AI on 2026-03-04

◆ GetTargetDwellTime()

CommonGUIModule GetTargetDwellTime ( inst )

Get the target dwell time for the current dwell operation.

Reads the dwell target time via mc.mcCntlGetValue() using mc.VAL_DWELL_TIME_TARGET on axis 0. Returns 0 if the read fails.

Parameters
inst(number) The Mach4 instance handle. If not provided, uses current instance
Returns
(number) The target dwell time in seconds, or 0 on error
Note
Documentation generated by AI on 2026-03-04

◆ GetTopFile()

CommonGUIModule Scheduler GetTopFile ( )

Return the file path of the first (top) entry in the schedule for a given instance.

Reads self:GetSchedule(inst)[1].path if the schedule is non-empty. Returns an empty string if the schedule is empty. Delegates the actual work to self:_GetTopFile() via w.pcall() for error protection.

Parameters
inst(number) The Mach4 instance handle. If not provided, uses current instance
Returns
(string) The file path of the top scheduled entry, or empty string if the schedule is empty
Note
Documentation generated by AI on 2026-03-04

◆ GetWhiteStackLightState()

CommonGUIModule StackLight GetWhiteStackLightState ( )

Get the desired state for the white stack light based on machine state transitions.

Calls the "UserGetWhiteStackLightState" hook to allow user override. If not overridden, activates the white light (light_cntl.active = true) only when the machine transitions away from MC_STATE_IDLE (i.e., OLD_MACH_STATE_INST was IDLE and current mach_state is not IDLE). State and blink are always set to false. Returns a light control table.

Returns
(table) Light control table with keys: 'state' (boolean), 'blink' (boolean), 'active' (boolean)
Note
Documentation generated by AI on 2026-03-04

◆ GetYellowStackLightState()

CommonGUIModule StackLight GetYellowStackLightState ( )

Get the desired state for the yellow stack light based on warning conditions and machine state.

Calls the "UserGetYellowStackLightState" hook to allow user override. If not overridden, the yellow light is active when a GMS warning is present and the red light is not already on. The warning flag is also forced true when the machine is in a macro hold or macro hold jog state (MC_STATE_FRUN_MACROH, MC_STATE_FRUN_MACROH_JOG, MC_STATE_MRUN_MACROH, MC_STATE_MRUN_MACROH_JOG). Blink behavior is controlled by the YellowBlink OEM parameter.

Returns
(table) Light control table with keys: 'state' (boolean), 'blink' (boolean), 'active' (boolean)
Note
Documentation generated by AI on 2026-03-04

◆ GoToLastLostCut()

CommonGUIModule GoToLastLostCut ( )

Move to the position of the most recent lost cut or cycle stop event.

Retrieves the sorted list of cut recovery positions via CommonGUIModule.GetAndSortCutRecovery(). If a recovery position exists, adjusts the X and Y positions to account for any difference between the tool active when the cut was lost and the current tool (using tool offset and wear data). Converts the stored positions to the unit system that was active when the positions were captured, then delegates to CommonGUIModule.GoToLine() to perform a dry run and reposition. If no recovery position exists, goes to the current G-code line number via GoToLine().

Returns
(nil|boolean) Result from CommonGUIModule.GoToLine()
(boolean) Success flag - true if repositioning completed successfully
(string) Status message describing the result
Note
Documentation generated by AI on 2026-03-04

◆ GoToLine()

CommonGUIModule GoToLine ( LineNumber ,
IsMachineCoords ,
X ,
Y ,
Z ,
A ,
B ,
C ,
Tag  )

Move the machine to a specified G-code line number using a dry run.

--------------------— GoToLine -----------------------------------—

Performs a dry run to the specified line number to calculate axis positions, then repositions the machine to those coordinates. If cutter compensation (G41/G42) is active, cancels it via MDI before the dry run and restores it after repositioning. If no explicit axis positions are provided, reads them from the G-code interpreter via mc.mcCntlGcodeInterpGetPos(). If the tool number at the target line differs from the current tool, commands a tool change (or displays a notice for manual tool changers). Displays PleaseWaitDialogs during the dry run calculation. An optional Tag string can be prepended to the repositioning MDI command.

Parameters
LineNumber(number) The G-code line number to move to
IsMachineCoords(boolean) If true, positions are treated as machine coordinates (G53)
X(number|nil) Target X position. If nil, uses interpreter position
Y(number|nil) Target Y position. If nil, uses interpreter position
Z(number|nil) Target Z position. If nil, uses interpreter position
A(number|nil) Target A position. If nil, uses interpreter position
B(number|nil) Target B position. If nil, uses interpreter position
C(number|nil) Target C position. If nil, uses interpreter position
Tag(string|nil) Optional G-code string to prepend to the repositioning move command
Returns
(nil|boolean) Result from w.MDICommand(), or nil on error
(boolean) Success flag - true if operation completed successfully
(string) Status message from w.FunctionError() or w.MDICommand()
Note
Documentation generated by AI on 2026-03-04

◆ GoToPositionDialogBtn()

CommonGUIModule GoToPositionDialogBtn ( )

Open the GoTo Positions dialog allowing the operator to select and move to a named position.

Guards against opening while a feed hold retract is active or the dialog is already open (GOTO_POSITION_MODE > 0). Requests a cycle start hold via w.RequestCycleStartHold(). Checks manual mode. Reads configured GoTo position names via w.GetConfiguredGoToPositionNames(); if none are configured, returns an error. Builds a radio-box dialog with all position names and a Cancel button. A timer polls for cycle start release; on confirmation, posts m.MoveToGoToPosition() to the file queue.

Returns
(nil) No meaningful primary return value
(boolean) Success flag - false if dialog could not be opened due to preconditions
(string) Status message from w.FunctionError() on failure
Note
Documentation generated by AI on 2026-03-04

◆ GoToSelectedLine()

CommonGUIModule SearchGCode GoToSelectedLine ( )

Navigate to the G-code line selected in the GCode Search grid.

Retrieves the array of selected rows from the grid. If at least one row is selected, reads the line number from column 0 of the first selected row and calls CommonGUIModule.GoToLine() with that line number.

Note
Documentation generated by AI on 2026-03-04

◆ HandleMachMessages()

CommonGUIModule HandleMachMessages ( inst ,
msg_type ,
param1 ,
param2  )

Dispatch incoming Mach4 messages to all registered callback functions.

Looks up the registered message handlers in CommonGUIModule.MachMsg["Registered"] for the given instance and message type. For MSG_REG_CHANGED and MSG_IO_CHANGED, uses param1 as a handle key to find registered callbacks. For MSG_GCODE_VAR_CHANGED and MSG_PARAMETER_CHANGED, uses param1 as the pound variable or parameter key. Invokes each matching callback via w.pcall() with the message arguments. Logs errors via w.FunctionError() if any callback raises an exception.

Parameters
inst(number) The Mach4 instance handle
msg_type(number) The Mach4 message type constant (e.g., mc.MSG_REG_CHANGED)
param1(number|string) First message parameter (register handle, IO handle, or pound var index)
param2(number|string) Second message parameter (new value or state)
Note
Documentation generated by AI on 2026-03-04

◆ HasEdits()

CommonGUIModule JobFile HasEdits ( )

Check whether the current Mach4 state differs from the values stored in the job file.

Compares all pound variables in jb.RangeString against jb.FileTable.PoundVars and all registers in jb.RegTable against jb.FileTable.Registers. Returns true as soon as any discrepancy is detected (pound variable difference > 0.000001 or register string mismatch). Returns false if all values match. Raises an error if any mc.mcCntlGetPoundVar() call fails.

Returns
(boolean) True if any pound variable or register value has changed from the stored job file values
Note
Documentation generated by AI on 2026-03-04

◆ HasFileLoaded()

CommonGUIModule JobFile HasFileLoaded ( )

Check whether a job file is currently loaded.

Returns true if jb.FileName is non-nil and not equal to the sentinel value " " (a single space), which indicates no file is loaded.

Returns
(boolean) True if a job file is loaded, false otherwise
Note
Documentation generated by AI on 2026-03-04

◆ HideMachMenu()

CommonGUIModule HideMachMenu ( )

Hide the Mach4 menu bar and persist the setting to the profile.

Calls scr.ShowMenu(false) to hide the menu and writes HideMachMenu=1 to the MachMotion profile section so the setting persists across restarts.

Note
Documentation generated by AI on 2026-03-04

◆ HomeABtn()

CommonGUIModule HomeABtn ( )

Button handler to home the A axis.

Delegates to CommonGUIModule.HomeAxis() with mc.A_AXIS and a confirmation flag based on whether commands are being pretended to come from operator panels.

Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the homing operation completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ HomeAll()

CommonGUIModule HomeAll ( confirm_homing ,
only_dereferenced_axes ,
inst_list  )

Home all axes on one or more Mach4 instances with full precondition checks and hook support.

Iterates over the provided instance list and verifies each instance is in IDLE state and enabled before proceeding. Adjusts home order for axes with absolute encoders (sets home order to 0 if already homed). Optionally presents a CycleStartDialog for operator confirmation. Runs HomeAllStart and HomeSafety hook scripts. Checks for active limit switches and home switch validity via m.CheckHomeSwitchesForHoming(). Calls the motion controller's PreHoming() method. If only_dereferenced_axes is true, builds a bitmask of unhomed axes and calls mc.mcAxisHomeAllEx(); otherwise calls mc.mcAxisHomeAll(). Calls user.UserHomeAll() if defined. After homing, calls m.AutoEnableSoftlimits(), m.WaitForHoming(), m.HomeOverrideAxes(), and the motion controller's PostHoming() method. Restores home order for absolute encoder axes and runs the HomeAllEnd hook.

Parameters
confirm_homing(boolean|nil) If true, presents a confirmation dialog before homing. Defaults based on operator panel mode
only_dereferenced_axes(boolean|nil) If true, only homes axes that are not currently homed. Defaults to false
inst_list(number|table|nil) Instance or list of instances to home. If not provided, homes all instances
Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if homing completed successfully for all instances
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Warning
Machine must be in IDLE state and enabled on all target instances before calling
Note
Documentation generated by AI on 2026-03-04

◆ HomeAllBtn()

CommonGUIModule HomeAllBtn ( )

Button handler to home all axes using the configured HomeAllBtnOptions parameter.

Logs the button press via w.OperatorLog(). Reads the HomeAllBtnOptions OEM parameter string to determine the homing scope. If "Home All Instances", calls m.HomeAll() for all instances. If "Home Selected Instance", calls m.HomeAllSelectedInstance() for the selected instance only. If the parameter is invalid, raises an error via w.Error(). The confirmation flag is derived from w.PretendCommandsAreFromOperatorPanels().

Returns
(nil) No meaningful primary return value - returns nothing explicitly on success
Note
Documentation generated by AI on 2026-03-04

◆ HomeAllDereferencedAxes()

CommonGUIModule HomeAllDereferencedAxes ( confirm_homing ,
selected_inst  )

Home all dereferenced (unhomed) axes only, with optional confirmation.

Delegates to CommonGUIModule.HomeAll() with the only_dereferenced_axes flag set to true, passing through the confirm_homing and selected_inst parameters.

Parameters
confirm_homing(boolean|nil) If true, presents a confirmation dialog before homing
selected_inst(number|nil) The instance to home. If not provided, homes all instances
Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if homing completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ HomeAllSelectedInstance()

CommonGUIModule HomeAllSelectedInstance ( confirm_homing ,
only_dereferenced_axes  )

Home all axes on the currently selected Mach4 instance with optional confirmation.

Logs the button press via w.OperatorLog(). Retrieves the currently selected instance via w.GetSelectedInstance() and delegates to CommonGUIModule.HomeAll() with the selected instance, passing through the confirm_homing and only_dereferenced_axes flags.

Parameters
confirm_homing(boolean|nil) If true, presents a confirmation dialog before homing
only_dereferenced_axes(boolean|nil) If true, only homes axes that are not currently homed
Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if homing completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ HomeAxis()

CommonGUIModule HomeAxis ( AxisID ,
use_confirmation  )

Home a single axis with optional confirmation dialog and comprehensive precondition checks.

Logs the operation via w.OperatorLog() and updates stop status. Verifies the machine is in IDLE state and enabled before proceeding. If the axis has no motors mapped or has an absolute encoder and is already homed, displays a warning and returns early. If use_confirmation is not false, presents a CycleStartDialog requiring the operator to confirm. Runs HomeSafety, PreHomeAxisStart, and axis-specific hook scripts. Calls user.UserHome{Axis}() if defined; otherwise calls mc.mcAxisHome(). After homing, calls m.AutoEnableSoftlimits(), CommonGUIModule.WaitForHoming(), m.HomeOverrideAxes(), and the motion controller's PostHoming() method. Runs HomeAxisEnd and axis-specific end hook scripts on completion.

Parameters
AxisID(number) The axis identifier to home (e.g., mc.X_AXIS, mc.Z_AXIS, mc.AXIS6)
use_confirmation(boolean|nil) If false, skips the cycle start confirmation dialog. Defaults to true
Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if homing completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Warning
Machine must be in IDLE state and enabled before calling this function
Note
Documentation generated by AI on 2026-03-04

◆ HomeBBtn()

CommonGUIModule HomeBBtn ( )

Button handler to home the B axis.

Delegates to CommonGUIModule.HomeAxis() with mc.B_AXIS and a confirmation flag based on whether commands are being pretended to come from operator panels.

Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the homing operation completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ HomeCBtn()

CommonGUIModule HomeCBtn ( )

Button handler to home the C axis.

Delegates to CommonGUIModule.HomeAxis() with mc.C_AXIS and a confirmation flag based on whether commands are being pretended to come from operator panels.

Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the homing operation completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ HomeOB1Btn()

CommonGUIModule HomeOB1Btn ( )

Button handler to home the OB1 (AXIS6) axis.

Delegates to CommonGUIModule.HomeAxis() with mc.AXIS6 and a confirmation flag based on whether commands are being pretended to come from operator panels.

Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the homing operation completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ HomeOB2Btn()

CommonGUIModule HomeOB2Btn ( )

Button handler to home the OB2 (AXIS7) axis.

Delegates to CommonGUIModule.HomeAxis() with mc.AXIS7 and a confirmation flag based on whether commands are being pretended to come from operator panels.

Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the homing operation completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ HomeOB3Btn()

CommonGUIModule HomeOB3Btn ( )

Button handler to home the OB3 (AXIS8) axis.

Delegates to CommonGUIModule.HomeAxis() with mc.AXIS8 and a confirmation flag based on whether commands are being pretended to come from operator panels.

Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the homing operation completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ HomeOB4Btn()

CommonGUIModule HomeOB4Btn ( )

Button handler to home the OB4 (AXIS9) axis.

Delegates to CommonGUIModule.HomeAxis() with mc.AXIS9 and a confirmation flag based on whether commands are being pretended to come from operator panels.

Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the homing operation completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ HomeOB5Btn()

CommonGUIModule HomeOB5Btn ( )

Button handler to home the OB5 (AXIS10) axis.

Delegates to CommonGUIModule.HomeAxis() with mc.AXIS10 and a confirmation flag based on whether commands are being pretended to come from operator panels.

Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the homing operation completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ HomeOB6Btn()

CommonGUIModule HomeOB6Btn ( )

Button handler to home the OB6 (AXIS11) axis.

Delegates to CommonGUIModule.HomeAxis() with mc.AXIS11 and a confirmation flag based on whether commands are being pretended to come from operator panels.

Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the homing operation completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ HomeOverrideAxes()

CommonGUIModule HomeOverrideAxes ( main_axis ,
inst  )

Home override (OB/secondary) axes associated with the specified primary axis.

Reads all configured operator panel profile sections via w.GetConfiguredOperatorPanels(). For each panel, looks up the secondary axis mapping for the given main_axis via mc.mcProfileGetInt(). If main_axis is -1, iterates all primary axes (X through C) and homes any mapped OB axes (AXIS6 through AXIS11) that are enabled, skipping duplicates. If main_axis is a specific axis, homes only its mapped OB axis. Calls m.HomeAxis() for each identified secondary axis with use_confirmation set to false.

Parameters
main_axis(number) The primary axis whose secondary OB axis should be homed, or -1 to home all secondary axes
inst(number) The Mach4 instance handle. If not provided, uses current instance
Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if all override axes were homed successfully
(string) Status message describing the outcome
Note
Documentation generated by AI on 2026-03-04

◆ HomeXBtn()

CommonGUIModule HomeXBtn ( )

Button handler to home the X axis.

Delegates to CommonGUIModule.HomeAxis() with mc.X_AXIS and a confirmation flag based on whether commands are being pretended to come from operator panels.

Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the homing operation completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ HomeYBtn()

CommonGUIModule HomeYBtn ( )

Button handler to home the Y axis.

Delegates to CommonGUIModule.HomeAxis() with mc.Y_AXIS and a confirmation flag based on whether commands are being pretended to come from operator panels.

Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the homing operation completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ HomeZBtn()

CommonGUIModule HomeZBtn ( )

Button handler to home the Z axis.

Delegates to CommonGUIModule.HomeAxis() with mc.Z_AXIS and a confirmation flag based on whether commands are being pretended to come from operator panels.

Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the homing operation completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ IncludeCommentsInMessages()

CommonGUIModule IncludeCommentsInMessages ( on_off )

Enable or disable inclusion of G-code comments in message output.

Writes a 1 to the Preferences/CommentsInMessages profile key if on_off is true, or a 0 if on_off is false, via mc.mcProfileWriteInt(). This setting controls whether parenthetical G-code comments are shown in the operator message area during program execution.

Parameters
on_off(boolean) True to include comments in messages, false to suppress them
Note
Documentation generated by AI on 2026-03-04

◆ InhibitJoggingWhenNotHomed()

CommonGUIModule InhibitJoggingWhenNotHomed ( )

Update jogging inhibit state for all instances based on homing status.

Only active when the InhibitJoggingWhenNotHomed OEM parameter is "Yes". For each instance, checks the jog inhibit override via CommonGUIModule.GetInhibitJoggingWhenNotHomedOverride() and verifies all axes are homed via w.VerifyAllAxesAreHomedCached(). If any axis is unhomed and the override is not active, inhibits jogging on all axes via w.InhibitJogOnAllAxes() and sets the INHIBIT_JOGGING_WHEN_NOT_HOMED_INST flag. If all axes are homed or the override is active, releases the inhibit via w.ReleaseInhibitJogOnAllAxes() and clears the flag.

Note
Documentation generated by AI on 2026-03-04

◆ InhibitJoggingWhenNotHomedOverrideToggle()

CommonGUIModule InhibitJoggingWhenNotHomedOverrideToggle ( inst )

Toggle the jog inhibit override state for the specified instance.

Reads the current override state via CommonGUIModule.GetInhibitJoggingWhenNotHomedOverride() and sets it to the opposite value via CommonGUIModule.SetInhibitJoggingWhenNotHomedOverride().

Parameters
inst(number|nil) The Mach4 instance handle. If not provided, uses selected instance
Note
Documentation generated by AI on 2026-03-04

◆ Initialize() [1/2]

UI Initialize ( )

Populate the tool setter list and pre-select the currently configured setter.

Populate the tool setter selection list and pre-select the currently active setter.

Retrieves all configured tool setters via w.GetAllToolSetters() and appends each setter name to the setter_list listbox. Sets the list selection to the last item and calls UI.OnToolSetterListSelected() to populate the detail fields for the selected setter. This is a closure defined inside CommonGUIModule.CalibrateToolSetters().

Note
This is a closure defined inside CommonGUIModule.CalibrateToolSetters()
Documentation generated by AI on 2026-03-04

Retrieves the current tool setter name via UI.GetCurrentToolSetterName(). Loads either all manual or all auto tool setters (depending on FilterToolSetterTypes) via w.GetAllManualToolSetters() or w.GetAllAutoToolSetters(). Appends each setter name to the setter_list listbox, tracking which entry matches the current setter name. Sets the list selection to the matching entry and calls UI.OnToolSetterListSelected() to sync the register. This is a closure defined inside CommonGUIModule.ToolSetterSelection().

Note
This is a closure defined inside CommonGUIModule.ToolSetterSelection()
Documentation generated by AI on 2026-03-04

◆ Initialize() [2/2]

CommonGUIModule SearchGCode Initialize ( inst )

Initialize the GCode Search object, read the loaded file, and open the search dialog.

Clears the internal gcode_tbl, calls ReadLoadedFile() to populate it from the specified file, then calls CreateSearchDialog() to display the search UI.

Parameters
file_name(string) The full path to the G-code file to search
inst(number) The Mach4 instance handle. If not provided, uses selected instance
Note
Documentation generated by AI on 2026-03-04

◆ InitializeAllModules()

CommonGUIModule InitializeAllModules ( )

Initialize all hardware interface module objects for all Mach4 instances.

Performs the following initialization steps for each Mach4 instance:

  • Creates a MotionController interface object via MotionController.Create() and stores it in m.MotionController[_inst]
  • Creates a BarcodeRS232 scanner interface object via BarcodeRS232.new() and stores it in m.BarcodeScannerRs232[_inst]
  • Creates all configured VFD objects via VFD.CreateVFDs() and stores the result in m.all_vfds; attempts to clear VFD alarms on success
  • Creates all ReciprocatingAxis control objects via recip.CreateAll() and stores them in m.ReciprocatingAxes
  • Runs the "InitializeModules" hooks via m.RunHooks() All steps use w.pcall() for error protection. Creation failures are reported via w.wxMessageBox().
    Note
    Documentation generated by AI on 2026-03-04

◆ InitializeEnabledAxes()

CommonGUIModule InitializeEnabledAxes ( GCodeParameterNumber )

Write the enabled axis configuration to a G-code parameter bit field.

Iterates over all axes from mc.X_AXIS to mc.MC_MAX_AXES - 1. For each axis, reads the AXIS_ENABLED_INST table for the selected instance and sets the corresponding bit in the specified G-code parameter number to 1 (enabled) or 0 (disabled) via w.SetParameterBit().

Parameters
GCodeParameterNumber(number) The G-code pound variable number to store the bit field in
Note
Documentation generated by AI on 2026-03-04

◆ InitializeGrid()

CommonGUIModule SearchGCode InitializeGrid ( )

Set default settings and column labels for the GCode Search grid.

Sets the default cell alignment to center, assigns column labels ("Line Number" and "GCode Line"), and marks both cells in the first row as read-only.

Note
Documentation generated by AI on 2026-03-04

◆ InitializeMachMenu()

CommonGUIModule InitializeMachMenu ( )

Initialize the Mach4 menu bar visibility based on the saved profile setting.

Reads the 'HideMachMenu' profile key from the MachMotion section. If the value is 0, shows the menu; otherwise hides it.

Note
Typically called once during module initialization to restore saved menu state
Documentation generated by AI on 2026-03-04

◆ InitializeRotaryAxesFeedrateMode()

CommonGUIModule InitializeRotaryAxesFeedrateMode ( )

Initialize the feedrate mode for all configured rotary axes from OEM parameters.

Iterates over the rotary axis range (A through C) for the selected instance. For each axis that is configured as rotary (AXIS_IS_ROTARY_INST), reads the corresponding Axis{N}RotaryFeedrateMode OEM parameter string. Sets the feedrate mode to 1 if the parameter equals "Constant Surface Speed", or 0 otherwise, via m.SetRotaryAxisFeedrateMode().

Note
Documentation generated by AI on 2026-03-04

◆ InitializeSelectedSpindle()

CommonGUIModule InitializeSelectedSpindle ( inst )

Initialize the selected spindle to the configured default spindle number.

Reads the default spindle number via m.GetDefaultSpindleNumber() and sets it as the selected spindle via m.SetSelectedSpindleNumber(). Called during screen initialization to ensure the spindle selection starts at the configured default.

Parameters
inst(number|nil) The Mach4 instance handle. If not provided, uses current instance
Note
Documentation generated by AI on 2026-03-04

◆ InitializeSpindleRanges()

CommonGUIModule InitializeSpindleRanges ( )

Initialize the spindle gear range for all Mach4 instances from the PLC or profile.

Saves the current instance via w.StoreInstance(). Iterates over all instances and for each calls m.GetCurrentGearRange() to read the gear range from the PLC or profile. If the range is valid, sets it via mc.mcSpindleSetRange(). Restores the original instance via w.RestoreInstance() after completion.

Note
Documentation generated by AI on 2026-03-04

◆ InitializeToolPathZoomLimits()

CommonGUIModule InitializeToolPathZoomLimits ( )

Initialize the tool path zoom limits from OEM parameters.

Reads the 'ToolPathZoomLimitMax' and 'ToolPathZoomLimitMin' OEM parameter values and applies them to the Mach4 controller via mc.mcCntlSetValue() using the VAL_ZOOM_MIN and VAL_ZOOM_MAX value types on the X axis.

Returns
(nil) No meaningful return value on success
(boolean) Success flag - true if limits were set successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ InitializeTools()

CommonGUIModule InitializeTools ( )

Initialize tool and pocket tracking for all Mach4 instances on startup.

Iterates over all instances. For each idle instance, reads the current tool pocket via w.GetCurrentToolPocket() and calls w.SetCurrentToolPocket() to update the pocket register. Reads the current tool via m.GetCurrentTool() and, if valid, calls w.SetCurrentTool() to set the active tool. Updates the Mach4 pound variables SV_CUR_TOOL_NUMBER and SV_CUR_LENGTH_INDEX to reflect the current tool. Saves and restores the active instance via w.StoreInstance() and w.RestoreInstance().

Note
Documentation generated by AI on 2026-03-04

◆ InitializeWorkLight()

CommonGUIModule InitializeWorkLight ( )

Initialize the work light feature and restore its previous on/off state.

Checks if the work light feature is enabled via m.IsWorkLightEnabled(). If enabled, adds the WorkLightOutput signal to the ignore lists for disable, stop, and emergency stop events via w.AddOEMParamSignalToOutputIgnoreList(). Reads the WorkLightWasOn OEM parameter; if it equals 1, calls m.WorkLightOn() to restore the light to its previous on state.

Note
Documentation generated by AI on 2026-03-04

◆ InsertFiles()

CommonGUIModule Scheduler InsertFiles ( )

Insert an array of file entries into the Schedule Editor list control.

Iterates over the provided files table and appends each entry to the wxListCtrl (self.UI.m_listCtrl2). If an entry has a 'path' field, inserts it with its 'qty' value in column 1; otherwise treats the entry itself as a plain file path string and sets quantity to "1". Does nothing if files is nil.

Parameters
files(table) Array of file entries; each entry is either a plain file path string or a table with fields 'path' (string) and 'qty' (string|number)
Note
Documentation generated by AI on 2026-03-04

◆ InstallerUpdateModule()

CommonGUIModule InstallerUpdateModule ( )

Run the installer update module script if the MachMotion build number has changed.

Compares the LastRunMachMotionBuild value stored in the profile against the current revision from w.GetVersionInfo("revision"). If the stored build is less than the current revision and InstallerUpdateModule.mcs exists, loads and runs the module's RunUpdateModule() function. If the build matches and the file exists, deletes the update script. Always updates the LastRunBuild value in the profile to the current revision.

Returns
(nil) No meaningful return value on success
(boolean) Success flag - true if operation completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ IsAxisHomed()

CommonGUIModule IsAxisHomed ( AxisID ,
IgnoreSaftyCheck ,
inst  )

Check whether a specific axis is homed - delegates to the wrapper module implementation.

This function was moved to the wrapper module. Calls w.IsAxisHomed() with all provided arguments and returns the result.

Parameters
AxisID(number) The axis identifier to check (e.g., mc.X_AXIS)
IgnoreSaftyCheck(boolean|nil) If true, skips the safety interlock check
inst(number|nil) The Mach4 instance handle. If not provided, uses current instance
Returns
(boolean) True if the specified axis is homed, false otherwise
(boolean) Success flag - true if the check completed without errors
(string) Status message from w.FunctionCompleted() or w.FunctionError()
See also
w.IsAxisHomed() for the full implementation
Note
Documentation generated by AI on 2026-03-04

◆ IsAxisHoming()

CommonGUIModule IsAxisHoming ( AxisID )

Check whether a specific axis is currently in the process of homing.

Calls mc.mcAxisIsHoming() for the current instance and the specified axis ID. If the API call returns an error code, returns nil, false, and an error message. Otherwise returns true if the axis is homing (rc == 1), false if not.

Parameters
AxisID(number) The axis identifier to check (e.g., mc.X_AXIS)
Returns
(boolean|nil) True if the axis is currently homing, false if not, nil on error
(boolean) Success flag - false if the API call returned an error
(string) Status message from w.FunctionError() on failure
Note
Documentation generated by AI on 2026-03-04

◆ IsAxisJogging()

CommonGUIModule IsAxisJogging ( Axis )

Check whether the specified axis is currently jogging.

Parameters
Axis(number) The axis index to check (0-based, e.g., mc.X_AXIS)
Returns
(boolean) True if the axis is actively jogging, false otherwise
Note
Documentation generated by AI on 2026-03-04

◆ IsAxisRotary()

CommonGUIModule IsAxisRotary ( AxisID ,
inst  )

Check whether a specified axis is configured as a rotary axis.

Runs registered hooks via m.RunHooks("IsAxisRotary", AxisID, inst). If hooks return false for the continue flag (a == false), returns the hook-provided rotary value directly. Otherwise delegates to w.IsAxisRotary() for the standard rotary axis check. Results are also cached in the AXIS_IS_ROTARY global array.

Parameters
AxisID(number) The axis identifier to check (e.g., mc.X_AXIS, mc.A_AXIS)
inst(number) The Mach4 instance handle. If not provided, uses current instance
Returns
(boolean) True if the axis is a rotary axis, false otherwise
Note
Documentation generated by AI on 2026-03-04

◆ IsCannedReciprocatingAxisRunning()

CommonGUIModule IsCannedReciprocatingAxisRunning ( axis_id )

Check whether a canned reciprocating axis cycle is currently running.

Parameters
axis_id(number) The axis identifier for the reciprocating axis to query
Returns
(boolean) True if the reciprocating axis cycle is running, false otherwise
Note
Documentation generated by AI on 2026-03-04

◆ IsCapturingToolPathMousePositions()

CommonGUIModule IsCapturingToolPathMousePositions ( )

Check whether the tool path panel is currently capturing mouse positions.

Iterates over all tool path panel names in TP_PANEL_NAMES (initializing the list via m.screen.GetToolPathPanelNames() if not already set). For each panel, reads the "MouseCapture Mode" property via h.GetObject(). Returns true as soon as any panel is found with capture mode set to "1". Returns false if no panels are capturing.

Returns
(boolean) True if any tool path panel has mouse capture mode active, false otherwise
Note
Documentation generated by AI on 2026-03-04

◆ IsCurrentTool()

CommonGUIModule IsCurrentTool ( toolIndex ,
inst  )

Check whether the specified tool index matches the currently loaded tool.

Parameters
toolIndex(number) The tool number to compare against the current tool
inst(number|nil) The Mach4 instance handle. If not provided, uses selected instance
Returns
(boolean) True if the specified tool index matches the current tool number, false otherwise
Note
Documentation generated by AI on 2026-03-04

◆ IsCutterCompensationType_A()

CommonGUIModule IsCutterCompensationType_A ( )

Check whether cutter compensation type A is currently enabled.

Reads the PV_CCT_BIT_SUP bit (bit 0) from the PV_CCT parameter (5003) via w.GetParameterBitCached(). Returns true if the bit value is 0 (type A enabled), false otherwise. Initializes PV_CCT_BIT_SUP and PV_CCT to their default values if they are nil.

Returns
(boolean) True if cutter compensation type A is enabled, false otherwise
Note
Documentation generated by AI on 2026-03-04

◆ IsCutterCompensationType_B()

CommonGUIModule IsCutterCompensationType_B ( )

Check whether cutter compensation type B is currently enabled.

Reads the PV_CCT_BIT_SUP bit (bit 0) from the PV_CCT parameter (5003) via w.GetParameterBitCached(). Returns true if the bit value is 1 (type B enabled), false otherwise. Initializes PV_CCT_BIT_SUP and PV_CCT to their default values if they are nil.

Returns
(boolean) True if cutter compensation type B is enabled, false otherwise
Note
Documentation generated by AI on 2026-03-04

◆ IsCutterCompensationType_C()

CommonGUIModule IsCutterCompensationType_C ( )

Check whether cutter compensation type C is currently enabled.

Reads the PV_CCT_BIT_SUV bit (bit 1) from the PV_CCT parameter (5003) via w.GetParameterBitCached(). Returns true if the bit value is 1 (type C enabled), false otherwise. Initializes PV_CCT_BIT_SUV and PV_CCT to their default values if they are nil.

Returns
(boolean) True if cutter compensation type C is enabled, false otherwise
Note
Documentation generated by AI on 2026-03-04

◆ IsDoorInterlockActive()

CommonGUIModule IsDoorInterlockActive ( )

Check whether the door interlock is currently active.

Reads the DoorSwitchInterlockEnabled OEM parameter. If the interlock is not enabled, returns false immediately. If enabled, reads the DoorSwitchInterlockActive OEM register and returns true if its value equals 1, false otherwise.

Returns
(boolean) True if the door interlock is currently active, false if inactive or not enabled
(boolean) Success flag - true if operation completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ IsDryRunOn()

CommonGUIModule IsDryRunOn ( )

Check whether dry run mode is currently active for the selected instance.

Reads the DryRun OEM parameter string via w.eGetOEMParamValueString() for the selected instance. Returns true if the value equals "Yes", false otherwise.

Returns
(boolean) True if dry run mode is active, false otherwise
Note
Documentation generated by AI on 2026-03-04

◆ IsFeedHoldRetract()

CommonGUIModule IsFeedHoldRetract ( )

Check whether the feed hold retract output signal is currently active.

Reads the OSIG_RETRACT output signal state via w.GetSignalState() for the current instance. Returns true if the retract signal is active, false otherwise.

Returns
(boolean) True if feed hold retract is currently active, false otherwise
Note
Documentation generated by AI on 2026-03-04

◆ IsFileResumeActive()

CommonGUIModule IsFileResumeActive ( )

Check whether a file resume or run-from-here operation is currently active.

Reads the mm_RunFromHereDialog register via w.GetRegValue() and the FileResumeIsActive OEM parameter via w.eGetOEMParamValue(). Returns true if either value is non-zero, indicating that a file resume or run-from-here dialog is currently in progress.

Returns
(boolean) True if a file resume or run-from-here operation is active, false otherwise
Note
Documentation generated by AI on 2026-03-04

◆ IsFixtureOffset()

CommonGUIModule IsFixtureOffset ( fixture )

Check whether the specified fixture offset index is currently active.

Compares the provided fixture index against the ACTIVE_FIXTURE_OFFSET_INDEX_INST global for the currently selected instance. Returns true if they match, false otherwise.

Parameters
fixture(number) The fixture offset index to compare against the active fixture
Returns
(boolean) True if the specified fixture index is the currently active fixture, false otherwise
Note
Documentation generated by AI on 2026-03-04

◆ IsFloodOn()

CommonGUIModule IsFloodOn ( )

Check whether the flood coolant output is currently active.

Reads the OSIG_COOLANTON output signal state via w.GetSignalState() for the selected instance. Returns true if flood coolant is on, false otherwise.

Returns
(boolean) True if flood coolant is active, false otherwise
Note
Documentation generated by AI on 2026-03-04

◆ IsGangSpindleControlSourceCommandTypeRPM()

CommonGUIModule IsGangSpindleControlSourceCommandTypeRPM ( )

Check whether the gang spindle control source command type is RPM.

Returns a cached value if available. Otherwise reads the GangSpindleControlSourceCommandType OEM parameter string. Returns true if the value equals "RPM", false otherwise. Caches the result for subsequent calls via w.SetCache().

Returns
(boolean) True if the gang spindle command type is RPM, false if it is percentage or another type
Note
Documentation generated by AI on 2026-03-04

◆ IsGangSpindleEnabled()

CommonGUIModule IsGangSpindleEnabled ( )

Check whether the gang spindle feature is enabled.

Returns a cached value if available. Otherwise reads the GangSpindleEnabled OEM parameter string. Returns true if the value equals "Yes", false otherwise. Logs errors via w.Error() if the parameter cannot be read. Caches the result via w.SetCache() for subsequent calls.

Returns
(boolean) True if gang spindles are enabled, false otherwise
Note
Documentation generated by AI on 2026-03-04

◆ IsGangSpindleEngaged()

CommonGUIModule IsGangSpindleEngaged ( idx )

Check whether a specific gang spindle index is currently engaged.

Checks if the GangSpindleEngaged OEM parameter signal is mapped for the given index. If mapped, reads and returns the signal state via w.GetOEMParamSig(). If not mapped, returns true (assuming the spindle is always engaged when no engagement signal is configured).

Parameters
idx(number) The 1-based gang spindle index to check
Returns
(boolean) True if the spindle is engaged or no engagement signal is mapped, false otherwise
Note
Documentation generated by AI on 2026-03-04

◆ IsGangSpindleInGroup()

CommonGUIModule IsGangSpindleInGroup ( idx )

Check whether a gang spindle at the given index is part of an active group.

Returns a cached result if available. Otherwise checks whether any of the three OEM parameter signals (GangSpindleCommandRPMRegister, GangSpindleForwardSig, GangSpindleReverseSig) are mapped for the given index. If in a group, also checks whether the spindle is currently engaged via m.IsGangSpindleEngaged(). Caches the in-group result for subsequent calls.

Parameters
idx(number) The 1-based gang spindle index to check
Returns
(boolean) True if the spindle is in a configured group and currently engaged, false otherwise
Note
Documentation generated by AI on 2026-03-04

◆ IsGCodeFileRepeatEnabled()

CommonGUIModule IsGCodeFileRepeatEnabled ( )

Check whether the G-code file repeat feature is enabled in OEM parameters.

Reads the OEM parameter 'GCodeFileRepeatEnabled' for the current instance. Result is cached using w.SetCache() so subsequent calls avoid re-reading the parameter.

Returns
(boolean) True if GCodeFileRepeatEnabled OEM parameter equals "Yes", false otherwise
Note
Result is cached per instance; cache key is "GCodeFileRepeatEnabled"
Documentation generated by AI on 2026-03-04

◆ IsGCodeFileRepeatOn()

CommonGUIModule IsGCodeFileRepeatOn ( )

Check whether the G-code file repeat mode is currently active.

Reads the OEM parameter 'GCodeFileRepeatActive' for the current instance and returns true if it equals 1. Returns false immediately if G-code file repeat is not enabled.

Returns
(boolean) True if G-code file repeat is currently active, false otherwise
Note
Documentation generated by AI on 2026-03-04

◆ IsHomeSwitchActive()

CommonGUIModule IsHomeSwitchActive ( homing_axis ,
inst  )

Check whether any home switch (or a specific axis home switch) is currently active.

Thin wrapper that delegates directly to w.IsHomeSwitchActive(). Returns the same values as the underlying wrapper function.

Parameters
homing_axis(number|nil) The axis index to check, or nil to check all axes
inst(number) The Mach4 instance handle. If not provided, uses current instance
Returns
(boolean) True if the specified (or any) home switch is active
(number|nil) The axis ID of the active home switch, or nil if none
(string) Status message describing the result
Note
Documentation generated by AI on 2026-03-04

◆ IsJogModeContinuous()

CommonGUIModule IsJogModeContinuous ( )

Check whether the current jog mode is continuous.

Returns
(boolean) True if continuous jog mode is active (JOG_MODE_CONT == true), false otherwise
Note
Documentation generated by AI on 2026-03-04

◆ IsJogModeIncremental()

CommonGUIModule IsJogModeIncremental ( )

Check whether the current jog mode is incremental.

Returns
(boolean) True if incremental jog mode is active (JOG_MODE_INC == true), false otherwise
Note
Documentation generated by AI on 2026-03-04

◆ IsLaserPointerOn()

CommonGUIModule IsLaserPointerOn ( )

Check whether the laser pointer output signal is currently active.

If the LaserPointerOutput OEM parameter signal is mapped, reads its current state via w.GetOEMParamSig(). Returns false if the signal is not mapped or if it is inactive.

Returns
(boolean) True if the laser pointer output signal is active, false otherwise
Note
Documentation generated by AI on 2026-03-04

◆ IsLimitSwitchActive()

CommonGUIModule IsLimitSwitchActive ( inst )

Check whether any limit switch is currently active.

Thin wrapper that delegates directly to w.IsLimitSwitchActive(). Returns the same value as the underlying wrapper function.

Parameters
inst(number) The Mach4 instance handle. If not provided, uses current instance
Returns
(boolean) True if any limit switch is currently active, false otherwise
Note
Documentation generated by AI on 2026-03-04

◆ IsM00Active()

CommonGUIModule IsM00Active ( inst )

Check whether a program stop (M00) is currently active at the current G-code line.

Reads the current G-code line number via mc.mcCntlGetGcodeLineNbr(). If m.M00LineNumber is nil or the current line has not advanced past the M00 line, returns false. Otherwise reads the OptionalStopActive OEM register and returns true if its value equals 1.

Parameters
inst(number) The Mach4 instance handle. If not provided, uses current instance
Returns
(boolean) True if an M00 stop is currently active at or past the recorded line, false otherwise
(boolean|nil) Success flag - false if the register read failed
(string|nil) Status message from w.FunctionError() on failure, nil on success
Note
Documentation generated by AI on 2026-03-04

◆ IsMachEnabled()

CommonGUIModule IsMachEnabled ( inst )

Check whether the machine is currently enabled and update global enable state variables.

For each Mach4 instance, reads the OSIG_MACHINE_ENABLED output signal state via w.GetSignalState() and stores the result in MACH_ENABLED_INST. Also updates the MACH_ENABLED global with the state of instance 0. Returns the enabled state for the resolved instance index.

Parameters
inst(number) The Mach4 instance handle. If not provided, uses current instance
Returns
(boolean) True if the specified instance is currently enabled, false otherwise
Note
Documentation generated by AI on 2026-03-04

◆ IsMistOn()

CommonGUIModule IsMistOn ( )

Check whether the mist coolant output is currently active.

Reads the OSIG_MISTON output signal state via w.GetSignalState() for the current instance. Returns true if mist coolant is on, false otherwise.

Returns
(boolean) True if mist coolant is active, false otherwise
Note
Documentation generated by AI on 2026-03-04

◆ IsMotionInhibitActive()

CommonGUIModule IsMotionInhibitActive ( )

Check whether the motion inhibit signal is currently active.

First checks if the motion inhibit feature is enabled via m.IsMotionInhibitEnabled(). If enabled, reads the ISIG_MOTION_INHIBIT signal state via w.GetSignalState() and returns it. If the feature is not enabled, returns false.

Returns
(boolean) True if motion inhibit is currently active, false if inactive or feature is disabled
Note
Documentation generated by AI on 2026-03-04

◆ IsMotionInhibitEnabled()

CommonGUIModule IsMotionInhibitEnabled ( )

Check whether the motion inhibit interlock feature is configured and enabled.

Reads the MotionInhibitInterlockEnabled OEM parameter string via w.GetOEMParamValueString(). Returns true only if the parameter equals "Yes" AND the MotionInhibitInterlockInput OEM parameter signal is mapped via w.IsOEMParamSigMapped().

Returns
(boolean) True if motion inhibit is enabled and the input signal is mapped, false otherwise
(string|nil) Error message from w.FunctionError() if the parameter read failed
Note
Documentation generated by AI on 2026-03-04

◆ IsMSTAndDryRunActive()

CommonGUIModule IsMSTAndDryRunActive ( )

Check whether MST lock or dry run is active and prompt the operator to confirm cycle start.

Reads the ConfirmationDialogs OEM parameter. If the current G-code line number is >= 1 and single block is on, returns true immediately (allows continuation). Otherwise, if ConfirmationDialogs is "Yes", reads the MSTLock and DryRun OEM registers. If either is active, builds a warning message string and presents a CycleStartDialog asking the operator to confirm. Returns the operator's response as the continue flag.

Returns
(boolean) True if cycle start should continue, false if the operator canceled
(boolean) Success flag - true if the check completed without errors
(string) Status message describing the result
Note
Documentation generated by AI on 2026-03-04

◆ IsMSTLockOn()

CommonGUIModule IsMSTLockOn ( )

Check whether the M-S-T lock is currently active for the selected instance.

Reads the MSTLock OEM register string via w.GetOEMRegValueString() for the selected instance. Returns true if the value equals "Yes", false otherwise.

Returns
(boolean) True if M-S-T lock is active, false otherwise
Note
Documentation generated by AI on 2026-03-04

◆ IsOptionalStopOn()

CommonGUIModule IsOptionalStopOn ( )

Check whether the optional stop (M1) feature is currently enabled.

Reads the optional stop state via mc.mcCntlGetOptionalStop() for the current instance. Returns true if the value equals 1 (enabled), false otherwise.

Returns
(boolean) True if optional stop is enabled, false otherwise
Note
Documentation generated by AI on 2026-03-04

◆ IsPartCounterQuotaReached()

CommonGUIModule IsPartCounterQuotaReached ( )

Check whether the required part counter quota has been reached.

Reads the current parts-produced count via w.GetParameter(mc.PV_PRTSA) and the required parts count via w.GetParameter(mc.PV_PRTSN). If the required count is greater than zero and the current count is greater than or equal to the required count, returns true.

Returns
(boolean) True if the required part quota has been reached, false otherwise
(boolean) Success flag - always true
(string) Status message from w.FunctionCompleted()
Note
Documentation generated by AI on 2026-03-04

◆ IsProfiling()

CommonGUIModule _LuaProfiling IsProfiling ( )

Check whether the Lua profiler is currently active.

Returns
(boolean) True if StartProfiler() has been called successfully and profiling is active, false otherwise
Note
Documentation generated by AI on 2026-03-04

◆ IsRotaryAxisFeedrateModeConstantSurfaceSpeed()

CommonGUIModule IsRotaryAxisFeedrateModeConstantSurfaceSpeed ( axis_id )

Check whether a rotary axis feedrate mode is set to Constant Surface Speed.

Reads the VAL_AXIS_VALTYPE value for the specified axis via mc.mcCntlGetValue() for the selected instance. Returns true if the value equals 1 (Constant Surface Speed mode), false otherwise.

Parameters
axis_id(number) The axis identifier to check (typically mc.A_AXIS through mc.C_AXIS)
Returns
(boolean) True if the axis feedrate mode is Constant Surface Speed, false otherwise
Note
Documentation generated by AI on 2026-03-04

◆ IsSafetyRelayCleared()

CommonGUIModule IsSafetyRelayCleared ( )

Check whether the safety relay circuit is currently in the cleared (OK) state.

If the SafetyRelayOKInput OEM parameter signal is mapped via w.IsOEMParamSigMapped(), reads its current state via w.GetOEMParamSig() and returns it. If the signal is not mapped, returns true (assumes cleared by default).

Returns
(boolean) True if the safety relay is cleared (OK), false if the relay has not reset
Note
Documentation generated by AI on 2026-03-04

◆ IsSchedulerActive()

CommonGUIModule IsSchedulerActive ( inst )

Check whether the file scheduler is currently active.

Reads the OEM parameter register identified by CommonGUIModule.Scheduler.SCHED_STATE for the given instance. Returns true if the value equals 1, false otherwise.

Parameters
inst(number) The Mach4 instance handle. If not provided, uses current instance
Returns
(boolean) True if the scheduler is active, false if inactive
Note
Documentation generated by AI on 2026-03-04

◆ IsSelectedSpindleNumber()

CommonGUIModule IsSelectedSpindleNumber ( inst ,
spindle  )

Check whether the specified spindle number is currently selected for the given instance.

Parameters
inst(number|nil) The Mach4 instance handle. If not provided, uses current instance
spindle(number) The spindle number to compare against the currently selected spindle
Returns
(boolean) True if the specified spindle number matches the currently selected spindle, false otherwise
Note
Documentation generated by AI on 2026-03-04

◆ IsSingleBlockOn()

CommonGUIModule IsSingleBlockOn ( inst )

Check whether single block mode is currently active for the specified instance.

Reads the OSIG_SINGLE_BLOCK output signal state via w.GetSignalState() for the specified instance. Returns true if single block is active, false otherwise.

Parameters
inst(number) The Mach4 instance handle. If not provided, uses selected instance
Returns
(boolean) True if single block mode is active, false otherwise
Note
Documentation generated by AI on 2026-03-04

◆ IsSpindleOn()

CommonGUIModule IsSpindleOn ( inst )

Check whether the spindle is currently running in any direction.

Reads the spindle direction via mc.mcSpindleGetDirection() for the selected instance. Returns true if the spindle direction is non-zero (i.e., forward or reverse), false if stopped.

Parameters
inst(number) The Mach4 instance handle. If not provided, uses selected instance
Returns
(boolean) True if the spindle is running (forward or reverse), false if stopped
Note
Documentation generated by AI on 2026-03-04

◆ IsSpindleOriented()

CommonGUIModule IsSpindleOriented ( )

Check whether the spindle is currently in the oriented position.

Reads the SpindleOrientCurrentState OEM register via w.GetOEMRegValue(). Returns true if the value equals 1, false otherwise.

Returns
(boolean) True if the spindle is oriented, false otherwise
Note
Documentation generated by AI on 2026-03-04

◆ IsSpindleOrientedBtn()

CommonGUIModule IsSpindleOrientedBtn ( )

Get the spindle orient state for use by a button indicator, including blink behavior.

Reads the SpindleOrientCurrentState OEM register. Returns true if the state is 1 (fully oriented), the value of BLINK_OBJECT_ACTIVE if the state is 2 (orienting in progress), or false if the state is any other value.

Returns
(boolean) True if spindle is oriented, BLINK_OBJECT_ACTIVE if orienting, false otherwise
Note
Documentation generated by AI on 2026-03-04

◆ IsSpindleWarmUpNeeded()

CommonGUIModule IsSpindleWarmUpNeeded ( )

Check whether a spindle warm-up is currently needed.

Reads the SpindleWarmUpEnabled OEM parameter string from the cache via w.eGetOEMParamValueStringCached(). Returns true if the SpindleWarmUpNeeded OEM parameter equals 1 and the SpindleWarmUpEnabled parameter equals "Yes", false otherwise.

Returns
(boolean) True if spindle warm-up is required and the feature is enabled, false otherwise
Note
Documentation generated by AI on 2026-03-04

◆ IsStepIntoSubPrograms()

CommonGUIModule IsStepIntoSubPrograms ( )

Check whether step-into sub-programs mode is currently active.

Reads the PV_CM1_SMB_BIT bit from the PV_CM1 Mach4 parameter via w.GetParameterBitCached(). Returns true if the bit value is 1 (step-into enabled), false otherwise.

Returns
(boolean) True if step-into sub-programs mode is active, false if step-over mode is active
Note
Documentation generated by AI on 2026-03-04

◆ IsSubSpindleEnabled()

CommonGUIModule IsSubSpindleEnabled ( inst )

Check whether the sub-spindle feature is enabled for the specified instance.

Uses the object cache (w.IsCached / w.GetCache / w.SetCache) keyed by "IsSubSpindleEnabled" and the untagged instance index to avoid repeated OEM register reads. On a cache miss, reads the SubSpindleEnabled OEM register string for the given instance and returns true if the value is "Yes".

Parameters
inst(number) The Mach4 instance handle. If not provided, uses the selected instance
Returns
(boolean) True if the sub-spindle is enabled for the specified instance, false otherwise
Note
Documentation generated by AI on 2026-03-04

◆ IsSubSpindleOn()

CommonGUIModule IsSubSpindleOn ( )

Check whether the sub-spindle is currently running in either direction.

If the sub-spindle is not enabled for the selected instance, returns false immediately. Otherwise reads the SubSpindleCW and SubSpindleCCW OEM parameter signals. Returns true if either signal is active, false if both are inactive.

Returns
(boolean) True if the sub-spindle is currently running (CW or CCW), false otherwise
Note
Documentation generated by AI on 2026-03-04

◆ IsToolSizeEntryDiameterMode()

CommonGUIModule IsToolSizeEntryDiameterMode ( mode )

Check if the tool size entry mode is configured for diameter mode.

Reads the ToolSizeEntryMode OEM parameter and returns true if the value is "diameter" (case-insensitive). If the parameter cannot be read, returns true as diameter is the default mode.

Parameters
mode(string|nil) Unused parameter, accepted for compatibility
Returns
(boolean) True if tool size entry mode is "diameter", false if "radius" or other value
Note
Documentation generated by AI on 2026-03-04

◆ IsWorkLightEnabled()

CommonGUIModule IsWorkLightEnabled ( )

Check whether the work light output signal is mapped and the feature is enabled.

Checks if the WorkLightOutput OEM parameter signal is mapped via w.IsOEMParamSigMapped(). Returns true if the signal is mapped (indicating the work light feature is configured), false otherwise.

Returns
(boolean) True if the work light feature is enabled (signal is mapped), false otherwise
Note
Documentation generated by AI on 2026-03-04

◆ IsWorkLightOn()

CommonGUIModule IsWorkLightOn ( )

Check whether the work light output signal is currently active.

First checks if the work light feature is enabled via m.IsWorkLightEnabled(). If enabled, reads the WorkLightOutput OEM parameter signal state via w.GetOEMParamSig() and returns it. If the feature is not enabled, returns false.

Returns
(boolean) True if the work light is on, false if it is off or the feature is not enabled
Note
Documentation generated by AI on 2026-03-04

◆ JogOffHomeSwitchDialog()

CommonGUIModule JogOffHomeSwitchDialog ( homing_axis ,
inst  )

Display a modal dialog allowing the operator to jog an axis off its home switch.

Validates the homing_axis parameter (clamped to valid axis range). Checks whether any home switch is active via m.IsHomeSwitchActive(). If DIALOG_IS_OPEN[4] is already true, returns an error to prevent duplicate dialogs. Creates a dialog with Jog+/Jog- buttons, a jog rate slider, a limit override button, and an OK button. A timer (100ms) monitors the home switch state, updates button colors, and enables/disables controls based on switch activity. The dialog closes when all switches are inactive and the operator presses OK.

Parameters
homing_axis(number|nil) The axis index to monitor, or nil to monitor all axes
inst(number) The Mach4 instance handle. If not provided, uses current instance
Returns
(nil) No meaningful return value on success
(boolean) False with error message if dialog is already open
(string) Status message from w.FunctionError() on failure
Warning
This function blocks execution until the operator closes the dialog
Note
Documentation generated by AI on 2026-03-04

◆ JogToolMagazineToNearestPocket()

CommonGUIModule JogToolMagazineToNearestPocket ( pocket_increment ,
spindle ,
inst  )

Move the tool magazine to the nearest pocket, optionally advancing by one pocket increment.

Guards against re-entrant calls using the JogToolMagazineActive flag. Calls m._JogToolMagazineToNearestPocket() via w.pcall() for error protection. Resets JogToolMagazineActive to false after completion. If the protected call fails, logs the error via w.FunctionError().

Parameters
pocket_increment(number) Direction to move: 1 for next pocket, -1 for previous pocket, 0 to stay at nearest
spindle(number|nil) The spindle index to use for pocket configuration. Defaults to selected spindle
inst(number|nil) The Mach4 instance handle. If not provided, uses current instance
Note
Documentation generated by AI on 2026-03-04

◆ JogToolMagazineToNextPocket()

CommonGUIModule JogToolMagazineToNextPocket ( spindle )

Jog the tool magazine to the next pocket position.

Logs the button press via w.OperatorLog() and delegates to m.JogToolMagazineToNearestPocket() with a pocket increment of +1 to move to the next pocket.

Parameters
spindle(number|nil) The spindle index to use for pocket configuration
Note
Documentation generated by AI on 2026-03-04

◆ JogToolMagazineToPreviousPocket()

CommonGUIModule JogToolMagazineToPreviousPocket ( spindle )

Jog the tool magazine to the previous pocket position.

Logs the button press via w.OperatorLog() and delegates to m.JogToolMagazineToNearestPocket() with a pocket increment of -1 to move to the previous pocket.

Parameters
spindle(number|nil) The spindle index to use for pocket configuration
Note
Documentation generated by AI on 2026-03-04

◆ LaserPointerCycleStartCheck()

CommonGUIModule LaserPointerCycleStartCheck ( )

Check if the laser pointer is active before cycle start and prompt the operator to confirm.

If the laser pointer is currently on (m.IsLaserPointerOn() returns true), displays a CycleStartDialog warning the operator that the laser pointer shifts X and Y offsets and asks them to confirm before continuing. If the operator cancels, returns a failure status. If the laser pointer is off, returns success immediately.

Returns
(nil) No meaningful primary return value
(boolean) False with error message if the operator cancels, true otherwise
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ LaserPointerInitialize()

CommonGUIModule LaserPointerInitialize ( )

Initialize the laser pointer by adding its output signal to the ignore lists.

If the LaserPointerOutput OEM parameter signal is mapped, calls w.AddOEMParamSignalToOutputIgnoreList() to register it in the IgnoreOutputsOnDisable, IgnoreOutputsOnStop, and IgnoreOutputsOnEmergencyStop ignore lists so the laser pointer output is not automatically cleared on those events.

Note
Documentation generated by AI on 2026-03-04

◆ LaserPointerOff()

CommonGUIModule LaserPointerOff ( )

Turn the laser pointer output signal off and reset the laser pointer offsets.

Calls m.ResetLaserPointerOffset() to zero out the X and Y offset pound variables. Then sets the LaserPointerOutput OEM parameter signal to false via w.SetOEMParamSig(). Logs an error via w.FunctionError() if the signal write fails.

Note
Documentation generated by AI on 2026-03-04

◆ LaserPointerOn()

CommonGUIModule LaserPointerOn ( )

Turn the laser pointer output signal on and apply the stored laser pointer offsets.

If the LaserPointerOutput OEM parameter signal is mapped, calls m.SetLaserPointerOffset() to apply the stored X and Y offsets to the corresponding pound variables, then sets the LaserPointerOutput OEM parameter signal to true via w.SetOEMParamSig(). Logs an error via w.FunctionError() if the signal write fails.

Note
Documentation generated by AI on 2026-03-04

◆ LaserPointerToggle()

CommonGUIModule LaserPointerToggle ( )

Toggle the laser pointer between on and off states.

If the laser pointer is currently on (m.IsLaserPointerOn() returns true), calls m.LaserPointerOff() to turn it off. Otherwise calls m.LaserPointerOn() to turn it on.

Note
Documentation generated by AI on 2026-03-04

◆ LimitOverrideToggle()

CommonGUIModule LimitOverrideToggle ( )

Toggle the limit override signal on or off with password protection.

Logs the button press via w.OperatorLog(). Requires password level 2 via m.screen.CheckPassword(). If the OSIG_LIMITOVER signal is currently false, sets it to true. Otherwise sets it to false. This allows the operator to temporarily override hardware limit switches to jog an axis off a limit.

Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the toggle completed successfully
(string) Status message from w.FunctionCompleted()
Warning
Overriding limit switches can allow motion beyond safe travel limits. Use with caution.
Note
Documentation generated by AI on 2026-03-04

◆ Load()

CommonGUIModule JobFile Load ( )

Open a file browser dialog and return the selected G-code file paths for scheduling.

Load a job file from the specified file path and write its data to Mach4.

Shows a multi-file wxFileDialog for the user to select one or more G-code files. If the user confirms the dialog, returns the selected file paths. If the user cancels, logs a cancellation message and returns -1.

Returns
(table|number) Array of selected file paths, or -1 if the user cancelled
Note
Documentation generated by AI on 2026-03-04

Checks whether the file exists via w.FileExists(). If it exists, sets jb.FileNamePath and jb.FileName and calls jb:WriteDataToMach() to apply the file's values. If the file does not exist, resets the file path and name to the sentinel value " ". Updates the JobFiles register with the current file name if jb.JobName is set.

Parameters
FilePath(string) The full path to the job file CSV to load
Note
Documentation generated by AI on 2026-03-04

◆ LoadAllModules()

CommonGUIModule LoadAllModules ( )

Load and initialize all required Lua modules for the CommonGUIModule screen environment.

Configures package.path and package.cpath to include all standard module directories (Modules, Addons, profile Macros/Scripts). Then loads modules in this order: int18n (with language catalog setup), WrapperModule (fatal if missing), GUIModule, ModbusModule, GCodeModule, GCACaller, lfs, winapi, LuaFileQueue, MotionController, VFD, ReciprocatingAxis, BarcodeRS232. Also loads optional modules: UserGUIModuleLoader, UserGUIModule, UserAuxModule (merged into user), LaserMeasureModule, MotionFilterModule, DataCollector, BridgeInterface, AzureLabelModule, ToolInfo, and version info. Runs the "LoadModules" hook and updates the ZeroBrane API maps.

Warning
WrapperModule is critical - a load failure displays a fatal error dialog and aborts loading.
Note
Documentation generated by AI on 2026-03-04

◆ LoadConversational()

CommonGUIModule LoadConversational ( )

Open the conversational (mill wizard) dialog by setting the trigger register.

Sets the MachMotion register "mm_MillWizardDialog" to 1 via w.SetRegValue(), which signals the MachMotion plugin to open the conversational programming dialog.

Returns
(nil) No meaningful primary return value
(boolean) Success flag - always true
(string) Status message from w.FunctionCompleted()
Note
Documentation generated by AI on 2026-03-04

◆ loader_handler()

loader_handler ( err )

Error handler for module loading that appends a stack traceback to the error message.

Formats a combined error string containing the original error message and the full Lua stack traceback from debug.traceback(). Used as the error handler in xpcall() calls during module loading so that load failures provide actionable context information.

Parameters
err(string) The error message from the failed module load
Returns
(string) Formatted error string containing the original error and stack traceback
Note
Documentation generated by AI on 2026-03-04

◆ LoadGCode()

CommonGUIModule LoadGCode ( GcodeFileName )

Load a G-code file into the current Mach4 instance if it is not already loaded.

Compares GcodeFileName against the currently loaded G-code file via mc.mcCntlGetGcodeFileName(). If the file differs and exists on disk, loads it via w.LoadGCodeFile(), then runs ProcessGcodeHeaderParameters() and UserProcessGcodeHeaderParameters() if they are defined. After loading, rewinds the file via mc.mcCntlRewindFile() to handle files that finish inside a subroutine.

Parameters
GcodeFileName(string) Full path to the G-code file to load
Returns
(nil) No meaningful primary return value
(boolean) Success flag - always true on normal completion
(string) Status message from w.FunctionCompleted()
Note
Documentation generated by AI on 2026-03-04

◆ LoadNextSheduledFile()

CommonGUIModule LoadNextSheduledFile ( inst )

Load the next file in the schedule after the current G-code file finishes running.

Checks whether the scheduler is active via m.IsSchedulerActive(). If active, waits for the machine to reach MC_STATE_IDLE using w.WaitOnCondition() with a PleaseWaitDialog. Once idle, advances the schedule by calling m.Scheduler:PopSchedule().

Parameters
inst(number) The Mach4 instance handle. If not provided, uses current instance
Returns
(nil|boolean) Returns nil on success, false with error message on wait failure
(boolean) Success flag - true if operation completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ LoadNotes()

UI LoadNotes ( )

Build the full notes string from the job file's in-memory notes table.

Reads notes from jb via jb:GetNotesCount() and jb:GetNote(). Returns an empty string if there are no notes. Otherwise, concatenates each note line with newline separators; the first line has no leading newline.

Returns
(string) The complete notes text as a single newline-separated string, or empty string if no notes
Note
This is a closure defined inside CommonGUIModule._NotesDialog()
Documentation generated by AI on 2026-03-04

◆ loadrequire()

CommonGUIModule loadrequire ( modulename ,
PrintError  )

Attempt to require a Lua module by name with optional error dialog on failure.

---------------—MODULE REQUIRE----------------—

Uses pcall() to safely call require() for the named module. If require() fails and PrintError is true, displays a warning message box via w.wxMessageBox() informing the user that the module could not be loaded. Silent failure occurs when PrintError is false.

Parameters
modulename(string) The name of the Lua module to require
PrintError(boolean) If true, displays a message box when the module fails to load
Note
Documentation generated by AI on 2026-03-04

◆ MachineCoordToggleBtn()

CommonGUIModule MachineCoordToggleBtn ( )

Toggle the machine coordinate display mode on or off.

Logs the button press (implicitly via caller). If the OSIG_MACHINE_CORD signal is currently false, sets it to true via w.SetSignalState(). Otherwise sets it to false. This controls whether the DRO displays machine coordinates or work coordinates.

Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the toggle completed successfully
(string) Status message from w.FunctionCompleted()
Note
Documentation generated by AI on 2026-03-04

◆ MachineLockToggleBtn()

CommonGUIModule MachineLockToggleBtn ( )

Button handler placeholder for machine lock toggle.

Logs the button press via w.OperatorLog() and returns a successful completion status. This function is a placeholder stub - the machine lock feature is not fully implemented.

Returns
(nil) No meaningful primary return value
(boolean) Success flag - always true
(string) Status message from w.FunctionCompleted()
Note
Documentation generated by AI on 2026-03-04

◆ MachMenuDialog()

CommonGUIModule MachMenuDialog ( )

Open the Mach menu configuration dialog.

Displays a modal-style dialog allowing the operator to show or hide the Mach4 menu bar and configure whether it is hidden on startup. Only opens if the machine is in IDLE state; otherwise shows a warning message. Includes Show Menu, Hide Menu, and Hide Menu On Startup toggle controls. Uses a timer to close automatically when Mach begins shutting down.

Warning
Can only be opened when the machine state is mc.MC_STATE_IDLE
Note
Documentation generated by AI on 2026-03-04

◆ ManagePartZeros()

CommonGUIModule ManagePartZeros ( )

Record the current fixture offsets to the profile as a rolling history of up to 10 entries.

Reads the current X, Y, Z, A, B, C origin offset pound variables (SV_ORIGIN_OFFSET_*) and the current G-code file name. Reads up to 10 previously saved part zero entries from the MachMotion profile section. Compares the new offsets against the most recent saved entry; if they differ, inserts the new entry at the front of the history and writes all entries back to the profile (PartZero{i}Axis{j}, PartZeroKey{i}, PartZeroFile{i}).

Note
This function is called automatically by SaveFixtureOffsets() to maintain the history
Documentation generated by AI on 2026-03-04

◆ ManualMode()

CommonGUIModule ManualMode ( Active )

Activate or deactivate manual mode for the current Mach4 instance.

Reads the ManualModeEnabled OEM parameter and ManualModeAxis OEM parameter to determine if the feature is supported. Checks via m.MotionController[_inst]:SupportsManualModeFeature() whether the motion controller supports manual mode.

When activating (Active == true): Verifies the machine is enabled and idle. Calls the motion controller's SetManualModeOn() method. Sets the ManualModeActive register to 1. Enables manual mode on each axis bit specified by ManualModeAxis. Displays a persistent "Manual Mode Active" warning.

When deactivating (Active == false): Waits for blended velocity to drop below 1 unit. Calls the motion controller's SetManualModeOff() method. Disables manual mode on each axis. Sets ManualModeActive to 0. Closes the warning notification.

Parameters
Active(boolean) True to activate manual mode, false to deactivate it
Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the operation completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Warning
Machine must be enabled and idle before activating manual mode
Deactivating manual mode blocks until blended velocity drops below 1 unit/min
Note
Documentation generated by AI on 2026-03-04

◆ ManualModeIsActive()

CommonGUIModule ManualModeIsActive ( AutoMessage )

Check whether manual mode is currently active and optionally display a warning.

Reads the ManualModeActive OEM register via w.GetOEMRegValue(). If manual mode is active (value == 1) and AutoMessage is true, displays a warning message via CommonGUIModule.SetWarningMessage() and logs the error via w.FunctionError(). Returns true as the first value if manual mode is active, false otherwise.

Parameters
AutoMessage(boolean) If true, automatically displays a warning message when manual mode is active
Returns
(boolean) True if manual mode is active, false otherwise
(boolean) Success flag - true if the check completed without errors
(string) Status message describing the manual mode state
Note
Documentation generated by AI on 2026-03-04

◆ ManualModeToggle()

CommonGUIModule ManualModeToggle ( )

Toggle manual mode on or off based on the current ManualModeActive register state.

Logs the button press via w.OperatorLog(). Reads the ManualModeActive OEM register via w.GetOEMRegValue(). If the register value is 0, calls CommonGUIModule.ManualMode(true) to activate manual mode. Otherwise calls CommonGUIModule.ManualMode(false) to deactivate it.

Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the toggle completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ ManualToolChangeDialog()

CommonGUIModule ManualToolChangeDialog ( tool_number ,
auto_tc_override ,
inst  )

Display the manual tool change dialog prompting the operator to install the requested tool.

Shows a dialog instructing the operator to install the specified tool number (with optional description) and press Cycle Start to continue. The dialog background turns green for normal tool changes and neon blue for auto-tool-changer override step 1. If auto_tc_override is non-zero, hides the Z offset checkbox and modifies the displayed instructions based on the override step (1=remove current tool, 2=install new tool, 3=remove and install). A timer closes the dialog automatically when the machine leaves macro-hold states or Mach shuts down. On close, sends the Z offset checkbox value across a register via w.SendTableAcrossRegister() for the M-code to read.

Parameters
tool_number(number) The tool number the operator must install
auto_tc_override(number|nil) Auto tool changer override step: 0=normal, 1=remove only, 2=install only, 3=remove+install. Defaults to 0
inst(number) The Mach4 instance handle. If not provided, uses current instance
Warning
Intended to be called from within a macro-hold state (M-code chunk). Dialog closes automatically on state change.
Note
Documentation generated by AI on 2026-03-04

◆ MDIBtn()

CommonGUIModule MDIBtn ( )

Button handler to execute MDI (Manual Data Input) G-code from the MDI input field.

Logs the MDI start action via w.OperatorLog(). Runs registered hooks via m.RunHooks("MDIStart"). Checks for active GMS alarms and warnings via w.GetGMSAlarms() and w.GetGMSWarnings(); if either is active, displays a warning message and returns. Checks manual mode via m.ManualModeIsActive(). If all preconditions pass, delegates to m.screen.ExecuteMDI() to execute the MDI command.

Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the MDI command was executed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ MDIDialog()

CommonGUIModule MDIDialog ( )

Open the MDI (Manual Data Input) command dialog.

Delegates to CommonGUIModule._MDIDialog() via w.pcall() for error protection. The underlying implementation creates a dialog with a multi-line G-code editor, history navigation controls (up/down arrow buttons), and a timer that closes the dialog automatically when Mach shuts down. If the dialog is already open, calling this function closes it instead. Also runs "MDIDialog" hooks which can cancel the dialog opening.

Note
If a feed hold retract is active, the dialog will not open
See also
CommonGUIModule._MDIDialog() for the full implementation
Note
Documentation generated by AI on 2026-03-04

◆ MistOff()

CommonGUIModule MistOff ( )

Turn off the mist coolant output for the selected instance.

Runs registered hooks via m.RunHooks("MistOff"). If hooks allow continuation, updates stop status and sets the OSIG_MISTON output signal to false via w.SetSignalState() for the selected instance.

Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the mist was turned off or hooks cancelled the operation
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ MistOn()

CommonGUIModule MistOn ( )

Turn on the mist coolant output for the selected instance.

Runs registered hooks via m.RunHooks("MistOn"). Checks the MSTLock and DryRun OEM registers; if either is active, displays a warning and skips the mist command. If neither lock is active, updates stop status and sets the OSIG_MISTON output signal to true via w.SetSignalState() for the selected instance.

Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the mist was turned on or skipped due to lock
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ MistToggleBtn()

CommonGUIModule MistToggleBtn ( )

Button handler to toggle mist coolant on or off.

Logs the button press via w.OperatorLog(). Checks the current mist state via m.IsMistOn(). If mist is currently on, calls m.MistOff() to turn it off. Otherwise calls m.MistOn() to turn it on.

Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the toggle completed successfully
(string) Status message from w.FunctionCompleted()
Note
Documentation generated by AI on 2026-03-04

◆ ModifyAxisDROPosition()

CommonGUIModule ModifyAxisDROPosition ( AxisID )

Delegate to modify the DRO position for the specified axis.

This is a deprecated forwarding function. It delegates to CommonGUIModule.screen.ModifyAxisDROPosition(). Use CommonGUIModule.screen.ModifyAxisDROPosition() in new code.

Parameters
AxisID(number) The axis identifier (e.g., mc.X_AXIS, mc.Y_AXIS, mc.Z_AXIS)
Note
Documentation generated by AI on 2026-03-04

◆ ModifyAxisPosition()

CommonGUIModule ModifyAxisPosition ( AxisID ,
Position ,
SkipUpdating  )

Modify an axis position by setting a new fixture offset value.

Runs registered hooks via m.RunHooks("ModifyAxisPosition", AxisID, Position). If the G68 rotation is active and the axis is X or Y, computes the rotated position using w.GetRotatedPartPos() and sets both X and Y via mc.mcAxisSetPos(). For Z-axis on Mill controls, optionally clears the ZHeadShiftOffset if TC_EnableModifyZOffsetsDuringToolChange is enabled. Converts A/B/C axis positions from current units if needed. Runs the "ModifyAxisPositionFinal" hook after setting the position.

Parameters
AxisID(number) The axis identifier to modify (e.g., mc.X_AXIS, mc.Z_AXIS)
Position(number) The new position value to set for the axis
SkipUpdating(boolean|nil) If true, skips setting the OFFSETS_WERE_MODIFIED flag. Defaults to false
Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the position was modified successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ ModifyZOffsetsInToolChangeDialog()

CommonGUIModule ModifyZOffsetsInToolChangeDialog ( inst )

Display a dialog allowing the operator to choose a method for modifying Z head shift offsets during a tool change.

Creates and shows a modal-style dialog with radio-button options for how to set the Z head shift offset during a tool change. Options include: continue without modifying, set position manually by jogging, set with Manual Tool Setter (if enabled), and set with Auto Tool Setter (if enabled). Selecting an option other than "continue" shows sub-directions and enables a numeric position input. A timer monitors machine state and closes the dialog automatically if the machine leaves macro-hold states or if Mach is shutting down. When closed, the selection and position value are sent across a register via w.SendTableAcrossRegister() for the waiting M-code to read.

Parameters
inst(number) The Mach4 instance handle. If not provided, uses current instance
Warning
This dialog is intended to be called from within a macro-hold state (M-code chunk).
Note
Documentation generated by AI on 2026-03-04

◆ ModifyZOffsetsInToolChangeFinalDialog()

CommonGUIModule ModifyZOffsetsInToolChangeFinalDialog ( modify_type ,
inst  )

Display the final safety-check dialog after modifying Z offsets during a tool change.

Creates and shows a modal-style dialog prompting the operator to jog Z to a safe clearance height and ensure all axes are in a safe position before completing the tool change. The instructions displayed depend on modify_type: 2 = Manual Tool Setter, 3 = Auto Tool Setter, all other values show a generic safe-position message. A timer monitors machine state and closes the dialog automatically if the machine leaves macro-hold states or if Mach is shutting down. When closed, packages the modify_type value into a Lua table and sends it across a register via w.SendTableAcrossRegister() so the waiting M-code can read the result.

Parameters
modify_type(number) The Z-offset modification method: 2 = Manual Tool Setter, 3 = Auto Tool Setter, other = generic
inst(number) The Mach4 instance handle. If not provided, uses current instance
Warning
This dialog is intended to be called from within a macro-hold state (M-code chunk). Closing it sends data across a register.
Note
Documentation generated by AI on 2026-03-04

◆ MonitorFixtureOffsets()

CommonGUIModule MonitorFixtureOffsets ( )

Save fixture offsets and optionally regenerate the tool path when offsets are modified.

Checks if OFFSETS_WERE_MODIFIED is true and MACH_STATE is IDLE. If both conditions are met, resets the flag, reads the ToolPathAutoRegen OEM parameter, and calls m.RegenerateToolPathDialog() if auto-regen is enabled. Then saves fixture offsets via m.SaveFixtureOffsets() and calls w.FunctionCompleted().

Note
Documentation generated by AI on 2026-03-04

◆ MonitorMachFileRunTime()

CommonGUIModule MonitorMachFileRunTime ( )

Monitor the G-code file run time and update history when a part is completed.

Iterates over all Mach4 instances. For each instance, reads the current run time via mc.mcCntlGetRunTime() and updates MACH_FILE_RUN_TIME_INST if the machine is in a running state (MC_STATE_FRUN or above). Resets the tracked run time to 0 when the machine returns to IDLE. Compares the current part count (mc.PV_PRTST) against MACH_LAST_PART_COUNT_INST; when a new part is completed, calls m.UpdateMachFileRunTimeHistory() with the accumulated run time and resets the counter.

Note
Documentation generated by AI on 2026-03-04

◆ MotionControllerInitialization()

CommonGUIModule MotionControllerInitialization ( )

Initialize all motion controller objects for each Mach4 instance.

Iterates over all Mach4 instances and calls the Initialization() method on each m.MotionController[_inst] object via w.pcall() for error protection. If initialization fails for any instance, creates a GMS Alarm message with title "Error In Motion Controller Initialization!" and the error description via w.CreateSystemGlobalMessage(), then returns a failure status.

Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if all motion controllers initialized successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ MotionControllerPreEnable()

CommonGUIModule MotionControllerPreEnable ( )

Run the motion controller pre-enable sequence for all instances.

Iterates over all Mach4 instances and calls m.MotionController[_inst]:PreEnableReset() via w.pcall() for each. If the call fails, creates a GMS alarm notification with the error message via w.CreateSystemGlobalMessage() and returns an error. This function is called before enabling the machine to allow the motion controller to perform any required pre-enable checks or interlocks.

Returns
(nil) No meaningful primary return value
(boolean) Success flag - false if any motion controller PreEnableReset call fails
(string) Status message from w.FunctionError() on failure
Note
Documentation generated by AI on 2026-03-04

◆ MotionInhibitEnd()

CommonGUIModule MotionInhibitEnd ( )

Release an active motion inhibit and allow program execution to continue.

Only acts if the motion inhibit feature is enabled and currently active. If the MotionInhibitInterlockInput signal is still ON, displays a warning message and does not release the inhibit. Otherwise, if the machine is not idle, runs the MotionInhibitEnd hook scripts. Clears the ISIG_MOTION_INHIBIT signal via w.SetSignalState() to release the inhibit. Closes the active GMS motion inhibit notification if one is open.

Note
Call this function when the operator confirms that the safety condition has been cleared and the machine is ready to resume program execution
Documentation generated by AI on 2026-03-04

◆ MotionInhibitStart()

CommonGUIModule MotionInhibitStart ( )

Activate motion inhibit while the machine is running to pause program execution.

Only acts if the motion inhibit feature is enabled and not already active, and only if the machine is currently running (MACH_STATE >= mc.MC_STATE_FRUN). Sets the ISIG_MOTION_INHIBIT signal to true via w.SetSignalState() to trigger the inhibit. Runs the MotionInhibitStart hook scripts. Closes any previous motion inhibit GMS notification and creates a new persistent "Motion Inhibit Active!" warning notification via w.CreateGMSDialog(), storing the handle in CommonGUIModule.MotionInhibitGMSHandle.

Note
Motion inhibit pauses program execution without stopping the machine. The operator must clear the safety condition and press Cycle Start to resume.
Documentation generated by AI on 2026-03-04

◆ MoveItemDown()

CommonGUIModule Scheduler MoveItemDown ( )

Move the currently selected scheduled item down one position in the schedule list.

Retrieves the currently selected item index via self:GetSelectedItem() and swaps it with the item at index + 1 via self:SwapItems().

Note
Documentation generated by AI on 2026-03-04

◆ MoveItemUp()

CommonGUIModule Scheduler MoveItemUp ( )

Move the currently selected scheduled item up one position in the schedule list.

Retrieves the currently selected item index via self:GetSelectedItem() and swaps it with the item at index - 1 via self:SwapItems().

Note
Documentation generated by AI on 2026-03-04

◆ MoveToBot()

CommonGUIModule Scheduler MoveToBot ( )

Move the currently selected scheduled item to the bottom of the schedule list.

Retrieves the selected item's index, file path, and quantity via self:GetSelectedItem(). If a valid item is selected and the list is non-empty, inserts a copy at the bottom of the list via InsertItem(), sets its quantity column, then deletes the original entry via self:DeleteItem().

Note
Documentation generated by AI on 2026-03-04

◆ MoveToGoToPosition()

CommonGUIModule MoveToGoToPosition ( goto_position_name )

Move the machine to the named GoTo position using a configured G-code string.

Updates stop status for all instances. Checks that rapid override is >= 1%. Checks manual mode. If goto_position_name is a valid non-empty string, sets GOTO_POSITION_NAME to it. Looks up the G-code string via w.GetGoToPositionGcode() and executes it via w.MDICommand(). On success, applies any G68 patch G-code. Logs any canceled or failed moves to the operator log.

Parameters
goto_position_name(string|nil) The name of the GoTo position to move to. If nil or empty, uses the current GOTO_POSITION_NAME global
Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the move was initiated or skipped successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ MoveToTop()

CommonGUIModule Scheduler MoveToTop ( )

Move the currently selected scheduled item to the top of the schedule list.

Retrieves the selected item's index, file path, and quantity via self:GetSelectedItem(). If a valid item is selected and the list is non-empty, inserts a copy at index 0 (top) of the list via InsertItem(), sets its quantity column, then deletes the original entry via self:DeleteItem().

Note
Documentation generated by AI on 2026-03-04

◆ MSTLockOff()

CommonGUIModule MSTLockOff ( )

Turn off the M-S-T lock for the selected instance.

Logs the action via w.OperatorLog() and sets the MSTLock OEM register string to "No" via w.SetOEMRegValueString() for the selected instance. M-S-T lock controls whether M, S, and T commands are suppressed during program execution.

Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the lock was cleared successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ MSTLockOn()

CommonGUIModule MSTLockOn ( )

Turn on the M-S-T lock for the selected instance if the machine is idle.

Logs the action via w.OperatorLog(). Reads the current machine state via mc.mcCntlGetState(). If the machine is idle, sets the MSTLock OEM register string to "Yes" via w.SetOEMRegValueString(). If the machine is not idle, logs a cancellation message and returns without making any change.

Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the operation completed (even if skipped due to machine state)
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
The M-S-T lock will only be activated when the machine is in IDLE state
Documentation generated by AI on 2026-03-04

◆ MSTLockToggleBtn()

CommonGUIModule MSTLockToggleBtn ( )

Toggle the M-S-T lock on or off based on its current state.

Logs the button press via w.OperatorLog(). Checks the current M-S-T lock state via m.IsMSTLockOn(). If the lock is currently on, calls m.MSTLockOff() to disable it. Otherwise calls m.MSTLockOn() to enable it.

Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the toggle completed successfully
(string) Status message from w.FunctionCompleted()
Note
Documentation generated by AI on 2026-03-04

◆ myfunc_wrapper()

myfunc_wrapper ( )

Example wrapper function showing how to profile a specific function call-tree.

Demonstrates the pattern for profiling a specific function by calling m._LuaProfiling.ResumeProfiler() before the target function and m._LuaProfiling.PauseProfiler() after it (even if the function raises an error via pcall). If the inner function raises an error, it is re-raised after pausing the profiler. This is an example/template and is not registered as a module function.

Note
Documentation generated by AI on 2026-03-04

◆ New() [1/2]

DrawingModule Point New ( )

Create and initialize a new Scheduler object, disabling any previously active scheduler.

Create a new Point instance from a coordinate array.

Sets the scheduler state OEM parameter (self.SCHED_STATE) to 0 via w.SetOEMParamValue() to prevent issues after Compile Scripts. This ensures a clean scheduler state whenever a new Scheduler is instantiated.

Parameters
inst(number) The Mach4 instance handle. If not provided, uses current instance
Note
Documentation generated by AI on 2026-03-04

Constructs a Point object by extracting the first and second elements of the provided coordinate array as x_cord and y_cord respectively. Points are used by all shape classes to store vertex and center positions.

Parameters
coord(table) A two-element array where coord[1] is the X coordinate and coord[2] is the Y coordinate
Returns
(table) The newly created Point object with x_cord and y_cord fields
Note
Documentation generated by AI on 2026-03-03

◆ New() [2/2]

CommonGUIModule JobFile New ( job_name )

Create and initialize a new JobFile object with the given configuration table and job name.

Constructs a new JobFile metatable instance with configuration from NewTable, including the pound variable range string, register table, header table, overwrite flag, password, default directory, and all open/close/save callback functions. If NewTable is nil, uses a set of default values. Registers the job name in the Mach4 profile and creates a register for it. Calls jb:ReLoad() to restore the last loaded file and jb:ReadDataFromMach(true) to initialize the in-memory data table.

Parameters
NewTable(table|nil) Configuration table with keys: 'RangeString', 'RegTable', 'Overwrite', 'ShowNotesOnOpen', 'RegenToolPath', 'Password', 'DefaultDirectory', 'HeaderTable', 'OnOpenStart', 'OnOpenFinal', 'OnCloseStart', 'OnCloseFinal', 'OnSaveStart', 'OnSaveFinal', 'OnSaveAsStart', 'OnSaveAsFinal'. All keys are optional with defaults.
job_name(string|nil) Optional name used to register this job file in the profile and the JobFiles register
Returns
(table) The new JobFile object instance
Note
Documentation generated by AI on 2026-03-04

◆ NewStackLight()

CommonGUIModule StackLight NewStackLight ( )

Create and initialize a new StackLight object for the given Mach4 instance.

Constructs a new StackLight metatable instance. Loads the LightStackEnabled OEM parameter to determine whether the stack light is active. Checks which output signals are mapped (Red, Yellow, Green, White) and reads the blink configuration for each color from OEM parameters. Initializes the Light_Info table with default state, blink, and active values for each color.

Parameters
instance(number) The Mach4 instance handle. If not provided, uses current instance
Returns
(table) The new StackLight object instance
Note
Documentation generated by AI on 2026-03-04

◆ NextPocketBtn()

CommonGUIModule NextPocketBtn ( use_confirmation )

Change to the next tool pocket in the tool changer carousel.

Checks MST lock, feedrate override, and rapid override before proceeding. Checks manual mode. Reads the current pocket from CURRENT_TOOL_POCKET_NUMBER_INST and increments it, wrapping to pocket 1 if the maximum is exceeded. Sets the ChangePocket OEM register to "true" and looks up the tool number for the selected pocket. Builds the appropriate G-code string for the machine type and optionally presents a CycleStartDialog confirmation before executing via mc.mcCntlMdiExecute().

Parameters
use_confirmation(boolean|nil) If true, shows a cycle start confirmation dialog before executing
Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if pocket change was initiated successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ NextToolBtn()

CommonGUIModule NextToolBtn ( use_confirmation )

Change to the next tool number in the tool changer.

Checks MST lock, feedrate override, and rapid override before proceeding. Checks manual mode. Reads the currently selected tool and increments the tool number by 1, clamping to the maximum tool number. Builds the appropriate G-code string for the machine type (Lathe or Mill). Optionally presents a CycleStartDialog confirmation before executing via mc.mcCntlMdiExecute().

Parameters
use_confirmation(boolean|nil) If true, shows a cycle start confirmation dialog before executing
Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if tool change was initiated successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ NotesDialog()

CommonGUIModule JobFile NotesDialog ( )

Open the Job Notes dialog for viewing and editing job file notes.

Delegates to CommonGUIModule._NotesDialog() via w.pcall() for error protection, passing the job file object (self) as the argument. If an error occurs, logs it via w.FunctionError(). The underlying implementation creates a resizable dialog with a multi-line text editor, OK and Cancel buttons, and a timer that closes the dialog when Mach shuts down.

Note
Errors thrown by the underlying dialog implementation are caught and logged
See also
CommonGUIModule._NotesDialog() for the full dialog implementation
Note
Documentation generated by AI on 2026-03-04

◆ OkButtonClick()

UI OkButtonClick ( )

Handle the OK button click in the Job Notes dialog.

Calls UI.StoreNotes() to capture the current editor content into the in-memory notes table, then calls UI.SaveNotesToFile() to persist the notes to the job file on disk.

Note
This is a closure defined inside CommonGUIModule._NotesDialog()
Documentation generated by AI on 2026-03-04

◆ OnAddNewClick()

UI OnAddNewClick ( )

Add a new tool setter entry with default values to the list and in-memory table.

Prompts the user for a tool setter name via w.GenericTextEntry(). If the name is non-empty and does not already exist in UI.tool_setters, creates a new entry with default values (AutoSetter=false, ProbeInput=0, Height=1, ZPosition=0, etc.) and appends the name to the setter_list listbox. Sets the list selection to the new entry and calls UI.OnToolSetterListSelected() to populate the detail fields. This is a closure defined inside CommonGUIModule.CalibrateToolSetters().

Note
This is a closure defined inside CommonGUIModule.CalibrateToolSetters()
Documentation generated by AI on 2026-03-04

◆ OnCancel()

UI OnCancel ( )

Stop the calibrate tool setters dialog timer and destroy the dialog window.

Stops the UI timer if it is active and destroys the toolsetter_dialog window. This is a closure defined inside CommonGUIModule.CalibrateToolSetters().

Note
This is a closure defined inside CommonGUIModule.CalibrateToolSetters()
Documentation generated by AI on 2026-03-04

◆ OnCaptureZPositionClick()

UI OnCaptureZPositionClick ( )

Capture the current Z machine position as the tool setter Z position.

Reads the current tool length offset from mc.SV_CUR_TOOL_ZLENGTH_REGISTER via mc.mcCntlGetPoundVar(). Reads the current Z machine position via mc.mcAxisGetMachinePos(). Computes the tool setter Z position as (Z machine pos - tool length - setter height) and updates the zpos_dro display. Calls UI.OnZPositionChanged() to store and normalize the value. This is a closure defined inside CommonGUIModule.CalibrateToolSetters().

Note
This is a closure defined inside CommonGUIModule.CalibrateToolSetters()
Documentation generated by AI on 2026-03-04

◆ OnClose()

UI OnClose ( )

Stop the tool setter selection dialog timer and destroy the dialog window.

Stops the UI timer if it is active and sets it to nil to prevent further timer events. Destroys the toolsetterselection_dialog window. This is a closure defined inside CommonGUIModule.ToolSetterSelection().

Note
This is a closure defined inside CommonGUIModule.ToolSetterSelection()
Documentation generated by AI on 2026-03-04

◆ OnEndGoToPositionChanged()

UI OnEndGoToPositionChanged ( )

Update the end GoTo position for the selected tool setter when the dropdown selection changes.

Reads the current dropdown selection index from UI.endgotoposition_choice and maps it to the corresponding name string in UI.endgotoposition_choiceChoices. Stores the result in UI.tool_setters[name].EndGoToPosition for the currently selected tool setter. This is a closure defined inside CommonGUIModule.CalibrateToolSetters().

Note
This is a closure defined inside CommonGUIModule.CalibrateToolSetters()
Documentation generated by AI on 2026-03-04

◆ OnFileQueueTimer()

CommonGUIModule OnFileQueueTimer ( )

Timer callback that processes the Lua file queue with function tracing.

Sets the FuncTracing flag for "m.OnFileQueueTimer" to true, then calls m.ProcessFileQueue() via w.pcall() for error protection. Clears the FuncTracing flag afterward. If an error occurs during processing, logs the error message via w.Log().

Note
Documentation generated by AI on 2026-03-04

◆ OnFixtureOffsetModeChanged()

UI OnFixtureOffsetModeChanged ( )

Update the fixture offset mode for the selected tool setter when the dropdown selection changes.

Reads the current selection index from UI.fixtureoffset_mode_choice and stores it as UI.tool_setters[name].FixtureOffsetMode for the currently selected tool setter. This is a closure defined inside CommonGUIModule.CalibrateToolSetters().

Note
This is a closure defined inside CommonGUIModule.CalibrateToolSetters()
Documentation generated by AI on 2026-03-04

◆ OnFixturesOffsetsChanged()

UI OnFixturesOffsetsChanged ( )

Update the fixture offsets toggle state for the selected tool setter and enable or disable the mode dropdown.

Reads the current boolean value from UI.fixturesoffsets and stores it in UI.tool_setters[name].FixturesOffsets. Enables or disables the fixtureoffset_mode_choice dropdown based on the new toggle value. This is a closure defined inside CommonGUIModule.CalibrateToolSetters().

Note
This is a closure defined inside CommonGUIModule.CalibrateToolSetters()
Documentation generated by AI on 2026-03-04

◆ OnGoToPositionChanged()

UI OnGoToPositionChanged ( )

Update the start GoTo position for the selected tool setter when the dropdown selection changes.

Reads the current dropdown selection index from UI.gotoposition_choice and maps it to the corresponding name string in UI.gotoposition_choiceChoices. Stores the result in UI.tool_setters[name].GoToPosition for the currently selected tool setter. This is a closure defined inside CommonGUIModule.CalibrateToolSetters().

Note
This is a closure defined inside CommonGUIModule.CalibrateToolSetters()
Documentation generated by AI on 2026-03-04

◆ OnLaunchHeightWizardClick()

UI OnLaunchHeightWizardClick ( )

Launch the tool setter height wizard and apply the result to the selected setter.

Gets the currently selected tool setter name. Calls CommonGUIModule.RunToolSetterHeightWizard() with the setter's name. If the wizard completes successfully and returns a non-nil height, logs the result via w.Log(), stores it in UI.tool_setters[name].Height, updates the height_dro display, and calls UI.OnToolSetterHeightChanged() to normalize the value. This is a closure defined inside CommonGUIModule.CalibrateToolSetters().

Note
This is a closure defined inside CommonGUIModule.CalibrateToolSetters()
Documentation generated by AI on 2026-03-04

◆ OnLaunchZPosWizardClick()

UI OnLaunchZPosWizardClick ( )

Launch the tool setter Z position wizard and apply the result to the selected setter.

Gets the currently selected tool setter name. Calls CommonGUIModule.RunToolSetterZPositionWizard() with the setter name, AutoSetter flag, and current Height value. If the wizard completes successfully and returns a non-nil Z position, stores it in UI.tool_setters[name].ZPosition, updates the zpos_dro display, and calls UI.OnZPositionChanged() to normalize the value. This is a closure defined inside CommonGUIModule.CalibrateToolSetters().

Note
This is a closure defined inside CommonGUIModule.CalibrateToolSetters()
Documentation generated by AI on 2026-03-04

◆ OnlineManualsBtn()

CommonGUIModule OnlineManualsBtn ( )

Open the MachMotion online manuals web page in the default browser.

Attempts to open https://support.machmotion.com/ using the system's default browser. On Windows, uses cmd.exe with 'start' to avoid wxWidgets ShellExecute edge cases. On other platforms, falls back to w.OpenURL(). Displays a warning message box if the URL cannot be opened.

Note
Documentation generated by AI on 2026-03-04

◆ OnProbeInputChanged()

UI OnProbeInputChanged ( )

Update the probe input selection for the selected tool setter when the dropdown changes.

Reads the current selection index from UI.probe_choice and stores it as UI.tool_setters[name].ProbeInput for the currently selected tool setter. This is a closure defined inside CommonGUIModule.CalibrateToolSetters().

Note
This is a closure defined inside CommonGUIModule.CalibrateToolSetters()
Documentation generated by AI on 2026-03-04

◆ OnRemoveClick()

UI OnRemoveClick ( )

Remove the currently selected tool setter from the list and the in-memory table.

Gets the currently selected tool setter name and its list index. Sets the corresponding entry in UI.tool_setters to nil and deletes the item from the setter_list listbox. Adjusts the list selection to the nearest remaining item and calls UI.OnToolSetterListSelected() to refresh the detail fields. This is a closure defined inside CommonGUIModule.CalibrateToolSetters().

Note
This is a closure defined inside CommonGUIModule.CalibrateToolSetters()
Documentation generated by AI on 2026-03-04

◆ OnRenameToolSetter()

UI OnRenameToolSetter ( )

Rename the currently selected tool setter via a modal rename dialog.

Gets the currently selected tool setter name and returns if none is selected. Creates a modal rename dialog with a text control pre-filled with the current name and OK/Cancel buttons. If the user confirms a new non-empty, non-duplicate name, copies the setter data to the new key, updates the setter name field, removes the old key, and updates any fixture setter OEM parameter references (ManualSetterFixtureSelection, AutoSetterFixtureSelection) if the renamed setter was the active one. Updates the listbox to reflect the new name and calls UI.OnToolSetterListSelected() to refresh the detail fields. This is a closure defined inside CommonGUIModule.CalibrateToolSetters().

Note
This is a closure defined inside CommonGUIModule.CalibrateToolSetters()
Documentation generated by AI on 2026-03-04

◆ OnSave()

UI OnSave ( )

Save all tool setter data and close the calibrate tool setters dialog.

Calls UI.Save() to persist all tool setter configurations to the profile, then calls UI.OnCancel() to stop the timer and destroy the dialog. If the screen has an InitializeToolSetters function (m.screen.InitializeToolSetters), calls it to reload the tool setter configuration. This is a closure defined inside CommonGUIModule.CalibrateToolSetters().

Note
This is a closure defined inside CommonGUIModule.CalibrateToolSetters()
Documentation generated by AI on 2026-03-04

◆ OnScreenJogButtonsOff()

CommonGUIModule OnScreenJogButtonsOff ( )

Delegate to hide the on-screen jog buttons.

This is a deprecated forwarding function. It delegates to CommonGUIModule.screen.OnScreenJogButtonsOff(). Use CommonGUIModule.screen.OnScreenJogButtonsOff() in new code.

Note
Documentation generated by AI on 2026-03-04

◆ OnScreenJogButtonsOn()

CommonGUIModule OnScreenJogButtonsOn ( )

Delegate to show the on-screen jog buttons.

This is a deprecated forwarding function. It delegates to CommonGUIModule.screen.OnScreenJogButtonsOn(). Use CommonGUIModule.screen.OnScreenJogButtonsOn() in new code.

Note
Documentation generated by AI on 2026-03-04

◆ OnSize()

CommonGUIModule SearchGCode OnSize ( )

Handle resize events for the Schedule Editor dialog.

Resize the GCode Search grid columns and rows to fit the current dialog size.

Called when the Schedule Editor dialog is resized. Delegates to self:SetColumnsWidth() to recalculate and apply the correct column widths based on the new dialog size.

Note
Documentation generated by AI on 2026-03-04

Calculates the available width for the G-code column by subtracting the fixed line number column width from the total grid width. Calculates row height by dividing the available grid height by the number of rows. Applies the new sizes inside a BeginBatch/EndBatch block and then calls Layout() to refresh the dialog.

Note
Documentation generated by AI on 2026-03-04

◆ OnSoftlimitsChanged()

UI OnSoftlimitsChanged ( )

Update the disable softlimits flag for the selected tool setter when the toggle changes.

Reads the current boolean value from UI.softlimits and stores it in UI.tool_setters[name].DisableSoftlimits for the currently selected tool setter. This is a closure defined inside CommonGUIModule.CalibrateToolSetters().

Note
This is a closure defined inside CommonGUIModule.CalibrateToolSetters()
Documentation generated by AI on 2026-03-04

◆ OnToolSetterHeightChanged()

UI OnToolSetterHeightChanged ( )

Validate and store the tool setter height value from the height_dro text field.

Reads the string value from UI.height_dro. If it converts to a valid number, stores it in UI.tool_setters[name].Height for the currently selected tool setter. Formats the stored value to 4 decimal places and updates the height_dro text field if it differs from the raw input. This is a closure defined inside CommonGUIModule.CalibrateToolSetters().

Note
This is a closure defined inside CommonGUIModule.CalibrateToolSetters()
Documentation generated by AI on 2026-03-04

◆ OnToolSetterListSelected()

UI OnToolSetterListSelected ( )

Populate all detail fields in the tool setter configuration panel for the selected setter.

Handle tool setter list selection by writing the selected name to the appropriate OEM register.

Reads the currently selected tool setter name from the setter_list listbox. If a valid name is found, updates all UI controls to reflect the stored values in UI.tool_setters[name]: sets the type radio buttons (manual/auto), probe input choice, height DRO, Z position DRO, softlimits toggle, fixture offsets toggle, fixture offset mode dropdown, and both GoTo position dropdowns. Enables or disables heightWizBtn, probe_choice, and fixtureoffset_mode_choice based on the auto setter flag and fixture offsets toggle state respectively. This is a closure defined inside CommonGUIModule.CalibrateToolSetters().

Note
This is a closure defined inside CommonGUIModule.CalibrateToolSetters()
Documentation generated by AI on 2026-03-04

Reads the currently selected tool setter name from the setter_list listbox. Based on the OffsetTypes and FilterToolSetterTypes closure variables, writes the selected name to one of four OEM registers: ManualSetterFixtureSelection, AutoSetterFixtureSelection, ManualSetterSelection, or AutoSetterSelection via w.SetOEMRegValueString(). Logs any register write errors via w.Error(). This is a closure defined inside CommonGUIModule.ToolSetterSelection().

Note
This is a closure defined inside CommonGUIModule.ToolSetterSelection()
Documentation generated by AI on 2026-03-04

◆ OnToolSetterTypeChanged()

UI OnToolSetterTypeChanged ( )

Update the tool setter type and enable or disable related controls when the radio button changes.

Reads the current boolean value from UI.type_auto and stores it as UI.tool_setters[name].AutoSetter for the currently selected tool setter. Enables or disables UI.heightWizBtn and UI.probe_choice based on whether the auto setter radio button is selected. This is a closure defined inside CommonGUIModule.CalibrateToolSetters().

Note
This is a closure defined inside CommonGUIModule.CalibrateToolSetters()
Documentation generated by AI on 2026-03-04

◆ OnZPositionChanged()

UI OnZPositionChanged ( )

Validate and store the Z position value from the zpos_dro text field for the selected tool setter.

Reads the string value from UI.zpos_dro. If it converts to a valid number, stores it in UI.tool_setters[name].ZPosition. Formats the stored value to 4 decimal places and updates the zpos_dro text field if it differs from the raw input. This is a closure defined inside CommonGUIModule.CalibrateToolSetters().

Note
This is a closure defined inside CommonGUIModule.CalibrateToolSetters()
Documentation generated by AI on 2026-03-04

◆ Open()

CommonGUIModule JobFile Open ( )

Open a file browser dialog to select and load a job file, then apply it to Mach4.

Runs the OnOpenStart callback (if set); if it returns false, cancels the open. Shows a wxFileDialog for the user to choose a CSV job file. If a valid file is selected, sets jb.FileNamePath and jb.FileName, calls jb:WriteDataToMach() to apply the data, optionally shows the Notes dialog if ShowNotesOnOpen is true and notes exist, updates the JobFiles register, saves the path to the 'LastLoadedJobFilePath' register, and runs the OnOpenFinal callback (if set).

Note
Documentation generated by AI on 2026-03-04

◆ OpenExternalApplication()

CommonGUIModule OpenExternalApplication ( )

Open the external conversational assistant application.

Logs the button press via w.OperatorLog(). Launches the StartConversationalAssistant.exe application located in the Mach4 Tools directory via os.execute(). The application window will be visible when launched.

Note
Documentation generated by AI on 2026-03-04

◆ OpenGCodeNesting()

CommonGUIModule OpenGCodeNesting ( )

Open the G-code nesting interface module.

Runs the "PreOpenGCodeNesting" hooks via m.RunHooks(). If any hook returns false as the primary value, cancels the operation. Otherwise forces a reload of the GCodeNesting module (setting package.loaded.GCodeNesting to nil), requires it, and calls GCNesting.Show() to display the nesting interface.

Returns
(nil) No meaningful primary return value on success
(boolean) False with error message if a hook cancels the operation
(string) Status message from w.FunctionError() on failure
Note
Documentation generated by AI on 2026-03-04

◆ OpenGCodeNestingBtn()

CommonGUIModule OpenGCodeNestingBtn ( )

Log the operator action and open the G-code nesting interface.

Logs "Open GCode Nesting Pressed" via w.OperatorLog() for the current instance, then delegates to m.OpenGCodeNesting() to display the nesting interface.

Note
Documentation generated by AI on 2026-03-04

◆ OpenGMSDiagnosticsDialog()

CommonGUIModule OpenGMSDiagnosticsDialog ( )

Open the GMS diagnostics dialog via the GMS plugin command interface.

Sends the "OpenDiagnostics" command with parameter "1" to the GMS plugin via w.SendGMSCommand(). If the command fails, logs the error via w.OperatorLog() and returns a failure status. Returns success if the command is sent successfully.

Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the command was sent successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ OpenGMSPluginConfig()

CommonGUIModule OpenGMSPluginConfig ( )

Open the GMS plugin configuration dialog.

If the machine is not in IDLE state, displays a warning via CommonGUIModule.SetWarningMessage(). Otherwise sends the "OpenConfig" command with parameter "Config" to the GMS plugin via w.SendGMSCommand(). If the command fails, logs the error via w.OperatorLog().

Note
Documentation generated by AI on 2026-03-04

◆ OpenM00Notification()

CommonGUIModule OpenM00Notification ( message ,
line ,
inst  )

Open an M00/M01 program stop notification and record the stop line number.

Skips opening if the retract output (OSIG_RETRACT) is currently active. Sets the OptionalStopActive OEM register to 1 via w.SetOEMRegValue(). If a previous notification is open (m.M00_NotificationHandle is not nil), closes it first via m.CloseM00Notification(). Creates a new GMS notification via w.CreateGMSNotification() and stores the handle in m.M00_NotificationHandle. Records the G-code line number in m.M00LineNumber.

Parameters
message(string) The message text to display in the stop notification
line(number) The G-code line number at which the M00/M01 stop occurred
inst(number) The Mach4 instance handle. If not provided, uses current instance
Returns
(nil) No meaningful primary return value
(boolean) Success flag - false if the register write failed
(string) Status message from w.FunctionError() on failure
Note
Documentation generated by AI on 2026-03-04

◆ OpenMachineCalibrationPluginAutomaticConfig()

CommonGUIModule OpenMachineCalibrationPluginAutomaticConfig ( )

Open the MachineCalibration plugin automatic calibration configuration dialog.

If the machine is not in IDLE state, displays a warning via CommonGUIModule.SetWarningMessage(). Otherwise sends the "AutomaticConfig" command to the MachineCalibration plugin via w.RegSendCommand(). If the command fails, logs the error via w.OperatorLog().

Note
Documentation generated by AI on 2026-03-04

◆ OpenMachineCalibrationPluginConfig()

CommonGUIModule OpenMachineCalibrationPluginConfig ( )

Open the MachineCalibration plugin configuration dialog.

If the machine is not in IDLE state, displays a warning via CommonGUIModule.SetWarningMessage(). Otherwise sends the "Config" command to the MachineCalibration plugin via w.RegSendCommand(). If the command fails, logs the error via w.OperatorLog().

Note
Documentation generated by AI on 2026-03-04

◆ OpenMachineCalibrationPluginManualConfig()

CommonGUIModule OpenMachineCalibrationPluginManualConfig ( )

Open the MachineCalibration plugin manual calibration configuration dialog.

If the machine is not in IDLE state, displays a warning via CommonGUIModule.SetWarningMessage(). Otherwise sends the "ManualConfig" command to the MachineCalibration plugin via w.RegSendCommand(). If the command fails, logs the error via w.OperatorLog().

Note
Documentation generated by AI on 2026-03-04

◆ OpenMachineCalibrationPluginScrewMappingConfig()

CommonGUIModule OpenMachineCalibrationPluginScrewMappingConfig ( )

Open the MachineCalibration plugin screw mapping configuration dialog.

If the machine is not in IDLE state, displays a warning via CommonGUIModule.SetWarningMessage(). Otherwise sends the "ScrewMapping" command to the MachineCalibration plugin via w.RegSendCommand(). If the command fails, logs the error via w.OperatorLog().

Note
Documentation generated by AI on 2026-03-04

◆ OpenMachMotionModbusPluginConfig()

CommonGUIModule OpenMachMotionModbusPluginConfig ( )

Open the MachMotion Modbus plugin configuration dialog.

If the machine is not in IDLE state, displays a warning via CommonGUIModule.SetWarningMessage(). Otherwise sends the "Config" command to the MachMotionModbusDevice plugin via w.RegSendCommand(). If the command fails, logs the error via w.OperatorLog().

Note
Documentation generated by AI on 2026-03-04

◆ OpenMachMotionPluginConfig()

CommonGUIModule OpenMachMotionPluginConfig ( )

Open the MachMotion plugin configuration dialog for the selected Mach4 instance.

If the machine is not in IDLE state, displays a warning via CommonGUIModule.SetWarningMessage(). Otherwise checks password level 3 via m.screen.CheckPassword(). If the password check passes, sends the "Config" command to the MachMotion plugin via w.RegSendCommand() for the selected instance. If the command fails, logs the error via w.OperatorLog().

Note
Documentation generated by AI on 2026-03-04

◆ OpenMotionControllerConfig()

CommonGUIModule OpenMotionControllerConfig ( )

Open the motion controller configuration dialog for the selected Mach4 instance.

Entry point for the screen button. Uses w.pcall() to protect against errors in CommonGUIModule._OpenMotionControllerConfig(). If an error occurs, logs it via w.FunctionError(). Requires the machine to be in IDLE state and password level 3. Opens the motion controller configuration via m.MotionController[selected_instance]:OpenConfiguration().

Returns
(nil) No meaningful return value; errors are handled internally
Warning
The machine must be in IDLE state before calling this function
Note
Documentation generated by AI on 2026-03-04

◆ OpenSetupWizard()

CommonGUIModule OpenSetupWizard ( )

Open the MachMotion setup wizard via the plugin command interface.

If the machine is not in IDLE state, displays a warning message via CommonGUIModule.SetWarningMessage(). Otherwise sends the "SetupWizard" command to the MachMotion plugin via w.RegSendCommand(). If the command fails, logs the error via w.OperatorLog().

Note
Documentation generated by AI on 2026-03-04

◆ OpenToolPocketsDialogBtn()

CommonGUIModule OpenToolPocketsDialogBtn ( )

Open the tool pockets dialog by setting the trigger register.

Sets the MachMotion register "mm_ToolPocketsDialog" to 1 via w.SetRegValue(), which signals the MachMotion plugin to open the tool pockets management dialog. Logs any errors via w.OperatorLog().

Note
Documentation generated by AI on 2026-03-04

◆ OpenToolTable()

CommonGUIModule OpenToolTable ( )

Open the tool table dialog if the screen is in edit mode.

Checks whether the screen is in edit mode via CommonGUIModule.screen.IsEditModeActive(). If not in edit mode, displays a warning dialog and returns an error. Otherwise sends the "ToolTable" command to the MachMotion plugin via w.RegSendCommand(). Logs any command errors via w.OperatorLog().

Returns
(nil) No meaningful primary return value
(boolean) False with error message if not in edit mode or command fails, true otherwise
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ OperatorLog()

w OperatorLog ( inst ,
"Run From Here Pressed"  )

Write an operator action message to the Mach4 operator log.

This is a reference to the w.OperatorLog() wrapper function used throughout CommonGUIModule to record operator-initiated actions. It writes timestamped messages to the Mach4 operator log for the specified instance.

Parameters
inst(number) The Mach4 instance handle for which to log the message
message(string) The message text to record in the operator log
Note
Documentation generated by AI on 2026-03-04

◆ OptionalStopOff()

CommonGUIModule OptionalStopOff ( )

Turn off the optional stop (M1) feature for the current instance.

Reads the current optional stop state via mc.mcCntlGetOptionalStop(). If optional stop is currently enabled (returns 1), disables it by calling mc.mcCntlSetOptionalStop() with 0.

Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the operation completed successfully
(string) Status message from w.FunctionCompleted()
Note
Documentation generated by AI on 2026-03-04

◆ OptionalStopOn()

CommonGUIModule OptionalStopOn ( )

Turn on the optional stop (M1) feature for the current instance.

Reads the current optional stop state via mc.mcCntlGetOptionalStop(). If optional stop is currently disabled (returns 0), enables it by calling mc.mcCntlSetOptionalStop() with 1.

Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the operation completed successfully
(string) Status message from w.FunctionCompleted()
Note
Documentation generated by AI on 2026-03-04

◆ OptionalStopToggleBtn()

CommonGUIModule OptionalStopToggleBtn ( )

Button handler to toggle the optional stop (M1) feature on or off.

Logs the button press via w.OperatorLog(). Checks the current optional stop state via m.IsOptionalStopOn(). If currently on, calls m.OptionalStopOff() to disable it. Otherwise calls m.OptionalStopOn() to enable it.

Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the toggle completed successfully
(string) Status message from w.FunctionCompleted()
Note
Documentation generated by AI on 2026-03-04

◆ OptSaveChanges()

CommonGUIModule JobFile OptSaveChanges ( )

Optionally prompt the user to save changes to the job file if any edits are detected.

Reads the job file CSV from jb.FileNamePath and compares each pound variable's stored value against the current value in Mach4 via mc.mcCntlGetPoundVar(). If any value differs by more than 0.000001, sets HasChanges=true and shows a wxMessageDialog asking whether to save. If the user confirms, calls jb:Save(). Returns false if no file is loaded. Returns HasChanges.

Returns
(boolean) True if changes were detected, false if no file is loaded or no changes found
Note
Documentation generated by AI on 2026-03-04

◆ OverrideLimits()

CommonGUIModule OverrideLimits ( )

Validate and swap spindle and feedrate override min/max OEM parameters if inverted.

Reads SpindleOverrideMaxPercent and SpindleOverrideMinPercent OEM parameters. If the minimum value is greater than the maximum, swaps them. Performs the same check and swap for FeedrateOverrideMaxPercent and FeedrateOverrideMinPercent. This prevents inverted override ranges from causing unexpected behavior.

Returns
(nil|boolean) nil on success, false with error message if OEM parameter read fails
(boolean) Success flag - true if operation completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ ParkToolBtn()

CommonGUIModule ParkToolBtn ( use_confirmation )

Park the current tool by changing to tool number 0.

Checks MST lock, feedrate override, and rapid override before proceeding. Checks manual mode. Sets the tool index to 0 (park position) and builds the appropriate G-code string for the machine type (Lathe or Mill). Optionally presents a CycleStartDialog confirmation before executing the park command via mc.mcCntlMdiExecute().

Parameters
use_confirmation(boolean|nil) If true, shows a cycle start confirmation dialog before executing
Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if park command was initiated successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ PartCounterDialog()

CommonGUIModule PartCounterDialog ( )

Open the Part Counter dialog for viewing and editing part count parameters.

Wraps the internal _PartCounterDialog() implementation via w.pcall() for error protection. If an error occurs during dialog creation or operation, displays the error message via w.wxMessageBox(). The dialog shows current program parts, total parts, required parts, M-code counter mode, and M-code number. All values are read from and written to the corresponding Mach4 parameters in real time.

Note
Documentation generated by AI on 2026-03-04

◆ PauseProfiler()

CommonGUIModule _LuaProfiling PauseProfiler ( logpath )

Temporarily pause an active Lua profiling session without losing collected data.

Checks that the profiler module is loaded and that profiling is currently active via prof.IsProfiling(). If both conditions are met, calls prof.profiler.pause() to suspend data collection. The profiling session can be resumed later via ResumeProfiler(). Does nothing if the profiler is not loaded or profiling is not active.

Parameters
logpath(string|nil) Unused parameter, accepted for API consistency with StopProfiler
Note
Documentation generated by AI on 2026-03-04

◆ PLCSequenceDialogBtn()

CommonGUIModule PLCSequenceDialogBtn ( )

Open the PLC Sequence dialog allowing the operator to manually trigger PLC sequences.

Guards against duplicate opens via DIALOG_IS_OPEN["PLC_SEQ"]. Requires password level 3. Reads all 64 sequence descriptions via mb.GetSeqDescription() and populates a list box. Provides a debugging checkbox and a Start Sequence button. The machine must be enabled and idle before a sequence can be started via mb.SeqCall(). A timer updates the button background color based on the PLCSeqFB feedback bit for the selected sequence. Displays a prominent danger warning.

Returns
(nil) No meaningful primary return value
(boolean) Success flag - false if the dialog is already open
(string) Status message from w.FunctionError() if dialog is already open
Warning
Manually running PLC sequences can be extremely dangerous. Use with caution.
Note
Documentation generated by AI on 2026-03-04

◆ PopSchedule()

CommonGUIModule Scheduler PopSchedule ( )

Decrement the quantity of the current top scheduled file and advance the schedule.

Retrieves the first entry in the schedule for the given instance and decrements its quantity by 1. If the quantity reaches 0 or below, removes the entry from the schedule via table.remove(). Otherwise updates the quantity in place. Then serializes the updated schedule to the OEM register via self:SendFilesToRegister() and calls self:Enable() to load the next file. Delegates the actual work to self:_PopSchedule() via w.pcall() for error protection.

Parameters
inst(number) The Mach4 instance handle. If not provided, uses current instance
Note
Documentation generated by AI on 2026-03-04

◆ PositionDisplayDROMode()

CommonGUIModule PositionDisplayDROMode ( )

Delegate to set the position display to DRO mode.

This is a deprecated forwarding function. It delegates to CommonGUIModule.screen.PositionDisplayDROMode(). Use CommonGUIModule.screen.PositionDisplayDROMode() in new code.

Note
Documentation generated by AI on 2026-03-04

◆ PositionDisplayLocked()

CommonGUIModule PositionDisplayLocked ( )

Delegate to lock the position display.

This is a deprecated forwarding function. It delegates to CommonGUIModule.screen.PositionDisplayLocked(). Use CommonGUIModule.screen.PositionDisplayLocked() in new code.

Note
Documentation generated by AI on 2026-03-04

◆ PositionDisplayUnLocked()

CommonGUIModule PositionDisplayUnLocked ( )

Delegate to unlock the position display.

This is a deprecated forwarding function. It delegates to CommonGUIModule.screen.PositionDisplayUnLocked(). Use CommonGUIModule.screen.PositionDisplayUnLocked() in new code.

Note
Documentation generated by AI on 2026-03-04

◆ PowerOff()

CommonGUIModule PowerOff ( )

Save critical data and shut down the Windows operating system.

Saves the tool table via mc.mcToolSaveFile(), saves fixture offsets via mc.mcFixtureSaveFile(), then issues a Windows shutdown command with a 20-second delay (shutdown /s /t 20). Finally calls scr.Exit(true) to close Mach4 immediately.

Returns
(nil) No meaningful return value on success
(boolean) Success flag - false if any save or shutdown step fails
(string) Status message from w.FunctionError() on failure
Warning
This function shuts down the Windows OS. Ensure the machine is in a safe state before calling.
Note
Documentation generated by AI on 2026-03-04

◆ PowerOffBtn()

CommonGUIModule PowerOffBtn ( )

Button handler that delegates to CommonGUIModule.PowerOffControl().

Simple pass-through that calls CommonGUIModule.PowerOffControl() with no arguments, resulting in a confirmation dialog before powering off.

Returns
(any) Returns the result of CommonGUIModule.PowerOffControl()
See also
CommonGUIModule.PowerOffControl() for the full power-off logic
Note
Documentation generated by AI on 2026-03-04

◆ PowerOffControl()

CommonGUIModule PowerOffControl ( skip_confirmation )

Prompt the user to confirm a power-off request and then shut down the control.

If skip_confirmation is false (default), shows a Yes/No confirmation dialog. If confirmed, calls m.PowerOff() immediately. If skip_confirmation is true, shows a 5-second countdown Please Wait dialog before calling m.PowerOff(). The countdown can be cancelled, in which case the power-off is aborted.

Parameters
skip_confirmation(boolean|nil) If true, skips the Yes/No dialog and uses a 5-second delay instead. Defaults to false
Returns
(nil) No meaningful return value on success
(boolean) Success flag - false if dialog fails or user cancels
(string) Status message from w.FunctionError() on failure
Warning
This function will shut down the Windows OS via m.PowerOff() if confirmed
Note
Documentation generated by AI on 2026-03-04

◆ PreviousPocketBtn()

CommonGUIModule PreviousPocketBtn ( use_confirmation )

Change to the previous tool pocket in the tool changer carousel.

Checks MST lock, feedrate override, and rapid override before proceeding. Checks manual mode. Reads the current pocket from CURRENT_TOOL_POCKET_NUMBER_INST and decrements it, wrapping to the maximum pocket number if the result is less than 1. Sets the ChangePocket OEM register to "true" and looks up the tool number for the selected pocket. Builds the appropriate G-code string for the machine type and optionally presents a CycleStartDialog confirmation before executing via mc.mcCntlMdiExecute().

Parameters
use_confirmation(boolean|nil) If true, shows a cycle start confirmation dialog before executing
Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if pocket change was initiated successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ PreviousToolBtn()

CommonGUIModule PreviousToolBtn ( use_confirmation )

Change to the previous tool number in the tool changer.

Checks MST lock, feedrate override, and rapid override before proceeding. Checks manual mode. Reads the currently selected tool and decrements the tool number by 1, clamping to 0 at the minimum. Builds the appropriate G-code string for the machine type (Lathe or Mill). Optionally presents a CycleStartDialog confirmation before executing via mc.mcCntlMdiExecute().

Parameters
use_confirmation(boolean|nil) If true, shows a cycle start confirmation dialog before executing
Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if tool change was initiated successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ print()

UI print ( ...)

Redirect Lua print() calls from executed scripts to the debug output window.

When user scripts are executed via UI.RunLuaCode(), the standard print() function is locally overridden with this function so that output appears in the dialog's Debug Output panel rather than the default Mach4 log. Accepts any number of arguments; each is converted via tostring() and concatenated with a tab separator before being passed to UI.DebugOutputAppend().

Parameters
...(any) Values to print, converted to strings and joined with tab separators
Note
This is a closure defined inside CommonGUIModule.RunLuaScriptFromDialog()
Documentation generated by AI on 2026-03-04

◆ ProcessFileQueue()

CommonGUIModule ProcessFileQueue ( )

Process one command from the Lua file queue, handling errors and stop status.

Sets the active instance to 0 and delegates to CommonGUIModule._ProcessFileQueue() via w.pcall(). If an error occurs, logs it and increments FQ_FAILURE_COUNT. If the failure count reaches FQ_MAX_FAILURE_COUNT, raises an alarm message via w.AlarmMessage() and returns without restarting the timer, permanently disabling the queue.

Warning
If FQ_MAX_FAILURE_COUNT failures accumulate, the file queue timer is permanently disabled. This is a critical failure condition that requires recompiling scripts to recover.
Note
Documentation generated by AI on 2026-03-04

◆ ReadDataFromMach()

CommonGUIModule JobFile ReadDataFromMach ( )

Read current Mach4 state (pound variables, registers, notes) and write to the job file on disk.

Builds the complete job file data table from the current Mach4 state. Iterates over all pound variables in jb.RangeString, all registers in jb.RegTable, and all notes in jb.FileTable.Notes. Assembles the full file structure including headers, data headers, pound vars, registers, and notes. If initialize_table is false, writes the assembled data to the job file CSV via w.WriteCSV(). If initialize_table is true, only populates the in-memory table without writing to disk.

Parameters
initialize_table(boolean|nil) If true, skip writing to disk and only populate in-memory table. Defaults to false
Note
Documentation generated by AI on 2026-03-04

◆ ReadGcodeHeaderParameters()

CommonGUIModule ReadGcodeHeaderParameters ( )

Read G-code header parameters from the currently loaded G-code file.

Thin wrapper that delegates to w.ReadGcodeHeaderParameters(). The caller should prefer the wrapper function directly. Returns whatever w.ReadGcodeHeaderParameters() returns.

Returns
(table|nil) The parsed G-code header parameters table, or nil on error
Note
Documentation generated by AI on 2026-03-04

◆ ReadLoadedFile()

CommonGUIModule SearchGCode ReadLoadedFile ( inst )

Read the currently loaded G-code file line by line into an internal table.

Opens the specified file using io.lines() and inserts each line into self.gcode_tbl. Displays a progress dialog during loading. Calls w.Sleep(1) every 1000 lines to prevent UI freezing during large file loads.

Parameters
file_name(string) The full path to the G-code file to read
inst(number) The Mach4 instance handle. If not provided, uses current instance
Warning
This function blocks during file reading and may be slow for very large files
Note
Documentation generated by AI on 2026-03-04

◆ RegenerateToolPathDialog()

CommonGUIModule RegenerateToolPathDialog ( )

Delegate to regenerate the tool path dialog via the wrapper module.

This is a deprecated forwarding function. It calls w.RegenerateToolPathDialog() directly. Use w.RegenerateToolPathDialog() in new code.

Note
Documentation generated by AI on 2026-03-04

◆ RegisterForMachMessage()

CommonGUIModule RegisterForMachMessage ( inst ,
msg_type ,
callback_func ,
param1 ,
param2  )

Register a callback function to be called when a specific Mach4 message event occurs.

Validates that msg_type is a supported message type from CommonGUIModule.MachMsg["Supported Types"]. For MSG_REG_CHANGED: requires param1 (device name string) and param2 (register name string); retrieves the register handle via w.GetRegHandle() and stores the callback keyed by handle. For MSG_IO_CHANGED: requires param1 (device name) and param2 (IO name); stores callback keyed by IO handle from w.GetIoHandle(). For MSG_GCODE_VAR_CHANGED: stores callback keyed by param1 (pound variable index). For MSG_PARAMETER_CHANGED: stores callback keyed by param1 (parameter index). Raises a Lua error via w.Error() if arguments are invalid or unsupported.

Parameters
inst(number) The Mach4 instance handle. If not provided, uses current instance
msg_type(number) The Mach4 message type constant (e.g., mc.MSG_REG_CHANGED)
callback_func(function) The function to call when the message is received
param1(string|number) Device name (for REG/IO types) or pound var/parameter index
param2(string|nil) Register name or IO name (for REG/IO types); unused for others
Warning
Raises a Lua error if msg_type is unsupported, arguments are invalid, or the register/IO handle cannot be found
Note
Documentation generated by AI on 2026-03-04

◆ ReLoad()

CommonGUIModule JobFile ReLoad ( )

Reload the last loaded job file from the path stored in the MachMotionOEMParameters register.

Reads the 'LastLoadedJobFilePath' register value from the "MachMotionOEMParameters" device. If the value is non-empty and not the sentinel " ", calls jb:Load() with that path to restore the previously loaded job file on startup or after a script recompile.

Note
Documentation generated by AI on 2026-03-04

◆ RemoteSupportBtn()

CommonGUIModule RemoteSupportBtn ( )

Open the MachMotion remote support tool.

Delegates to CommonGUIModule._RemoteSupportBtn() via w.ProtectedMsg() for error handling. The underlying implementation locates and executes the _MachMotionRemoteSupport.cmd script from the profile's ConfigTools directory.

Note
Documentation generated by AI on 2026-03-04

◆ Reset()

CommonGUIModule Reset ( )

Reset the Mach4 controller with re-entrancy protection.

Guards against concurrent execution using w.FuncTracing["m.Reset"]. If already in progress, logs a skip message and returns an error. Otherwise calls m._Reset() via w.pcall() for protected execution. On error, logs an alarm message via w.AlarmMessage() and returns a formatted error via w.FunctionError().

Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the reset completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ ResetAllOverrideAxes()

CommonGUIModule ResetAllOverrideAxes ( inst )

Reset all override (OB1-OB6) axes to zero position and restore their override mappings.

Checks if the machine is enabled via the OSIG_MACHINE_ENABLED signal. If enabled, iterates over all OB axes (OB1_AXIS through OB6_AXIS) and checks up to 4 override axis mappings per axis via mcAxisGetOverrideAxis(). For each mapped override axis that is not -1, removes the override via mcAxisRemoveOverrideAxis(), then jogs the axis to position 0 at maximum jog feedrate if the current position is more than 0.001 units from zero. After all axes are jogging, displays a PleaseWaitDialog until motion stops, then restores all override mappings via mcAxisSetOverrideAxis(). Always calls w.FunctionCompleted() on exit.

Parameters
inst(number) The Mach4 instance handle. If not provided, uses current instance
Warning
This function modifies axis override mappings and commands motion. Ensure the machine is in a safe state before calling.
Note
Documentation generated by AI on 2026-03-04

◆ ResetBtn()

CommonGUIModule ResetBtn ( )

Button handler to reset the controller, running pre/post reset hooks.

Logs the button press via w.OperatorLog(). Runs the PreResetBtn hook scripts. Calls m.CycleStop(1) to ensure the machine is stopped before resetting. Reads GMS alarm status. Runs the ResetBtn and PostResetBtn hook scripts. Delegates to m.Reset() to perform the actual controller reset. Returns the result from m.Reset().

Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the reset completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ ResetCurrentPocket()

CommonGUIModule ResetCurrentPocket ( )

Reset the current tool pocket number to a user-specified value.

Requires password level 3. Calls user.UserResetCurrentPocket() if defined, allowing a user script to override the default behavior. Reads the ToolChangerMemorySource OEM parameter to determine the pocket storage method. For PLC-sourced memory, pulses bit 2 of ContBitData via Modbus. For Mach-sourced memory, prompts the operator for a pocket number via a text dialog and stores it via w.SetToolChangeStatus(). Calls m.CompileScriptsBtn() after updating.

Parameters
IgnoreConfirmationDialogs- not applicable; password check is always enforced
Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if operation completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ ResetEndOfProgramOutput()

CommonGUIModule ResetEndOfProgramOutput ( inst )

Reset the end-of-program output signal and clear the EndOfProgram register.

If the OEM parameter signal 'EndOfProgramOutput' is configured, sets it to false. Then resets the 'EndOfProgram' OEM register value to 0 to clear the end-of-program state.

Parameters
inst(number) The Mach4 instance handle. If not provided, uses current instance
Returns
(nil) No meaningful return value on success
(boolean) Success flag - true if operation completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ ResetLaserPointerOffset()

CommonGUIModule ResetLaserPointerOffset ( )

Clear the laser pointer X and Y offset pound variables back to zero.

Retrieves the offset variable indices via m.GetLaserPointerOffsetVars(). Writes 0 to both the X and Y offset pound variables via mc.mcCntlSetPoundVar(). Logs errors via w.FunctionError() if either API call fails.

Note
Documentation generated by AI on 2026-03-04

◆ ResetSafetyRelay()

MotionController ResetSafetyRelay ( )

Reset the safety relay circuit with re-entrancy protection.

Base implementation to reset the safety relay on the motion controller.

Guards against concurrent execution using w.FuncTracing["m.ResetSafetyRelay"]. If already in progress, logs a skip message and returns an error. Otherwise calls m._ResetSafetyRelay() via w.pcall() for protected execution. On error, returns a formatted error message via w.FunctionError().

Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the safety relay was reset successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

Does nothing in the base implementation. Subclasses (RapidPath) override this to send a 'ResetSafetyRelay' operation command to the plugin, which initializes the watchdog I/O for the safety relay circuit.

See also
RapidPath:ResetSafetyRelay() for RapidPath-specific implementation
Note
Documentation generated by AI on 2026-03-04

◆ RestoreHeadShiftOffsets()

CommonGUIModule RestoreHeadShiftOffsets ( )

Restore saved head shift offsets to all axes for all instances based on OEM parameter mode.

Iterates over all instances and all coordinate axes. For each instance whose 'HeadShiftOffsetsMode' OEM parameter equals "Restore Last Value" or "Restore Permanent Value", reads the saved offset from the 'HeadShiftOffset_<axis>' OEM parameter and applies it to the corresponding pound variable (5081 + axis index) via mc.mcCntlSetPoundVar(). Returns an error if any read or set operation fails.

Returns
(nil) No meaningful return value on success
(boolean) Success flag - true if all offsets were restored successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ ReStoreMachOverrides()

CommonGUIModule ReStoreMachOverrides ( )

Restore previously saved Mach4 speed overrides from the profile.

Reads the 'RetainMachOverrides' OEM parameter; if not "Yes", returns immediately. Otherwise, restores the Spindle Override via mc.mcSpindleSetOverride(), the Feedrate Override via mc.mcCntlSetFRO(), and the Rapid Rate Override via mc.mcCntlSetRRO(), reading each value from the MachMotion profile section. Returns an error if any profile read or set operation fails.

Returns
(nil) No meaningful return value on success
(boolean) Success flag - true if overrides were restored successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ RestoreWorkShiftOffsets()

CommonGUIModule RestoreWorkShiftOffsets ( )

Restore saved work shift offsets to all axes for all instances based on OEM parameter mode.

Iterates over all instances and all coordinate axes. For each instance whose 'WorkShiftOffsetsMode' OEM parameter equals "Restore Last Value" or "Restore Permanent Value", reads the saved offset from the 'WorkShiftOffset_<axis>' OEM parameter and applies it to the corresponding pound variable (5201 + axis index) via mc.mcCntlSetPoundVar(). Returns an error if any read or set operation fails.

Returns
(nil) No meaningful return value on success
(boolean) Success flag - true if all offsets were restored successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ ResumeProfiler()

CommonGUIModule _LuaProfiling ResumeProfiler ( logpath )

Resume a previously paused Lua profiling session.

Checks that the profiler module is loaded and that profiling is currently active via prof.IsProfiling(). If both conditions are met, calls prof.profiler.resume() to continue collecting profiling data from where it was paused. Does nothing if the profiler is not loaded or profiling is not active.

Parameters
logpath(string|nil) Unused parameter, accepted for API consistency with StopProfiler
Note
Documentation generated by AI on 2026-03-04

◆ ReverseRunBtn()

CommonGUIModule ReverseRunBtn ( )

Button handler to initiate a reverse run operation.

Logs the button press via w.OperatorLog() and updates the stop status. Checks manual mode via CommonGUIModule.ManualModeIsActive(). Returns a successful completion status. The actual reverse run signal toggling is commented out in the current implementation.

Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the operation completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ Rewind()

CommonGUIModule Rewind ( )

Rewind the currently loaded G-code file to the beginning.

Runs registered hooks via m.RunHooks("Rewind"). If hooks allow continuation, calls mc.mcCntlRewindFile() to rewind the G-code file to line 1. Returns an error if the API call fails.

Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the rewind completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ RewindBtn()

CommonGUIModule RewindBtn ( )

Button handler to rewind the currently loaded G-code file to the beginning.

Logs the button press via w.OperatorLog() and delegates to m.Rewind() to perform the actual rewind operation.

Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the rewind completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ RunFromHereBtn()

CommonGUIModule RunFromHereBtn ( )

Button handler to initiate a run-from-here operation at the current G-code line.

Logs the button press via w.OperatorLog(). Reads the current G-code file name and line number. If the line number is <= 1, logs a cancellation message and returns. Checks the mm_RunFromHereDialog register; if already set to 1, clears it and returns. If a file is loaded, updates stop status and checks manual mode. Calls the user UserRunFromHere script if defined; otherwise sets the mm_RunFromHereDialog register to 1 to trigger the built-in run-from-here dialog. If no file is loaded, logs a cancellation message.

Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the dialog was triggered or operation was skipped
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ RunHooks()

CommonGUIModule RunHooks ( hook_name ,
... )

Run registered hook scripts for the specified hook event.

Delegates to CommonGUIModule._RunHooks() with the silent flag set to false. Checks hook functions in the following priority order: user module, user module with "User" prefix, m.screen with "Machine" prefix, m.screen with "MachineScreen" prefix, m.screen with no prefix, and m module with "Machine" prefix. Each hook can return (false, ...) to stop further processing or (true, ...) to allow subsequent hooks to run.

Parameters
hook_name(string) The name of the hook to execute (e.g., "EnableBtn", "CycleStart")
...(any) Additional arguments passed through to each hook function
Returns
(boolean) Continue flag - false if a hook handled the event and no further processing should occur
(boolean) Success flag - false if a hook encountered a fatal error
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ RunHooksSilent()

CommonGUIModule RunHooksSilent ( hook_name ,
... )

Run registered hook scripts silently without logging completion messages.

Delegates to CommonGUIModule._RunHooks() with the silent flag set to true. When silent is true, hook completion messages are not passed through w.FunctionCompleted() and are returned as plain strings instead.

Parameters
hook_name(string) The name of the hook to execute (e.g., "EnableBtn", "CycleStart")
...(any) Additional arguments passed through to each hook function
Returns
(boolean) Continue flag - false if a hook handled the event and no further processing should occur
(boolean) Success flag - false if a hook encountered a fatal error
(string) Status message describing the hook result
Note
Documentation generated by AI on 2026-03-04

◆ RunLuaCode()

UI RunLuaCode ( )

Execute the Lua code currently in the Run Lua Script dialog editor.

Saves the current editor content to history, resets the error style, then builds the full execution string via UI.ConstructLuaString() and runs it with w.RunLuaString(). If a compile or load error is returned, the debug output background turns red and the error message is appended. On success, the background is restored and a success message with elapsed time is appended to the debug output window.

Note
This is a closure defined inside CommonGUIModule.RunLuaScriptFromDialog()
Documentation generated by AI on 2026-03-04

◆ RunLuaPrint()

CommonGUIModule RunLuaPrint ( ...)

Convenience alias for AppendRunLuaDebugMessage.

Forwards all arguments to CommonGUIModule.AppendRunLuaDebugMessage(). Appends a message to the Run Lua Script dialog's Debug Output window if it is open. Has no effect if the dialog is not currently visible.

Parameters
...(any) One or more values to display in the debug output window
See also
CommonGUIModule.AppendRunLuaDebugMessage()
Note
Documentation generated by AI on 2026-03-04

◆ RunLuaScriptFromDialog()

CommonGUIModule RunLuaScriptFromDialog ( )

Open the Run Lua Script dialog for interactive Lua code execution.

Creates and displays a resizable dialog containing a Lua script editor, a debug output panel, and history navigation controls. The editor supports both wxTextCtrl and wxStyledTextCtrl (with syntax highlighting if available). Script history is persisted to a .lua file in the profile directory and navigated with up/down arrow buttons. The splitter sash position between editor and debug output is saved and restored from the Mach4 profile. A timer monitors for Mach shutdown and closes the dialog automatically. The dialog exposes a debug print interface via CommonGUIModule._RunLuaUIRef and _G._RunLuaUIRef while open.

Note
The dialog runs Lua code in the context of the CommonGUIModule environment
See also
CommonGUIModule.AppendRunLuaDebugMessage() for external debug output while the dialog is open
Note
Documentation generated by AI on 2026-03-04

◆ RunLubeCycle()

CommonGUIModule RunLubeCycle ( )

Execute the lube system M-code script if the lube system is enabled and not already cycling.

Checks whether LUBE_SYSTEM_ENABLED is "Yes". If enabled, reads the LubeSystemInCycle OEM register; if not already in a cycle, checks that the LubeSystem.mcs M-code file exists and executes it via mc.mcScriptExecutePrivate(). Logs an error via w.FunctionError() if the file is not found or if the script execution fails.

Note
Documentation generated by AI on 2026-03-04

◆ RunLubeCycleOnStartup()

CommonGUIModule RunLubeCycleOnStartup ( )

Run the lube cycle once on startup if configured and not yet run.

Reads the LubeCycleOnStartup OEM register to determine if startup lube is enabled, and reads the LubeStartupFlag OEM register to determine if the cycle has already run this session. If LubeCycleOnStartup is "Yes" and LubeStartupFlag is not 1, executes m.RunLubeCycle() and sets LubeStartupFlag to 1 to prevent re-running on the same session.

Note
Documentation generated by AI on 2026-03-04

◆ RunToolSetterHeightWizard()

CommonGUIModule RunToolSetterHeightWizard ( settername )

Run the tool setter height wizard to calculate and store the tool setter height.

Creates and runs a 4-page wizard that guides the operator through determining the height of an automatic tool setter. Page 1 captures the Z machine position while touching a solid surface. Page 2 instructs the operator to place the setter on the same surface. Page 3 uses a CycleStartHold and executes M903/M901/M1 G-code via w.MDICommand() to probe the tool setter; calculates setter height as (probe_position - surface_position). Page 4 displays the result and prompts the operator to finish. Returns the calculated height and whether the wizard completed.

Parameters
settername(string) The name of the tool setter being calibrated
Returns
(number) The calculated tool setter height in current machine units
(boolean) True if the wizard completed successfully, false if it was canceled
Note
Documentation generated by AI on 2026-03-04

◆ RunToolSetterZPositionWizard()

CommonGUIModule RunToolSetterZPositionWizard ( settername ,
auto_setter ,
manual_setter_height  )

Run the tool setter Z position wizard to calculate and store the tool setter Z machine position.

Creates and runs an 8-page wizard that guides the operator through determining the Z machine position of a tool setter or gauge block. The wizard adapts based on whether the operator has a calibrated tool loaded and whether the setter is automatic or manual. For auto setters, page 6 uses M903/M901/M1 G-code via MDI to probe the setter. For manual setters, page 7 guides the operator to touch off on a gauge block manually. Page navigation uses SetNext/SetPrev to dynamically route through the appropriate pages based on user selections. Supports CycleStartHold integration for the probe step. Returns the calculated setter position and whether the wizard completed.

Parameters
settername(string) The name of the tool setter being calibrated
auto_setter(boolean) True if the setter is an automatic probe-based setter, false for manual
manual_setter_height(number) The known height of the manual setter or gauge block in current units
Returns
(number) The calculated Z machine position of the tool setter or gauge block
(boolean) True if the wizard completed successfully, false if it was canceled
Note
Documentation generated by AI on 2026-03-04

◆ Save()

CommonGUIModule JobFile Save ( )

Persist all tool setter configurations to the Mach4 profile.

Save the job file to its current path, with password protection.

Iterates over all entries in UI.tool_setters. For each non-empty tool setter name, assigns a sequential SectionName (e.g., "ToolSetter0", "ToolSetter1") and writes the setter data via w.WriteToolSetter(). Writes the total count of tool setters to the MachMotion profile section via mc.mcProfileWriteInt(). This is a closure defined inside CommonGUIModule.CalibrateToolSetters().

Note
This is a closure defined inside CommonGUIModule.CalibrateToolSetters()
Documentation generated by AI on 2026-03-04

Checks the password via jb:CheckPassword() before proceeding. If the password check passes, delegates to jb:_Save() which either calls jb:_SaveAs() (if no path is set) or reads current Mach4 data and writes to the existing file path. If the password check fails, logs a message and takes no action.

Returns
(nil) No meaningful return value
Note
Documentation generated by AI on 2026-03-04

◆ SaveAs()

CommonGUIModule JobFile SaveAs ( )

Save the job file to a new location chosen by the user, with password protection.

Checks the password via jb:CheckPassword() before proceeding. If the password check passes, delegates to jb:_SaveAs() which opens a wxFileDialog for the user to choose a save location. If the password check fails, logs a message and takes no action.

Returns
(nil) No meaningful return value
Note
Documentation generated by AI on 2026-03-04

◆ SaveFixtureOffsets()

CommonGUIModule SaveFixtureOffsets ( )

Save fixture offsets to disk for all idle Mach4 instances.

Calls m.ManagePartZeros() to record the current fixture offsets to the rolling history. Then iterates over all Mach4 instances. For each instance that is currently in IDLE state (MACH_STATE_INST[_inst] == mc.MC_STATE_IDLE), calls mc.mcFixtureSaveFile() to persist the fixture offset table to disk. Logs the save action via w.Log().

Returns
(nil) No meaningful primary return value
(boolean) Success flag - false if mc.mcFixtureSaveFile() returns an error
(string) Status message from w.FunctionError() on failure
Note
Fixture offsets are only saved for instances that are currently idle
Documentation generated by AI on 2026-03-04

◆ SaveNotesToFile()

UI SaveNotesToFile ( )

Save the current notes from the dialog to the job file on disk.

Delegates to jb:UpdateNotesOnlyToJobFile() which writes only the Notes section of the job file CSV while leaving all other fields (pound variables, registers, headers) unchanged.

Note
This is a closure defined inside CommonGUIModule._NotesDialog()
Documentation generated by AI on 2026-03-04

◆ SaveSchedule()

CommonGUIModule Scheduler SaveSchedule ( inst )

Save a table of scheduled file entries to the in-memory schedule for a given instance.

Clears the existing schedule for the instance via self:ClearSchedule(), then inserts each entry from files_tbl into the schedule table via table.insert(self:GetSchedule(inst), file).

Parameters
files_tbl(table) Array of file entry tables, each with fields 'path' (string) and 'qty' (string|number)
inst(number) The Mach4 instance handle. If not provided, uses current instance
Note
Documentation generated by AI on 2026-03-04

◆ SaveSettings()

UI SaveSettings ( )

Save the current block delete level checkbox states to the Mach4 profile and apply them.

Reads the checked state of each of the ten block delete level checkboxes (levels 0-9). For each level, writes the boolean value to the MachMotion profile section via mc.mcProfileWriteInt() and applies it immediately via mc.mcCntlSetBlockDelete(). After saving all levels, reads the ToolPathAutoRegen OEM parameter and regenerates the tool path dialog via m.RegenerateToolPathDialog() if the parameter is set to "Yes".

Note
This function is defined as a local closure within CommonGUIModule.BlockDeleteToggleBtn()
Documentation generated by AI on 2026-03-04

◆ SaveSysVars()

CommonGUIModule SaveSysVars ( )

Save system variables to disk for all idle Mach4 instances.

Iterates over all Mach4 instances. For each instance that is currently in IDLE state (MACH_STATE_INST[_inst] == mc.MC_STATE_IDLE), calls mc.mcCntlSaveSysvars() to persist the system variables to disk. Logs the save action via w.Log().

Returns
(nil) No meaningful primary return value
(boolean) Success flag - false if mc.mcCntlSaveSysvars() returns an error
(string) Status message from w.FunctionError() on failure
Note
System variables are only saved for instances that are currently idle
Documentation generated by AI on 2026-03-04

◆ SaveToHistory() [1/2]

UI SaveToHistory ( )

Save the current editor content to the Lua script history file.

Delegates to UI._SaveToHistory() via w.Protected() for error safety. The raw editor text is appended to the history file, the in-memory history table is refreshed, and the current history index is updated to the most recent entry.

Note
This is a closure defined inside CommonGUIModule.RunLuaScriptFromDialog()
Documentation generated by AI on 2026-03-04

◆ SaveToHistory() [2/2]

UI SaveToHistory ( gcode )

Save the current MDI command text to the MDI history file.

Retrieves the current MDI string via UI.ConstructMDIString() and, if non-empty, appends it to the history file via w.AddToListHistory(). Refreshes the in-memory history table and updates the current history index to the most recent entry. Also calls UI.UpdateHistoryBtns() to reflect the new navigation state.

Note
This is a closure defined inside CommonGUIModule.MDIDialog()
Documentation generated by AI on 2026-03-04

◆ SaveToolOffsets()

CommonGUIModule SaveToolOffsets ( )

Save tool offsets to disk for all idle Mach4 instances.

Iterates over all Mach4 instances. For each instance that is currently in IDLE state (MACH_STATE_INST[_inst] == mc.MC_STATE_IDLE), calls mc.mcToolSaveFile() to persist the tool offset table to disk. Logs the save action via w.Log().

Returns
(nil) No meaningful primary return value
(boolean) Success flag - false if mc.mcToolSaveFile() returns an error
(string) Status message from w.FunctionError() on failure
Note
Tool offsets are only saved for instances that are currently idle
Documentation generated by AI on 2026-03-04

◆ ScanWarningsAlarms()

CommonGUIModule ScanWarningsAlarms ( )

Update the alarm dialog button icon based on current GMS alarm and warning state.

Reads active alarms via w.GetGMSAlarms() and warnings via w.GetGMSWarnings(). If either is active, alternates the AlarmDialogBtn icon between "alarm-icon.png" and "warning-icon.png" in sync with BLINK_OBJECT_ACTIVE to create a blinking effect. If neither alarms nor warnings are active, sets the icon to "ok-icon.png". Only updates the screen object when the icon actually changes to minimize unnecessary screen writes.

Returns
(nil) No meaningful return value on success
(boolean) False with error message if GMS alarm or warning read fails
(string) Status message from w.FunctionError() on failure
Note
Documentation generated by AI on 2026-03-04

◆ ScreenConfigurationDialog()

CommonGUIModule ScreenConfigurationDialog ( )

Delegate to open the screen configuration dialog.

This is a deprecated forwarding function. It delegates to CommonGUIModule.screen.ScreenConfigurationDialog(). Use CommonGUIModule.screen.ScreenConfigurationDialog() in new code.

Note
Documentation generated by AI on 2026-03-04

◆ ScreenIsLoadedScript()

CommonGUIModule ScreenIsLoadedScript ( )

Entry point called when the Mach4 screen has finished loading all controls.

Wraps CommonGUIModule._ScreenIsLoadedScript() via w.Protected() for error handling, then calls w.FunctionCompleted(). The inner function performs final post-load initialization: resizes the tool path panel height, yields to allow the GUI to process events, runs CommonStartUpScript(), sets the ScreenIsLoaded OEM register to 1, runs the "ScreenIsLoadedScript" hooks, and sets ENABLE_MAIN_PLC_SCRIPT to true to allow PLC execution.

Note
Documentation generated by AI on 2026-03-04

◆ Search()

CommonGUIModule SearchGCode Search ( )

Search the loaded G-code file for lines matching a keyword.

Converts the keyword to lowercase and iterates over self.gcode_tbl, performing a case-insensitive pattern match on each line. Matching lines are collected into a result table with fields 'idx' (1-based line number) and 'gcode' (original line text).

Parameters
keyword(string) The search term to look for (case-insensitive)
Returns
(table) Array of match tables, each with fields 'idx' (number) and 'gcode' (string)
Note
Documentation generated by AI on 2026-03-04

◆ SearchGCodeBtn()

CommonGUIModule SearchGCodeBtn ( )

Open the G-code search dialog for the currently loaded G-code file.

Logs the button press via w.OperatorLog(). Reads the currently loaded G-code file name via mc.mcCntlGetGcodeFileName(). If a file is loaded, updates the stop status and checks manual mode via m.ManualModeIsActive(). If preconditions pass, initializes the SearchGCode dialog via CommonGUIModule.SearchGCode:Initialize(). If no file is loaded, logs a cancellation message.

Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the dialog was opened or operation was skipped
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ SendFilesToRegister()

CommonGUIModule Scheduler SendFilesToRegister ( inst )

Serialize all scheduled files to an OEM register string for persistence.

If from_gui is true, reads the current file list from the Schedule Editor UI via self:GetSchedFiles() and saves it to the in-memory schedule table via self:SaveSchedule(). If from_gui is false, reads directly from the in-memory schedule via self:GetSchedule(). Formats each file entry as "path|name|qty/" and writes the concatenated string to the OEM register identified by self.FILE_REG via w.SetOEMRegValueString().

Parameters
from_gui(boolean) If true, reads file list from the UI list control; if false, reads from in-memory schedule
inst(number) The Mach4 instance handle. If not provided, uses current instance
Note
Documentation generated by AI on 2026-03-04

◆ SendToolTable()

CommonGUIModule SendToolTable ( )

Serialize and send the tool name table to the MachMotion plugin via register command.

If TOOL_NAMES is nil or empty, calls w.CreateToolInfoFile() to populate it. If TOOL_NAMES is populated, builds a pipe-delimited command string encoding the count of tools, each tool index, and all non-table key-value pairs for each tool entry (table values are serialized as comma-separated lists). Sends the serialized string to the MachMotion plugin via w.RegSendCommand() on the "mm_ToolTable" register. Logs errors via w.FunctionError().

Note
Documentation generated by AI on 2026-03-04

◆ SetColumns()

CommonGUIModule Scheduler SetColumns ( )

Create and insert the column headers for the Schedule Editor list control.

Iterates over self.UI.cols ({"File", "Qty"}) and inserts each as a column into the wxListCtrl (self.UI.m_listCtrl2). The first column uses default left alignment; subsequent columns use center alignment (wxLIST_FORMAT_CENTER). Sets initial column widths with column 0 taking the available width minus 80 pixels and column 1 set to 80 pixels.

Note
Documentation generated by AI on 2026-03-04

◆ SetColumnsWidth()

CommonGUIModule Scheduler SetColumnsWidth ( )

Recalculate and apply column widths for the Schedule Editor list control.

Reads the current size of the wxListCtrl (self.UI.m_listCtrl2) and sets column 0 (file path) to the total width minus 80 pixels, and column 1 (quantity) to 80 pixels. Delegates the actual work to self:_SetColumnsWidth() via w.pcall() for error protection.

Note
Documentation generated by AI on 2026-03-04

◆ SetCurrentFixtureOffset()

CommonGUIModule SetCurrentFixtureOffset ( AxisID ,
value ,
inst  )

Set the current fixture offset value for the specified axis.

Reads the current fixture index via mc.mcFixtureGetCurrentIndex(). For older Mach4 versions (before build 4898), uses the SV_FIXTURE_G54 pound variable approach to set the offset. For newer versions, uses mc.mcFixtureSetOffset() to set the value directly.

Parameters
AxisID(number) The axis identifier to set the offset for (e.g., mc.X_AXIS)
value(number) The fixture offset value to set
inst(number|nil) The Mach4 instance handle. If not provided, uses selected instance
Note
Documentation generated by AI on 2026-03-04

◆ SetCurrentFixtureOffsetDRO()

CommonGUIModule SetCurrentFixtureOffsetDRO ( value ,
AxisID ,
... )

DRO callback to set the current fixture offset for the specified axis.

Converts the value to a number via w.tonumber() and delegates to CommonGUIModule.SetCurrentFixtureOffset() with the provided AxisID and current instance. Returns the original value string for the DRO display.

Parameters
value(string) The new offset value entered in the DRO
AxisID(number) The axis identifier to set the offset for (e.g., mc.X_AXIS)
...(any) Additional arguments passed by the DRO framework (ignored)
Returns
(string) The original value string passed in, for DRO display
Note
Documentation generated by AI on 2026-03-04

◆ SetCurrentToolDRO()

CommonGUIModule SetCurrentToolDRO ( selectedtool ,
... )

Set the current tool number, updating pocket assignments and tool length offset as configured.

Reads ToolChangerMethod, AutoEnableToolLengthOffset, and ToolChangerType OEM parameters. For Auto tool changers (non-Random Memory ATC), prompts the operator to register the tool to a pocket number via a number input dialog. Calls w.SetCurrentTool() to set the tool, then updates pocket assignments in the tool table, removing the tool from any previously mapped pocket. For Random Memory ATC, clears the tool's pocket mapping. Updates the PreviousToolBeforeDrillBank status and optionally enables the tool length offset via mc.mcCntlSetOffsetIndex() if AutoEnableToolLengthOffset is "Yes".

Parameters
selectedtool(number) The tool number to set as the current tool
...(any) Additional arguments accepted for screen DRO compatibility (unused)
Returns
(number|nil) The selectedtool value on success, or nil on error
(boolean) Success flag - true if operation completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ SetDryRun()

CommonGUIModule SetDryRun ( on_off )

Set the dry run mode on or off for the selected instance.

Checks manual mode via m.ManualModeIsActive(). If manual mode is active or the check fails, returns an error. If on_off is true, sets the DryRun OEM parameter string to "Yes" via w.eSetOEMParamValueString(). If on_off is false, sets it to "No".

Parameters
on_off(boolean) True to enable dry run mode, false to disable it
Note
Documentation generated by AI on 2026-03-04

◆ SetErrorStyle()

UI SetErrorStyle ( is_error )

Set the debug output background color to indicate error or normal state.

If is_error is true, sets the debug output text control background to a light red color to highlight that an error occurred. If false, restores the default background color. Calls Refresh() on the control to apply the change immediately. Has no effect if the dialog or debug output control is not available.

Parameters
is_error(boolean) True to show error style (red background), false to restore normal
Note
This is a closure defined inside CommonGUIModule.RunLuaScriptFromDialog()
Documentation generated by AI on 2026-03-04

◆ SetFeedrateDRO()

CommonGUIModule SetFeedrateDRO ( FeedRate ,
... )

Set the active feedrate via MDI command when the machine is idle and enabled.

Updates the stop status via w.SetStopStatus(). If the machine state is IDLE and MACH_ENABLED is true, executes an "F<FeedRate>" MDI command via mc.mcCntlMdiExecute(). If the machine is not idle or not enabled, returns success without changing the feedrate.

Parameters
FeedRate(number) The target feedrate value in current units per minute
...(any) Additional arguments accepted for screen DRO compatibility (unused)
Returns
(number|nil) The FeedRate value if MDI succeeded, or nil if machine was not idle/enabled
(boolean) Success flag - true if operation completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ SetFeedrateOverride()

CommonGUIModule SetFeedrateOverride ( percentage )

Set the feedrate override percentage with hook support and bounds clamping.

Runs registered hooks via m.RunHooks("SetFeedrateOverride", percentage). Clamps the percentage to configured bounds via m.CheckFeedrateOverride(). Applies the override via mc.mcCntlSetFRO(). Returns the clamped percentage that was applied.

Parameters
percentage(number) The desired feedrate override percentage (0-100 scale)
Returns
(number|nil) The clamped feedrate override percentage that was applied, or nil on error
(boolean) Success flag - true if the override was set successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ SetInhibitJoggingWhenNotHomedOverride()

CommonGUIModule SetInhibitJoggingWhenNotHomedOverride ( on_off ,
inst  )

Set the jog inhibit override state for the specified instance.

Resolves the instance via w.GetUTI(). Validates on_off as a boolean (defaults to false if not boolean). Stores the value in INHIBIT_JOGGING_WHEN_NOT_HOMED_OVERRIDE_INST for the resolved instance index. When the override is true, jogging is permitted even when axes are not homed, bypassing the InhibitJoggingWhenNotHomed interlock.

Parameters
on_off(boolean) True to enable the override (allow jogging when not homed), false to disable it
inst(number|nil) The Mach4 instance handle. If not provided, uses selected instance
Note
Documentation generated by AI on 2026-03-04

◆ SetJogModeContinuous()

CommonGUIModule SetJogModeContinuous ( )

Set the jog mode to continuous velocity jogging.

If continuous mode is not already active, stops all active jogging via m.StopJogging(-1), sets JOG_MODE_INC to false and JOG_MODE_CONT to true.

Note
Documentation generated by AI on 2026-03-04

◆ SetJogModeIncremental()

CommonGUIModule SetJogModeIncremental ( )

Set the jog mode to incremental stepping.

If incremental mode is not already active, stops all active jogging via m.StopJogging(-1), sets JOG_MODE_INC to true and JOG_MODE_CONT to false.

Note
Documentation generated by AI on 2026-03-04

◆ SetLaserPointerOffset()

CommonGUIModule SetLaserPointerOffset ( )

Apply the stored laser pointer X and Y offsets to the corresponding pound variables.

Retrieves the offset variable indices via m.GetLaserPointerOffsetVars(). Reads the LaserPointerOffset_X and LaserPointerOffset_Y OEM register values via w.GetOEMRegValue() and writes them to the X and Y offset pound variables via mc.mcCntlSetPoundVar(). Logs errors via w.FunctionError() if any register read or API call fails.

Note
Documentation generated by AI on 2026-03-04

◆ SetMCodeCounter()

UI SetMCodeCounter ( )

Write the M-code counter enable/disable selection to the Mach4 parameter.

Reads the current selection index from UI.m_MCodeCounter and calls UI.SetParameter() to write it to mc.PV_PRTCNTL.

Note
This is a closure defined inside CommonGUIModule._PartCounterDialog()
Documentation generated by AI on 2026-03-04

◆ SetMcodeNumber()

UI SetMcodeNumber ( )

Write the M-code number value from the numeric control to the Mach4 parameter.

Reads the current value from UI.m_McodeNumber and calls UI.SetParameter() to write it to mc.PV_PRTINCM.

Note
This is a method defined inside CommonGUIModule._PartCounterDialog()
Documentation generated by AI on 2026-03-04

◆ SetParameter()

UI SetParameter ( param ,
value  )

Set a Mach4 parameter to the specified value with logging.

Logs the parameter number and value via w.Log(), then calls w.SetParameter() to write the value to Mach4. Converts the value to a number via tonumber() before writing.

Parameters
param(number) The Mach4 parameter constant (e.g., mc.PV_PRTSA)
value(string|number) The value to set the parameter to
Note
This is a closure defined inside CommonGUIModule._PartCounterDialog()
Documentation generated by AI on 2026-03-04

◆ SetPartsCurrentProgram()

UI SetPartsCurrentProgram ( )

Write the current program parts value from the numeric control to the Mach4 parameter.

Reads the current value from UI.m_PartsCurrentProgram and calls UI.SetParameter() to write it to mc.PV_PRTSA.

Note
This is a method defined inside CommonGUIModule._PartCounterDialog()
Documentation generated by AI on 2026-03-04

◆ SetPartsRequired()

UI SetPartsRequired ( )

Write the parts required value from the numeric control to the Mach4 parameter.

Reads the current value from UI.m_PartsRequired and calls UI.SetParameter() to write it to mc.PV_PRTSN.

Note
This is a method defined inside CommonGUIModule._PartCounterDialog()
Documentation generated by AI on 2026-03-04

◆ SetPartsTotal()

UI SetPartsTotal ( )

Write the total parts value from the numeric control to the Mach4 parameter.

Reads the current value from UI.m_PartsTotal and calls UI.SetParameter() to write it to mc.PV_PRTST.

Note
This is a method defined inside CommonGUIModule._PartCounterDialog()
Documentation generated by AI on 2026-03-04

◆ SetRotaryAxisFeedrateMode()

CommonGUIModule SetRotaryAxisFeedrateMode ( axis_id ,
val  )

Set the feedrate mode for a rotary axis.

If the specified axis is a rotary axis (checked via AXIS_IS_ROTARY_INST), converts a boolean val to 0 or 1 if needed. Sets the VAL_AXIS_VALTYPE value for the axis via w.api("mcCntlSetValue") for the selected instance. A value of 0 sets normal feedrate mode; a value of 1 sets Constant Surface Speed mode.

Parameters
axis_id(number) The axis identifier to configure (typically mc.A_AXIS through mc.C_AXIS)
val(number|boolean) The feedrate mode value: 0 or false for normal, 1 or true for Constant Surface Speed
Note
Documentation generated by AI on 2026-03-04

◆ SetSelectedSpindleNumber()

CommonGUIModule SetSelectedSpindleNumber ( inst ,
spindle  )

Set the selected spindle number for the specified Mach4 instance.

Parameters
inst(number|nil) The Mach4 instance handle. If not provided, uses current instance
spindle(number) The spindle number to set as selected
Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the spindle was set successfully
(string) Status message from w.SetSelectedSpindle()
Note
Documentation generated by AI on 2026-03-04

◆ SetSelectedToolDRO()

CommonGUIModule SetSelectedToolDRO ( SelectedTool ,
... )

Set the currently selected tool number pound variable.

Writes the SelectedTool value to the mc.SV_CUR_SELECTED_TOOL pound variable via mc.mcCntlSetPoundVar(). Returns an error if the API call fails.

Parameters
SelectedTool(number) The tool number to set as the selected tool
...(any) Additional arguments accepted for screen DRO compatibility (unused)
Returns
(number|nil) The SelectedTool value on success, or nil on error
(boolean) Success flag - true if operation completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ SetSpindleOverride()

CommonGUIModule SetSpindleOverride ( percentage )

Set the spindle override percentage with hook support and bounds clamping.

Runs registered hooks via m.RunHooks("SetSpindleOverride", percentage). Clamps the percentage to configured bounds via m.CheckSpindleOverride(). Converts from 0-100% scale to Mach4's internal representation and applies via mc.mcSpindleSetOverride(). Returns the clamped percentage that was applied.

Parameters
percentage(number) The desired spindle override percentage (0-100 scale)
Returns
(number|nil) The clamped spindle override percentage that was applied, or nil on error
(boolean) Success flag - true if the override was set successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ SetSpindleSpeedDRO()

CommonGUIModule SetSpindleSpeedDRO ( Speed ,
... )

Set the spindle speed via MDI command when the machine is idle and enabled.

Updates the stop status via w.SetStopStatus(). If the machine state is IDLE and MACH_ENABLED is true, executes an "S<Speed>" MDI command via mc.mcCntlMdiExecute(). If the machine is not idle, sets the commanded spindle RPM directly via w.api("mcSpindleSetCommandRPM").

Parameters
Speed(number) The target spindle speed in RPM
...(any) Additional arguments accepted for screen DRO compatibility (unused)
Returns
(number|nil) The Speed value if MDI succeeded, or nil if machine was not idle
(boolean) Success flag - true if operation completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ SetToolDiameterDRO()

CommonGUIModule SetToolDiameterDRO ( ToolDiameterOffset ,
... )

Set the tool diameter (or radius) offset for the current tool and save the tool file.

Reads the current tool number via mc.mcToolGetCurrent(). If the screen is configured for diameter entry mode (m.IsToolSizeEntryDiameterMode()), divides the provided value by 2 to convert from diameter to radius before storing. Writes the radius value via mc.mcToolSetData() with MTOOL_MILL_RAD and saves the tool file via mc.mcToolSaveFile().

Parameters
ToolDiameterOffset(number) The tool diameter or radius offset value to set in current units
...(any) Additional arguments accepted for screen DRO compatibility (unused)
Returns
(number|nil) The stored ToolDiameterOffset value on success, or nil on error
(boolean) Success flag - true if operation completed successfully
(string) Status message from w.FunctionError() on failure
Note
Documentation generated by AI on 2026-03-04

◆ SetToolLengthDRO()

CommonGUIModule SetToolLengthDRO ( ToolLengthOffset ,
... )

Set the tool length offset for the current tool and optionally enable it.

Reads the AutoEnableToolLengthOffset OEM parameter. Sets the MTOOL_MILL_HEIGHT value for the current tool via mc.mcToolSetData() and saves the tool file via mc.mcToolSaveFile(). If AutoEnableToolLengthOffset is "Yes", also activates the tool length compensation by calling mc.mcCntlSetOffsetIndex() with the current tool number.

Parameters
ToolLengthOffset(number) The tool length offset value to set in current units
...(any) Additional arguments accepted for screen DRO compatibility (unused)
Returns
(number|nil) The ToolLengthOffset value on success, or nil on error
(boolean) Success flag - true if operation completed successfully
(string) Status message from w.FunctionError() on failure
Note
Documentation generated by AI on 2026-03-04

◆ SetToolSizeEntryMode()

CommonGUIModule SetToolSizeEntryMode ( mode )

Configure the tool size entry mode for the Tool Offsets dialog and screen display.

Sets the tool size entry mode to either "radius" or "diameter". Validates the mode string and verifies a minimum Mach4 version (4.2.0.3230) is installed. Updates the Tool Offsets column definitions via mc.mcToolSetPropertyStr() to use the appropriate field names and types (MTOOL_MILL_RAD/MTOOL_MILL_DIA and their wear counterparts). Also updates the screen DRO label and DRO code for the ToolDiameterDRO(1) object to match the selected mode.

Parameters
mode(string) The tool size entry mode - must be either "radius" or "diameter"
Returns
(nil|boolean) nil on success, false with error message if validation fails
(boolean) Success flag - true if mode was configured successfully
(string) Status message from w.FunctionError() on failure
Note
Documentation generated by AI on 2026-03-04

◆ SetupDialog()

UI SetupDialog ( )

Initialize the block delete level checkboxes from the saved Mach4 profile values.

Reads the saved state for each of the ten block delete levels (0-9) from the MachMotion profile section via mc.mcProfileGetInt() and sets the corresponding checkbox value via SetValue(). This restores the previous block delete level selections when the dialog is opened.

Note
This function is defined as a local closure within CommonGUIModule.BlockDeleteToggleBtn()
Documentation generated by AI on 2026-03-04

◆ SetWarningMessage()

CommonGUIModule SetWarningMessage ( Message ,
TimeOut ,
EveryWhere ,
Title ,
Size ,
inst  )

Display a warning message - delegates to the wrapper module implementation.

This function was moved to the wrapper module. Calls w.SetWarningMessage() with all provided arguments and returns the result.

Parameters
Message(string) The warning message text to display
TimeOut(boolean) If true, the message will automatically time out and clear
EveryWhere(boolean) If true, the message is displayed across all screens
Title(string|nil) Optional title for the warning message
Size(number|nil) Optional size hint for the message display
inst(number|nil) The Mach4 instance handle. If not provided, uses current instance
Returns
(any) The return value from w.SetWarningMessage()
See also
w.SetWarningMessage() for the full implementation
Note
Documentation generated by AI on 2026-03-04

◆ ShowMachineStats()

CommonGUIModule ShowMachineStats ( )

Show machine statistics (currently commented out/disabled).

This function is currently disabled and not called. When active, it would read machine statistics from the Mach4 profile including total hours, spindle hours, distance traveled per axis, and M-code counts (M3, M4, M6), then display them in a message box.

Note
This function body is commented out in the source code and has no effect when called
Documentation generated by AI on 2026-03-04

◆ ShowMachMenu()

CommonGUIModule ShowMachMenu ( )

Show the Mach4 menu bar and persist the setting to the profile.

Calls scr.ShowMenu(true) to display the menu and writes HideMachMenu=0 to the MachMotion profile section so the setting persists across restarts.

Note
Documentation generated by AI on 2026-03-04

◆ SingleBlockOff()

CommonGUIModule SingleBlockOff ( inst )

Turn off single block mode for the specified instance.

Reads the current single block state via mc.mcCntlGetSingleBlock(). If single block is currently enabled (returns 1), disables it by calling mc.mcCntlSetSingleBlock() with 0.

Parameters
inst(number) The Mach4 instance handle. If not provided, uses selected instance
Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the operation completed successfully
(string) Status message from w.FunctionCompleted()
Note
Documentation generated by AI on 2026-03-04

◆ SingleBlockOn()

CommonGUIModule SingleBlockOn ( inst )

Turn on single block mode for the specified instance.

Reads the current single block state via mc.mcCntlGetSingleBlock(). If single block is currently disabled (returns 0), enables it by calling mc.mcCntlSetSingleBlock() with 1.

Parameters
inst(number) The Mach4 instance handle. If not provided, uses selected instance
Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the operation completed successfully
(string) Status message from w.FunctionCompleted()
Note
Documentation generated by AI on 2026-03-04

◆ SingleBlockToggleBtn()

CommonGUIModule SingleBlockToggleBtn ( inst )

Button handler to toggle single block mode on or off.

Logs the button press via w.OperatorLog(). Checks the current single block state via m.IsSingleBlockOn(). If currently on, calls m.SingleBlockOff() to disable it. Otherwise calls m.SingleBlockOn() to enable it.

Parameters
inst(number) The Mach4 instance handle. If not provided, uses selected instance
Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the toggle completed successfully
(string) Status message from w.FunctionCompleted()
Note
Documentation generated by AI on 2026-03-04

◆ SkipSpindleWarmUp()

CommonGUIModule SkipSpindleWarmUp ( )

Skip an active spindle warm-up cycle and mark warm-up as completed.

Requires password level 2. Executes registered hooks via m.RunHooks("SkipSpindleWarmUp"). If a warm-up is currently active (SpindleWarmUpActive == 1), sets the register to -1 to cancel it. Writes the current time to SpindleWarmUpOffTime and sets SpindleWarmUpCompleted to 2 to indicate the warm-up was skipped.

Parameters
(none)
Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the skip operation completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ SkipSpindleWarmUpBtn()

CommonGUIModule SkipSpindleWarmUpBtn ( )

Button handler for skipping the spindle warm-up cycle.

Logs the button press via w.OperatorLog() and delegates to CommonGUIModule.SkipSpindleWarmUp() to perform the actual skip operation.

Note
Documentation generated by AI on 2026-03-04

◆ SoftLimitToggleBtn()

CommonGUIModule SoftLimitToggleBtn ( )

Button handler to toggle software limits on or off.

Logs the button press via w.OperatorLog(). Requires the machine to be in IDLE state; returns an error if not idle. If software limits are currently disabled, enables them via w.SetSoftLimits(true). If software limits are currently enabled, disables them via w.SetSoftLimits(false).

Returns
(nil) No meaningful primary return value
(boolean) Success flag - false if the machine is not idle
(string) Status message from w.FunctionError() if not idle
Warning
Software limits prevent axes from traveling beyond configured boundaries. Disabling them can allow unsafe motion.
Note
Documentation generated by AI on 2026-03-04

◆ SpindleBrakeOff()

CommonGUIModule SpindleBrakeOff ( )

Release the spindle brake by executing the SpindleBrakeOff M-code script.

Runs registered hooks via m.RunHooks("SpindleBrakeOff"). If hooks allow continuation, executes the SpindleBrakeOff.mcs script via mc.mcScriptExecute() for the current instance. Updates the stop status before proceeding.

Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the brake-off script executed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ SpindleBrakeOffBtn()

CommonGUIModule SpindleBrakeOffBtn ( )

Button handler to release the spindle brake.

Logs the button press via w.OperatorLog() and delegates to CommonGUIModule.SpindleBrakeOff() to perform the actual brake release.

Note
Documentation generated by AI on 2026-03-04

◆ SpindleBrakeOn()

CommonGUIModule SpindleBrakeOn ( )

Apply the spindle brake by executing the SpindleBrakeOn M-code script.

Runs registered hooks via m.RunHooks("SpindleBrakeOn"). If hooks allow continuation, checks that the spindle is not currently running (mc.mcSpindleGetDirection must equal 0). If the spindle is running, logs the event and returns success without applying the brake. Clears the SpindleBrakeMacroDelay register, then executes SpindleBrakeOn.mcs via mc.mcScriptExecute(). Updates stop status before proceeding.

Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the brake-on script executed successfully or was skipped
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
The brake will not be applied if the spindle is currently running
Documentation generated by AI on 2026-03-04

◆ SpindleBrakeOnBtn()

CommonGUIModule SpindleBrakeOnBtn ( )

Button handler to apply the spindle brake.

Logs the button press via w.OperatorLog() and delegates to CommonGUIModule.SpindleBrakeOn() to perform the actual brake application.

Note
Documentation generated by AI on 2026-03-04

◆ SpindleFWD()

CommonGUIModule SpindleFWD ( use_confirmation )

Start the spindle in forward direction by executing the M3 M-code script.

Updates stop status and runs a spindle safety check via m.SpindleSafetyCheck(). Runs registered hooks via m.RunHooks("SpindleFWD"). Checks MST lock; if active, skips the command with a warning. Checks if SpindleDelayActive is already set to prevent duplicate commands. Optionally presents a CycleStartDialog confirmation before executing. If the machine is enabled, executes the m3.mcs script via mc.mcScriptExecutePrivate(). If the machine is not enabled, displays a warning message.

Parameters
use_confirmation(boolean|nil) If true, shows a cycle start confirmation dialog before executing
Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the forward command was issued or skipped successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Warning
Machine must be enabled before calling this function
Note
Documentation generated by AI on 2026-03-04

◆ SpindleFWDBtn()

CommonGUIModule SpindleFWDBtn ( use_confirmation )

Button handler to start the spindle in forward direction.

Logs the button press via w.OperatorLog() and delegates to CommonGUIModule.SpindleFWD() to perform the actual spindle forward operation.

Parameters
use_confirmation(boolean|nil) If true, shows a cycle start confirmation dialog before executing
Note
Documentation generated by AI on 2026-03-04

◆ SpindleFWDWait()

CommonGUIModule SpindleFWDWait ( use_confirmation )

Start the spindle in forward direction and wait for it to reach speed.

Checks if the spindle is already running forward (MC_SPINDLE_FWD). If not, sets SpindleDelayActive to 2, calls m.SpindleFWD() to initiate forward rotation, then blocks via w.WaitOnCondition() until the SpindleDelayActive register returns to 0, indicating the spindle has reached the commanded speed.

Parameters
use_confirmation(boolean|nil) If true, shows a cycle start confirmation dialog before starting
Warning
This function blocks execution until the spindle reaches speed
Note
Documentation generated by AI on 2026-03-04

◆ SpindleOrient()

CommonGUIModule SpindleOrient ( use_confirmation )

Orient the spindle to its home position using M19.

Requires the machine to be enabled. Updates stop status and runs registered hooks via m.RunHooks("SpindleOrient"). If use_confirmation is true, presents a CycleStartDialog prompt before executing. Executes the orient command via mc.mcCntlMdiExecute(inst, "M19"). If the machine is not enabled, displays a warning message.

Parameters
use_confirmation(boolean|nil) If true or nil (defaults to true), shows a cycle start confirmation dialog before executing
Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if orient command was issued or skipped successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Warning
Machine must be enabled before calling this function
Note
Documentation generated by AI on 2026-03-04

◆ SpindleOrientBtn()

CommonGUIModule SpindleOrientBtn ( )

Button handler to orient the spindle.

Logs the button press via w.OperatorLog() and delegates to CommonGUIModule.SpindleOrient() to perform the actual spindle orientation.

Note
Documentation generated by AI on 2026-03-04

◆ SpindleOrientToggleBtn()

CommonGUIModule SpindleOrientToggleBtn ( use_confirmation )

Toggle spindle orient on or off based on current orient state.

If the spindle is currently oriented (m.IsSpindleOriented() returns true), calls m.SpindleStop() to stop the spindle. Otherwise calls m.SpindleOrient() with the provided confirmation flag to initiate spindle orientation.

Parameters
use_confirmation(boolean|nil) If true, shows a cycle start confirmation dialog before orienting
Note
Documentation generated by AI on 2026-03-04

◆ SpindleOverrideDecrement()

CommonGUIModule SpindleOverrideDecrement ( increment )

Decrement the spindle override percentage by the configured or specified increment.

Reads the current spindle override and rounds it to the nearest integer. If no increment is provided, selects the SmallIncrement (<= 10%) or LargeIncrement (> 10%) from OEM parameters. Runs registered hooks via m.RunHooks("SpindleOverrideDecrement"). Subtracts the increment from the current percentage and delegates to m.SetSpindleOverride() to apply the clamped new value.

Parameters
increment(number|nil) Amount to decrement. If nil, uses the configured small or large increment
Returns
(number|nil) The new spindle override percentage, or nil on error
(boolean) Success flag - true if the override was updated successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ SpindleOverrideIncrement()

CommonGUIModule SpindleOverrideIncrement ( increment )

Increment the spindle override percentage by the configured or specified increment.

Reads the current spindle override and rounds it to the nearest integer. If no increment is provided, selects the SmallIncrement (< 10%) or LargeIncrement (>= 10%) from OEM parameters. Runs registered hooks via m.RunHooks("SpindleOverrideIncrement"). Adds the increment to the current percentage and delegates to m.SetSpindleOverride() to apply the clamped new value.

Parameters
increment(number|nil) Amount to increment. If nil, uses the configured small or large increment
Returns
(number|nil) The new spindle override percentage, or nil on error
(boolean) Success flag - true if the override was updated successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ SpindleREV()

CommonGUIModule SpindleREV ( use_confirmation )

Start the spindle in reverse direction by executing the M4 M-code script.

Updates stop status and runs a spindle safety check via m.SpindleSafetyCheck(). Runs registered hooks via m.RunHooks("SpindleREV"). Checks MST lock; if active, skips the command with a warning. Optionally presents a CycleStartDialog confirmation before executing. If the machine is enabled, executes the m4.mcs script via mc.mcScriptExecutePrivate(). If the machine is not enabled, displays a warning message.

Parameters
use_confirmation(boolean|nil) If true, shows a cycle start confirmation dialog before executing
Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the reverse command was issued or skipped successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Warning
Machine must be enabled before calling this function
Note
Documentation generated by AI on 2026-03-04

◆ SpindleREVBtn()

CommonGUIModule SpindleREVBtn ( use_confirmation )

Button handler to start the spindle in reverse direction.

Logs the button press via w.OperatorLog() and delegates to CommonGUIModule.SpindleREV() to perform the actual spindle reverse operation.

Parameters
use_confirmation(boolean|nil) If true, shows a cycle start confirmation dialog before executing
Note
Documentation generated by AI on 2026-03-04

◆ SpindleREVWait()

CommonGUIModule SpindleREVWait ( use_confirmation )

Start the spindle in reverse and wait for it to reach speed.

Checks if the spindle is already running in reverse (MC_SPINDLE_REV). If not, sets SpindleDelayActive to 2, calls m.SpindleREV() to initiate reverse rotation, then blocks via w.WaitOnCondition() until the SpindleDelayActive register returns to 0, indicating the spindle has reached the commanded speed.

Parameters
use_confirmation(boolean|nil) If true, shows a cycle start confirmation dialog before starting
Warning
This function blocks execution until the spindle reaches speed
Note
Documentation generated by AI on 2026-03-04

◆ SpindleSafetyCheck()

CommonGUIModule SpindleSafetyCheck ( inst )

Verify that the machine is in a safe state to start the spindle.

Checks that the machine is currently enabled (MACH_ENABLED). If not enabled, displays a warning message and returns false. Reads the current GMS alarms and warnings via w.GetGMSAlarms() and w.GetGMSWarnings(). If any alarms or warnings are active, displays a warning prompting the operator to press Reset before starting the spindle.

Parameters
inst(number) The Mach4 instance handle. If not provided, uses selected instance
Returns
(boolean) True if the machine is in a safe state to start the spindle, false otherwise
(boolean) Success flag - true if the check completed without errors
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ SpindleSpeedCheck()

CommonGUIModule SpindleSpeedCheck ( )

Configure and apply the spindle speed check enable state and tolerance percentage.

Reads the SpindleSpeedCheckEnabled and SpindleSpeedCheckPercent OEM parameters for the selected instance. If SpindleSpeedCheckEnabled is "Yes", enables the spindle speed check via mc.mcSpindleSetSpeedCheckEnable(). Otherwise disables it. Clamps SpindleSpeedCheckPercent to a minimum of 1 if it is nil or less than 1, then applies it via mc.mcSpindleSetSpeedCheckPercent().

Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if operation completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ SpindleStop()

CommonGUIModule SpindleStop ( )

Stop the spindle by executing the M5 M-code script.

Updates stop status and runs registered hooks via m.RunHooks("SpindleStop"). Checks MST lock; if active, skips the stop with a warning. Cancels any active spindle warm-up by setting SpindleWarmUpActive to -1. If a SpindleDelay is active, stops the spindle directly via mc.mcSpindleSetDirection(). Otherwise executes the m5.mcs script via mc.mcScriptExecutePrivate() to perform the full stop sequence.

Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the stop command was issued or skipped successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ SpindleStopBtn()

CommonGUIModule SpindleStopBtn ( )

Button handler to stop the spindle.

Logs the button press via w.OperatorLog() and delegates to CommonGUIModule.SpindleStop() to perform the actual spindle stop.

Note
Documentation generated by AI on 2026-03-04

◆ SpindleStopWait()

CommonGUIModule SpindleStopWait ( )

Stop the spindle and wait for the stop to complete.

Checks if the spindle is currently running (direction is not MC_SPINDLE_OFF). If running, sets SpindleDelayActive to 2, calls m.SpindleStop() to initiate the stop, then blocks via w.WaitOnCondition() until the SpindleDelayActive register returns to 0, indicating the stop sequence has completed.

Warning
This function blocks execution until the spindle stop sequence completes
Note
Documentation generated by AI on 2026-03-04

◆ SpindleWarmUp()

CommonGUIModule SpindleWarmUp ( )

Execute a spindle warm-up sequence at the configured idle speed.

Requires the machine to be enabled. Runs registered hooks via m.RunHooks("SpindleWarmUp"). Checks MST lock; if active, skips the warm-up with a warning. Reads SpindleWarmUpIdleSpeed and SpindleWarmUpMDIGCodeBeforeWarmUp OEM parameters to build the G-code command. If idle speed > 0, appends "M03 S{speed}"; otherwise appends "M03 M05". Presents a CycleStartDialog confirmation before executing the command via mc.mcCntlMdiExecute().

Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the warm-up was initiated or skipped successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Warning
Machine must be enabled before calling this function
Note
Documentation generated by AI on 2026-03-04

◆ SpindleWarmUpBtn()

CommonGUIModule SpindleWarmUpBtn ( )

Button handler to start the spindle warm-up sequence.

Logs the button press via w.OperatorLog() and delegates to CommonGUIModule.SpindleWarmUp() to perform the actual warm-up operation.

Note
Documentation generated by AI on 2026-03-04

◆ SpindleWarmUpInterLockWithCycleStart()

CommonGUIModule SpindleWarmUpInterLockWithCycleStart ( )

Interlock spindle warm-up with cycle start to prevent running without completing warm-up.

Checks if the SpindleWarmUpInterLockWithCycleStart OEM parameter is set to "Yes". If so, and if a spindle warm-up is needed (IsSpindleWarmUpNeeded() returns true) and the machine is currently idle, calls CommonGUIModule.SpindleWarmUp() to initiate the warm-up and returns false to block cycle start. Returns true in all other cases to allow cycle start to proceed.

Returns
(boolean) True if cycle start is allowed to proceed, false if warm-up interlock is blocking it
Note
Documentation generated by AI on 2026-03-04

◆ StartCannedReciprocatingAxis()

CommonGUIModule StartCannedReciprocatingAxis ( axis_id ,
position_a ,
position_b ,
dwell ,
feedrate  )

Start a canned reciprocating axis cycle between two positions.

Starts a canned reciprocating cycle for the specified axis, oscillating between position_a and position_b with an optional dwell time and feedrate. Raises an error if the axis_id is not found in m.ReciprocatingAxes.

Parameters
axis_id(number) The axis identifier for the reciprocating axis to start
position_a(number) The first target position for the reciprocating cycle
position_b(number) The second target position for the reciprocating cycle
dwell(number) Dwell time in milliseconds between direction reversals
feedrate(number) The feedrate to use during the reciprocating motion
Warning
Raises a Lua error if axis_id is not registered in m.ReciprocatingAxes
Note
Documentation generated by AI on 2026-03-04

◆ StartCapturingToolPathMousePositions()

CommonGUIModule StartCapturingToolPathMousePositions ( )

Start capturing tool path mouse positions on all tool path panels.

Initializes TP_PANEL_NAMES via m.screen.GetToolPathPanelNames() if not already set. Ensures the OSIG_TP_MOUSE_DN signal is set to false via w.SetSignalState(). For each panel in TP_PANEL_NAMES, sets "MouseCapture Mode" to "1" via h.SetObject() to enable mouse position reporting.

Note
Documentation generated by AI on 2026-03-04

◆ StartDisableSequence()

CommonGUIModule StartDisableSequence ( )

Initiate the machine disable sequence with re-entrancy protection.

Guards against concurrent execution using w.FuncTracing["m.StartDisableSequence"]. If already in progress, logs a skip message and returns an error. Otherwise calls m._StartDisableSequence() via w.pcall() for protected execution. On error, returns a formatted error via w.FunctionError().

Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the disable sequence completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ StartEnableSequence()

CommonGUIModule StartEnableSequence ( async )

Initiate the machine enable sequence with re-entrancy protection and jog inhibit management.

Runs the PreStartEnableSequence hook scripts. Guards against concurrent execution using w.FuncTracing["m.StartEnableSequence"]. If already in progress, logs a skip message and returns an error. Inhibits jogging on all axes via w.InhibitJogOnAllAxes() during the enable sequence, then releases the inhibit via w.ReleaseInhibitJogOnAllAxes() on completion. Calls m._StartEnableSequence() via w.pcall() for protected execution. Runs PostStartEnableSequence hook scripts on completion.

Parameters
async(number|nil) If 1, runs the MachineEnable.mcs script asynchronously. Defaults to 1
Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the enable sequence completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ StartJog()

UI StartJog ( axis ,
direction  )

Start a velocity jog on the specified axis at the current slider rate and direction.

Reads the jog rate from the JogRateSlider UI element, applies it via mc.mcJogSetRate(), then starts a velocity jog on the specified axis in the specified direction via mc.mcJogVelocityStart(). This is a closure defined inside CommonGUIModule.JogOffHomeSwitchDialog().

Parameters
axis(number) The axis index to jog (e.g., mc.X_AXIS)
direction(number) The jog direction: 1 for positive, -1 for negative
Note
This is a closure defined inside CommonGUIModule.JogOffHomeSwitchDialog()
Documentation generated by AI on 2026-03-04

◆ StartJogging()

CommonGUIModule StartJogging ( Axis ,
Direction ,
inst  )

Start jogging the specified axis in the given direction using external jog parameters.

Initializes the JOGGING_ACTIVE_AXIS table if not already set. If the axis is not already jogging, reads ExternalJogAccel, ExternalContJogRate, and ExternalJogIncremant from OEM parameters and applies them via mc.mcJogSetAccel(), mc.mcJogSetRate(), and mc.mcJogSetInc(). If JOG_MODE_CONT is active, starts velocity jogging via mc.mcJogVelocityStart(). If JOG_MODE_INC is active, starts incremental jogging via mc.mcJogIncStart(). Sets JOGGING_ACTIVE_AXIS[Axis] to true on success.

Parameters
Axis(number) The axis index to jog (0-based, e.g., mc.X_AXIS)
Direction(number) The jog direction: positive (1) or negative (-1)
inst(number) The Mach4 instance handle. If not provided, uses current instance
Returns
(nil|boolean) nil on success, false with error message if OEM parameter read fails
(boolean) Success flag - true if operation completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ StartProfiler()

CommonGUIModule _LuaProfiling StartProfiler ( context )

Start the Lua profiler with an optional context label.

Delegates to CommonGUIModule._LuaProfiling._StartProfiler() via pcall() for error protection. If an error occurs during profiler startup, displays the error via w.wxMessageBox(). The inner function replaces all mc.* functions with thin wrapper closures to enable call-level profiling of mc API usage, then starts the profiler module.

Parameters
context(string|nil) Optional label to include in the generated profiling report filename
Note
Documentation generated by AI on 2026-03-04

◆ StartProfilerTimed()

CommonGUIModule _LuaProfiling StartProfilerTimed ( context ,
seconds  )

Start the Lua profiler for a fixed duration in seconds.

Records the start time via os.clock() and calculates the end time as start + seconds. Sets the Timed flag to true so that UpdateTimedProfiling() will automatically stop the profiler when the duration expires. Then delegates to _StartProfiler() via pcall() to begin actual data collection. If an error occurs, displays it via w.wxMessageBox().

Parameters
context(string|nil) Optional label to include in the generated profiling report filename
seconds(number) Duration in seconds to run the profiler before automatically stopping
Note
Documentation generated by AI on 2026-03-04

◆ StartScreenTimers()

CommonGUIModule StartScreenTimers ( )

Start all screen-managed blink timers for normal and slow blink rates.

Stops and restarts the BlinkObjectNomal screen timer at 300ms and the BlinkObjectSlow screen timer at 600ms via scr.StopTimer() and scr.StartTimer(). Uses timer IDs from the SCREEN_TIMERS table.

Returns
(nil) No meaningful primary return value
(boolean) Success flag - always true
(string) Status message from w.FunctionCompleted()
Note
Documentation generated by AI on 2026-03-04

◆ StepIntoSubPrograms()

CommonGUIModule StepIntoSubPrograms ( )

Set single-block execution to step into sub-programs.

Sets the PV_CM1_SMB_BIT bit in the PV_CM1 Mach4 parameter to 1 via w.SetParameterBit(), causing single-block stepping to enter sub-program calls and execute each line of the sub-program individually.

Note
Documentation generated by AI on 2026-03-04

◆ StepIntoSubProgramsToggle()

CommonGUIModule StepIntoSubProgramsToggle ( )

Toggle between step-into and step-over sub-program execution modes.

If step-into sub-programs is currently active (m.IsStepIntoSubPrograms() returns true), calls m.StepOverSubPrograms() to switch to step-over mode. Otherwise calls m.StepIntoSubPrograms() to switch to step-into mode.

Note
Documentation generated by AI on 2026-03-04

◆ StepOverSubPrograms()

CommonGUIModule StepOverSubPrograms ( )

Set single-block execution to step over (not into) sub-programs.

Clears the PV_CM1_SMB_BIT bit in the PV_CM1 Mach4 parameter to 0 via w.SetParameterBit(), causing single-block stepping to treat sub-program calls as a single step rather than entering the sub-program.

Note
Documentation generated by AI on 2026-03-04

◆ StopAuxiliaries()

CommonGUIModule StopAuxiliaries ( )

Stop all auxiliary outputs and signals after a cycle stop or disable event.

Runs registered hooks via m.RunHooks("StopAuxiliaries"). Executes the MachineStop.mcs private script for the current instance. For each Mach4 instance, optionally turns off mist (OSIG_MISTON) and flood (OSIG_COOLANTON) based on MistOffCycleStop and FloodOffCycleStop OEM parameters. Resets the spindle-was-on flag. Resets the gear range if currently in range 19. Turns off all active output signals except the spindle brake output and any outputs listed in the IgnoreOutputsOnStop parameter. Also turns off any active auxiliary button outputs that are not listed in IgnoreAuxButtonsOnStop (for screen version 2).

Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if all auxiliaries were stopped successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ StopCannedReciprocatingAxis()

CommonGUIModule StopCannedReciprocatingAxis ( axis_id ,
stop_type  )

Stop a canned reciprocating axis cycle.

Stops the reciprocating cycle for the specified axis using the given stop type. Raises an error if the axis_id is not found in m.ReciprocatingAxes.

Parameters
axis_id(number) The axis identifier for the reciprocating axis to stop
stop_type(number) The stop mode to use when halting the axis cycle
Warning
Raises a Lua error if axis_id is not registered in m.ReciprocatingAxes
Note
Documentation generated by AI on 2026-03-04

◆ StopCapturingToolPathMousePositions()

CommonGUIModule StopCapturingToolPathMousePositions ( )

Stop capturing tool path mouse positions on all tool path panels.

Initializes TP_PANEL_NAMES via m.screen.GetToolPathPanelNames() if not already set. Ensures the OSIG_TP_MOUSE_DN signal is set to false. If mouse capture is currently active (as determined by m.IsCapturingToolPathMousePositions()), sets "MouseCapture Mode" to "0" on each panel in TP_PANEL_NAMES via h.SetObject().

Note
Documentation generated by AI on 2026-03-04

◆ StopJog()

UI StopJog ( )

Stop all currently active jog motions on all axes.

Iterates over all axes from 0 to mc.MC_MAX_AXES. For each axis that is currently jogging (mc.mcJogIsJogging() returns 1), calls mc.mcJogVelocityStop() to halt the motion. This is a closure defined inside CommonGUIModule.JogOffHomeSwitchDialog().

Note
This is a closure defined inside CommonGUIModule.JogOffHomeSwitchDialog()
Documentation generated by AI on 2026-03-04

◆ StopJogging()

CommonGUIModule StopJogging ( Axis )

Stop jogging on the specified axis or all axes.

If Axis is -1 and the jog mode is continuous, iterates over all axes and stops any that are actively jogging via mc.mcJogVelocityStop(), then clears JOGGING_ACTIVE_AXIS for all axes. If a specific axis is given, checks if it is jogging via mc.mcJogIsJogging() and stops it if so, then clears JOGGING_ACTIVE_AXIS for that axis.

Parameters
Axis(number) The axis index to stop (0-based), or -1 to stop all axes
Note
Documentation generated by AI on 2026-03-04

◆ StopProfiler()

CommonGUIModule _LuaProfiling StopProfiler ( logpath )

Stop the Lua profiler and generate a profiling report file.

Delegates the actual stop work to CommonGUIModule._LuaProfiling._StopProfiler() via w.pcall() for error protection. If an error occurs, displays it via w.wxMessageBox(). After stopping, restores the original mc table by swapping _G._orig_mc back to _G.mc (which was replaced with a wrapper table during profiling). The report is written to logpath, or a default path of the form 'screenprofiling{.<context>}.<timestamp>.log' if logpath is nil.

Parameters
logpath(string|nil) Full path for the profiling report file. If nil, a default timestamped filename is used in the Mach directory
Note
Documentation generated by AI on 2026-03-04

◆ StopSpindleDuringToolPathRegen()

CommonGUIModule StopSpindleDuringToolPathRegen ( inst )

Stop the spindle during a tool path regeneration operation.

Runs registered hooks via m.RunHooks("StopSpindleDuringToolPathRegen"). If hooks allow continuation, sets the spindle direction to MC_SPINDLE_OFF via mc.mcSpindleSetDirection(). This function is intended to be called before regenerating the tool path to ensure the spindle is safely stopped.

Parameters
inst(number) The Mach4 instance handle. If not provided, uses current instance
Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the spindle was stopped or hooks cancelled the operation
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ StoreHeadShiftOffsets()

CommonGUIModule StoreHeadShiftOffsets ( inst )

Save the head shift offsets for all coordinate axes to OEM parameter storage.

Iterates from mc.X_AXIS to mc.MC_MAX_COORD_AXES - 1 and calls CommonGUIModule.StoreHeadShiftOffsetsAxis() for each axis with the given instance.

Parameters
inst(number) The Mach4 instance handle. If not provided, uses current instance
Returns
(nil) No meaningful return value on success
(boolean) Success flag - true if all offsets were saved successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ StoreHeadShiftOffsetsAxis()

CommonGUIModule StoreHeadShiftOffsetsAxis ( AxisID ,
inst  )

Save the head shift offset for a single axis to the OEM parameter store.

Reads the current head shift offset from pound variable (5081 + AxisID) via mc.mcCntlGetPoundVar(), then writes it to the OEM parameter 'HeadShiftOffset_<axis letter>' via w.SetOEMParamValue(). Returns an error if either the read or write fails.

Parameters
AxisID(number) The axis index (e.g., mc.X_AXIS, mc.Y_AXIS, mc.Z_AXIS)
inst(number) The Mach4 instance handle. If not provided, uses current instance
Returns
(nil) No meaningful return value on success
(boolean) Success flag - true if the offset was saved successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ StoreLastValueHeadShiftOffsets()

CommonGUIModule StoreLastValueHeadShiftOffsets ( )

Save head shift offsets for all instances where the mode is "Restore Last Value".

Iterates over all instances and reads the 'HeadShiftOffsetsMode' OEM parameter for each. If the mode equals "Restore Last Value", calls CommonGUIModule.StoreHeadShiftOffsets() for that instance to persist the current offsets to OEM parameter storage.

Returns
(nil) No meaningful return value on success
(boolean) Success flag - always true if iteration completes
(string) Status message from w.FunctionCompleted()
Note
Typically called on program end or shutdown to persist the last-used head shift offsets
Documentation generated by AI on 2026-03-04

◆ StoreLastValueWorkShiftOffsets()

CommonGUIModule StoreLastValueWorkShiftOffsets ( )

Save work shift offsets for all instances where the mode is "Restore Last Value".

Iterates over all instances and reads the 'WorkShiftOffsetsMode' OEM parameter for each. If the mode equals "Restore Last Value", calls CommonGUIModule.StoreWorkShiftOffsets() for that instance to persist the current offsets to OEM parameter storage.

Returns
(nil) No meaningful return value on success
(boolean) Success flag - always true if iteration completes
(string) Status message from w.FunctionCompleted()
Note
Typically called on program end or shutdown to persist the last-used work shift offsets
Documentation generated by AI on 2026-03-04

◆ StoreMachOverrides()

CommonGUIModule StoreMachOverrides ( )

Save the current Mach4 speed overrides to the profile for later restoration.

Reads and stores the current Spindle Override via mc.mcSpindleGetOverride(), the Feedrate Override via mc.mcCntlGetFRO(), and the Rapid Rate Override via mc.mcCntlGetRRO(), writing each to the MachMotion section of the Mach4 profile via mc.mcProfileWriteDouble(). Returns an error triple if any read or write operation fails.

Returns
(nil) No meaningful return value on success
(boolean) Success flag - true if all overrides were saved successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ StoreNotes()

UI StoreNotes ( )

Store the current notes from the dialog editor into the job file's in-memory notes table.

Clears jb.FileTable.Notes and repopulates it by iterating over all lines in the multi-line text control UI.notes_line using GetNumberOfLines() and GetLineText(). Each line is stored as jb.FileTable.Notes[tostring(i)].

Note
This is a closure defined inside CommonGUIModule._NotesDialog()
Documentation generated by AI on 2026-03-04

◆ StoreWorkShiftOffsets()

CommonGUIModule StoreWorkShiftOffsets ( inst )

Save the work shift offsets for all coordinate axes to OEM parameter storage.

Iterates from mc.X_AXIS to mc.MC_MAX_COORD_AXES - 1 and calls CommonGUIModule.StoreWorkShiftOffsetsAxis() for each axis with the given instance.

Parameters
inst(number) The Mach4 instance handle. If not provided, uses current instance
Returns
(nil) No meaningful return value on success
(boolean) Success flag - true if all offsets were saved successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ StoreWorkShiftOffsetsAxis()

CommonGUIModule StoreWorkShiftOffsetsAxis ( AxisID ,
inst  )

Save the work shift offset for a single axis to the OEM parameter store.

Reads the current work shift offset from pound variable (5201 + AxisID) via mc.mcCntlGetPoundVar(), then writes it to the OEM parameter 'WorkShiftOffset_<axis letter>' via w.SetOEMParamValue(). Returns an error if either the read or write fails.

Parameters
AxisID(number) The axis index (e.g., mc.X_AXIS, mc.Y_AXIS, mc.Z_AXIS)
inst(number) The Mach4 instance handle. If not provided, uses current instance
Returns
(nil) No meaningful return value on success
(boolean) Success flag - true if the offset was saved successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ SubSpindleForward()

CommonGUIModule SubSpindleForward ( use_confirmation )

Run the sub-spindle in the forward direction, optionally prompting for confirmation.

Performs a spindle safety check via m.SpindleSafetyCheck(). If use_confirmation is true, displays a CycleStartDialog prompt asking the operator to confirm sub-spindle forward. If the operator cancels, returns success without running. On confirmation, executes the M103.mcs private script via mc.mcScriptExecutePrivate() to start the sub-spindle forward. Logs any script execution error via w.FunctionError().

Parameters
use_confirmation(boolean) If true, displays a cycle start confirmation dialog before running
Note
Documentation generated by AI on 2026-03-04

◆ SubSpindleForwardToggle()

CommonGUIModule SubSpindleForwardToggle ( use_confirmation )

Toggle the sub-spindle between forward and stopped states.

If the sub-spindle is currently on (m.IsSubSpindleOn() returns true), calls CommonGUIModule.SubSpindleStop() to stop it. Otherwise calls CommonGUIModule.SubSpindleForward() with the provided use_confirmation flag.

Parameters
use_confirmation(boolean) If true, passes confirmation requirement to SubSpindleForward()
Note
Documentation generated by AI on 2026-03-04

◆ SubSpindleReverse()

CommonGUIModule SubSpindleReverse ( use_confirmation )

Run the sub-spindle in reverse direction, optionally prompting for confirmation.

Performs a spindle safety check via m.SpindleSafetyCheck(). If use_confirmation is true, displays a CycleStartDialog prompt asking the operator to confirm. If the operator cancels, returns success without running. On confirmation, executes the M104.mcs private script via mc.mcScriptExecutePrivate() to start the sub-spindle in reverse. Logs any script execution error via w.FunctionError().

Parameters
use_confirmation(boolean) If true, displays a cycle start confirmation dialog before running
Note
Documentation generated by AI on 2026-03-04

◆ SubSpindleReverseToggle()

CommonGUIModule SubSpindleReverseToggle ( use_confirmation )

Toggle the sub-spindle between reverse and stopped states.

If the sub-spindle is currently on (m.IsSubSpindleOn() returns true), calls CommonGUIModule.SubSpindleStop() to stop it. Otherwise calls CommonGUIModule.SubSpindleReverse() with the provided use_confirmation flag.

Parameters
use_confirmation(boolean) If true, passes confirmation requirement to SubSpindleReverse()
Note
Documentation generated by AI on 2026-03-04

◆ SubSpindleStop()

CommonGUIModule SubSpindleStop ( )

Stop the sub-spindle by executing the M105 M-code script.

Retrieves the selected instance and its untagged instance index. Executes the M105.mcs private script file from the MCODE_DIRECTORY_INST path via mc.mcScriptExecutePrivate(). If the script execution fails, logs the error via w.FunctionError().

Note
Documentation generated by AI on 2026-03-04

◆ SubSpindleUpdate()

CommonGUIModule SubSpindleUpdate ( )

Update sub-spindle analog output speed for all enabled instances.

Iterates over all Mach4 instances. For each instance where the sub-spindle is enabled, reads the SubSpindleCommandedRPM OEM register, SubSpindleScaleAnalog OEM register, and SubSpindleMaxRPM OEM parameter. If ScaleAnalog is "Yes", computes the analog output as (CommandedRPM / SubSpindleMaxRPM) * 10; otherwise clamps the commanded RPM to SubSpindleMaxRPM. Writes the computed speed to the SubSpindleAnalog OEM parameter register via w.SetOEMParamReg().

Note
Documentation generated by AI on 2026-03-04

◆ SupportBtn()

CommonGUIModule SupportBtn ( )

Open the MachMotion support web page in the default browser.

Attempts to open https://machmotion.com/support-main using w.OpenURL(). Displays a warning message box if the page cannot be opened.

Note
Documentation generated by AI on 2026-03-04

◆ SwapItems()

CommonGUIModule Scheduler SwapItems ( idx2 )

Swap the display data of two items in the Schedule Editor list control.

Exchanges all column values (file path and quantity) between the items at idx1 and idx2 in the wxListCtrl (self.UI.m_listCtrl2). After swapping, clears the current selection via self:ClearSelection() and sets the selection to idx2. Does nothing if idx1 == idx2 or either index is out of bounds.

Parameters
idx1(number) The zero-based index of the first item to swap
idx2(number) The zero-based index of the second item to swap
Note
Documentation generated by AI on 2026-03-04

◆ TeachLaserPointerOffsets()

CommonGUIModule TeachLaserPointerOffsets ( )

Capture the current X and Y axis positions as the laser pointer offset values.

Reads the current X and Y axis work positions via mc.mcAxisGetPos(). Writes the X position to the LaserPointerOffset_X OEM register and the Y position to the LaserPointerOffset_Y OEM register via w.SetOEMRegValue(). Logs errors via w.FunctionError() if any register write fails. Then calls m.LaserPointerOn() to activate the laser pointer with the newly captured offsets.

Note
Documentation generated by AI on 2026-03-04

◆ TeachWorkShiftOffsets()

CommonGUIModule TeachWorkShiftOffsets ( AxisID )

Teach the work shift offset for a single axis from the current machine position.

Reads the current tool offset for the specified axis from the appropriate pound variable (SV_CUR_TOOL_XLENGTH_REGISTER, YLENGTH, or ZLENGTH), then reads the current machine position via mc.mcAxisGetMachinePos(). Computes the work shift offset as (machine position - tool offset) and writes it to pound variable (5201 + AxisID) via mc.mcCntlSetPoundVar(). Returns an error if any read or write fails.

Parameters
AxisID(number) The axis index (mc.X_AXIS, mc.Y_AXIS, or mc.Z_AXIS)
Returns
(nil) No meaningful return value on success
(boolean) Success flag - true if the offset was taught successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ ToggleCapturingToolPathMousePositions()

CommonGUIModule ToggleCapturingToolPathMousePositions ( )

Toggle tool path mouse position capture on or off.

Checks the current capture state via m.IsCapturingToolPathMousePositions(). If capture is active, stops it via m.StopCapturingToolPathMousePositions(). If capture is inactive, starts it via m.StartCapturingToolPathMousePositions(). Uses the selected instance from w.GetSelectedInstance().

Note
Documentation generated by AI on 2026-03-04

◆ ToggleEnable()

CommonGUIModule Scheduler ToggleEnable ( )

Toggle the scheduler active state when the machine is idle.

Checks the current machine state via mc.mcCntlGetState(). If the machine is in MC_STATE_IDLE, reads the current scheduler state from the OEM parameter identified by self.SCHED_STATE. If the scheduler is active (value == 1), deactivates it by setting the parameter to 0. If the scheduler is inactive, activates it via self:Enable(). Does nothing if the machine is not idle. Delegates the actual work to self:_ToggleEnable() via w.pcall() for error protection.

Parameters
inst(number) The Mach4 instance handle. If not provided, uses current instance
Note
Documentation generated by AI on 2026-03-04

◆ ToggleEnableBtn()

CommonGUIModule ToggleEnableBtn ( )

Button handler to toggle the machine enable state on or off.

Checks the current machine enable state via m.IsMachEnabled(). If the machine is currently enabled, calls m.DisableBtn() to disable it. Otherwise calls m.EnableBtn() to enable it.

Note
Documentation generated by AI on 2026-03-04

◆ ToggleEnableResetBtn()

CommonGUIModule ToggleEnableResetBtn ( )

Button handler to toggle the enable/reset state based on current machine enable status.

Checks the current machine enable state via m.IsMachEnabled(). If the machine is currently enabled, calls m.DisableBtn() to disable it. Otherwise calls m.EnableReset() to perform the combined enable and reset sequence.

Note
Documentation generated by AI on 2026-03-04

◆ ToggleMachMenu()

CommonGUIModule ToggleMachMenu ( )

Toggle the Mach4 menu bar between hidden and visible.

Reads the 'HideMachMenu' profile value. If currently 0 (visible), hides the menu; if currently non-zero (hidden), shows the menu.

Note
Documentation generated by AI on 2026-03-04

◆ ToggleOnScreenJogBtn()

CommonGUIModule ToggleOnScreenJogBtn ( )

Toggle the on-screen jog buttons panel on or off.

Checks the Enabled property of the JogButtonsGroup screen object. If the group is currently disabled (Enabled == "0"), calls m.OnScreenJogButtonsOn() to show the jog buttons. Otherwise calls m.OnScreenJogButtonsOff() to hide them.

Note
Documentation generated by AI on 2026-03-04

◆ ToggleSpindleBrake()

CommonGUIModule ToggleSpindleBrake ( inst )

Toggle the spindle brake on or off based on its current state.

Reads the SpindleBrakeEnabled OEM parameter. If the feature is enabled, checks the current state of the SpindleBrakeOutput signal. If the brake is currently applied, calls m.SpindleBrakeOffBtn() to release it. Otherwise calls m.SpindleBrakeOnBtn() to apply it.

Parameters
inst(number) The Mach4 instance handle. If not provided, uses selected instance
Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the toggle completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ ToggleSpindleFWD()

CommonGUIModule ToggleSpindleFWD ( use_confirmation ,
inst  )

Toggle the spindle between forward and stopped states.

If the spindle is currently on (m.IsSpindleOn() returns true), calls CommonGUIModule.SpindleStop() to stop it. Otherwise calls CommonGUIModule.SpindleFWDBtn() with the provided confirmation flag to start the spindle in forward direction.

Parameters
use_confirmation(boolean|nil) If true, shows a cycle start confirmation dialog before starting
inst(number) The Mach4 instance handle. If not provided, uses selected instance
Note
Documentation generated by AI on 2026-03-04

◆ ToggleSpindleREV()

CommonGUIModule ToggleSpindleREV ( use_confirmation ,
inst  )

Toggle the spindle between reverse and stopped states.

If the spindle is currently on (m.IsSpindleOn() returns true), calls m.SpindleStop() to stop it. Otherwise calls m.SpindleREVBtn() with the provided confirmation flag to start the spindle in reverse.

Parameters
use_confirmation(boolean|nil) If true, shows a cycle start confirmation dialog before starting
inst(number) The Mach4 instance handle. If not provided, uses selected instance
Note
Documentation generated by AI on 2026-03-04

◆ ToolChangeToTool()

CommonGUIModule ToolChangeToTool ( toolIndex ,
inst  )

Execute a tool change to a specific tool number.

Checks MST lock, feedrate override, rapid override, and manual mode before proceeding. Builds the appropriate G-code string for the machine type (Lathe or Mill). Presents a CycleStartDialog confirmation and executes the tool change via mc.mcCntlMdiExecute().

Parameters
toolIndex(number) The tool number to change to
inst(number|nil) The Mach4 instance handle. If not provided, uses selected instance
Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if tool change was initiated successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ ToolLengthVerifyOff()

CommonGUIModule ToolLengthVerifyOff ( )

Disable tool length verification mode and reset the verify DRO display.

Sets TOOL_LENGTH_VERIFY to false, clears the ToolLengthVerifyDRO via CommonGUIModule.screen.SetToolLengthVerifyDRO("0"), and calls CommonGUIModule.screen.SetToolLengthVerifyButton(false) if that function exists.

Returns
(nil) No meaningful primary return value
(boolean) Success flag - always true
(string) Status message from w.FunctionCompleted()
Note
Documentation generated by AI on 2026-03-04

◆ ToolLengthVerifyOn()

CommonGUIModule ToolLengthVerifyOn ( )

Enable tool length verification mode.

Sets the global TOOL_LENGTH_VERIFY flag to true, activating live tool length verification display via UpdateToolVerifyDRO().

Returns
(nil) No meaningful primary return value
(boolean) Success flag - always true
(string) Status message from w.FunctionCompleted()
Note
Documentation generated by AI on 2026-03-04

◆ ToolLengthVerifyToggle()

CommonGUIModule ToolLengthVerifyToggle ( )

Toggle tool length verification mode on or off.

If TOOL_LENGTH_VERIFY is currently true, calls CommonGUIModule.ToolLengthVerifyOff() to disable it. Otherwise calls CommonGUIModule.ToolLengthVerifyOn() to enable it.

Returns
(nil) No meaningful primary return value
(boolean) Success flag - always true
(string) Status message from w.FunctionCompleted()
Note
Documentation generated by AI on 2026-03-04

◆ ToolSetterSelection()

CommonGUIModule ToolSetterSelection ( FilterToolSetterTypes ,
OffsetTypes  )

Display the tool setter selection dialog for choosing the active manual or auto setter.

Creates and shows a non-modal dialog containing a list of tool setters filtered by FilterToolSetterTypes ("Manual" or "Auto") and OffsetTypes ("Tool" or "Fixture"). The selected tool setter name is written to the appropriate OEM register (ManualSetterSelection, AutoSetterSelection, ManualSetterFixtureSelection, or AutoSetterFixtureSelection) whenever the list selection changes. A timer (100ms) monitors for Mach shutdown and closes the dialog automatically if Mach is shutting down. An OK button closes the dialog and confirms the selection.

Parameters
FilterToolSetterTypes(string) Filter type - "Manual" to show only manual setters, any other value for auto setters
OffsetTypes(string|nil) Offset category - "Fixture" for fixture offsets, any other value (or nil) for tool offsets
Note
Documentation generated by AI on 2026-03-04

◆ UpdateAxesArrayCache()

CommonGUIModule UpdateAxesArrayCache ( )

Refresh the cached axis letter and short name arrays for all instances and axes.

Iterates over all Mach4 instances and all axes (X through MC_MAX_AXES-1). For each axis, calls m.GetAxisLetterName() and m.GetAxisShortName() to retrieve the current label strings and stores them in the AXIS_LETTER_ARRAY_TEXT_INST, AXIS_LETTER_ARRAY_TEXT_0_INST, AXIS_SHORT_NAME_ARRAY_INST, and AXIS_SHORT_NAME_ARRAY_0_INST per-instance cache tables. For instance 0, also updates the global AXIS_LETTER_ARRAY_TEXT, AXIS_LETTER_ARRAY_TEXT_0, AXIS_SHORT_NAME_ARRAY, and AXIS_SHORT_NAME_ARRAY_0 tables. Calls w.FunctionCompleted() on exit.

Note
Documentation generated by AI on 2026-03-04

◆ UpdateCurrentToolAndPocketGlobals()

CommonGUIModule UpdateCurrentToolAndPocketGlobals ( )

Update the global current tool number and tool pocket number arrays for all instances.

Iterates over all Mach4 instances and updates CURRENT_TOOL_NUMBER_INST and CURRENT_TOOL_POCKET_NUMBER_INST global arrays by calling w.GetCurrentTool() and w.GetCurrentToolPocket() for each instance.

Note
Documentation generated by AI on 2026-03-04

◆ UpdateDoorInterlock()

CommonGUIModule UpdateDoorInterlock ( )

Monitor and update the door interlock output based on machine state.

Reads the DoorSwitchInterlockEnabled OEM parameter and returns early if not enabled. Calls user.UserUpdateDoorInterlock() if defined, allowing user override. Reads the door switch input and output signals. Locks the door (deactivates output) when the machine is running (MC_STATE_FRUN or above, excluding macro hold and feed hold states) or when UserInterlock is true. Unlocks the door (activates output) after a configurable delay (DoorSwitchInterlockOutputDelay) once the machine returns to a non-running state.

Returns
(nil) No meaningful return value on success
(boolean) Success flag - true if operation completed successfully
(string) Status message describing the result
Note
Documentation generated by AI on 2026-03-04

◆ UpdateEnabledAxesCache()

CommonGUIModule UpdateEnabledAxesCache ( )

Refresh the cached enabled state flags for all instances and axes.

Iterates over all Mach4 instances and all axes (X through MC_MAX_AXES-1). For each axis, calls mc.mcAxisIsEnabled() and stores the boolean result (enabled == 1) in AXIS_ENABLED_INST[_inst][axis]. For instance 0, also updates the global AXIS_ENABLED[axis] table. Calls w.FunctionCompleted() on exit.

Note
Documentation generated by AI on 2026-03-04

◆ UpdateEndOfProgramTimeOn()

CommonGUIModule UpdateEndOfProgramTimeOn ( )

Check and reset the end-of-program output signal for all instances when its timer expires.

Iterates over all active instances and checks if the 'EndOfProgramTimeOn' OEM parameter is greater than 0 and a program-end start time has been recorded. If the elapsed time since end-of-program exceeds the configured duration and the 'EndOfProgramOutput' signal is configured, calls ResetEndOfProgramOutput() and clears the start time for that instance. Intended to be called periodically from a screen timer.

Note
Documentation generated by AI on 2026-03-04

◆ UpdateGangSpindles()

CommonGUIModule UpdateGangSpindles ( )

Update all gang spindle command registers, feedback aggregation, and control signals.

Reads the commanded RPM from the gang spindle control source (either an auxiliary register or mc.mcSpindleGetMotorRPM()). For each gang spindle in the group, writes the commanded RPM (or percentage if command type is not RPM) to GangSpindleCommandRPMRegister. Aggregates load and RPM feedback from all engaged spindles using the configured averaging mode (Max, Min, or Average). Controls forward/reverse/stop signals for each spindle based on the current machine enable state and spindle direction. Publishes aggregated feedback values to GangSpindles registers and optionally feeds them back to Mach via mc.mcSpindleSetSensorRPM().

Note
This function is called periodically from the PLC loop and should not be called directly
Documentation generated by AI on 2026-03-04

◆ UpdateGenericGridDialog()

UI UpdateGenericGridDialog ( )

Timer callback to keep the Generic Grid dialog alive and handle shutdown.

Checks whether Mach4 is shutting down via w.IsMachShuttingDown(). If shutting down, calls UI.CloseGenericGridDialog() to safely close the dialog. Returns true on normal execution to signal successful completion to the timer handler.

Returns
(boolean) True if Mach is not shutting down and the dialog should remain open
Note
This is a closure defined inside CommonGUIModule.GenericGridDialog()
Documentation generated by AI on 2026-03-04

◆ UpdateGlobalWithActiveFixtureIndex()

CommonGUIModule UpdateGlobalWithActiveFixtureIndex ( )

Update the global active fixture offset index variables from the current Mach4 state.

Reads the current fixture index via w.GetCurrentFixtureIndex() for the selected instance and stores it in both the ACTIVE_FIXTURE_OFFSET_INDEX global and the per-instance ACTIVE_FIXTURE_OFFSET_INDEX_INST table.

Note
Documentation generated by AI on 2026-03-04

◆ UpdateGrid()

CommonGUIModule SearchGCode UpdateGrid ( )

Insert search matches into the GCode Search grid.

Iterates over the provided table of search results and populates the grid (self.UI.m_grid) with each match. The first row reuses the existing grid row; subsequent matches append new rows. Each row is set read-only and displays the line index in column 0 and the G-code text in column 1. Calls OnSize() after updating to resize columns.

Parameters
tbl(table) Array of match tables, each with fields 'idx' (number) and 'gcode' (string)
Note
Documentation generated by AI on 2026-03-04

◆ UpdateHistoryBtns()

UI UpdateHistoryBtns ( )

Update the enabled state of the MDI history navigation buttons.

Update the enabled state of the history navigation buttons.

Enables or disables the Previous (down arrow) and Next (up arrow) history navigation buttons based on the current position in the MDI history list. The Previous button is enabled when current_index > 1; the Next button is enabled when current_index < the total number of history entries.

Note
This is a closure defined inside CommonGUIModule.MDIDialog()
Documentation generated by AI on 2026-03-04

Enables or disables the Previous (down arrow) and Next (up arrow) history navigation buttons based on the current position in the Lua script history list. The Previous button is enabled when current_index > 1; the Next button is enabled when current_index < the total number of history entries.

Note
This is a closure defined inside CommonGUIModule.RunLuaScriptFromDialog()
Documentation generated by AI on 2026-03-04

◆ UpdateHomedAxesCache()

CommonGUIModule UpdateHomedAxesCache ( )

Refresh the cached homed state flags for all instances and axes.

Iterates over all Mach4 instances and all axes (X through MC_MAX_AXES-1). For each axis, calls mc.mcAxisIsHomed() and stores the boolean result (homed == 1) in AXIS_IS_HOMED_INST[_inst][axis]. For instance 0, also updates the global AXIS_IS_HOMED[axis] table. Calls w.FunctionCompleted() on exit.

Note
Documentation generated by AI on 2026-03-04

◆ UpdateLastGCodeFileName()

CommonGUIModule UpdateLastGCodeFileName ( )

Monitor the loaded G-code filename and trigger header processing when the file changes.

For the currently selected instance, reads the LastGcodeFileName OEM register and compares it to the currently loaded G-code file via mc.mcCntlGetGcodeFileName(). If the filename has changed, is not empty, and is not a subroutine file, calls ProcessGcodeHeaderParameters() and UserProcessGcodeHeaderParameters() if defined, then updates the LastGcodeFileName register. Also tracks whether a G-code file has been opened (GCODE_FILE_WAS_OPEN_INST) and clears the register when the file is unloaded.

Note
Documentation generated by AI on 2026-03-04

◆ UpdateLubeTimer()

CommonGUIModule UpdateLubeTimer ( )

Update the lube system timer and trigger lube cycles based on configured mode and action.

Handles two lube system modes based on LUBE_TYPE:

  • "Timed": Measures elapsed time since LUBE_START_TIME. When LUBE_TIME_OFF milliseconds have elapsed, checks LUBE_ACTION ("Any Time", "Machine Enabled", "Spindle Running", or "Not Idle") to determine whether conditions are met, then calls m.RunLubeCycle() and resets the timer.
  • "Event": Continuously checks LUBE_ACTION conditions. Turns the LubeOutputName OEM signal on or off based on whether the condition is currently met. Does nothing if LUBE_SYSTEM_ENABLED is not "Yes" or LUBE_TIME_OFF is 0 in Timed mode.
    Note
    Documentation generated by AI on 2026-03-04

◆ UpdateMachFileRunTimeHistory()

CommonGUIModule UpdateMachFileRunTimeHistory ( run_time )

Shift the G-code file run time history registers and store a new run time entry.

Iterates over all Mach4 instances. Shifts the existing history values stored in OEM registers MachFileRunTimeHistory_0 through MachFileRunTimeHistory_4 by one position (oldest entry is discarded). Writes the new run_time value to MachFileRunTimeHistory_0. If run_time is nil, uses the current run time from mc.mcCntlGetRunTime() for the instance.

Parameters
run_time(number|nil) The run time value in milliseconds to record. If nil, uses the current Mach4 run time
Note
Documentation generated by AI on 2026-03-04

◆ UpdateMotionInhibit()

CommonGUIModule UpdateMotionInhibit ( )

Release motion inhibit if the machine becomes idle.

Checks whether motion inhibit is currently active via m.IsMotionInhibitActive(). If active and the machine state has returned to IDLE (MACH_STATE == mc.MC_STATE_IDLE), calls m.MotionInhibitEnd() to release the inhibit signal.

Note
This function is typically called from the PLC script to automatically release motion inhibit once the machine has stopped moving
Documentation generated by AI on 2026-03-04

◆ UpdateNotesOnlyToJobFile()

CommonGUIModule JobFile UpdateNotesOnlyToJobFile ( )

Write only the Notes section of the job file to disk, leaving all other fields unchanged.

Rebuilds the complete file data table from in-memory state (headers, data headers, pound variables from jb.FileTable.PoundVars, registers from jb.FileTable.Registers, and notes from jb.FileTable.Notes) and writes the result to the job file via w.WriteCSV(). If no file is loaded, prompts the user to save via jb:SaveAs(). This method preserves existing pound variable and register values rather than re-reading them from Mach4.

Note
Documentation generated by AI on 2026-03-04

◆ UpdatePartCounters()

UI UpdatePartCounters ( )

Refresh all Part Counter numeric controls with the current Mach4 parameter values.

Checks whether Mach4 is shutting down and closes the dialog if so. For each numeric control (current program parts, total parts, required parts, M-code number), updates the displayed value from the corresponding Mach4 parameter only if the control is not currently being edited by the user.

Returns
(boolean) True if all controls were updated successfully
Note
This is a closure defined inside CommonGUIModule._PartCounterDialog()
Documentation generated by AI on 2026-03-04

◆ UpdateRotaryAxesCache()

CommonGUIModule UpdateRotaryAxesCache ( )

Refresh the cached rotary axis flags for all instances and axes.

Iterates over all Mach4 instances and all axes (X through MC_MAX_AXES-1). For each axis, calls m.IsAxisRotary() and stores the result in AXIS_IS_ROTARY_INST[_inst][axis]. For instance 0, also updates the global AXIS_IS_ROTARY[axis] table. Calls w.FunctionCompleted() on exit.

Note
Documentation generated by AI on 2026-03-04

◆ UpdateRows()

UI UpdateRows ( MessageArray ,
RowNum  )

Populate the alarms grid with the provided alarm message array.

Iterates from 0 to RowNum-1, setting each grid cell value in column 0 to the corresponding string from MessageArray and marking each cell as read-only. This is a closure defined inside CommonGUIModule.CycleStartInhibitDialog().

Parameters
MessageArray(table) Array of alarm message strings to display in the grid
RowNum(number) The number of rows to populate in the alarms grid
Note
This is a closure defined inside CommonGUIModule.CycleStartInhibitDialog()
Documentation generated by AI on 2026-03-04

◆ UpdateScreenLayout()

CommonGUIModule UpdateScreenLayout ( )

Enforce single rotary axis constraint for V1 screens by disabling conflicting axes.

For non-V2 screens (SCREEN_VERSION != 2), checks which of A, B, or C axes is enabled via mc.mcAxisIsEnabled(). If the A axis is enabled, disables B and C. If B is enabled, disables A and C. If C is enabled, disables A and B. This ensures only one rotary axis is active at a time in the legacy screen layout. Returns an error if any axis disable API call fails.

Returns
(nil) No meaningful return value on success
(boolean) False with error message if an axis enable/disable API call fails
(string) Status message from w.FunctionError() on failure
Note
Documentation generated by AI on 2026-03-04

◆ UpdateScreenWarningMessage()

CommonGUIModule UpdateScreenWarningMessage ( )

Placeholder function stub for updating the screen warning message area (currently disabled).

This function is currently commented out and has no active implementation. It was intended to update the warning group, logo, alarm dialog button, and part info group screen objects based on the warning group width. No operation is performed when called.

Note
Documentation generated by AI on 2026-03-04

◆ UpdateSignalLibraryArray()

CommonGUIModule UpdateSignalLibraryArray ( )

Build the signal library arrays for limit switches, home signals, and special signals for all instances.

For each Mach4 instance, populates SIG_LIBRARY_INST[_inst] with callback functions keyed by signal ID. Registers handlers for:

  • Positive and negative limit switches for all axes (OSIG_XLIMITPLUS through OB6LIMITMINUS): Creates or clears GMS limit switch alarm messages via m.CreateLimitSwitchAlarm() and m.CreateLimitSwitchActiveMessage().
  • Homed signals for all axes (OSIG_HOMED_X through OSIG_HOMED_OB6): Updates AXIS_IS_HOMED_INST and calls m.screen.UpdateAxisHomeStatus().
  • OSIG_TP_MOUSE_DN: Runs ProcessToolPathMouseDownEvent or ProcessToolPathMouseUpEvent hooks.
  • MotionInhibitInterlockInput (if enabled): Calls m.MotionInhibitStart() or m.MotionInhibitEnd().
  • OSIG_MACHINE_ENABLED: Runs the full enable/disable sequence including StartEnableSequence() or StartDisableSequence(), updating MACH_ENABLED_INST and related registers. Also reads and stores the SpindleBrakeOutput signal ID in SIG_LIBRARY_INST and SIGNAL_LIB_ARRAY.
    Note
    Documentation generated by AI on 2026-03-04

◆ UpdateSpindleControls()

CommonGUIModule UpdateSpindleControls ( )

Update spindle control button states when spindle direction or delay state changes.

Reads SpindleDelayActive from OEM registers and SpindleDirection from mc.mcSpindleGetDirection() for the selected instance. If neither SpindleDirection nor SpindleDelayActive has changed since the last call, returns immediately to avoid unnecessary screen updates. Otherwise updates the cached values, calls m.screen.UpdateSpindleButtons() if available, and runs the "SpindleStateChanged" hooks via m.RunHooks().

Note
Documentation generated by AI on 2026-03-04

◆ UpdateStackLight()

CommonGUIModule StackLight UpdateStackLight ( )

Update all configured stack light outputs based on current machine state and alarm conditions.

Returns early if the light stack is disabled or if user.UserUpdateStackLight() returns false. Updates self.Alarm and self.Warning from GMS, then updates self.mach_state and blink state from globals. For each configured color output (Red, Yellow, Green, White), retrieves the desired light state via the corresponding GetXxxStackLightState() method, applies blink logic if configured, and writes the output state via w.SetOEMParamSig().

Returns
(nil) No meaningful return value on success
(boolean) True if operation completed successfully
(string) Status message describing the result
Note
Documentation generated by AI on 2026-03-04

◆ UpdateTimedProfiling()

CommonGUIModule _LuaProfiling UpdateTimedProfiling ( )

Check whether a timed profiling session has expired and stop the profiler if so.

If the Timed flag is set to true, reads the current time via os.clock() and compares it against the EndTime set by StartProfilerTimed(). If the current time is at or past EndTime and the profiler is active, stops it via StopProfiler(). Resets StartTime, EndTime, and the Timed flag to their default values after stopping.

Note
Documentation generated by AI on 2026-03-04

◆ UpdateToolVerifyDRO()

CommonGUIModule UpdateToolVerifyDRO ( )

Update the tool length verify DRO display if tool length verification is active.

If TOOL_LENGTH_VERIFY is true and a manual tool setter is enabled, reads the ToolLengthVerifyMode OEM parameter. Computes the tool verify value from the current Z machine position minus the sum of the tool setter position and height. In "Verify Length" mode, sets the ToolLengthVerifyDRO to the raw ToolVerify value; otherwise sets it to the absolute difference between ToolVerify and the current tool length offset pound variable. Also enables the ToolLengthVerifyButton screen object if it exists.

Returns
(nil) No meaningful primary return value
(boolean) False with error message if an API call fails
(string) Status message from w.FunctionError() on failure
Note
Documentation generated by AI on 2026-03-04

◆ UPSPowerOffControl()

CommonGUIModule UPSPowerOffControl ( )

Initiate a delayed power-off sequence triggered by UPS loss of power.

Displays a 5-second countdown Please Wait dialog with a message indicating that the UPS has detected a loss of power. If the countdown completes without cancellation, calls m.PowerOff() to save data and shut down the OS. If the dialog is cancelled, logs an error via w.FunctionError().

Warning
This function will shut down the Windows OS if the countdown completes
Note
Intended to be called automatically when UPS signals power loss
Documentation generated by AI on 2026-03-04

◆ VerifyHoming()

CommonGUIModule VerifyHoming ( IgnoreSaftyCheck ,
inst  )

Verify that all required axes are homed - delegates to the wrapper module implementation.

This function was moved to the wrapper module. Calls w.VerifyAllAxesAreHomed() with all provided arguments and returns the result.

Parameters
IgnoreSaftyCheck(boolean|nil) If true, skips the safety interlock check
inst(number|nil) The Mach4 instance handle. If not provided, uses current instance
Returns
(boolean) True if all required axes are homed, false otherwise
(boolean) Success flag - true if the check completed without errors
(string) Status message describing the homing status
See also
w.VerifyAllAxesAreHomed() for the full implementation
Note
Documentation generated by AI on 2026-03-04

◆ WaitForHoming()

CommonGUIModule WaitForHoming ( AxisID ,
inst  )

Wait for the machine to return to IDLE state after a homing operation.

Displays a "Machine is Homing..." PleaseWait dialog via w.PleaseWaitDialog() that waits for the machine state to reach MC_STATE_IDLE. If the wait is canceled or times out, displays a "Canceling Homing..." dialog and dereferences all non-absolute-encoder axes via m.DeReferenceAxis(). If AxisID is -1, dereferences all enabled coordinate axes; otherwise dereferences only the specified axis. After waiting, calls m.MotionController[_inst]:WaitForHomingToComplete() to allow the motion controller to finalize.

Parameters
AxisID(number) The axis that was homed, or -1 if all axes were homed
inst(number) The Mach4 instance handle. If not provided, uses current instance
Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if homing completed, false if canceled or interrupted
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Warning
This function blocks execution until the machine returns to IDLE state
Note
Documentation generated by AI on 2026-03-04

◆ WorkLightOff()

CommonGUIModule WorkLightOff ( dontsaveoutputstate )

Turn off the work light output signal and optionally save the off state.

Checks if the work light feature is enabled via m.IsWorkLightEnabled(). If enabled, sets the WorkLightOutput OEM parameter signal to false via w.SetOEMParamSig(). Unless dontsaveoutputstate is true, also sets the WorkLightWasOn OEM parameter to 0 to persist the off state across restarts.

Parameters
dontsaveoutputstate(boolean|nil) If true, skips saving the off state to the WorkLightWasOn parameter
Note
Documentation generated by AI on 2026-03-04

◆ WorkLightOn()

CommonGUIModule WorkLightOn ( )

Turn on the work light output signal and save the on state.

Checks if the work light feature is enabled via m.IsWorkLightEnabled(). If enabled, sets the WorkLightOutput OEM parameter signal to true via w.SetOEMParamSig(). Also sets the WorkLightWasOn OEM parameter to 1 so the light state is restored on the next startup.

Note
Documentation generated by AI on 2026-03-04

◆ WorkLightToggle()

CommonGUIModule WorkLightToggle ( )

Toggle the work light on or off based on its current state.

Checks the current state via m.IsWorkLightOn(). If the work light is on, calls m.WorkLightOff() to turn it off. Otherwise calls m.WorkLightOn() to turn it on.

Note
Documentation generated by AI on 2026-03-04

◆ WriteDataToMach()

CommonGUIModule JobFile WriteDataToMach ( )

Dispatch job file data writing to the appropriate version handler.

Reads the file version via jb:GetFileVersion(). If the version exceeds the current supported version (jb.FileVersion), shows a warning message and returns nil. Otherwise dispatches to jb:_WriteDataToMach_V2() for version 2 or jb:_WriteDataToMach_V1() for version 1.

Note
Documentation generated by AI on 2026-03-04

◆ YesNoDialog()

CommonGUIModule YesNoDialog ( yes_no_table )

Display a modal Yes/No dialog with bitmap buttons for binary user decisions.

Creates a styled dialog with a question text, Yes and No bitmap buttons with optional note labels below each button, and optional custom action buttons displayed above the Yes/No buttons. The dialog is shown modally and returns the wxWidgets ID of the button pressed. Action buttons execute user-supplied callback functions without closing the dialog.

Parameters
yes_no_table(table) Configuration table with keys:
  • 'Title' (string): Dialog title - required, raises error if missing
  • 'Question' (string): The question text displayed - required, raises error if missing
  • 'YesNote' (string|nil): Optional note text displayed below the Yes button
  • 'NoNote' (string|nil): Optional note text displayed below the No button
  • 'ActionButtons' (table|nil): Optional array of action button tables, each with:
    • 'Text' (string): Button label
    • 'Function' (function): Callback executed when button is clicked
Returns
(number) The wxWidgets ID of the button pressed: wx.wxID_YES, wx.wxID_NO, or wx.wxID_CANCEL
Note
Documentation generated by AI on 2026-03-04

◆ ZAxisLockToggleBtn()

CommonGUIModule ZAxisLockToggleBtn ( )

Button handler placeholder for Z-axis lock toggle.

Logs the button press via w.OperatorLog() and returns a successful completion status. This function is a placeholder stub - the Z-axis lock feature is not fully implemented.

Returns
(nil) No meaningful primary return value
(boolean) Success flag - always true
(string) Status message from w.FunctionCompleted()
Note
Documentation generated by AI on 2026-03-04

◆ ZeroABC()

CommonGUIModule ZeroABC ( IgnoreConfirmationDialogs ,
IgnoreEditMode  )

Zero the A, B, and C axes fixture offsets simultaneously.

Delegates to CommonGUIModule.ZeroMultipleAxes() with an axis table of {mc.A_AXIS, mc.B_AXIS, mc.C_AXIS}, passing through the IgnoreConfirmationDialogs and IgnoreEditMode flags.

Parameters
IgnoreConfirmationDialogs(boolean|nil) If true, skips the confirmation dialog
IgnoreEditMode(boolean|nil) If true, skips the edit mode check
Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the zero operation completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ ZeroABCBtn()

CommonGUIModule ZeroABCBtn ( IgnoreConfirmationDialogs )

Button handler to zero the A, B, and C axes fixture offsets simultaneously.

Delegates to CommonGUIModule.ZeroABC() with the provided IgnoreConfirmationDialogs flag.

Parameters
IgnoreConfirmationDialogs(boolean|nil) If true, skips the confirmation dialog
Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the zero operation completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ ZeroABtn()

CommonGUIModule ZeroABtn ( IgnoreConfirmationDialogs )

Button handler to zero the A axis fixture offset.

Delegates to CommonGUIModule.ZeroAxis() with mc.A_AXIS and the provided IgnoreConfirmationDialogs flag.

Parameters
IgnoreConfirmationDialogs(boolean|nil) If true, skips the confirmation dialog
Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the zero operation completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ ZeroAllBtn()

CommonGUIModule ZeroAllBtn ( IgnoreConfirmationDialogs ,
IgnoreEditMode  )

Button handler to zero all axis fixture offsets simultaneously.

Sets the instance to the selected instance. Checks edit mode (unless IgnoreEditMode is true) and requires the machine to be in IDLE state. Updates stop status. Calls user.UserZeroAllStart() hook if defined. If ConfirmationDialogs is "Yes" and IgnoreConfirmationDialogs is false, prompts for confirmation. Calls user.UserZeroAll() if defined (and saves fixture offsets); otherwise iterates over all coordinate axes and calls m.ModifyAxisPosition() to set each to 0.

Parameters
IgnoreConfirmationDialogs(boolean|nil) If true, skips the confirmation dialog. Defaults to false
IgnoreEditMode(boolean|nil) If true, skips the edit mode check. Defaults to false
Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the zero operation completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ ZeroAllDROBtn()

CommonGUIModule ZeroAllDROBtn ( )

Zero all axis DROs by computing offsets from current machine positions.

Logs the operation, then iterates over all coordinate axes (X through MC_MAX_COORD_AXES-1). For each axis, reads the current machine position via mc.mcAxisGetMachinePos() and converts it to current units via w.ConvertUnits(). Stores the negated value in DRO_MODE_OFFSET_ARRAY to make all displayed DRO values read zero.

Returns
(nil) No meaningful return value on success
(boolean) False with error message if unit conversion fails
(string) Status message from w.FunctionError() on failure
Note
Documentation generated by AI on 2026-03-04

◆ ZeroAxis()

CommonGUIModule ZeroAxis ( AxisID ,
IgnoreConfirmationDialogs ,
IgnoreEditMode  )

Zero the fixture offset for a single axis with optional confirmation and edit mode checks.

Sets the instance to the selected instance. Checks edit mode (unless IgnoreEditMode is true) and requires the machine to be in IDLE state before zeroing. Updates stop status. Calls user.UserZero{Axis}Start() hook if defined. If ConfirmationDialogs is "Yes" and IgnoreConfirmationDialogs is false, prompts the operator for confirmation via w.MessageDialog(). Calls user.UserZero{Axis}() if defined; otherwise calls m.ModifyAxisPosition() to set the axis position to 0 and saves fixture offsets.

Parameters
AxisID(number) The axis identifier to zero (e.g., mc.X_AXIS, mc.Z_AXIS)
IgnoreConfirmationDialogs(boolean|nil) If true, skips the confirmation dialog. Defaults to false
IgnoreEditMode(boolean|nil) If true, skips the edit mode check. Defaults to false
Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the zero operation completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ ZeroBBtn()

CommonGUIModule ZeroBBtn ( IgnoreConfirmationDialogs )

Button handler to zero the B axis fixture offset.

Delegates to CommonGUIModule.ZeroAxis() with mc.B_AXIS and the provided IgnoreConfirmationDialogs flag.

Parameters
IgnoreConfirmationDialogs(boolean|nil) If true, skips the confirmation dialog
Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the zero operation completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ ZeroCBtn()

CommonGUIModule ZeroCBtn ( IgnoreConfirmationDialogs )

Button handler to zero the C axis fixture offset.

Delegates to CommonGUIModule.ZeroAxis() with mc.C_AXIS and the provided IgnoreConfirmationDialogs flag.

Parameters
IgnoreConfirmationDialogs(boolean|nil) If true, skips the confirmation dialog
Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the zero operation completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ ZeroDROBtn()

CommonGUIModule ZeroDROBtn ( Axis )

Zero a single axis DRO by computing an offset from the current machine position.

Logs the operation, reads the current machine position for the specified axis via mc.mcAxisGetMachinePos(), converts it to current units via w.ConvertUnits(), and stores the negated value in DRO_MODE_OFFSET_ARRAY to make the displayed DRO value read zero.

Parameters
Axis(number) The axis index constant (e.g., mc.X_AXIS, mc.Z_AXIS)
Returns
(nil) No meaningful return value on success
(boolean) False with error message if unit conversion fails
(string) Status message from w.FunctionError() on failure
Note
Documentation generated by AI on 2026-03-04

◆ ZeroMultipleAxes()

CommonGUIModule ZeroMultipleAxes ( AxisID ,
IgnoreConfirmationDialogs ,
IgnoreEditMode  )

Zero the fixture offset for one or more axes simultaneously.

Sets the instance to the selected instance and retrieves the selected instance handle. Accepts either a single axis ID or a table of axis IDs. For each axis, validates the axis ID and builds a combined short name string for display and logging. Checks edit mode (unless IgnoreEditMode is true) and requires the machine to be in IDLE state. Calls user.UserZeroMultipleAxesStart() if defined. If ConfirmationDialogs is "Yes" and IgnoreConfirmationDialogs is false, prompts the operator for confirmation. For each axis, calls user.UserZeroMultipleAxes() if defined, otherwise calls m.ModifyAxisPosition() to set the position to 0. Sets OFFSETS_WERE_MODIFIED to true on completion.

Parameters
AxisID(number|table) A single axis identifier or a table of axis identifiers to zero (e.g., mc.X_AXIS or {mc.X_AXIS, mc.Y_AXIS})
IgnoreConfirmationDialogs(boolean|nil) If true, skips the confirmation dialog. Defaults to false
IgnoreEditMode(boolean|nil) If true, skips the edit mode check. Defaults to false
Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the zero operation completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ ZeroXBtn()

CommonGUIModule ZeroXBtn ( IgnoreConfirmationDialogs )

Button handler to zero the X axis fixture offset.

Delegates to CommonGUIModule.ZeroAxis() with mc.X_AXIS and the provided IgnoreConfirmationDialogs flag.

Parameters
IgnoreConfirmationDialogs(boolean|nil) If true, skips the confirmation dialog
Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the zero operation completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ ZeroXY()

CommonGUIModule ZeroXY ( IgnoreConfirmationDialogs ,
IgnoreEditMode  )

Zero the X and Y axes fixture offsets simultaneously.

Delegates to CommonGUIModule.ZeroMultipleAxes() with an axis table of {mc.X_AXIS, mc.Y_AXIS}, passing through the IgnoreConfirmationDialogs and IgnoreEditMode flags.

Parameters
IgnoreConfirmationDialogs(boolean|nil) If true, skips the confirmation dialog
IgnoreEditMode(boolean|nil) If true, skips the edit mode check
Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the zero operation completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ ZeroXYBtn()

CommonGUIModule ZeroXYBtn ( IgnoreConfirmationDialogs )

Button handler to zero the X and Y axes fixture offsets simultaneously.

Delegates to CommonGUIModule.ZeroXY() with the provided IgnoreConfirmationDialogs flag.

Parameters
IgnoreConfirmationDialogs(boolean|nil) If true, skips the confirmation dialog
Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the zero operation completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ ZeroXYZ()

CommonGUIModule ZeroXYZ ( IgnoreConfirmationDialogs ,
IgnoreEditMode  )

Zero the X, Y, and Z axes fixture offsets simultaneously.

Delegates to CommonGUIModule.ZeroMultipleAxes() with an axis table of {mc.X_AXIS, mc.Y_AXIS, mc.Z_AXIS}, passing through the IgnoreConfirmationDialogs and IgnoreEditMode flags.

Parameters
IgnoreConfirmationDialogs(boolean|nil) If true, skips the confirmation dialog
IgnoreEditMode(boolean|nil) If true, skips the edit mode check
Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the zero operation completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ ZeroXYZBtn()

CommonGUIModule ZeroXYZBtn ( IgnoreConfirmationDialogs )

Button handler to zero the X, Y, and Z axes fixture offsets simultaneously.

Delegates to CommonGUIModule.ZeroXYZ() with the provided IgnoreConfirmationDialogs flag.

Parameters
IgnoreConfirmationDialogs(boolean|nil) If true, skips the confirmation dialog
Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the zero operation completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ ZeroXZ()

CommonGUIModule ZeroXZ ( IgnoreConfirmationDialogs ,
IgnoreEditMode  )

Zero the X and Z axes fixture offsets simultaneously.

Delegates to CommonGUIModule.ZeroMultipleAxes() with an axis table of {mc.X_AXIS, mc.Z_AXIS}, passing through the IgnoreConfirmationDialogs and IgnoreEditMode flags.

Parameters
IgnoreConfirmationDialogs(boolean|nil) If true, skips the confirmation dialog
IgnoreEditMode(boolean|nil) If true, skips the edit mode check
Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the zero operation completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ ZeroXZBtn()

CommonGUIModule ZeroXZBtn ( IgnoreConfirmationDialogs )

Button handler to zero the X and Z axes fixture offsets simultaneously.

Delegates to CommonGUIModule.ZeroXZ() with the provided IgnoreConfirmationDialogs flag.

Parameters
IgnoreConfirmationDialogs(boolean|nil) If true, skips the confirmation dialog
Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the zero operation completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ ZeroYBtn()

CommonGUIModule ZeroYBtn ( IgnoreConfirmationDialogs )

Button handler to zero the Y axis fixture offset.

Delegates to CommonGUIModule.ZeroAxis() with mc.Y_AXIS and the provided IgnoreConfirmationDialogs flag.

Parameters
IgnoreConfirmationDialogs(boolean|nil) If true, skips the confirmation dialog
Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the zero operation completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ ZeroYZ()

CommonGUIModule ZeroYZ ( IgnoreConfirmationDialogs ,
IgnoreEditMode  )

Zero the Y and Z axes fixture offsets simultaneously.

Delegates to CommonGUIModule.ZeroMultipleAxes() with an axis table of {mc.Y_AXIS, mc.Z_AXIS}, passing through the IgnoreConfirmationDialogs and IgnoreEditMode flags.

Parameters
IgnoreConfirmationDialogs(boolean|nil) If true, skips the confirmation dialog
IgnoreEditMode(boolean|nil) If true, skips the edit mode check
Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the zero operation completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ ZeroYZBtn()

CommonGUIModule ZeroYZBtn ( IgnoreConfirmationDialogs )

Button handler to zero the Y and Z axes fixture offsets simultaneously.

Delegates to CommonGUIModule.ZeroYZ() with the provided IgnoreConfirmationDialogs flag.

Parameters
IgnoreConfirmationDialogs(boolean|nil) If true, skips the confirmation dialog
Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the zero operation completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04

◆ ZeroZBtn()

CommonGUIModule ZeroZBtn ( IgnoreConfirmationDialogs )

Button handler to zero the Z axis fixture offset.

Delegates to CommonGUIModule.ZeroAxis() with mc.Z_AXIS and the provided IgnoreConfirmationDialogs flag.

Parameters
IgnoreConfirmationDialogs(boolean|nil) If true, skips the confirmation dialog
Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if the zero operation completed successfully
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-04