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

Go to the source code of this file.

Functions

TurnScreenV02 MachineScreenLoadScript ()
 Screen load script for the turn screen - registers signal library handlers.
TurnScreenV02 MachineScreenStartupScript ()
 Startup script for the turn screen machine configuration.
TurnScreenV02 MachineScreenPLCScript ()
 PLC script loop handler for the turn screen.
TurnScreenV02 MachineScreenLowPriorityLoop ()
 Low priority periodic loop for updating tool and spindle screen objects.
TurnScreenV02 PostInitializeAxisPositionGroup ()
 Post-initialization hook for the axis position group.
TurnScreenV02 UnMapXDistToGoDROFromMach ()
 Unmap the X distance-to-go DRO from its Mach4-controlled DRO code.
TurnScreenV02 UpdateToGoDROs ()
 Update the X axis distance-to-go DRO with diameter mode compensation.
TurnScreenV02 UpdateDRODecimalCount ()
 Update DRO format strings based on configured decimal precision settings.
TurnScreenV02 UpdateDROPostions ()
 Placeholder for updating DRO position display values.
TurnScreenV02 UpdateToolOffsetsTab ()
 Update the Tool Offsets tab UI layout based on OEM parameter configuration.
TurnScreenV02 OnCannedCyclesPost ()
 Post-process handler called after canned cycle operations complete.
TurnScreenV02 LaunchLatheCannedCycles ()
 Launch the Lathe Canned Cycles wizard module.
TurnScreenV02 UpdateAxisDROs ()
 Update the X axis DRO display based on diameter mode and tool slide configuration.
TurnScreenV02 UpdateMBSequenceBitData ()
 Update PLC-controlled button states from ModBus sequence bit data.
TurnScreenV02 UpdateScreenSpindleObjects ()
 Update spindle-related screen objects including mode, speed, and G50 limit display.
TurnScreenV02 UpdateScreenToolObjects ()
 Update all tool offset DROs and related screen objects for the current tool.
TurnScreenV02 OperationTabEnter (TabNumber)
 Handle entry into an operation tab and manage edit mode state accordingly.
TurnScreenV02 OperationTabExit (TabNumber)
 Handle exit from an operation tab and update edit mode state.
TurnScreenV02 ConfigureConversationalButton ()
 Configure the visibility of the Conversational button based on Alexsys eCam availability.
TurnScreenV02 MachineCreatePreCannedCommands ()
 Register pre-canned commands for the lathe screen.

Function Documentation

◆ ConfigureConversationalButton()

TurnScreenV02 ConfigureConversationalButton ( )

Configure the visibility of the Conversational button based on Alexsys eCam availability.

Checks for the existence of the Alexsys eCam executable in the software directory. If the file is found, the ConversationalBtn is enabled; otherwise it is disabled.

Note
Documentation generated by AI on 2026-03-03

◆ LaunchLatheCannedCycles()

TurnScreenV02 LaunchLatheCannedCycles ( )

Launch the Lathe Canned Cycles wizard module.

Logs the button press to the operator log, appends the Wizards directory to the Lua package path, clears any cached version of the module, and requires the "Lathe Canned Cycles" module to launch the wizard interface.

Note
Documentation generated by AI on 2026-03-03

◆ MachineCreatePreCannedCommands()

TurnScreenV02 MachineCreatePreCannedCommands ( )

Register pre-canned commands for the lathe screen.

Creates and registers the Lathe Canned Cycles command action option and simple command using w.CreateCommandActionOption() and w.CreateSimpleCommand(). This function is registered with the CommandRegistrar during startup and is called to populate the pre-canned command list for the lathe screen.

Note
Documentation generated by AI on 2026-03-03

◆ MachineScreenLoadScript()

TurnScreenV02 MachineScreenLoadScript ( )

Screen load script for the turn screen - registers signal library handlers.

Initializes the SCREEN_SIG_LIBRARY table if not already present and registers a handler for the OSIG_TOOL_CHANGE signal. The handler updates the ToolChangeActiveText label LED, the ToolChangeLED state, and the ToolNumberText foreground and background colors to indicate active (yellow) or inactive (default DRO color) tool change state.

Note
Documentation generated by AI on 2026-03-03

