cover hole in face

Hello,

I have

TopoDS_Solid s_box = BRepPrimAPI_MakeBox(gp_Pnt(-a/2,-b/2,-c/2),gp_Pnt(a/2,b/2,c/2));
TopoDS_Solid s_cyl = BRepPrimAPI_MakeCylinder(yaxis1,r1,h1);

I subtract the cylinder from the box with:

BRepAlgoAPI_Cut s_res(s_box,s_cyl);

Everything work fine untill here but the cut operation creates a hole in one of the s_box's faces.
Does anyone know how can I "cover" this hole (while keeping the cylindrical hole) ?

Thanks in advance.

Cauchy Ding's picture

Here is my persudocode, hope it works.

TopExp_Explorer exp, exp2;
TopoDS_Wire wire, outWireShape;
TopoDS_Face newface;
for(exp.Init(box, TopAbs_FACE); exp.More(); exp.Next())
{
newface = TopoDS::Face(exp.Current());
outWireShape = TopoDS::Wire(BRepTools::OuterWire(newface));
for(exp2.Init(newface, TopAbs_WIRE); exp2.More(); exp2.Next())
{
wire = TopoDS::Wire(exp2.Current());
if(wire==outWireShape)
continue;
BRepTools_ReShape reshaper;
reshaper.Remove(wire);
newface = TopoDS::Face(reshaper.Apply (newface));
}
}

Valeriu Catina's picture

Thanks, but your code does not remove the inner wire from the face.

Cauchy Ding's picture

Hi Catina,

I think the above code can remove the wire shared by only one face. If it's shared by multiple faces, the code doesn't work.

Regards.

Valeriu Catina's picture

Sorry, you're right the code can indeed remove the wire, I made a mistake while typing.
However, what I'm looking for is a boolean operation similar to the non-regularized booleans in the ACIS kernel - the surface formed by the intersection wire of 2 solids is kept in the resulting solid after performing a boolean. I'm not sure this can be done in open Cascade since in the documentation they say the result of a boolean can be only a non-manifold solid.

Cheers,

Vali