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

Go to the source code of this file.

Functions

PlasmaGUIModule MachineLoadModules ()
 Load all machine-specific modules required by the Plasma GUI.
PlasmaGUIModule MachineInitializeModules ()
 Initialize all height controller modules for the Plasma GUI.
PlasmaGUIModule ScreenLoadScript ()
 Execute all screen load initialization tasks for the Plasma GUI module.
PlasmaGUIModule StartUpScript ()
 Execute all startup configuration tasks for the Plasma GUI screen.
PlasmaGUIModule LoadHeightControllers ()
 Load the HeightControllers module and create a height controller interface object for each Mach4 instance.
PlasmaGUIModule HeightControllersInitialization ()
 Execute the Initialization routine on all height controller instances.
PlasmaGUIModule HeightControllersStartup ()
 Execute the Startup routine on all height controller instances.
PlasmaGUIModule HeightControllersStartCutRecoveryCuttingRoutine ()
 Invoke the StartCutRecoveryCuttingRoutine on all height controller instances.
PlasmaGUIModule PLCScript ()
 Execute all PLC scan cycle tasks for the Plasma screen module.
PlasmaGUIModule MachineSignalScript (sig_id, sig_state, inst)
 Forward machine signal events to the height controller for the affected instance.
PlasmaGUIModule MachineCycleStop ()
 Delegate the cycle stop event to the active height controller instance.
PlasmaGUIModule MachineReset ()
 Delegate the machine reset event to the active height controller instance.
PlasmaGUIModule MachineCycleStartFinal ()
 Delegate the cycle start final event to the active height controller instance.
PlasmaGUIModule ConfigureToolSizeEntryMode ()
 Read the ToolSizeEntryMode OEM parameter and apply it by calling SetToolSizeEntryMode.
PlasmaGUIModule LowPriorityLoop ()
 Delegate the low priority loop processing to the active height controller instance.
PlasmaGUIModule RetractDialog ()
 Display a modal dialog for the operator to select a retract position or stay in place.
UI CloseDialog ()
 Save the current radio box selection to the profile and destroy the retract dialog.

Function Documentation

◆ CloseDialog()

UI CloseDialog ( )

Save the current radio box selection to the profile and destroy the retract dialog.

Reads the currently selected position index from GoToPositionRadioBox, persists it to the Mach4 profile under "MachMotion/LastGoToRetractPositionType", stops the GoToRetractPositionsDialogTimer if running, and then destroys the dialog window. This function is a closure defined inside RetractDialog and operates on the UI table.

Note
This is a nested closure and can only be called within the scope of RetractDialog
Documentation generated by AI on 2026-03-03

◆ ConfigureToolSizeEntryMode()

PlasmaGUIModule ConfigureToolSizeEntryMode ( )

Read the ToolSizeEntryMode OEM parameter and apply it by calling SetToolSizeEntryMode.

Retrieves the ToolSizeEntryMode string value from OEM parameters. If the parameter is found, calls PlasmaGUIModule.SetToolSizeEntryMode with the retrieved value using w.pcall for protected execution. Any error returned from SetToolSizeEntryMode is logged to the Mach4 control log at line 26.

Note
Documentation generated by AI on 2026-03-03

◆ HeightControllersInitialization()

PlasmaGUIModule HeightControllersInitialization ( )

Execute the Initialization routine on all height controller instances.

Iterates over all Mach4 instances. For each instance where HC[_inst] exists and is not nil, calls HC[_inst]:Initialization() inside a w.pcall protected call. If the call fails, extracts the error message (from table or string), creates a system global Alarm GMS message with the error description, and returns an error result. Returns success on normal completion.

Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if all instances initialized successfully, false if any failed
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Warning
If any height controller instance fails, an Alarm GMS message is created and the function returns immediately
Note
Documentation generated by AI on 2026-03-03

◆ HeightControllersStartCutRecoveryCuttingRoutine()

PlasmaGUIModule HeightControllersStartCutRecoveryCuttingRoutine ( )

Invoke the StartCutRecoveryCuttingRoutine on all height controller instances.

