NurbsCurveCollection.Navigate

Introduced

v3.0

Description

Allows you to navigate through the NurbsCurves of the associated geometry. This method returns one NurbsCurve for each corresponding component in the collection. For example, if you have a NurbsCurveCollection containing 5 curves and you call this method with the direction set to siLastComponent, the returned collection will contain 5 instances of the last curve in the original NurbsCurveCollection.

C# Syntax

NurbsCurveCollection NurbsCurveCollection.Navigate( siNavigateComponentType in_siNavigate );

Scripting Syntax

oReturn = NurbsCurveCollection.Navigate( Navigation );

Return Value

NurbsCurveCollection

Parameters

Parameter Type Description
Navigation siNavigateComponentType Select the direction of navigation.

Examples

JScript Example

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

See Also

NurbsCurve.Navigate NurbsCurveList.Curves