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

Go to the source code of this file.

Functions

CommonShapeCuttingScreenV02 ProcessToolPathMouseDownEvent ()
 Handle a left mouse button down event on the tool path display.
CommonShapeCuttingScreenV02 MoveToToolPathPosition ()
 Initiate the Move To Tool Path Position workflow.
CommonShapeCuttingScreenV02 ProcessMoveToTPPathPosition (mouse_pos)
 Process a tool path mouse click to move the machine to the selected path position.
CommonShapeCuttingScreenV02 MoveToToolPathStart ()
 Initiate the Move To Tool Path Start workflow.
CommonShapeCuttingScreenV02 ProcessMoveToTPPathStart (mouse_pos)
 Process a tool path mouse click to move the machine to the start of the nearest cut.
CommonShapeCuttingScreenV02 UpdateMoveToTPPositionBtn ()
 Update the visual state of the Move To Tool Path Position and Start buttons.
CommonShapeCuttingScreenV02 CutRecoveryBtn ()
 Handle the Cut Recovery button press from the screen.
CommonShapeCuttingScreenV02 CutRecovery (use_confirmation, mouse_pos)
 Execute a cut recovery operation with protected error handling.
CommonShapeCuttingScreenV02 RotatePoint (x, y, angle)
 Rotate a 2D point around the origin by a given angle.
CommonShapeCuttingScreenV02 PauseAfterCutToggle ()
 Toggle the Pause After Cut feature on or off.
CommonShapeCuttingScreenV02 IsPauseAfterCutEnabled ()
 Check whether the Pause After Cut feature is enabled.
CommonShapeCuttingScreenV02 OpenShapeLibrary ()
 Open the Shape Library browser dialog.
CommonShapeCuttingScreenV02 CommonShapeCuttingCreatePreCannedCommands ()
 Register pre-canned commands for common shape cutting screen functionality.

Function Documentation

◆ CommonShapeCuttingCreatePreCannedCommands()

CommonShapeCuttingScreenV02 CommonShapeCuttingCreatePreCannedCommands ( )

Register pre-canned commands for common shape cutting screen functionality.

Creates and registers a set of standard commands used by shape cutting screens (Jet, Plasma, etc.). Each command is registered with an action option, optional feedback option, and button labels. The following commands are registered:

  • "Move To Tool Path Position": Moves the machine to a selected tool path position
  • "Cut Recovery": Initiates a cut recovery operation
  • "Open Shape Library": Opens the shape library browser
  • "Pause After Cut": Toggles the pause-after-cut feature
    Note
    This function should be called during screen initialization to set up the command system
    Documentation generated by AI on 2026-03-03

◆ CutRecovery()

CommonShapeCuttingScreenV02 CutRecovery ( use_confirmation ,
mouse_pos  )

Execute a cut recovery operation with protected error handling.

Wraps the internal _CutRecovery function in a protected call via w.pcall() to catch any Lua errors that occur during the recovery process. If an error is raised, it is forwarded to w.FunctionError(). This is the safe public entry point for cut recovery.

Parameters
use_confirmation(boolean) If true (or not explicitly false), shows a Cycle Start confirmation dialog before moving. Pass false to skip confirmation.
mouse_pos(table|nil) Optional table containing machine and part coordinates from a tool path mouse click event. If nil, uses the current machine position.
See also
CommonShapeCuttingScreenV02._CutRecovery() for the underlying implementation
Note
Documentation generated by AI on 2026-03-03

◆ CutRecoveryBtn()

CommonShapeCuttingScreenV02 CutRecoveryBtn ( )

Handle the Cut Recovery button press from the screen.

Determines whether commands are being issued from operator panels using w.PretendCommandsAreFromOperatorPanels(), then invokes the cut recovery operation with the inverted result as the use_confirmation flag. When not pretending to be operator panel commands, confirmation will be requested from the user.

See also
CommonShapeCuttingScreenV02.CutRecovery() for the cut recovery implementation
Note
Documentation generated by AI on 2026-03-03

◆ IsPauseAfterCutEnabled()

CommonShapeCuttingScreenV02 IsPauseAfterCutEnabled ( )

