X3DObject.FindChildren2
 
 
 

X3DObject.FindChildren2

Introduced

v9.0 (2011)

Description

Finds all X3DObject children of an X3DObject object that match a set of search criteria. By default the search is done recursively. The function returns all objects satisfying the following criteria: name, type and family(ies). This method is typically used for hierarchically navigating a scene of 3D objects.

To get the collection of all X3DObjects children under a given X3DObject, including those nested inside all Models and parented under X3DObjects, call this method with no arguments. For getting all X3DObject objects in a scene you may want to use FindObjects instead for better performance.

This method differs from X3DObject.FindChildren because this method will not return itself if its family matches the specified family. For example, calling 'cube.FindChildren("", "", si3DObjectFamily)' will return a collection containing the cube itself but this method will return an empty collection.

C# Syntax

X3DObjectCollection X3DObject.FindChildren2( Object in_varName, String in_pbstrType, Object in_famArray, Boolean in_bRecursive );

Scripting Syntax

oReturn = X3DObject.FindChildren2( [Name], [Type], [Family], [Recursive] );

Return Value

X3DObjectCollection

Parameters

Parameter Type Description
Name String or CollectionItem A name expression or a CollectionItem, the expression can also contain wildcard characters.
Type String The type of object defined by siType or an empty string if no type is used. The type can be a specific X3DObject type such as siModelType and si3DObjectType or a primitive type such as siPolyMeshType or siSrfMeshPrimType. If a primitive type is supplied, the function considers only the children objects defined with a primitive of this type. The valid types are listed below.

Possible Values:

Description:

si3DObjectType 3D Object type
siArcPrimType Implicit Arc Primitive type
siAttractorCtrlType Attractor Control Object type (electric force)
siCameraPrimType Camera Primitive type
siCameraRootPrimType Camera Root primitive type
siChainBonePrimType Chain Bone Primitive type
siChainEffPrimType Chain End Effector Primitive type
siChainRootPrimType Chain Root Primitive type
siCirclePrimType Implicit Circle Primitive type
siCloudPrimType Cloud Primitive type
siConePrimType Cone Primitive type
siCrvListAggregatePrimType NURBS Curve List Aggregate Primitive type
siCrvListPrimType NURBS Curve List Primitive type
siCubePrimType Cube Primitive type
siCylinderPrimType Cylinder Primitive type
siDiscPrimType Disc Primitive type
siDodecahedronPrimType Dodecahedron Primitive type
siDragCtrlPrimType Drag Control Primitive type
siEddyCtrlPrimType Eddy Control Primitive type
siFanType Fan Force Object type
siFurPrimType Fur Primitive type
siGeoShaderPrimType GeoShader Primitive Type
siGravityCtrlType Gravity Force Control Object type
siGridPrimType Grid Primitive type
siIcosahedronPrimType Icosahedron Primitive type
siLatticePrimType Lattice Primitive type
siLightPrimType Light Primitive type
siModelNullPrimType Model Null Primitive type
siModelType 3D Model type
siNullPrimType Null Primitive type
siOctahedronPrimType Octahedron Primitive type
siPolyMeshType Polygon Mesh type
siSpherePrimType Sphere Primitive type
siSpiralPrimType Implicit Spiral Primitive type
siSpotInterestPrimType Spot Interest Primitive type
siSpotRootPrimType Spot Root Primitive type
siSquarePrimType Implicit Square Primitive type
siSrfMeshPrimType NURBS Surface Mesh Primitive type
siTetrahedronPrimType Tetrahedron Primitive type
siTorusPrimType Torus Primitive type
siTurbulenceCtrlPrimType Turbulence Control Primitive type
siVolumeDeformType Volume Deform type (implicit sphere volume)
siVortexCtrlType Vortex Control Object type (magnetic force)
siWaveCtrlType Wave Control Object type
siWindType Wind Force Object type
Family siFamily or Array of siFamily elements. An array of families defined by siFamily or an empty array if none are required. The families are used for narrowing down the search, the array can contain X3DObject families like si3DObjectFamily or primitive families such as siNurbsSurfaceMeshFamily or siNullPrimitiveFamily. Only the children objects that match the supplied families are considered. If primitive families are supplied then only the objects defined with a primitive that belongs to one of them are considered. The valid families are listed below.

Possible Values:

Description:

si3DObjectFamily 3D Object family
siCameraFamily Camera family
siChainElementFamily Chain Element family
siControlObjectFamily Control Object family
siCurveFamily Curve Geometry family
siGeometryFamily Geometry family
siGeometryShaderFamily Geometry shader family
siImplicitGeometryFamily Implicit Geometry family
siLatticeFamily Lattice family
siLightPrimitiveFamily Light Primitive family
siMeshFamily Mesh Geometry family
siNullPrimitiveFamily Null Primitive family
siNurbsCurveListFamily Nurbs CurveList Geometry family
siNurbsSurfaceMeshFamily Nurbs Surface Mesh Geometry family
siSurfaceCurveFamily Surface Curve Geometry family
siSurfaceFamily Surface Geometry family
Recursive Boolean Recurse if True, otherwise the search is done on the immediate children. This recursion will include the contents of any X3DObjects found nested underneath the object.

Default Value: True

Examples

Python Example

#
# FindChildren vs. FindChildren2 Python Example
#
from win32com.client import constants as const
Application.NewScene("", False)
# Create a cube
Application.CreatePrim("Cube", "MeshSurface", "cube", "")
root = Application.ActiveSceneRoot
cube = root.FindChild("cube")
# Use "FindChildren" to get the "si3DObjectFamily" children of the cube
# NOTE: FindChildren includes the parent if it is of the same family
children = cube.FindChildren("", "", const.si3DObjectFamily, True)
# The count will be one even if the cube has no children, because the
# cube family is of si3DObjectFamily
Application.LogMessage( "FindChildren  count: " + str(children.Count))
# Use "FindChildren2" to get the "si3DObjectFamily" children of the cube
# NOTE: FindChildren2 always ignore the parent regarless of its family
children = cube.FindChildren2("", "", const.si3DObjectFamily, True)
# The count will be zero because the cube has no children
Application.LogMessage( "FindChildren2 count: " + str(children.Count))
# Expected Results:
# INFO : FindChildren  count: 1
# INFO : FindChildren2 count: 0

See Also

X3DObject.Children X3DObject.FindChild X3DObject.FindChild2 EnumElements