Detect an NGon with a hole through it

I am working on an importer for lightwave. NGon support in blender is much improved, however it still seems to fall down when there is an NGon with a hole through it. I would prefer not to have to triangulate every NGon in a mesh.

Is it possible, some way, mathematically or what ever, to detect if the an NGon has a hole versus those that don’t.

Also is there a loose rule of thumb for Ngons, is it possible to have a ngon with a hole if you only have 6 or 7 verts?

Or is there a smarter way to deal with Ngons with holes in them, a smart cut, via python not the GUI or course.

If I recall correctly Lightwave uses keyhole polygons (polygons that loop back on themselves).

This can be handled in a few ways,

You could convert them into multiple polygons with holes, then calculate multiple non-overlapping ngons by creating connecting edges (the keyhole edge could be used for one).

Or you could triangulate the keyhole polygon, then merge the triangles as they don’t share an edge.

Here’s the bmesh documentation, not sure how up-to-date it is:
This is the current task for supporting nGon holes, the discussion seems pretty inconclusive, though :

I’m hoping this helps you somehow!

That was very helpful.

Ultimately i would just like to see ngon with holes support in blender, but that discussion suggests it is a long way off and a very low priority, which i think i knew.

But what i did get out of it is that the ngons that are a problem have more than one closed loop per face. That is what i want to know.

Is there a way to return even just the number of closed loops per face? If it is more than one, triangulate it!

There has been some more recent discussion on how to handle ngons with holes here:

That link was in the post I was replying and referring to.

Ah, i didn’t see @Josephbburg’s comment. Carry on :slight_smile:

:+1: No worries thanks for the help