TriangleCollection.Array
 
 
 

TriangleCollection.Array

Description

Returns the triangle collection as an Array of Triangle objects.

C# Syntax

// get accessor
Object rtn = TriangleCollection.Array;

Examples

VBScript Example

' This example show how to print out the point positions and
' the triangle data for a polygon mesh using the
' TriangleCollection.Array property to get at the
' triangles
set oRoot = Application.ActiveProject.ActiveScene.root
set oCube = oRoot.AddGeometry( "Cube", "MeshSurface" )
set oGeometry = oCube.ActivePrimitive.Geometry
aTriangles = oGeometry.Triangles.Array
aPointArray = oGeometry.Points.PositionArray
Application.LogMessage "Object: " & oCube.Name
Application.LogMessage "points: " & UBound( aPointArray, 2 )-LBound( aPointArray, 2 )+1
' print out the x,y,z positions of each point
for i=LBound( aPointArray, 2 ) to UBound( aPointArray, 2 )
        Application.LogMessage vbTab & _
                aPointArray(0,i) & "," & _
                aPointArray(1,i) & "," & _
                aPointArray(2,i)
next
Application.LogMessage "triangles: " & UBound( aTriangles, 1 )-LBound( aTriangles, 1 )+1
' print out the point indices for each triangle
for i=LBound( aTriangles, 1 ) to UBound( aTriangles, 1 )
        set oTriangle = aTriangles(i)
        Application.LogMessage vbTab & _
                oTriangle.Points(0).Index & "," & _
                oTriangle.Points(1).Index & "," & _
                oTriangle.Points(2).Index
next