ViewCollection

Introduced

4.0

Description

A collection of View objects.

Methods

ViewCollection.Filter | ViewCollection.Find | ViewCollection.GetAsText

Properties

ViewCollection.Count | ViewCollection.Item

Examples

1. VBScript Example

    ' Log all views currently loaded in Softimage
    set views = Application.Desktop.ActiveLayout.Views

    for each view in views
       Application.LogMessage view.Name
    next

2. JScript Example

    /*
    This example demonstrates how to use the ViewCollection to find out
    information about the current views (both floating and part of the
    current layout)
    */
    NewScene( null, false );

    var oAllViews = Application.Desktop.ActiveLayout.Views
    LogMessage( "There are " + oAllViews.Count + " view windows" ) ;

    // ViewCollection.Filter is useful for quickly finding all views
    // of a particular type
    var oTextViews = oAllViews.Filter( "Text Editor" )
    LogMessage( "There are " + oTextViews.Count + " text editors" ) ;

    for ( var i=0; i<oTextViews.Count; i++ ) {
       strFileName = oTextViews(i).GetAttributeValue( "FileName" ) ;

       if ( strFileName != "" ) {
           LogMessage( "File being edited: " + strFileName );
       }
    }

    var oNetviewViews = oAllViews.Filter( "Netview" ) ;
    LogMessage( "There are " + oNetviewViews.Count + " Netview windows" ) ;

    for ( var i=0; i<oNetviewViews.Count; i++ ) {
       strUrl = oNetviewViews(i).GetAttributeValue( "url" ) ;

       if ( strUrl != "" ) {
           LogMessage( "Viewed webpages: " + strUrl );
       }
    }

    // Expected result:
    //INFO : There are 19 view windows
    //INFO : There are 0 text editors
    //INFO : There are 0 Netview windows

See Also

Layout.Views | View.Views

Autodesk Softimage v7.5