Children (X3DObject)
Description
Returns an X3DObjectCollection containing all X3DObject children parented under the object. No recursive search is performed, in other words only direct children are returned, not children of children.
C# Syntax
// get accessor X3DObjectCollection rtn = X3DObject.Children;
Examples
1. VBScript Example
set oRoot = Application.ActiveProject.ActiveScene.Root oRoot.AddGeometry "Sphere", "MeshSurface" oRoot.AddNull for each oChild in oRoot.Children Application.LogMessage oChild.Name & ", " & oChild.Type next ' Expected results: 'INFO : Camera_Root, CameraRoot 'INFO : light, light 'INFO : sphere, polymsh 'INFO : null, null
2. JScript Example
/* Compare this example with the similar example for X3DObject.FindChildren */ // Create a sample scene NewScene( null, false ) ; var oRoot = Application.ActiveSceneRoot; var oNull = oRoot.AddNull( "MyNull" ) ; var oSphere = oRoot.AddGeometry( "Sphere", "MeshSurface", "MySphere" ) ; var oNestedSphere = oNull.AddNull( "NestedNull" ) ; var oConeInModel = oRoot.AddGeometry( "Cone", "NurbsSurface", "ConeInMdl" ) ; var oModel = oRoot.AddModel(oConeInModel, "MyModel") ; // The X3DObject.Children collection returns all X3DObjects // but it is not recursive. PrintChildren( "Children of SceneRoot:", oRoot.Children ) ; PrintChildren( "Children of Null:", oNull.Children ) ; PrintChildren( "Children of Model:", oModel.Children ) ; // Expected result: //INFO : Children of SceneRoot: //INFO : Camera_Root //INFO : light //INFO : MyNull //INFO : MySphere //INFO : MyModel //INFO : ---------------------------- //INFO : Children of Null: //INFO : NestedNull //INFO : ---------------------------- //INFO : Children of Model: //INFO : MyModel.ConeInMdl //INFO : ---------------------------- // Helper function showing the contents of a collection function PrintChildren( in_msg, in_oChildren ) { Application.LogMessage( in_msg ) ; for ( var i=0 ; i<in_oChildren.Count; i++ ) { Application.LogMessage( "\t" + in_oChildren.Item(i).FullName ) ; } Application.LogMessage( "----------------------------" ) ; }
See Also
Autodesk Softimage v7.5