Creating MeshFaceList type



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

Mesh created by Rhino.Geometry.Mesh.Vertices.Add() and Rhino.Geometry.Mesh.Faces.AddFace() used in AdjactedFaces outputs:

Runtime error (ArgumentTypeException): expected MeshFaceList, got Mesh

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


(Steve Baer) #2

Do you have a small sample of the script that is not working? Maybe I can use that to help.


Hi Steve,

So this is what happens. V and F are list access; A, B and C are item access. All with no type hints. Same error with F instead of mesh as an argument for AdjactedFaces.

import Rhino as rh
import rhinoscriptsyntax as rs

mesh = rh.Geometry.Mesh()

for i in range(0, len(V)):

for i in range(0, len(F)):
    mesh.Faces.AddFace(A, B, C)


rh.Geometry.Collections.MeshFaceList.AdjacentFaces(F, 6)

AdjactedFaces.3dm (192.9 KB) (12.5 KB)

(Steve Baer) #4

Create a python component with a single input named mesh and give it a typehint of Mesh. Wire the Mesh component output directly to this new python component. Inside the python component, write

print mesh.Faces.AdjacentFaces(6)

Let me know if that makes sense. Thanks,


It worked. The component outputs an array of adjaced faces’ indicies.