Applies To
FindObjects command
Description
This example demonstrates how to use the FindObjects command.
Code
/* Demonstrates how to use FindObjects to get all models */ NewScene( null, false ) ; var oModel = ActiveSceneRoot.AddModel(null, "MyModel" ) ; var oNestedModel = oModel.AddModel(null, "Nested1" ) ; var oNestedModel = oModel.AddModel(null, "Nested2" ) ; var oNotAModel = oModel.AddNull() ; // Won't be found var classIDOfModels = XSIUtils.DataRepository.GetIdentifier( oModel, siObjectCLSID ) ; var oColl = FindObjects( null, classIDOfModels ) ; Application.LogMessage( "FindObjects found " + oColl.GetAsText() ) ; // An alternative way to find models is with the Model property var oModelsUnderSceneRootModel = ActiveSceneRoot.Models ; for ( var i = 0 ; i < oModelsUnderSceneRootModel.count ; i++ ) { Application.LogMessage( oModelsUnderSceneRootModel.Item( i ) ) ; } //Expected results: // //INFO : FindObjects found MyModel,Nested1,Nested2,Scene_Root //INFO : MyModel //INFO : Nested1 //INFO : Nested2
Related Examples
Keywords
FindObjects
Autodesk Softimage 2011