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

Go to the source code of this file.

Functions

AzureLabelModule ScreenLoad ()
 Initialize the AzureLabelModule during Mach4 screen load.
AzureLabelModule InitializeAPI ()
 Initialize the Azure label REST API backend.
AzureLabelModule GetLabels ()
 Retrieve all available Azure label templates as an ID-keyed table.
AzureLabelModule SelectLabel ()
 Display a dialog allowing the operator to select an Azure label template.
UI DestroyGauge ()
 Destroy the label picker dialog and release its resources.
AzureLabelModule SelectCurrentLabel (UI)
 Pre-select the currently active label in the label picker UI choice control.
AzureLabelModule SendLabelData ()
 Send label data to the Azure label printing API.
AzureLabelModule GetTemplate ()
 Retrieve the data fields of the current Azure label template from the API.
AzureLabelModule CreateTemplate (temp_tbl, lbl_tbl)
 Populate a ready data table with label field values using a template definition.
AzureLabelModule GetLabelID ()
 Get the currently selected Azure label ID from the machine profile.
AzureLabelModule CreatePreCannedCommands ()
 Register all AzureLabelModule commands with the Mach4 command system.

Function Documentation

◆ CreatePreCannedCommands()

MotionController CreatePreCannedCommands ( )

Register all AzureLabelModule commands with the Mach4 command system.

Create pre-canned user commands for the motion controller.

Creates and registers the pre-canned Mach4 commands associated with the AzureLabelModule. Currently registers the "Select Label" command, which opens a dialog for the operator to choose the active Azure label template. This function is intended to be called during screen load via the CommandRegistrar.

Note
Documentation generated by AI on 2026-03-03

Base implementation that creates the generic commands applicable to all motion controllers by calling CreateGenericCommands(). Subclasses such as RapidPath override this to register additional controller-specific commands (motor disconnect, FDC capture, slave sync, etc.) while also calling this base method via self:CreateGenericCommands().

Returns
(boolean) False in the base implementation
See also
MotionController:CreateGenericCommands() for the generic commands created here
RapidPath:CreatePreCannedCommands() for the RapidPath-specific extension
Note
Documentation generated by AI on 2026-03-04

◆ CreateTemplate()

AzureLabelModule CreateTemplate ( temp_tbl ,
lbl_tbl  )

Populate a ready data table with label field values using a template definition.

Iterates over the provided label data table and maps matching fields into the ready data table using the template definition as a schema. Only fields whose keys match a name entry in temp_tbl are written. The "templateId" key is explicitly excluded from processing. Field values are converted to strings before being written into the output table.

Parameters
ready_tbl(table) The output table to populate with matched label data fields
temp_tbl(table) Array of template field definition tables, each containing a "name" key
lbl_tbl(table) Table of label data key-value pairs to map into the template
Returns
(table) The populated ready_tbl with matched fields inserted as string values
Note
Documentation generated by AI on 2026-03-03

◆ DestroyGauge()

GCACaller UI DestroyGauge ( )

Destroy the label picker dialog and release its resources.

Destroy the GCACaller Array UI dialog and release associated resources.

Destroy the GCACaller progress bar dialog and release associated resources.

Destroy the GCode Search dialog and release its reference.

Destroy the quantity entry dialog and release its reference.

Calls Destroy() on the dialog window to free all associated wx resources and sets the dialog reference to nil. This function is assigned as a closure capturing the UI table and is called by both the close button handler and the EVT_CLOSE_WINDOW event handler.

Note
Documentation generated by AI on 2026-03-03

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

Destroys the wxWidgets Dialog1 progress bar window used during the MirrorX G-code adaptation operation and sets GCACaller.DI to nil, releasing all resources. This function is stored as a closure on GCACaller.DI and is called automatically when the adaptation process completes or is canceled by the operator.

Warning
After this function is called, GCACaller.DI will be nil. Do not attempt to access gauge or dialog elements after calling this function.
Note
Documentation generated by AI on 2026-03-03

Destroys the wxWidgets Dialog1 progress bar window used during the MirrorY G-code adaptation operation and sets GCACaller.DI to nil, releasing all resources. This function is stored as a closure on GCACaller.DI and is called automatically when the adaptation process completes or is canceled by the operator.

Warning
After this function is called, GCACaller.DI will be nil. Do not attempt to access gauge or dialog elements after calling this function.
Note
Documentation generated by AI on 2026-03-03

Destroys the wxWidgets Dialog1 progress bar window used during the Rotate G-code adaptation operation and sets GCACaller.DI to nil, releasing all resources. This function is stored as a closure on GCACaller.DI and is called automatically when the adaptation process completes or is canceled by the operator.

Warning
After this function is called, GCACaller.DI will be nil. Do not attempt to access gauge or dialog elements after calling this function.
Note
Documentation generated by AI on 2026-03-03

