NurbsCurveCollection.Navigate

導入

v3.0

詳細

関連付けられているジオメトリのNurbsCurveセグメント間を移動できます。このメソッドは、コレクション内のコンポーネントごとに対応するNurbsCurve を戻します。たとえば、5 つのカーブを持つNurbsCurveCollectionがあり、方向が siLastComponent に設定されている状態でこのメソッドを呼び出すと、元の NurbsCurveCollection のうち、最終ファセットの 5 つのカーブを含むコレクションが戻されます。

スクリプト 構文

oReturn = NurbsCurveCollection.Navigate( Navigation );

戻り値

NurbsCurveCollection

パラメータ

パラメータ タイプ 詳細
Navigation siNavigateComponentType 移動方向を選択します。

JScript の例

NewScene( "", false );
// Get a nurbs curve object
var obj = ActiveSceneRoot.AddGeometry( "Arc", "NurbsCurve" );
FreezeObj( obj );
var crvlist = obj.ActivePrimitive.Geometry;
var crv = crvlist.Curves(0);
// Get a complete data description of the arc
var VBdata = crv.Get2( siSiNurbs );                                     // returns a safearray
var data = VBdata.toArray();                                    // convert the safearray to a JS array
// For clarity, extract and store the data in separate variables
var crtlvertices = data[0];
var knots = data[1];
var isclosed = data[2];
var degree = data[3];
var parameterization = data[4];
// We want to make another 4 curves
for ( times=0; times<4; times++ ){
        // Translate every controlvertex of the new curve from 5 in x
        for ( var i=0; i<crtlvertices.length; i=i+3 ) {
                crtlvertices[i] = crtlvertices[i] + 5;
        }
        // Add a new nurbs curve using the modified data description
        crvlist.AddCurve( crtlvertices, knots, isclosed, degree, parameterization );
}
// Now get the collection of all nurbs curves in the list
var crvcoll = crvlist.Curves;
var firstcrvs = crvcoll.Navigate( siFirstComponent );
var fc = new Enumerator( firstcrvs ); var result = "";
for ( ; ! fc.atEnd(); fc.moveNext() ) {
        var crv = fc.item();
        result += crv.Index + "\t";
}
LogMessage( "The associated first curves are    \t" + result );
var lastcrvs = crvcoll.Navigate( siLastComponent );
var lc = new Enumerator( lastcrvs ); result = ""
for ( ; ! lc.atEnd(); lc.moveNext() ) {
        var crv = lc.item();
        result += crv.Index + "\t";
}
LogMessage( "The associated last curves are     \t" + result );
var nextcrvs = crvcoll.Navigate( siNextComponent );
var nc = new Enumerator( nextcrvs ); result = ""
for ( ; ! nc.atEnd(); nc.moveNext() ) {
        var crv = nc.item();
        result += crv.Index + "\t";
}
LogMessage( "The associated next curves are     \t" + result );
var prevcrvs = crvcoll.Navigate( siPreviousComponent );
var pc = new Enumerator( prevcrvs ); result = ""
for ( ; ! pc.atEnd(); pc.moveNext() ) {
        var crv = pc.item();
        result += crv.Index + "\t";
}
LogMessage( "The associated previous curves are \t" + result );
// Expected result:
//INFO : The associated first curves are        0       0       0       0       0       
//INFO : The associated last curves are         4       4       4       4       4       
//INFO : The associated next curves are         1       2       3       4       0       
//INFO : The associated previous curves are     4       0       1       2       3

関連項目

NurbsCurve.Navigate NurbsCurveList.Curves