cmd_exec()

Executes a command by either its ID or name. Optionally, additional parameters can be passed depending on the command requirements.

Syntax

Execute a command by ID or name, optionally with up to three parameters

cmd_exec(command)
cmd_exec(command, parameter)
cmd_exec(command, int_value, double_value)
cmd_exec(command, int_value, double_value1, double_value2)

Parameters

Parameter Type Description
command_id Number The ID of the command to execute.
command_name String The name of the command to execute.
parameter Number A single numeric parameter. optional
int_value Number An integer value. optional
double_value Number A numeric value. optional
double_value1, double_value2 Number Additional numeric values for extended command arguments. optional
string_argument String A string parameter for the command. optional

Return Value

Examples

Open “File Open” dialog.

cmd_exec("File.Open_...");
id = cmd_get_id("File.Open_...");
cmd_exec(id);

Open G-code for small square.

cmd_exec("File.Open_Code", "G00 X0 Y0\nG01 X30\nG01 Y30\nG01 X0\nG01 Y0");

Set jogging speed to 100.

cmd_exec("Jog.Jog_Speed.Set", 100.0/60);

Turn output pin 3 on.

cmd_exec("Machine.Output", 3, 1);

Set output pin 6 to PWM to duty cycle 25% at frequency 10kHz.

cmd_exec("Machine.Output_PWM", 6, 25, 10000);

Set spindle override value to 120%.

cmd_exec("Machine.Override.Spindle.Reset", 1.2)

Set feed override value to 80%.

cmd_exec("Machine.Override.Feed.Reset", 0.8)

See also

cmd_list
cmd_count

cmd_get_id
cmd_get_name
cmd_get_displayname

cmd_is_enabled
cmd_is_checked

cmd_exec