Rebuild object by creating outer shell in python

Hey,
Currently I have to simplify a lot of meshes which look like this:

There are a lot of unnecessary holes in it and I want to simplify it to just the outer shell. I can’t use the bounding box because of the parts that jump into the model. So I want to find the outer corner points. How can I do it with python? Any tpps?

Or is there even an easier way? Automate Remesh-, + Decimate-Modifier?


This approach works nearly, and can lead to unexpectable behaviour…

Thanks in Advance!

use limited dissolve

1 Like

Thanks a lot! Didn’t know the feature yet.

Thats a good start.
Do you also know how to clean up the rest and delete all the holes?
I can do it manually, but it would be cool to auomate things, because I have a lot of these objects :slight_smile:

assuming it’s a closed mesh (or supposed to be):

select all, region to loop, fill, select all, limited dissolve

This will fail on a surface that is supposed to have open boundary edges because region_to_loop will select them and fill will turn it into a polygon that you will have to delete manually. you could write some logic to deselect any exterior boundary edges in the bmesh after region to loop, and then run the fill after that.

edit: if those holes in your mesh are not actually boundary edges, you could just loop through all of the faces in the mesh after Limited Dissolve and delete any face with an area less than some threshold, then use the process I described above. Just be aware that depending on what you set the threshold to you could end up deleting faces you wanted to keep- or keeping faces you wanted to delete.

1 Like

Use
Mesh > Clean Up > Delete Loose
Mesh > Clean Up > Fill Holes