Selecting outer or inner faces of mesh with PyMEL?

Selecting outer or inner faces of mesh with PyMEL?

Anonymous
Not applicable
482 Views
1 Reply
Message 1 of 2

Selecting outer or inner faces of mesh with PyMEL?

Anonymous
Not applicable
Hi all,

I'm writing a PyMEL script that generates the Menger Sponge with geometry. The script generates a whole bunch of cubes, combines them, merges the verticies then deletes the lamina faces. After i'm left with inner faces that were at the same positions at the lamina faces.

The only way I can think off to get rid of these faces is to either select all the external faces of a mesh and duplicate them to a new mesh or delete all the internal faces.

Anyone know how to do either?

Thanks,

David.

0 Likes
483 Views
1 Reply
Reply (1)
Message 2 of 2

Anonymous
Not applicable
I've made some progress...

The snippet below now get's most lamina and inner faces for deletion. But is extremely slow when working on a mesh with 2400 polys (Menger Sponge iteration 2). Since the mesh is symmetrical I can polySplit it before performing this operation so save some time. Can anyone think of a faster solution?


laminaf = pm.polyInfo(lf=True)
innerf = []
for lf in range(0, len(laminaf)):
verts = pm.PyNode(laminaf).connectedVertices()
for face in mesh.f:
if face.connectedVertices() == verts:
innerf.append(face)

output('deleting %i' % (len(laminaf) + len(laminaf)) + ' lamina and inner faces')
pm.delete()
0 Likes