' This example illustrates how to enumerate the triangles
' of a polygon mesh an print out the position of each
' triangle vertex
set oRoot = Application.ActiveProject.ActiveScene.root
set oCube = oRoot.AddGeometry( "Cube", "MeshSurface" )
set oGeometry = oCube.ActivePrimitive.Geometry
set oTriangles = oGeometry.Triangles
Application.LogMessage "Object: " & oCube.Name
Application.LogMessage "Number of triangles: " & oTriangles.Count
for each oTriangle in oTriangles
Application.LogMessage oTriangle.Name
for each oVertex in oTriangle.Points
set oPosition = oVertex.Position
Application.LogMessage vbTab & oPosition.x & "," & _
oPosition.y & "," & _
oPosition.z
next
next |