v6.0
スクリプト名で特定された Softimage Command を実行します。このメソッドを使用すると、組み込みコマンドおよびカスタムコマンドを実行できます。このメソッドは XSIApplication.ExecuteScriptCommand に似ていますが、ExecuteScriptCommand,と違い、ISIVTCollection オブジェクトの出力引数をパックするのではなく、標準の Array の出力引数をパック化します。
Softimage コマンドは直接呼び出すことができるため、通常のスクリプトではこのメソッドは必要ありません。したがって、C#で記述されているアプリケーションで Softimage コマンドを呼び出せるようにすることが、このメソッドの主な用途になります。
Object XSIApplication.ExecuteCommand( String in_bzScriptName, Object in_vsa ); |
oVariant = XSIApplication.ExecuteCommand( Name, [Arguments] ); |
コマンドから戻された値を含む System.Object(C#の場合)または Variant(スクリプトの場合)。明示的に定義された戻り値がコマンドに存在しい場合、ExecuteCommand は Array オブジェクトのすべての出力引数を戻します。ただし、コマンドで戻り値を定義している場合は、戻り値から出力引数を抽出することはできません。これは、そのコマンドが出力引数の配列ではなく特定の値を戻すためです。「C#およびスクリプトリファレンス」の「戻り値」セクションでは、コマンドが明示的な戻り値を使用するかどうかや、その値が何であるかを調べることができます。
| パラメータ | タイプ | 説明 |
|---|---|---|
| Name | String | コマンドのスクリプト名 |
| Arguments | Variant の Array(スクリプトの場合)、System.Objects の配列(C#の場合)。 | 出力引数を含むすべての必要なコマンド引数の配列です。 |
//
// This example illustrates how to use Softimage commands from C#.
//
CXSIApplication xsi = new CXSIApplication();
try
{
// Create a cube to add the new property
Object[] args = new Object[4] { "Cube", "MeshSurface", null, null };
xsi.ExecuteCommand("CreatePrim", args);
// Add an Annotation property to the new cube
args = new Object[5] { "Annotation", null, null, "Annotation", null };
Array retVal = (Array)xsi.ExecuteCommand("SIAddProp", args);
// Inspect the Annotation Property
args = new Object[5];
args[0] = retVal;
xsi.ExecuteCommand("InspectObj", args);
}
catch (Exception e)
{
xsi.LogMessage("Exception raised: " + e.ToString(), siSeverity.siError);
} |