Iterates over all Mach4 instances. For each instance where HC[_inst] exists and is not nil, calls HC[_inst]:StartCutRecoveryCuttingRoutine() inside a w.pcall protected call. If the call fails, extracts the error message (from table or string), creates a system global alarm message with the error description, and returns an error result. Returns no explicit success result on completion (no return at end of function for the success path).

Returns
(nil) No meaningful primary return value
(boolean) false on error
(string) Status message from w.FunctionError() on error
Warning
If any height controller instance fails, an Alarm GMS message is created and the function returns immediately
Note
Documentation generated by AI on 2026-03-03

◆ HeightControllersStartup()

PlasmaGUIModule HeightControllersStartup ( )

Execute the Startup routine on all height controller instances.

Iterates over all Mach4 instances. For each instance where HC[_inst] exists and is not nil, calls HC[_inst]:Startup() inside a w.pcall protected call. If the call fails, extracts the error message (from table or string), creates a system global Alarm GMS message with the error description, and returns an error result. Returns success on normal completion.

Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if all instances started successfully, false if any failed
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Warning
If any height controller instance fails, an Alarm GMS message is created and the function returns immediately
Note
Documentation generated by AI on 2026-03-03

◆ LoadHeightControllers()

PlasmaGUIModule LoadHeightControllers ( )

Load the HeightControllers module and create a height controller interface object for each Mach4 instance.

Clears any previously loaded HeightControllers module from package.loaded, then requires it using w.pcall for protected loading. If loading fails, logs the error and displays a message box. On success, iterates over all Mach4 instances (0 to GetInstanceCount()-1) and calls HC:Create() for each instance in "SCREEN" mode using w.pcall. If object creation fails, displays a message box with the error. On success, stores the returned object in HC[_inst].

Warning
Displays a wxMessageBox on load failure or object creation failure; does not raise an error
Note
Documentation generated by AI on 2026-03-03

◆ LowPriorityLoop()

PlasmaGUIModule LowPriorityLoop ( )

Delegate the low priority loop processing to the active height controller instance.

Retrieves the current unique tool instance (UTI) and, if the height controller object HC[_inst] exists and implements a LowPriorityLoop method, calls it. This function is intended to be called from the screen's low priority loop to allow height controller housekeeping tasks to run at reduced frequency.

Note
Documentation generated by AI on 2026-03-03

◆ MachineCycleStartFinal()

PlasmaGUIModule MachineCycleStartFinal ( )

Delegate the cycle start final event to the active height controller instance.

Retrieves the current unique tool instance (UTI) and, if the height controller object HC[_inst] exists and implements a CycleStartFinal method, calls it and returns its result. This is called at the final stage of cycle start to allow the height controller to perform any last-moment checks or actions before motion begins.

Returns
(any) The return value from HC[_inst]:CycleStartFinal(), or nil if no handler is registered
Note
Documentation generated by AI on 2026-03-03

◆ MachineCycleStop()

PlasmaGUIModule MachineCycleStop ( )

Delegate the cycle stop event to the active height controller instance.

Retrieves the current unique tool instance (UTI) and, if the height controller object HC[_inst] exists and implements a CycleStop method, calls it. This allows the height controller to perform any necessary actions (such as retracting the torch) when a cycle stop event occurs.

Note
Documentation generated by AI on 2026-03-03

◆ MachineInitializeModules()

PlasmaGUIModule MachineInitializeModules ( )

Initialize all height controller modules for the Plasma GUI.

Delegates to m.HeightControllersInitialization() to run the initialization sequence for all loaded height controller instances. Called during the module initialization phase before startup.

Note
Documentation generated by AI on 2026-03-03

◆ MachineLoadModules()

PlasmaGUIModule MachineLoadModules ( )

Load all machine-specific modules required by the Plasma GUI.

Delegates to m.LoadHeightControllers() to load and instantiate the HeightControllers module. Called during the machine module load phase before initialization and startup.

Note
Documentation generated by AI on 2026-03-03

◆ MachineReset()

PlasmaGUIModule MachineReset ( )

Delegate the machine reset event to the active height controller instance.

Retrieves the current unique tool instance (UTI) and, if the height controller object HC[_inst] exists and implements a Reset method, calls it. This allows the height controller to perform any necessary cleanup or state reset when the machine reset event occurs.

