Removing Internal Geometry

Greetings. I want to make a script to automate a rather tedious process that needs repeated dozens (or even hundreds) of times. One step of the process involves the removal of internal geometry.

This image illustrates the issue. There are several cubes in the same mesh that have been merged together with a “remove doubles” operation. I want to remove the red, internal faces.


I can do it manually in face select mode by limiting the selection to the visible geometry, box selecting at several angle, inverting my selection, and deleting faces. As far as I know, this specific process cannot be done with the Blender API. But, doing it manually is impractically tedious and impossibly time-consuming.

This is a sample of what I’m trying to do. I have hundreds of discretely displaced cubes, and I need to merge the vertices and remove the internal geometry for smooth shading to work correctly. In this example, the cubes are only facing upwards, but the actual case has cubes facing all directions (making a large cube) so that the geometry to be removed is inside a closed shell. I need to do this operation dozens or hundreds of times.


Any ideas? Is this even possible? Thank you.

Hmm, I have used the select non-manifold operator to do this from time to time, but it isn’t rock solid reliable, it requires a lot of manual intervention… might be a good start though

Hm, I have never used that operator before now. It seems very useful in general. It does work for the example in blue. If I use it in vertex select mode and change to face select mode, it has all the necessary faces selected for deletion. But, in the realistic sample, it does not work.

In the real sample, many of the surface edges connect to 3+ faces, which means that many of the surface faces are selected. Moreover, some of the internal edges only connect to 2 faces. So, simply considering how many faces an edge connects to is not enough for what I need. I am not seeing any differentiating properties of the internal geometry to select it by.

I am wondering if there is a way to select a shell starting with a face that the user selects. It would not be as automatic as I’d like, but it seems more reasonable. But, I have some questions to know if this is possible.

Can you loop through all the edges of a given face?
Can you loop through all the faces attached to a given edge?
Can you get the normal vector of a given face?
Can you add a given face to the selection?
Can you check if a given face is selected or not?
Edit: Can you tell if a normal of a face is “flipped” relative to an adjacent face?

And, before going too far, I should check if someone else has made a shell select script. It seems too basic for someone not to have.