X3DObject.FindChild2

Introduced

v9.0 (2011)

Description

Finds the first X3DObject child object of an X3DObject that matches a set of search criteria. The search is done recursively by default, the function returns the object that meet all supplied criteria i.e. name, type and family(ies). This function is typically used for retrieving an object if you know its type or name for instance.

This method differs from X3DObject.FindChild because this method will not return itself if its family matches the specified family. For example, calling 'cube.FindChild("", siMeshFamily)' will return the cube itself but this method will return null.

C# Syntax

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

Scripting Syntax

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

Return Value

X3DObject

Parameters

Parameter Type Description
Name String or CollectionItem A name expression or a CollectionItem, the expression can also contain wildcard characters. The name can be empty if the name is not required.
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.

Default Value: True

Examples

Python Example

#
# FindChild vs. FindChild2 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 "FindChild" to get the first child of the cube of "siMeshFamily" family;
# NOTE: FindChild also considers the parent object if it is of the same family
child = cube.FindChild("", "",const.siMeshFamily)
# FindChild returns the cube itself as its first child
Application.LogMessage("FindChild : " + child.Name)
# Use "FindChild2" to get the first child of the cube of "siMeshFamily" family;
# NOTE: FindChild2 always ignore the parent regardless of its family
child = cube.FindChild2("", "",const.siMeshFamily)
# FindChild2 returns the first child of the cube, none in this example
if not child:
	Application.LogMessage("FindChild2: <none>")
else:
	Application.LogMessage("FindChild2: " + child.Name)
# Expected results:
# INFO : FindChild : cube
# INFO : FindChild2: <none>