ClusterElementCollection.ItemsByIndex.1.vbs Example
Applies To
Description
This example shows how to use ItemsByIndex on a Cluster
Code
dim oRoot, oGrid, oCluster, aValues, iElement
set oRoot = Application.ActiveProject.ActiveScene.Root
set oGrid = oRoot.AddGeometry("Grid","MeshSurface")
set oCluster = oGrid.ActivePrimitive.Geometry.AddCluster( _
siPolygonCluster, "PolygonClusterOnGrid", _
array(59,60,61))
'Ask for items 0,1,2 of the cluster - which corresponds to
'pnt 59,60,61. In fact this is the entire cluster.
aValues = oCluster.Elements.ItemsByIndex( Array(0,1,2) )
'Show the ranges of the returned 1-dimensional array
LogMessage "lbound(aValues,1) = " & lbound(aValues,1)
LogMessage "ubound(aValues,1) = " & ubound(aValues,1)
'Print out the geometry indices of the requested cluster
'elements
for iIndex=lbound(aValues,1) to ubound(aValues,1)
iElement = aValues(iIndex)
LogMessage "element(" & iIndex & ") = " & _
oCluster.type & "(" & iElement & ") "
next
' Output of above script:
'INFO : "lbound(aValues,1) = 0"
'INFO : "ubound(aValues,1) = 2"
'INFO : "element(0) = poly(59) "
'INFO : "element(1) = poly(60) "
'INFO : "element(2) = poly(61) "Related Examples
Keywords
ClusterElementCollection ItemsByIndex
Autodesk Softimage 2011