Notifications
Clear all

[Closed] how to determine if a mesh is closed

Simple question hopefully with a simple answer. How can I determine if a mesh is closed or not?

5 Replies

you could loop through the edges and see if any edge is only contained in one face… that face would be open

mark

Why not just use an STL modifier to check it?

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?

-- For Editable Meshes and Polys:
(meshOp.getOpenEdges $).isEmpty
(polyOp.getOpenEdges $).isEmpty

-- true: the surface is closed
-- false: the surface is open

Cheers

  • Enrico

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