ジャンプ先: 概要. 戻り値. MEL 例.

概要

string[] executeForEachObject( string $inThisList[], string $thisCmd )

このプロシージャは、オブジェクト名のリストを取得して、「thisCmd」のコマンドを各オブジェクトに適用します。オブジェクト名は、このコマンドでは %s で置き換えられます。

戻り値

このコマンドを適用可能な各オブジェクトに対して実行した結果の名前をすべて含む文字配列。

引数

変数名 変数タイプ 説明
$inThisListstring[]- 操作するオブジェクト名のリストです。
$thisCmdstring- %s を含む文字列です。

MEL 例

  // Example 1. if "thisCmd" is a string that looks like:

          string $thisCmd = "reverseCommand -ch off -rpo on %s";
  // and curve1 and curve2 are in the given list, then the commands 

  // that will be executed for each object will look like:

          reverseCommand -ch off -rpo on curve1;
          reverseCommand -ch off -rpo on curve2;

  // Example 2.  if "thisCmd" is a string that looks like:

          string $thisCmd = "reverseProc( true, false, %s )";
  // and curve1 and curve2 are in the given list, then the commands 

  // that will be executed for each object will look like:

          reverseProc( true, false, "curve1" );
          reverseProc( true, false, "curve2" );

  // Example 3.

          cone; sphere; select -all;
          string $cmd = "duplicate %s";
          string $itemList[] = `ls -sl`;
          select -d;
          string $results[] = executeForEachObject($itemList, $cmd);