Returns a ModelCollection containing each Model under this 3D object.

Note: Since Python does not support input parameters on properties, X3DObject.Models will fail in Python. Use the Python-compliant version X3DObject.GetModels2 instead.

C# Syntax

// get accessor
ModelCollection X3DObject.get_Models( Boolean in_bMode );


Parameter Type Description
Recursive Boolean Recurse if True, otherwise the search is done on the immediate children.

Default Value: True


1. JScript Example

main() ;
function main()
        NewScene( null, false );
        var oRoot = Application.ActiveSceneRoot;
        // Stick all the x3dobjects in the current scene into a model
        var oModel = oRoot.AddModel( oRoot.Children, "TopModel" );
        // Create two models, each of which contain a Null and nest them inside the TopModel.
        oNull = oRoot.AddNull( "mynull");
        oModel.AddModel( oNull, "SubModel" );
        oNull2 = oRoot.AddNull( "mynull" );
        oModel.AddModel( oNull2, "AnotherSubModel" );
        WriteModels( oRoot ) ;
function  WriteModels( in_obj )
        var mdls = in_obj.Models;
        n = mdls.Count;
        for ( var i=0; i<n; i++ ) {
                m = mdls.Item(i);
                Application.LogMessage( "Model " + m.Name + " is nested inside " + m.model ) ;
// Expected results:
//INFO : Model TopModel is nested inside Scene_Root
//INFO : Model SubModel is nested inside TopModel
//INFO : Model AnotherSubModel is nested inside TopModel

2. VBScript Example

Option Explicit
sub main()
        NewScene , false
        dim oRoot
        set oRoot = Application.ActiveProject.ActiveScene.Root
        oRoot.AddModel oRoot.Children, "Mary"
        WriteModels oRoot
end sub
' Recursive function to read all models no matter how deeply nested
function WriteModels( in_obj )
        dim list, n, i, mdls
        set mdls = in_obj.Models(0)
        n = mdls.Count
        if n = 0 then
                exit function
        end if
        for i=0 to n-1
                Application.LogMessage mdls(i).Name
                ' Drill down
                WriteModels mdls(i)
end function
' Expected results:
'INFO : Mary

See Also