Help: how to tell if a mesh face is triangle or quad?

Hi guys, if I coerce a mesh and print the face info I get a list of the vertices, but I can not len(face) to see if they are 3 or 4 vertices. And if i print them then they show up with either t or q as a preface:
image
So I presume there is a fast way to tell if it is a triangle or a quad, but I can not figure out how… :slight_smile:
Anybody knows?

Oh…
if face.IsQuad:
does the trick! :slight_smile:

IIRC triangles have the last two indices the same, meaning you have four vertices for both quads and tris, so check the third and fourth

Thanks I tried that, but apparently it is different now, see image above.

But I can use
if face.IsQuad == True:

IsQuad indeed is probably the better way. Other than that you could do:

if face.C != face.D: #quad

See

https://developer.rhino3d.com/api/RhinoCommon/html/T_Rhino_Geometry_MeshFace.htm

1 Like

Thanks as always Nathan!