MeshFaceList logic


I’m trying to use Rhino.Geometry.Collections.MeshFaceList.ExtractFaces method which asks for self: MeshFaceList, faceIndex: int as input. The script editor outputs that ExtractFaces method takes exactly 2 arguments, but I can’t get over with MeshFaceList type.
Here my script:

#python to extract mesh faces with naked edges
import rhinoscriptsyntax as rs
import os.path
from os import path
import Rhino

mesh = rs.GetObject(“Select mesh”, rs.filter.mesh)
vertices = rs.MeshVertices(mesh)
meshfaces = rs.MeshFaceVertices(mesh)
naked = rs.MeshNakedEdgePoints(mesh)
for i, vertex in enumerate(vertices):
if naked[i]:
vertex_faces = rs.MeshVertexFaces(mesh, i )
if vertex_faces:
for face_index in vertex_faces:
face = meshfaces[face_index]

Can you explain the construction of MeshFaceList to a beginner and give an example of python script which uses MeshFaceList please?


This is wrong:
Rhino.Geometry.Collections.MeshFaceList. **ExtractFaces** (something?,face)

This is how you access the mesh faces collection:
NewMesh = YourMesh.Faces.ExtractFaces( AListOfFaceIndices );
The output of this method is a mesh.

Mesh face list is just a collection inside mesh class, just like vertices and edges:

You would understand this better if you would use less rhinoscriptsyntax and more rhinocommon.

To understand RhinoCommon methods inside rhinoscriptsyntax library check this: