ユーザー オペランド

ZOSAPI ベースのユーザー オペランドを使用する場合、"Prog#" が 0 であれば計算を実行し、それ以外の値であれば、結果のベクトルから指定した値を取得します。

double Hx = TheApplication.OperandArgument1;    //  Hx
double Hy = TheApplication.OperandArgument2;    //  Hy
double Px = TheApplication.OperandArgument3;    //  Px
double Py = TheApplication.OperandArgument4;    //  Py
int dataLength = TheApplication.OperandResults.Length;
double[] results = new double[dataLength];
for (int i = 0; i < results.Length; ++i)
{
    double x = i;
    double x2 = x * x;
    double x3 = x * x * x;
 
    results[i] = Hx * x3 + Hy * x2 + Px * x + Py;
}
//
//  Now assign the locally calculated resule back to the Application.
//
TheApplication.OperandResults.Data = results;

注 : インターフェイスは任意の大規模なベクトルを許容しますが、OpticStudio が保存してアクセスできるのは、最初の 100 個の値のみです。

次へ :