
各インデックス PolygonNode が続く各 PolygonFace 上の数を含む PolygonNode 1D Arrayを、PolygonFaceCollection 内部の順序に従って戻します。たとえば、3PolygonNodes を含むメッシュがある場合は、4, 0, 1, 2, 3, 3, 4, 5, 6, 4, 7, 8, 9, 10 という配列を取得します。
// get accessor Object rtn = PolygonFaceCollection.PolygonNodePolygonFaceIndexArray; |
NewScene , false
' Create a cube and then slice one of the polygons (to get an irregular # of nodes)
set oObject = Application.ActiveProject.ActiveScene.Root.AddGeometry("Cube","MeshSurface")
ApplyTopoOp "SlicePolygons", oObject & ".poly[4]", siUnspecified, siPersistentOperation
' Get the facets on the mesh
set oPolygonMesh = oObject.ActivePrimitive.Geometry
set oPolygonFaceCollection = oPolygonMesh.Polygons
' Get the node number/index array and loop through the array, printing the info
aPolygonNodePolygonFaceIndexArray = oPolygonFaceCollection.PolygonNodePolygonFaceIndexArray
i = 0
for each oPolygonFace in oPolygonFaceCollection
Application.LogMessage "There are " & aPolygonNodePolygonFaceIndexArray(i) & " PolygonNodes on this PolygonFace "
nodecount = aPolygonNodePolygonFaceIndexArray(i)
i = i + 1
results = vbTab & "The indices for those PolygonNodes are :"
for j = 0 to nodecount-1
results = results & " " & aPolygonNodePolygonFaceIndexArray(i)
i = i + 1
next
Application.LogMessage results
next
' Expected results:
'INFO : There are 5 PolygonNodes on this PolygonFace
'INFO : The indices for those PolygonNodes are : 0 1 26 2 3
'INFO : There are 4 PolygonNodes on this PolygonFace
'INFO : The indices for those PolygonNodes are : 4 5 6 7
'INFO : There are 4 PolygonNodes on this PolygonFace
'INFO : The indices for those PolygonNodes are : 8 9 10 11
'INFO : There are 4 PolygonNodes on this PolygonFace
'INFO : The indices for those PolygonNodes are : 12 13 14 15
'INFO : There are 4 PolygonNodes on this PolygonFace
'INFO : The indices for those PolygonNodes are : 16 17 24 27
'INFO : There are 5 PolygonNodes on this PolygonFace
'INFO : The indices for those PolygonNodes are : 20 21 22 25 23
'INFO : There are 4 PolygonNodes on this PolygonFace
'INFO : The indices for those PolygonNodes are : 18 19 29 28 |