CommandDefinition.execute Method

Parent Object: CommandDefinition
Defined in namespace "adsk::core" and the header file is <Core/UserInterface/CommandDefinition.h>

Description

Executes this command definition. This is the same as the user clicking a button that is associated with this command definition.

Remarks

The execute method is not supported within any of the Command related events because it results in starting a new command which has the side-effect of terminating the current command, which is your running command.

Syntax

"commandDefinition_var" is a variable referencing a CommandDefinition object.
# Uses no optional arguments.
returnValue = commandDefinition_var.execute()

# Uses optional arguments.
returnValue = commandDefinition_var.execute(input)
"commandDefinition_var" is a variable referencing a CommandDefinition object.

#include <Core/UserInterface/CommandDefinition.h>

// Uses no optional arguments.
returnValue = commandDefinition_var->execute();

// Uses optional arguments.
returnValue = commandDefinition_var->execute(input);

Return Value

Type Description
boolean Returns true or false indicating if the execution was successful.

Parameters

Name Type Description
input NamedValues A list of named values that will provide input to the command. The values supported are unique for each command. and not all commands support input values.

This is an optional argument whose default value is null.

Samples

Name Description
Command Inputs API Sample

Creates a command dialog that demonstrates all of the available command inputs.

To use the sample, create a new Python or C++ script and copy and paste this code, replacing the default code. You also need to unpack this zip file which contains a resource folder into the same folder where the source code file (.py or .cpp) is.

Custom Event Sample Demonstrates the ability to call into the main thread from a worker thread. This sample is an add-in. To use it, use the Scripts and Add-Ins command to create a new add-in. Delete all of the code in the newly created add-in and replace it with the code below. Have a model open that has a parameter named "Length". Load the add-in. The add-in will change the value of the parameter every two seconds using a random value between 1 and 10.

Version

Introduced in version August 2014