Maybe there's an easier way, but this is one solution :)
The only reason I don't like it is because you have to actually select stuff for the
This code simply checks to see if a mesh has border edges. Border edges only show up if there's a hole, that would create a border.
The only reason I don't like it is because you have to actually select stuff for the
polySelectConstraint
to work.This code simply checks to see if a mesh has border edges. Border edges only show up if there's a hole, that would create a border.
import pymel.core as pm def selectBorderEdges(mesh): mesh = pm.PyNode(mesh) if len(mesh.e) == 0: raise Exception("") pm.select(mesh.e) pm.polySelectConstraint(mode=2, type=0x8000, where=True) pm.polySelectConstraint(mode=0, disable=True) def getBorderEdges(mesh): sel = pm.ls(selection=True) selectBorderEdges(mesh) borderEdges = pm.ls(selection=True, flatten=True) if sel: pm.select(sel) else: pm.select(clear=True) return borderEdges def hasHole(mesh): if getBorderEdges(mesh): return True else: return False