X3DObjectCollection.Find

説明

タイプの基準に一致する、このコレクションの最初のメンバを戻します。項目が検出されなかった場合、このメソッドは"Nothing"を戻すので、エラーの捕捉に使用できます。

C#構文

X3DObject X3DObjectCollection.Find( String in_filter );

スクリプト構文

oReturn = X3DObjectCollection.Find( [Type] );

戻り値

X3DObject

パラメータ

パラメータ タイプ 説明
Type siType siType で定義されている検索対象オブジェクトのタイプ。タイプが必要ない場合は空の文字列になります。タイプには、特定の X3DObject タイプ(siModelType、si3DObjectType など)とプリミティブタイプ(siPolyMeshType、siSrfMeshPrimType など)があります。プリミティブタイプを指定した場合は、関数ではこのタイプのプリミティブが定義されている最初の子オブジェクトが戻されます。

指定可能な値:

説明:

siPolyMeshType Polygon Mesh タイプ
si3DObjectType 3D Object タイプ
siArcPrimType Implicit Arc Primitive タイプ
siAttractorCtrlType Attractor Control Object タイプ(電気力)
siCameraPrimType Camera Primitive タイプ
siCameraRootPrimType Camera Root primitive タイプ
siChainBonePrimType Chain Bone Primitive タイプ
siChainEffPrimType Chain End Effector Primitive タイプ
siChainRootPrimType Chain Root Primitive タイプ
siCirclePrimType Implicit Circle Primitive タイプ
siCloudPrimType Cloud Primitive タイプ
siConePrimType Cone Primitive タイプ
siCrvListAggregatePrimType NURBS Curve List Aggregate Primitive タイプ
siCrvListPrimType NURBS Curve List Primitive タイプ
siCubePrimType Cube Primitive タイプ
siCylinderPrimType Cylinder Primitive タイプ
siDiscPrimType Disc Primitive タイプ
siDodecahedronPrimType Dodecahedron Primitive タイプ
siDragCtrlPrimType Drag Control Primitive タイプ
siEddyCtrlPrimType Eddy Control Primitive タイプ
siFanType Fan Force Object タイプ
siFurPrimType Fur Primitive タイプ
siGeoShaderPrimType GeoShader Primitive タイプ
siGravityCtrlType Gravity Force Control Object タイプ
siGridPrimType Grid Primitive タイプ
siIcosahedronPrimType Icosahedron Primitive タイプ
siLatticePrimType Lattice Primitive タイプ
siLightPrimType Light Primitive タイプ
siModelNullPrimType Model Null Primitive タイプ
siModelType 3D Model タイプ
siNullPrimType Null Primitive タイプ
siOctahedronPrimType Octahedron Primitive タイプ
siSpherePrimType Sphere Primitive タイプ
siSpiralPrimType Implicit Spiral Primitive タイプ
siSpotInterestPrimType Spot Interest Primitive タイプ
siSpotRootPrimType Spot Root Primitive タイプ
siSquarePrimType Implicit Square Primitive タイプ
siSrfMeshPrimType NURBS Surface Mesh Primitive タイプ
siTetrahedronPrimType Tetrahedron Primitive タイプ
siTorusPrimType Torus Primitive タイプ
siTurbulenceCtrlPrimType Turbulence Control Primitive タイプ
siVolumeDeformType Volume Deform タイプ(インプリシット球のボリューム)
siVortexCtrlType Vortex Control Object タイプ(磁力)
siWaveCtrlType Wave Control Object タイプ
siWindType Wind Force Object タイプ

VBScript の例

'VBScript example

' Set up the example using a mesh grid, cube, cone, and a nurbs cube:

set oRoot = activesceneroot

oRoot.addgeometry "grid", "meshsurface"

oRoot.addgeometry "cube", "meshsurface"

oRoot.addgeometry "cone", "meshsurface"

oRoot.addgeometry "cube", "nurbssurface"

set oGeoms = oRoot.findchildren( ,,siGeometryFamily)

logmessage "The collection of geometry from the root is a " & typename( oGeoms ) 

logmessage "There are " & oGeoms.count & " geometry objects under the root." 

logmessage ""

for each item in oGeoms

	logmessage item.name & " is a " & item.type & " " & typename( item )

next

set oCone = oGeoms.find( "cone" )

set oCube = oGeoms.find( "cube" )

set oGrid = oGeoms.find( "grid" )

logmessage ""

logmessage "=========================================================================="

logmessage " Stats for the collection:"

logmessage " ------------------------"

logmessage "	Total number of objects in collection: " & oGeoms.count

logmessage "	Name of the first cone in the collection: " & oCone.name

logmessage "	Name of the first cube in the collection: " & oCube.name

' Try some error trapping ( if you are trying to use a find criteria that returns Nothing, 

' you will see this error message: 'ERROR : "Object required: 'oCube1'" )

set oCube1 = oGeoms.find( "cube1" )

if typename( oCube1 ) = "Nothing" then

	logmessage "	Can't get the name of the other cube in the collection."

else 

	logmessage "	Name of the other cube in the collection: " & oCube1.name

end if

logmessage "	Name of the first grid in the collection: " & oGrid.name

' Output of above script is:

'INFO : "The collection of geometry from the root is a X3DObjectCollection"

'INFO : "There are 4 geometry objects under the root."

'INFO : ""

'INFO : "grid is a polymsh X3DObject"

'INFO : "cube is a polymsh X3DObject"

'INFO : "cone is a polymsh X3DObject"

'INFO : "cube1 is a surfmsh X3DObject"

'INFO : ""

'INFO : "=========================================================================="

'INFO : " Stats for the collection:"

'INFO : " ------------------------"

'INFO : "	Total number of objects in collection: 4"

'INFO : "	Name of the first cone in the collection: cone"

'INFO : "	Name of the first cube in the collection: cube"

'INFO : "	Can't get the name of the other cube in the collection."

'INFO : "	Name of the first grid in the collection: grid"