## SampleCollection.Navigate

### Introduced

v3.0

### Description

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

### C# Syntax

    SampleCollection SampleCollection.Navigate( siNavigateComponentType in_siNavigate );

### Scripting Syntax

    oReturn = SampleCollection.Navigate( Navigation );

### Return Value

SampleCollection

### Parameters

Parameter | Type | Description
--- | --- | ---
Navigation | siNavigateComponentType | Select the direction of navigation.

### Examples

#### JScript Example

    var obj = ActiveSceneRoot.AddGeometry( "Cube", "MeshSurface" );
    var samplelist = obj.ActivePrimitive.Geometry.Facets(2).Samples;
    var results = "";
    var fs = new Enumerator( samplelist.Navigate(siFirstComponent) );
    for ( ; ! fs.atEnd(); fs.moveNext() ) {
            var firstsample = fs.item();
            results += firstsample.Index + " ";
    }
    LogMessage( "The associated first samples are " + results );
    results = "";
    var ls = new Enumerator( samplelist.Navigate(siLastComponent) );
    for ( ; ! ls.atEnd(); ls.moveNext() ) {
            var lastsample = ls.item();
            results += lastsample.Index + " ";
    }
    LogMessage( "The associated last samples are " + results );
    results = "";
    var ns = new Enumerator( samplelist.Navigate(siNextComponent) );
    for ( ; ! ns.atEnd(); ns.moveNext() ) {
            var nextsample = ns.item();
            results += nextsample.Index + " ";
    }
    LogMessage( "The associated next samples are " + results );
    results = "";
    var ps = new Enumerator( samplelist.Navigate(siPreviousComponent) );
    for ( ; ! ps.atEnd(); ps.moveNext() ) {
            var prevsample = ps.item();
            results += prevsample.Index + " ";
    }
    LogMessage( "The associated previous samples are " + results );
    // Expected results:
    //INFO : The associated first samples are 0 0 0 0
    //INFO : The associated last samples are 23 23 23 23
    //INFO : The associated next samples are 9 10 11 12
    //INFO : The associated previous samples are 7 8 9 10

### See Also

Sample.Navigate Geometry.Samples