◆ MachineScreenLowPriorityLoop()

TurnScreenV02 MachineScreenLowPriorityLoop ( )

Low priority periodic loop for updating tool and spindle screen objects.

Called periodically at low priority to refresh tool offset DROs and spindle status display objects. Delegates to UpdateScreenToolObjects() and UpdateScreenSpindleObjects(). Suitable for updates that do not require high-frequency refresh.

Note
Documentation generated by AI on 2026-03-03

◆ MachineScreenPLCScript()

TurnScreenV02 MachineScreenPLCScript ( )

PLC script loop handler for the turn screen.

Called on every PLC cycle to update PLC-controlled button states and the X axis distance-to-go DRO. Delegates to UpdateMBSequenceBitData() for button updates and UpdateToGoDROs() for DRO updates.

Note
Documentation generated by AI on 2026-03-03

◆ MachineScreenStartupScript()

TurnScreenV02 MachineScreenStartupScript ( )

Startup script for the turn screen machine configuration.

Sets the machine type name label to "Mach Turn", initializes the fixture offsets group, unmaps the X distance-to-go DRO from Mach4 automatic control, and registers the MachineCreatePreCannedCommands function with the CommandRegistrar for later invocation.

Note
Documentation generated by AI on 2026-03-03

◆ OnCannedCyclesPost()

TurnScreenV02 OnCannedCyclesPost ( )

Post-process handler called after canned cycle operations complete.

Switches the OperationTabs control to tab index 0 and queues a 'Refresh Enabled Buttons' user command via the post-to-file queue to update button states after the canned cycle exits.

Note
Documentation generated by AI on 2026-03-03

◆ OperationTabEnter()

TurnScreenV02 OperationTabEnter ( TabNumber )

Handle entry into an operation tab and manage edit mode state accordingly.

Refreshes enabled button states on every tab entry. For tab 5, initializes the axis position group. For tabs 3 and 4 (fixtures/tool offset tabs), edit mode is automatically enabled or its button state refreshed depending on whether edit mode is already active. For all other tabs, edit mode is turned off if it is currently active.

Parameters
TabNumber(number) The index of the operation tab being entered
Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if operation completed successfully
(string) Status message from w.FunctionCompleted()
Note
Documentation generated by AI on 2026-03-03

◆ OperationTabExit()

TurnScreenV02 OperationTabExit ( TabNumber )

Handle exit from an operation tab and update edit mode state.

Stores the exiting tab number in LAST_OPERATION_TAB. If the tab being exited is not tab 3 or 4 and edit mode is currently active, edit mode is automatically turned off.

Parameters
TabNumber(number) The index of the operation tab being exited
Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if operation completed successfully
(string) Status message from w.FunctionCompleted()
Note
Documentation generated by AI on 2026-03-03

◆ PostInitializeAxisPositionGroup()

TurnScreenV02 PostInitializeAxisPositionGroup ( )

Post-initialization hook for the axis position group.

Called after the axis position group is initialized. Unmaps the X distance-to-go DRO from Mach4 control by calling m.screen.UnMapXDistToGoDROFromMach(). Returns false as the first value to indicate the base initialization should not be suppressed.

Returns
(boolean) false - indicates base behavior should proceed
(boolean) Success flag - true if completed successfully
(string) Status message from w.FunctionCompleted()
Note
Documentation generated by AI on 2026-03-03

◆ UnMapXDistToGoDROFromMach()

TurnScreenV02 UnMapXDistToGoDROFromMach ( )

Unmap the X distance-to-go DRO from its Mach4-controlled DRO code.

Clears the DRO Code property of the XToGoDRO screen object, decoupling it from automatic Mach4 updates so that the value can be manually controlled by UpdateToGoDROs().

Note
Documentation generated by AI on 2026-03-03

◆ UpdateAxisDROs()

TurnScreenV02 UpdateAxisDROs ( )

Update the X axis DRO display based on diameter mode and tool slide configuration.

Manages the XPosDRO display code and value depending on the LATHE_TOOL_SLIDE_SECONDARY global flag. When the secondary tool slide is active, the DRO is set to DRO_NONE and the value is manually set to the negated X axis position. When the primary tool slide is active, the DRO is mapped to DRO_AXIS_POS_X. Does nothing if MACHINE_COORDINATES_ACTIVE is set.

