Other Functions

Last modified by writer on 2023/09/08 18:37

void FloodEnable()

Turn on the flood coolant.

void FloodDisable()

Turn off the flood coolant.

void MistEnable()

Turn on spray coolant.

void MistDisable()

Turn off the spray coolant.

void Sleep(number milliseconds)

Waiting for the specified number of milliseconds.

Options:

  • number milliseconds – the number of milliseconds during which the macro will pause.
void DisplayMessage(string message)

Displays a macro message in the user interface.

Options:

  • string message – the text of the message that should be shown to the user.
void Stop()

Stopping G code execution. Immediately after calling this function, it is recommended to exit the macro using the “return” operator.

void EStop()

Switching to Estop mode. Immediately after calling this function, it is recommended to exit the macro using the “return” operator.

number GetUserVariable(number index)

Getting the value of a user variable.

Options:

  • number index – the number of the variable, an integer from 0 to 99.

Return value:

  • current value of the user variable (real number).
void SetUserVariable(number index, number value)

Setting the value of a user variable. This value can be read when another macro is executed, including after restarting PUMOTIX.

Options:

  • number index – variable number, integer from 0 to 99;
  • number value – the value of the user variable (real number) that must be set.
string str(number value)

Convert a real number to a string.

The Lua language supports implicit conversion of a number into a string, but by default for a very small real number the conversion result can have an exponential format, which does not allow using the string as part of a G-code string. For convenience, you can use the str function, which ensures that the number has a decimal representation.

Options:

  • number value – a real number to be converted.

Return value:

  • string representation of a given number.
void ExecuteMDI(string command)

Execution of a given line of G-code. The function returns control only after the command specified in the G-code line is executed and the movement caused by this command is completed. Thus, several calls to the ExecuteMDI function can be made sequentially without additional synchronization.

Options:

  • string command – the G-code string to be executed.
string GetMessage(number value)

Get the string representation of a message.

Options:

  • number value – message identifier (one of the constants defined in the Messages list must be passed as this parameter).

Return value:

  • message text.

Example: DisplayMessage(GetMessage(Messages.ProbeActive))

double GetAnalogInput(number index)

Get the value of an analog input (from 0 to 1) as a real number.

Options:

  • number index – analog input number (starting from 0).

Return value:

  • analog input value (from 0 to 1).
number GetExecutingMCode()

Returns the number of the running macro. Returns -1 if the macro is not running.

Return value:

  • macro number.
bool GetLedUserValue(number index)

Getting the value of a user variable.

Options:

  • number index – variable namber, an integer from 0 to 29.

Return value:

  • bool – user variable value.
void SetLedUserValue(number index, bool a_value)

Setting the value of a user variable. This value can be read when executing another macro including after restarting PUMOTIX.

Options:

  • number index – variable number, an integer from 0 to 29;
  • bool a_value – user variable value.
number GetNumUserValue(number index)

Getting the value of a user variable.

Options:

  • number index – variable namber, an integer from 0 to 29.

Return value:

  • number – user variable value.
void SetNumUserValue(number index, number value)

Setting the value of a user variable. This value can be read when executing another macro including after restarting PUMOTIX.

Options:

  • number index – variable number, an integer from 0 to 29;
  • number value – the value of the user variable (real number) to be set.
string GetStrUserValue(number index)

Getting the value of a user variable.

Options:

  • number index – variable number, an integer from 0 to 29.

Return value:

  • string – user variable value.
void SetStrUserValue(number index, string value)

Setting the value of a user variable. This value can be read when executing another macro including after restarting PUMOTIX.

Options:

  • number index – variable number, an integer from 0 to 29;
  • string value – the value of the user variable (string) to be set.
bool IsGCodeRunning()

Allows you to check if the PUMOTIX is in G-code execution mode.

Return value:

  • true – if PUMOTIX is in G-code execution mode.
bool IsMDIRunning()

Allows you to check if the PUMOTIX is in manual command execution mode.

Return value:

  • true – if the PUMOTIX is in manual command execution mode.
number GetGantryAlignmentRectLengthX()

Gets the distance along X specified in the gantry alignment settings.

Return value:

  • distance along X, mm.
number GetGantryAlignmentRectLengthY()

Gets the distance along Y specified in the gantry alignment settings.

Return value:

  • distance along Y, mm.
number GetGantryAlignmentTotalLength()

Gets the width of the portal specified in the gantry alignment settings.

Return value:

  • gantry width, mm.
number GetGantryAlignmentAxis()

Gets the portal axis specified in the gantry alignment settings.

Return value:

  • axis number, an integer from 0 to 1 (one of the constants defined in the Axes list).
void WeldOscillatorEnable()

Turn on the oscillator.

void WeldOscillatorDisable()

Turn off the oscillator.

Messages:
  • ProbeActive;
  • ProbeNotConfigured.