Removing holes

I have an object that I need to remove many holes from and was wondering how to do this with a script. Here is one of the “plates” that I need to remove the holes from. The object has about 50 of these, at various locations and this is one of the simpler plates, which is why I’m look toward a script to do the heavy lifting for me. I can select all the co-planar faces then run the script.

Here’s what I’d like to get to, a flat plate without the holes:

Thanks for any help.

Shift+F fills the mesh with Inside-Outside Detection
Alt+F beautifies the filling

repeat Alt+F for 2-3 times.

Thanks for the advice but nothing happens when I type Shift+F. I tried both selecting just one hole and all the holes and still nothing changes.

You could also select all the holes and scale them to zero ([Alt][b][b] select + [S][0] + [W]->remove doubles) This should work fine in this case. You may want to do this at 2-3 points though (see the 3 center-points in your second image).

Werner

Thanks for the scale to zero tip.

I’d really like to be able to do this in a script since I have many 1000s (yes thousands) of holes to remove from the full assembly I am working with (it’s got over 1,000,000 vertices in it) and selecting them by hand would be very time consuming.

What I am currently thinking is that if I can detect the outer edge loop of the plate then I can find all the other edges with only one face and this will give me the candidate list for the interior holes. I then group the edges together into loops and then merge them and poly reduce the plate. I hope that all made sense :slight_smile:

The part I’m stuck on is figuring out what the outside edge of the plate in python.

If flashnfantasy’s advice didn’t work I’d go with what Werner said. If all the holes can fit perfectly inside rectangle; a box select it shouldn’t take too long to select them all.

Instead of selecting the holes, select just the outside frame. Then Ctrl I to select inverse.

I have a time manually filled them up. Sure it takes a while, but it’s quite relaxing too.

If you really wanted to do it via Python, you’d be better off to just model the shape you want and then have python find one corner of the object with holes, and duplicate the model you want to replace the one with holes to that proper position. From there, you just have to delete the original mesh with holes.

If you want the general solution (for instance, if all plates aren’t the same shape), its probably going to be harder. To generically detect the outer vertices, you need to find one and then follow its edges (since it will be connected to all other outer vertices in a chain). Just take the most extreme values (smallest and largest positions) of its edge neighbors, and then repeat the process.

Better yet, you can take the edge from the previously found outer vertex, and look through the current vertex’s edges for the edge that makes the largest angle away from it (there may be some tricky trig here with CW vs CCW, not 100% sure, even though either way it should be the largest angle), since this would be the next most outer edge.

You might also want to look in the Blender source at edge loop finding code. It could be a big help (more so than what I just said :eek:).

just to make sure

  • you have erased all “inner” edges, so that just the outlines are left
  • you have highlighted all points, not just one point of the polygon

i have repeatet Shift+F several times with different starts, and there where always a result, sometimes maybe screwed up, but there was always something afterwards.

I may have the answer. This could work for the holes on one plane at a time.Deselect all the vertices on the mesh, then just select all of the holes on a plane. Select them all at once. Set your pivot type to cursor and move the cursor to a point where they can all be merged. Then just scale them all down to this point. Alt-M to remove doubles. If you have indentations around the edge of the plane that could cause problems, it may need to be done recursively removing different sets of holes in stages.

Ooops. Someone else already suggested that.

Maybe if you could post the blend file or a rendered image of the object, someone might be able to make a suggestion. One idea is that if the geometry is too complicated, you could always just use ALT-B to simplify first.

Thanks everyone for their help on this.

To give a bit more background on this problem. I am just given the assemblies from a CAD system and I need to reduce the complexity to make them usable in Blender for others to examine who don’t have the CAD software. I can still represent the assembly without all the holes to give a usable “reduced detail version” and that will greatly reduce the face, vertex, edge count.

This particular assembly I have is very complex and the plates are all different sizes, shapes, angles and they sometimes change it on me so I need go back an remake the “reduced detail version”, which to me implies script instead of a manual process.

forTe. Thanks for the thoughts. I understand exactly what you are saying. Do you know where to find the source code for the edge loop finding code to look at?

I believe its in source/blender/src/editmesh_loop.c

Note that I don’t know how well its going to do with all those triangles, but it still may be worth a look.

Made an example of my own.

I just can not accept that this is not working.

these are the short cuts, i use:

shift + f = Mesh - Faces - Fill
alt + f = Mesh - Faces - Beauty Fill
alt + j = Mesh - Faces - convert Triangles to Quads

http://images.fotopic.net/y6dhdl.jpg

Fill just fills the mesh with inside/outside-detection
Beauty-Fill flips successivly edges to archive shorter distances
and finaly Triangles to Quad reduce the Polys

Thanks for the additional help and the pointer to the source code.

I know that the script will be slow dealing with this much data but letting the computer grind away at the problem is better than me grinding away getting rid of all the holes :yes:

This works but it is the opposite of the problem I am trying to solve. I already have the mesh with all the holes and faces in it and I need to remove them to make the mesh simpler.

And this is just one plate of the full assembly I need to deal with. The full assembly is a 44Meg blend file. I checked the sizes again and there are over 1,000,000 vertices and 345,00 faces in it. :spin:

That is why I need to use a script and let in grind away at it so I don’t have to manually do the simplification.

How’d you end up with a mesh like that in the first place?

(just wondering)

I’m getting these assemblies from a CAD system used to design the parts for manufacturing them. This particular assembly is a power supply and has lots of cooling holes which is why it’s so big.

I need to be able to display the parts to others. And they don’t have a CAD system so using Blender is a good choice since it’s free! :smiley: But the assemblies are so big, it hard to work with them hence the need to reduce the level of detail in them.