|
Mach Modules Documentation
Lua Module API Documentation
|
Go to the source code of this file.
Functions | |
| GearShaperScreenV02 | MachineScreenStartupScript () |
| Initialize the Gear Shaper screen on startup. | |
| GearShaperScreenV02 | MachineScreenPLCScript () |
| PLC-rate callback that executes core Gear Shaper screen update tasks. | |
| GearShaperScreenV02 | MachineScreenLowPriorityLoop () |
| PLC-rate screen update loop for the Gear Shaper screen. | |
| GearShaperScreenV02 | MachineScreenLoadScript () |
| Initialize screen objects and register commands when the Gear Shaper screen is loaded. | |
| GearShaperScreenV02 | CompensateXAxis () |
| Apply an X-axis tool length compensation adjustment from the CompXAxisDRO input field. | |
| GearShaperScreenV02 | GoToLoadPosition () |
| Move the machine to the configured Z load position. | |
| GearShaperScreenV02 | CheckEndOfProgram () |
| Detect end-of-program condition and record the cycle time to the machine profile. | |
| GearShaperScreenV02 | UpdateCycleProgresBar () |
| Update the cycle progress bar gauge based on elapsed versus last known cycle time. | |
| GearShaperScreenV02 | UpdateCurrentTime () |
| Update the current date and time display label on the Gear Shaper screen. | |
| GearShaperScreenV02 | EnableCutSections () |
| Show or hide cut data panels based on the configured number of cuts per piece. | |
| GearShaperScreenV02 | ResetTotalAxisComp (AxisID) |
| Reset the total compensation accumulator for a specific axis to zero. | |
| GearShaperScreenV02 | ResetTotalComp () |
| Reset the global total compensation accumulator to zero. | |
| GearShaperScreenV02 | CheckCompAmount (Amount) |
| Validate that a compensation amount does not exceed the configured maximum increment. | |
| GearShaperScreenV02 | Comp (AxisID, Direction, AmountName, Type) |
| Apply a compensation offset to a specified axis using fixture or tool offsets. | |
| GearShaperScreenV02 | MachineCreatePreCannedCommands () |
| Register all pre-canned compensation and reset commands for the Gear Shaper screen. | |
| GearShaperScreenV02 CheckCompAmount | ( | Amount | ) |
Validate that a compensation amount does not exceed the configured maximum increment.
Reads the 'MaxCompIncrement' OEM parameter and compares it against the absolute value of the provided amount. If the amount exceeds the maximum, a warning dialog is displayed via m.SetWarningMessage() and an error is returned. Otherwise, the original amount is returned unchanged.
| Amount | (number) The compensation amount to validate |
| GearShaperScreenV02 CheckEndOfProgram | ( | ) |
Detect end-of-program condition and record the cycle time to the machine profile.
Reads the 'EndOfProgram' OEM register. If it equals 1, the function clears the register back to 0, reads the current program run time via mc.mcCntlGetRunTime(), and writes that value to the MachMotion profile as 'LastProgramCycleTime' for use by the cycle progress bar. It also sets the 'CycleProgressBarGauge' to 100% to indicate program completion.
| GearShaperScreenV02 Comp | ( | AxisID | , |
| Direction | , | ||
| AmountName | , | ||
| Type | ) |
Apply a compensation offset to a specified axis using fixture or tool offsets.
Applies a coarse or fine compensation amount to the specified axis in the given direction. Supports four compensation types:
| AxisID | (number) The axis index to compensate (mc.X_AXIS through mc.MC_MAX_COORD_AXES) |
| Direction | (number) Compensation direction: 1 for positive, -1 for negative (defaults to 1 if invalid) |
| AmountName | (string) The compensation step size: "Coarse" or "Fine" |
| Type | (number) Compensation type: 1 (fixture offset), 2 (fixture offset + move), 3 (tool offset), 4 (tool offset + move) |
| GearShaperScreenV02 CompensateXAxis | ( | ) |
Apply an X-axis tool length compensation adjustment from the CompXAxisDRO input field.
Reads the value from the 'CompXAxisDRO' screen object, divides it by 2, and adds it to the current tool's height offset (MTOOL_MILL_HEIGHT) using the active tool number from pound variable SV_CUR_LENGTH_INDEX. Calls m.SetToolLengthDRO() to apply the updated offset, then resets the 'CompXAxisDRO' field to "0".
| GearShaperScreenV02 EnableCutSections | ( | ) |
Show or hide cut data panels based on the configured number of cuts per piece.
Reads pound variable #511 (CutsPerPiece) to determine how many cut sections should be visible. Panels named 'CutData0Panel' through 'CutData<count-1>Panel' are shown (Hidden = 0), and panels from index cut_count through 9 are hidden (Hidden = 1). Each visibility change is logged via w.Log(). Only panels that exist (verified with h.IsObject()) are modified.
| GearShaperScreenV02 GoToLoadPosition | ( | ) |
Move the machine to the configured Z load position.
Reads the unit mode (Imperial or Metric) from pound variable #614 and the Z load position from pound variable #514. Converts the load position from its stored units to the current machine units (dividing by 25.4 if Imperial mode is active). Issues an MDI command "M19 G90 G00 Z<pos>" to orient the spindle and move to the load position.
| GearShaperScreenV02 MachineCreatePreCannedCommands | ( | ) |
Register all pre-canned compensation and reset commands for the Gear Shaper screen.
Iterates over all enabled axes and registers coarse/fine compensation commands for both fixture offsets (Types 1/2) and tool offsets (Types 3/4), in both positive and negative directions. For each enabled axis, eight compensation commands are created (Fixture Coarse In/Out, Fixture Fine In/Out, Tool Coarse In/Out, Tool Fine In/Out). Additionally, per-axis total comp reset commands and a global total comp reset command are registered. All commands are created via w.CreateCommandActionOption(), w.CreateSimpleCommand(), and w.SetCommandButtonLabels().
| GearShaperScreenV02 MachineScreenLoadScript | ( | ) |
Initialize screen objects and register commands when the Gear Shaper screen is loaded.
Creates a new job file (m.JobFile) associated with the current screen, configured to manage pound variables in the range 502, 506, 508, 510-516, and 520-589, with overwrite enabled and notes shown on open. Resets the 'CycleProgressBarGauge' to 0. Initializes enabled axes via m.InitializeEnabledAxes(1902). Registers the MachineCreatePreCannedCommands function with the CommandRegistrar so compensation commands are available.
| GearShaperScreenV02 MachineScreenLowPriorityLoop | ( | ) |
PLC-rate screen update loop for the Gear Shaper screen.
Called at PLC cycle rate. Updates the 'CutsLeftText' label to display the currently running cut data index. When the machine is not in FRUN or FRUN_FH state, the label is cleared to a blank space. During program execution, reads CutsLeft (#600) and CutsPerPiece (#511) from pound variables, clamps CutsLeft to CutsPerPiece if it exceeds it, and formats the label as "Currently Running 'Cut Data <N>'".
| GearShaperScreenV02 MachineScreenPLCScript | ( | ) |
PLC-rate callback that executes core Gear Shaper screen update tasks.
Called at PLC cycle rate. Invokes end-of-program detection, cycle progress bar update, and current time display update in sequence by calling CheckEndOfProgram(), UpdateCycleProgresBar(), and UpdateCurrentTime().
| GearShaperScreenV02 MachineScreenStartupScript | ( | ) |
Initialize the Gear Shaper screen on startup.
Sets the machine type name label on the screen to the localized string "Mach Gear Shaper" using m.screen.SetMachineTypeNameLabel().
| GearShaperScreenV02 ResetTotalAxisComp | ( | AxisID | ) |
Reset the total compensation accumulator for a specific axis to zero.
Sets the OEM parameter 'TotalCompAmount_<AxisLetter>' to zero for the specified axis, clearing the running total of compensation adjustments applied to that axis. The axis letter is resolved from AXIS_LETTER_ARRAY_0 using the provided AxisID.
| AxisID | (number) The axis index whose total compensation should be reset (mc.X_AXIS through mc.MC_MAX_COORD_AXES) |
| GearShaperScreenV02 ResetTotalComp | ( | ) |
Reset the global total compensation accumulator to zero.
Sets the OEM parameter 'TotalCompAmount' to zero, clearing the running total of all compensation adjustments that have been applied across all axes.
| GearShaperScreenV02 UpdateCurrentTime | ( | ) |
Update the current date and time display label on the Gear Shaper screen.
Reads the current system time formatted as "DayOfWeek, Month Day, HH:MM:SS" using os.date() and sets the "CurrentTimeText" screen object label to this value.
| GearShaperScreenV02 UpdateCycleProgresBar | ( | ) |
Update the cycle progress bar gauge based on elapsed versus last known cycle time.
Only updates the progress bar when the machine is in the FRUN (program running) state. Reads the current run time via mc.mcCntlGetRunTime() and the last recorded program cycle time from the MachMotion profile ('LastProgramCycleTime'). If a valid prior cycle time exists (> 0), calculates the percentage completion and updates the 'CycleProgressBarGauge' screen object. The percentage is formatted to one decimal place.