Notifications
Clear all
[Closed] how to determine if a mesh is closed
Jan 19, 2009 10:41 am
Simple question hopefully with a simple answer. How can I determine if a mesh is closed or not?
5 Replies
Jan 19, 2009 10:41 am
you could loop through the edges and see if any edge is only contained in one face… that face would be open
mark
Jan 19, 2009 10:41 am
that could work but has the potential to be extremely slow, especially looping over multiple objects. I was hoping there was a built in function.
After writing the above and before posting I had a quick look at the edit_poly mod and came up with this function:
fn isClosedMesh o =
(
addModifier o (edit_poly())
m = o.modifiers[1]
faces = #{1..(m.GetNumFaces())}
m.SetSelection #Face faces
isMeshClosed = (m.convertSelectionToBorder #Face #Edge) == 0
deleteModifier o 1
isMeshClosed
)
It only seems to work with the modify panel open though which is a pain
Anyone know of a better way to do this?
Jan 19, 2009 10:41 am
-- For Editable Meshes and Polys:
(meshOp.getOpenEdges $).isEmpty
(polyOp.getOpenEdges $).isEmpty
-- true: the surface is closed
-- false: the surface is open
Cheers
- Enrico
Jan 19, 2009 10:41 am
Thanks Dave I’d completely forgotton about the STL modifier.
SyncViewS, your solution is nice and tidy. I don’t think I’ve ever used getOpenEdges before. Thanks heaps