Check whether the Pause After Cut feature is enabled.

Reads the "PauseAfterCutEnabled" OEM parameter and returns true if its value is "Yes".

Returns
(boolean) True if Pause After Cut is enabled, false otherwise
Note
Documentation generated by AI on 2026-03-03

◆ MoveToToolPathPosition()

CommonShapeCuttingScreenV02 MoveToToolPathPosition ( )

Initiate the Move To Tool Path Position workflow.

This is the first half of a two-step operation. When called:

  • If tool path mouse capture is already active, it stops capturing (acts as a cancel/toggle)
  • Otherwise, validates that the machine is Enabled and Idle, verifies homing status, confirms a G-code file is loaded, then activates MoveToTPPathPositionIsActive and begins capturing tool path mouse click events The second half of the workflow is handled by ProcessMoveToTPPathPosition() when the user clicks on the tool path display.
    Returns
    (nil) No meaningful return value on success
    (boolean) Success flag - false on validation error, true on normal exit
    (string) Status message from w.FunctionCompleted() or w.FunctionError()
    Warning
    Machine must be Enabled and in IDLE state before this function will activate capture
    See also
    CommonShapeCuttingScreenV02.ProcessMoveToTPPathPosition() for the second half of the workflow
    Note
    Documentation generated by AI on 2026-03-03

◆ MoveToToolPathStart()

CommonShapeCuttingScreenV02 MoveToToolPathStart ( )

Initiate the Move To Tool Path Start workflow.

This is the first half of a two-step operation. When called:

  • If tool path mouse capture is already active, it stops capturing (acts as a cancel/toggle)
  • Otherwise, validates that the machine is Enabled and Idle, verifies homing status, confirms a G-code file is loaded, then activates MoveToTPPathStartIsActive and begins capturing tool path mouse click events The second half of the workflow is handled by ProcessMoveToTPPathStart() when the user clicks on the tool path display.
    Returns
    (nil) No meaningful return value on success
    (boolean) Success flag - false on validation error, true on normal exit
    (string) Status message from w.FunctionCompleted() or w.FunctionError()
    Warning
    Machine must be Enabled and in IDLE state before this function will activate capture
    See also
    CommonShapeCuttingScreenV02.ProcessMoveToTPPathStart() for the second half of the workflow
    Note
    Documentation generated by AI on 2026-03-03

◆ OpenShapeLibrary()

CommonShapeCuttingScreenV02 OpenShapeLibrary ( )

Open the Shape Library browser dialog.

Unloads any cached version of the ShapeLibraryMain module before reloading it, ensuring the latest version is always used. Then launches the main shape browser UI.

Note
Documentation generated by AI on 2026-03-03

◆ PauseAfterCutToggle()

CommonShapeCuttingScreenV02 PauseAfterCutToggle ( )

Toggle the Pause After Cut feature on or off.

If Pause After Cut is currently enabled, disables it by setting the "PauseAfterCutEnabled" OEM parameter to "No". If it is currently disabled, enables it by setting the parameter to "Yes".

See also
CommonShapeCuttingScreenV02.IsPauseAfterCutEnabled() for the current state query
Note
Documentation generated by AI on 2026-03-03

◆ ProcessMoveToTPPathPosition()

CommonShapeCuttingScreenV02 ProcessMoveToTPPathPosition ( mouse_pos )

Process a tool path mouse click to move the machine to the selected path position.

This is the second half of the Move To Tool Path Position workflow, called after the user clicks on the tool path display. Validates that the mouse_pos argument is a table, then optionally shows a Cycle Start confirmation dialog. If confirmed (or confirmation is skipped), delegates to m.screen.CutRecovery() with the mouse position to perform the repositioning move.

Parameters
mouse_pos(table) Table with "machine" and "part" sub-tables indexed by axis constant, containing the machine and part coordinates of the mouse click on the tool path display
Returns
(nil) No meaningful return value on success
(boolean) True if operation was completed or cancelled normally
(string) Status message from w.FunctionCompleted()
See also
CommonShapeCuttingScreenV02.MoveToToolPathPosition() for the first half of the workflow
Note
Documentation generated by AI on 2026-03-03

