Command.Execute

説明

指定されたコマンドを実行します。新しいカスタムコマンドの場合は、実行させる前に、XSIApplication.AddCommandを使用して Softimage 内にインストールしておく必要があります。コマンドに引数を指定するにはCommand.Argumentsプロパティを使用します。

注:引数を取るコマンドで、引数が指定されていない場合にはデフォルトの引数で起動されます。

スクリプト 構文

oVariant = Command.Execute();

戻り値

コマンドから戻される値を含むVariantが戻されます。明示的に定義された戻り値がコマンドに存在しい場合、Execute はArrayオブジェクトのすべての出力引数を戻します。ただし、コマンドで戻り値を定義している場合は、戻り値から出力引数を抽出することはできません。これは、そのコマンドが出力引数の配列ではなく特定の値を戻すためです。「C#およびスクリプトリファレンス」の「戻り値」セクションでは、コマンドが明示的な戻り値を使用するかどうかや、その値が何であるかを調べることができます。

1. VBScript の例

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

2. Python の例

# 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", "")