MeshVertexFaces

Returns the mesh faces that share a specified mesh vertex.

Syntax

rhinoscriptsyntax.MeshVertexFaces (mesh_id, vertex_index)

rhinoscript.mesh.MeshVertexFaces (mesh_id, vertex_index)

Parameters

mesh_id

Required.  String or Guid.  The identifier of a mesh object.

vertex_index

Required.  Number.  The index of the mesh vertex.

Returns

Tuple

A tuple of the indices of the faces that share the specified vertex if successful.

None

If not successful, or on error.

Example

import rhinoscriptsyntax as rs

import random

def TestMeshVertexFaces():

    mesh = rs.GetObject("Select mesh", rs.filter.mesh)

    vertices = rs.MeshVertices(mesh)

    meshfaces = rs.MeshFaceVertices(mesh)

    vertex = random.randint(0, len(vertices)-1) #some random vertex

    vertex_faces = rs.MeshVertexFaces(mesh, vertex )

    if vertex_faces:

        rs.AddPoint( vertices[vertex] )

        for face_index in vertex_faces:

            face = meshfaces[face_index]

            polyline = []

            polyline.append( vertices[face[0]] )

            polyline.append( vertices[face[1]] )

            polyline.append( vertices[face[2]] )

            if face[2]!=face[3]:

                polyline.append( vertices[face[3]] )

            polyline.append( polyline[0] )

            rs.AddPolyline(polyline)

 

TestMeshVertexFaces()

Also See

MeshFaces

MeshFaceVertices

MeshVertices