Command.Execute

Description

Executes the underlying command. In the case of a new custom command, the command needs to be installed inside Softimage before this works, using XSIApplication.AddCommand. Use the Command.Arguments property to specify arguments for the command.

Note: If the command expects arguments and none is specified then it is invoked with the default arguments.

Scripting Syntax

oVariant = Command.Execute();

Return Value

A Variant containing the value returned from the command. If the command has no return value explicitly defined, Execute returns all output arguments in an Array object. However, if the command defines a return value, you cannot extract any output arguments from it. This is because the command is not returning an output argument array, but a specific value. You can check the Return Value section in the reference documentation to see whether it uses an explicit return value and what that value is.

Examples

1. VBScript Example

'
'       VBScript example
'
set cmd = Application.Commands("Duplicate/Instantiate Options")
cmd.Execute

2. Python Example

# This sample demonstrates how to execute commands with specific arguments and inspect the return values.
Application.CreatePrim("Grid", "MeshSurface", "", "")
# Note: The base commands for 'Quick Stretch', 'Bend' and 'Bevel' return the newly created operators in a list 
# so you have get the operator at position 0 in the list.
op = Application.Commands( "Quick Stretch" ).Execute()[0]
op2 = Application.Commands( "Bend" ).Execute()[0]
bevelCmd = Application.Commands( "Bevel" )
setarg = bevelCmd.Arguments("ConnectionSet")
setarg.Value = "grid.poly[52,53]"
op3 = bevelCmd.Execute()[0]
ops = [op, op2, op3]
Application.InspectObj( ops )
# History log
# Application.CreatePrim("Grid", "MeshSurface", "", "")
# Application.ApplyKinematicOp("QStretch", "grid", "")
# Application.ApplyOp("Bend", "grid", 3, "siPersistentOperation", "", 0)
# Application.ApplyTopoOp("BevelComponent", "grid.poly[52,53]", "siUnspecified", "siPersistentOperation", "")