Note
Documentation generated by AI on 2026-03-03

◆ MachineSignalScript()

PlasmaGUIModule MachineSignalScript ( sig_id ,
sig_state ,
inst  )

Forward machine signal events to the height controller for the affected instance.

Resolves the unique tool instance index from the provided inst handle using w.GetUTI(). If the height controller HC[_inst] exists and implements a SignalScript method, calls it with the signal ID and signal state so the height controller can respond to I/O signal changes.

Parameters
sig_id(number) The signal identifier that changed state
sig_state(boolean) The new state of the signal (true = active, false = inactive)
inst(number) The Mach4 instance handle associated with the signal event
Note
Documentation generated by AI on 2026-03-03

◆ PLCScript()

PlasmaGUIModule PLCScript ( )

Execute all PLC scan cycle tasks for the Plasma screen module.

Called on every PLC scan cycle. Performs the following tasks in order:

  1. Updates the tool verify DRO via UpdateToolVerifyDRO()
  2. Updates feedrate text and DROs via screen.UpdateFeedrateDROLabels()
  3. Checks whether the retract dialog should be opened via IsRetractActive()
  4. Iterates over all Mach4 instances and calls HC[_inst]:PLCScript() for each height controller that implements the PLCScript method
    Note
    Documentation generated by AI on 2026-03-03

◆ RetractDialog()

PlasmaGUIModule RetractDialog ( )

Display a modal dialog for the operator to select a retract position or stay in place.

Creates and shows a wxDialog with a radio box listing all configured go-to positions (from w.GetConfiguredGoToPositions()) and Move/Stay buttons. The last selected position index is persisted to the Mach4 profile and restored on open. A repeating 200ms timer monitors for Mach shutdown or stop events; if detected, closes the dialog and sets the result to "Do Not Move". The Move button closes the dialog with the selected position name. The Stay button sets the result to "Do Not Move" and closes the dialog. The selected position name is written back to the RetractDialog OEM register by the caller (IsRetractActive).

Returns
(string) The name of the selected retract position, or "Do Not Move" if stay was chosen or dialog was cancelled
(boolean) Success flag - always true
(string) Status message from w.FunctionCompleted()
See also
PlasmaGUIModule.IsRetractActive for the calling context and register write-back
Note
Documentation generated by AI on 2026-03-03

◆ ScreenLoadScript()

PlasmaGUIModule ScreenLoadScript ( )

Execute all screen load initialization tasks for the Plasma GUI module.

Performs the following operations during screen load:

  1. Sets the module version strings from SVN URL and Revision keywords via w.SetVersionStrings()
  2. Initializes the spindle tool release indicator via m.InitializeSpindleToolRelease()
  3. Registers the CreateMillPreCannedCommands function with the CommandRegistrar under the key "PlasmaGUIModule.CreateMillPreCannedCommands"
    Note
    Documentation generated by AI on 2026-03-03

◆ StartUpScript()

PlasmaGUIModule StartUpScript ( )

Execute all startup configuration tasks for the Plasma GUI screen.

Performs the following startup operations in order:

  1. Starts up all height controllers via m.HeightControllersStartup()
  2. Configures the tool size entry mode from OEM parameters via m.ConfigureToolSizeEntryMode()
  3. Initializes tool changers via m.InitializeToolChangers()
  4. Configures the conversational button on the screen via m.screen.ConfigureConversationalButton()
  5. Configures the tool length measurement mode via m.ConfigureTLMMode()
  6. Adds spindle rotation column to the tool table via m.AddSpindleRotationToToolTable()
  7. Adds ignore auto tool setter column to the tool table via m.AddIgnoreAutoToolSetterToToolTable()
  8. Adds tool size column to the tool table via m.AddToolSizeToToolTable()
  9. Adds tool path color column to the tool table via m.AddToolPathColorsToToolTable()
  10. Adds tool setter offset column to the tool table via m.AddToolSetterOffsetToToolTable()
  11. Adds tool changer override column to the tool table via m.AddToolChangerOverrideToToolTable()
    Note
    Documentation generated by AI on 2026-03-03