◆ ProcessMoveToTPPathStart()

CommonShapeCuttingScreenV02 ProcessMoveToTPPathStart ( mouse_pos )

Process a tool path mouse click to move the machine to the start of the nearest cut.

This is the second half of the Move To Tool Path Start workflow, called after the user clicks on the tool path display. It performs the following steps:

  1. Validates that mouse positions are within software limits for all axes
  2. Finds the nearest G-code line on the cut path using mcCntlGetCutRecoveryGcodeLine
  3. Performs a dry run to that line (including M3/M4 spindle start flags)
  4. Waits for the dry run to complete
  5. Reads the dry run end position and current machine positions
  6. Reads the CutRecoveryRePositionAxisSelection OEM parameter to determine which axes to reposition
  7. Constructs a G-code move string (Z first if Z needs to move up, then XY)
  8. Shows a Cycle Start confirmation dialog
  9. Executes the MDI move and waits, then prompts to resume the file
    Parameters
    mouse_pos(table) Table with "machine" and "part" sub-tables indexed by axis constant, containing the machine and part coordinates of the mouse click on the tool path display
    Returns
    (nil) No meaningful return on success
    (boolean) Success flag - false on error conditions, true on normal completion
    (string) Status message from w.FunctionCompleted() or w.FunctionError()
    Warning
    This function performs machine motion and may start the spindle (M3/M4) during dry run
    Note
    Documentation generated by AI on 2026-03-03

◆ ProcessToolPathMouseDownEvent()

CommonShapeCuttingScreenV02 ProcessToolPathMouseDownEvent ( )

Handle a left mouse button down event on the tool path display.

This function is called when the user clicks on the tool path display during a Move To Position or Move To Start workflow. It performs the following steps:

  1. Retrieves the clicked position in machine coordinates via mcToolPathGetLeftMouseDn
  2. Validates that all axis positions are within software limits
  3. Calculates part-space coordinates by applying fixture offsets and tool length offsets
  4. Applies the current G-code rotation angle to the part-space XY position via RotatePoint()
  5. Stops capturing tool path mouse positions
  6. Dispatches to ProcessMoveToTPPathPosition or ProcessMoveToTPPathStart depending on which workflow flag (MoveToTPPathPositionIsActive / MoveToTPPathStartIsActive) is set If the clicked position is outside software limits on any axis, a warning message is shown and mouse capture is stopped without proceeding.
    Warning
    This function performs machine motion indirectly through CutRecovery or MoveToTPPathStart
    See also
    CommonShapeCuttingScreenV02.ProcessMoveToTPPathPosition() for the position workflow handler
    CommonShapeCuttingScreenV02.ProcessMoveToTPPathStart() for the start-of-cut workflow handler
    Note
    Documentation generated by AI on 2026-03-03

◆ RotatePoint()

CommonShapeCuttingScreenV02 RotatePoint ( x ,
y ,
angle  )

Rotate a 2D point around the origin by a given angle.

Rotates the point (x, y) around the origin (0, 0) by the specified number of degrees. The angle sign is automatically inverted before conversion to radians, so a positive input angle produces a clockwise rotation in standard screen coordinates.

Parameters
x(number) The X coordinate of the point to rotate
y(number) The Y coordinate of the point to rotate
angle(number) The rotation angle in degrees (sign is inverted internally)
Returns
(number) The new X coordinate after rotation
(number) The new Y coordinate after rotation
Note
Documentation generated by AI on 2026-03-03

◆ UpdateMoveToTPPositionBtn()

CommonShapeCuttingScreenV02 UpdateMoveToTPPositionBtn ( )

Update the visual state of the Move To Tool Path Position and Start buttons.

Sets the button color of "MoveToTPPositionBtn" to BTN_COLOR_ON when MoveToTPPathPositionIsActive is true and tool path mouse capture is active, otherwise sets it to BTN_COLOR_OFF. Applies the same logic to "MoveToTPStartBtn" using the MoveToTPPathStartIsActive flag. This function should be called on screen update cycles.

Note
Documentation generated by AI on 2026-03-03