Note
Documentation generated by AI on 2026-03-03

◆ UpdateDRODecimalCount()

TurnScreenV02 UpdateDRODecimalCount ( )

Update DRO format strings based on configured decimal precision settings.

Reads decimal count preferences from the Mach4 profile for feedrate and tool DROs, then applies the appropriate format string (e.g., "%0.4f") to each DRO object. Also iterates over all 6 axes (0-5) and sets the format for PosDRO, ToGoDRO, DRO, and MachineDRO objects using the per-axis precision value from mc.mcAxisGetPrecision(). Defaults to "4" decimal places if the axis precision value is nil or empty.

Note
Documentation generated by AI on 2026-03-03

◆ UpdateDROPostions()

TurnScreenV02 UpdateDROPostions ( )

Placeholder for updating DRO position display values.

This function is reserved for updating DRO positions but is currently not implemented. It exists as an extension point for machine-specific DRO position update logic.

Note
Documentation generated by AI on 2026-03-03

◆ UpdateMBSequenceBitData()

TurnScreenV02 UpdateMBSequenceBitData ( )

Update PLC-controlled button states from ModBus sequence bit data.

Reads PLCSeqBitData bits from the ModBus device for the M10 (Chuck), M11, M25 (Tailstock), and M26 sequence numbers defined in OEM parameters. Updates the Chuck and Tailstock button colors and labels to reflect the current PLC state. Only executes if mb.GetBit is available (ModBus plugin is loaded).

Note
Documentation generated by AI on 2026-03-03

◆ UpdateScreenSpindleObjects()

TurnScreenV02 UpdateScreenSpindleObjects ( )

Update spindle-related screen objects including mode, speed, and G50 limit display.

Reads the current spindle mode (G96 CSS or G97 RPM) from modal group 13 and updates the SpindleModeText label and background color accordingly. Displays commanded RPM in G97 mode and commanded SFM in G96 mode. Also computes and displays the G50 speed limit label with a yellow highlight when the G50 limit is less than the maximum RPM for the current pulley range.

Note
Documentation generated by AI on 2026-03-03

◆ UpdateScreenToolObjects()

TurnScreenV02 UpdateScreenToolObjects ( )

Update all tool offset DROs and related screen objects for the current tool.

Retrieves the current tool number and pocket from Mach4 and OEM registers, then updates the tool number label and all tool offset DROs (X, Z, X wear, Z wear, tip radius, tip direction). Also updates the tool slide front/rear text label and the tip direction arrow image based on the MTOOL_LATHE_TOOLSLIDE and MTOOL_LATHE_TIPDIR values. The tip direction image is only updated when the direction changes from the last known value (TIP_DIRECTION_LAST) to reduce unnecessary screen updates.

Note
Documentation generated by AI on 2026-03-03

◆ UpdateToGoDROs()

TurnScreenV02 UpdateToGoDROs ( )

Update the X axis distance-to-go DRO with diameter mode compensation.

Reads the X axis distance-to-go from mc.mcCntlGetDistToGo() and doubles the value when CURRENT_DIAMETER_MODE is 1 (diameter mode active) before displaying it in the XToGoDRO object. The DRO code must be unlinked from Mach4 via UnMapXDistToGoDROFromMach() before this function is called.

Note
Documentation generated by AI on 2026-03-03

◆ UpdateToolOffsetsTab()

TurnScreenV02 UpdateToolOffsetsTab ( )

Update the Tool Offsets tab UI layout based on OEM parameter configuration.

Reads the ToolSetterType, ManualGageBlockHeight, ToolSetterHeight, ToolSetterPositionType, and ToolChangerMethod OEM parameters and configures the visibility and enabled state of UI groups and buttons accordingly. Manual vs Auto tool setter determines which setting groups are shown. Auto vs Manual tool changer determines which change groups are shown. Fixed vs Random tool setter position determines which offset groups and buttons are enabled.

Returns
(nil) No meaningful primary return value
(boolean) Success flag - true if all OEM parameters were read and UI was updated
(string) Status message from w.FunctionCompleted() or w.FunctionError()
Note
Documentation generated by AI on 2026-03-03