Destroys the wxWidgets Dialog1 progress bar window used during the Array G-code adaptation operation and sets GCACaller.DI to nil, releasing all resources. This function is stored as a closure on GCACaller.DI and is called automatically when the adaptation process completes or is canceled by the operator.

Warning
After this function is called, GCACaller.DI will be nil. Do not attempt to access gauge or dialog elements after calling this function.
Note
Documentation generated by AI on 2026-03-03

Destroys the wxWidgets ArrayDialog window and sets GCACaller.UI to nil, releasing all UI resources associated with the array configuration dialog. This function is stored as a closure on GCACaller.UI and should be called when the array dialog is no longer needed.

Warning
After this function is called, GCACaller.UI will be nil. Do not attempt to access any UI elements after calling this function.
Note
Documentation generated by AI on 2026-03-03

◆ GetLabelID()

AzureLabelModule GetLabelID ( )

Get the currently selected Azure label ID from the machine profile.

Reads the label ID stored in the "AzureLabelData" section of the Mach4 machine INI profile under the key "LabelID". Returns 0 if no label ID has been saved.

Returns
(number) The stored label ID, or 0 if not set
Note
Documentation generated by AI on 2026-03-03

◆ GetLabels()

AzureLabelModule GetLabels ( )

Retrieve all available Azure label templates as an ID-keyed table.

Initializes the API if not already initialized, then calls the API's GetIDs() method to retrieve all label definitions. The raw array response is transformed into a table keyed by label ID with the label name as the value, making lookups by ID efficient.

Returns
(table) Table mapping label ID (key) to label name string (value)
Note
Documentation generated by AI on 2026-03-03

◆ GetTemplate()

AzureLabelModule GetTemplate ( )

Retrieve the data fields of the current Azure label template from the API.

Initializes the API if not already initialized, then fetches the template definition for the currently selected label ID. The label ID is stripped of any trailing ".0" decimal notation before being sent to the API. Returns only the "dataFields" portion of the template response.

Returns
(table) Array of data field definition tables for the current label template
Note
Documentation generated by AI on 2026-03-03

◆ InitializeAPI()

AzureLabelModule InitializeAPI ( )

Initialize the Azure label REST API backend.

Loads the mRESTData module and configures the AzureLabel backend with the provided URL and current Mach4 instance. If the API has already been initialized, this function returns immediately without reinitializing. The Modules/Addons directory is appended to package.path before requiring the module to ensure it can be located. Uses w.pcall() for protected loading and raises an error via w.Error() if the require fails.

Parameters
url(string|nil) The Azure label API endpoint URL. If nil, uses AzureLabelModule.URL
Note
This function is idempotent - subsequent calls after initialization have no effect
Documentation generated by AI on 2026-03-03

◆ ScreenLoad()

AzureLabelModule ScreenLoad ( )

Initialize the AzureLabelModule during Mach4 screen load.

Registers the CreatePreCannedCommands function with the CommandRegistrar so that Azure label commands are available in Mach4. Reads the saved label ID from the machine profile and, if no label ID has been stored, retrieves the default label ID from the "AzureLabelDefaultLabelID" OEM parameter and writes it to the profile for future use.

Note
This function is called automatically by Mach4 during screen load
Documentation generated by AI on 2026-03-03

◆ SelectCurrentLabel()

AzureLabelModule SelectCurrentLabel ( UI )

Pre-select the currently active label in the label picker UI choice control.

Reads the saved label ID from the Mach4 machine profile and finds the corresponding label name in the provided labels table. If a valid saved label ID is found, the matching entry in the wxChoice control is selected automatically. If the saved ID is 0 or nil, no selection is made.

Parameters
labels(table) Table mapping label IDs (keys) to label name strings (values)
UI(table) The UI state table containing the m_choice wxChoice control
Note
Documentation generated by AI on 2026-03-03

◆ SelectLabel()

AzureLabelModule SelectLabel ( )

Display a dialog allowing the operator to select an Azure label template.

Fetches all available labels from the API and presents them in a wxChoice control within a standard dialog. The previously saved label ID is pre-selected. When the operator clicks Save, the chosen label ID is written to the Mach4 machine profile under "AzureLabelData/labelID". The dialog position and size are managed via w.Formatting staged dialog helpers.

-- Typically invoked from a command button action
AzureLabelModule SelectLabel()
Display a dialog allowing the operator to select an Azure label template.
Note
The dialog is non-modal; it is shown using w.Formatting.ShowDialog()
Documentation generated by AI on 2026-03-03

◆ SendLabelData()

AzureLabelModule SendLabelData ( )

Send label data to the Azure label printing API.

Initializes the API if not already initialized, then builds and transmits a complete label print request. If the provided table does not include a "templateId", the currently selected label ID is used automatically. The function fetches the label template, maps the provided data fields using CreateTemplate(), and structures the payload with a "readyData" source type before calling the underlying API send method.

Parameters
lbl_tbl(table) Table of label field key-value pairs to print. May optionally include a "templateId" key to override the default label ID
Note
Documentation generated by AI on 2026-03-03