この 3d オブジェクトの各 ModelCollection を含む Model を戻します。
注:Python ではプロパティ上の入力パラメータがサポートされていないため、X3DObject.Models は失敗します。代わりに Python 互換バージョンの X3DObject.GetModels2 を使用してください。
// get accessor ModelCollection X3DObject.get_Models( Boolean in_bMode ); |
| パラメータ | タイプ | 説明 |
|---|---|---|
| Recursive | Boolean |
True の場合は、再帰的に検索します。False の場合は、直接の子について検索します。 デフォルト値: True |
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 |
Option Explicit main() 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) next end function ' Expected results: 'INFO : Mary |