Removing 3D holes from 3D bodies

Hello Everybody!

This is my first ever post on this forum, hope that it's in the right category.

I'm trying to use Open Cascade to eliminate 3D holes from 3D bodies. In other words I have some 3D shapes (mostly solids) which contain holes and I wish to get rid of those holes.To understand what I mean, look at attached images CubeWithHoles_A_Shaded, CubeWithholes_A_WireFrame, CubeWithHoles_B_Shaded and CubeWithHoles_B_WireFrame, which show the same example from different viewing angles and in different drawing modes.

The end result that I desire to obtain is a cube which has no holes.

I'm having a hard time finding Open Cascade functions to achieve this. At first I tried ShapeUpgrade_RemoveInternalWires with RemoveFaceMode set to TRUE. This gets rid of some holes, but only the ones which are defined with internal wires on some faces and which go all the way through the cube. It does leave the half holes behind and it never even touches holes which are not defined by internal wires. See attached CbeWithHoles_C_Shaded and CubeWithHoles_C_WireFrame to see what I mean.

What would the the right functions be to perform this task?


Thank you!

Qr Qr's picture

You cannot simply remove a solid hole as very often it will require geometric reconstruction. In simple cases (when a hole is inserted somewhere in interior of support faces) topological-only reduction is enough, and BRepTools_ReShape could help you there. But anyway there is also a problem to find these holes. Google keywords: feature identification, feature suppression.

Qr Qr's picture

BTW, are you sure that ShapeUpgrade_RemoveInternalWires really removes your solid holes? It may simply kill the internal wires, so that the hole faces inside your solid become invisible to you. Check your result with checkshape.