' 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 ""
' Use error trapping ( if you get an empty collection, you will
' see this error message: 'ERROR : "Object required: 'oCube1'" )
if typename( oGeoms ) = "Nothing" then
logmessage "Collection is empty"
else
logmessage "Collection has " & oGeoms.count & " member(s)."
for i = 0 to oGeoms.count - 1
set oGeomItem = oGeoms.item(i)
logmessage oGeomItem.name & " is a " & oGeomItem.type & " " & typename( oGeomItem )
set oGeomItem = Nothing
next
end if
' 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 : "Collection has 4 member(s)."
'INFO : "grid is a polymsh X3DObject"
'INFO : "cube is a polymsh X3DObject"
'INFO : "cone is a polymsh X3DObject"
'INFO : "cube1 is a surfmsh X3DObject"
|