MeshVertexFaces

Returns the mesh faces that share a specified mesh vertex.

Syntax

Rhino.MeshVertexFaces (strObject, intVertex)

Parameters

strObject

Required.  String.  The identifier of a mesh object.

intVertex

Required.  Number.  The index of the mesh vertex.

Returns

Array

An array the indices of the faces that share the specified vertex if successful.

Null

If not successful, or on error.

Example

Sub TestMeshVertexFaces()

  Dim strMesh, arrVertices, arrFaceVertices

  Dim intVertex, arrVertexFaces, arrFace, i

  Dim arrPolyline()

  strMesh = Rhino.GetObject("Select mesh", 32)

  arrVertices = Rhino.MeshVertices(strMesh)

  arrFaceVertices = Rhino.MeshFaceVertices(strMesh)

  intVertex = UBound(arrVertices) \ 2 ' Some vertex

  arrVertexFaces = Rhino.MeshVertexFaces(strMesh, intVertex )

  If IsArray(arrVertexFaces) Then

    For i = 0 To UBound(arrVertexFaces)

      arrFace = arrFaceVertices(arrVertexFaces(i))

      If IsArray(arrFace) Then

        If (arrFace(2) = arrFace(3)) Then

          ReDim arrPolyline(3)

          arrPolyline(0) = arrVertices(arrFace(0))

          arrPolyline(1) = arrVertices(arrFace(1))

          arrPolyline(2) = arrVertices(arrFace(2))

          arrPolyline(3) = arrVertices(arrFace(0))

        Else

          ReDim arrPolyline(4)

          arrPolyline(0) = arrVertices(arrFace(0))

          arrPolyline(1) = arrVertices(arrFace(1))

          arrPolyline(2) = arrVertices(arrFace(2))

          arrPolyline(3) = arrVertices(arrFace(3))

          arrPolyline(4) = arrVertices(arrFace(0))

        End If

        Call Rhino.AddPolyline(arrPolyline)

      End If   

    Next

  End If

End Sub

Also See

MeshFaces

MeshFaceVertices

MeshVertices