planar face with hole

Hello,

I build a planr Face from a Wire and I want to add an internal hole defined by an other Wire. How can I do that???

Thank's for answer(s)...

francisco castillo's picture

You have to add the internal wires to the face, see code:
TopoDS_Wire aWire = ....
//External wire
TopoDS_Face F = BRepBuilderAPI_MakeFace( aWire );
//Internal hole
TopoDS_Wire aHoleWire = ...
//Check that this wire have opposite orientation
// if not, use aHoleWire.Reverse();
//Add this hole to te face
F = BRepBuilderAPI_MakeFace( F, aHoleWire );

thierry MAIRE's picture

Thank you Francisco,

but this doesn't work !
this is my code :
// declarations
BRepBuilderAPI_MakeWire extWire;
BRepBuilderAPI_MakeWire intWire;
// 2 loops for adding edges
.
.
.
// getting the external TopoDS_Wire
TopoDS_Wire ew = extWire.Wire();
// creating the TopoDS_Face
TopoDS_Face face = BRepBuilderAPI_MakeFace(ew);
// getting the internal TopoDS_Wire
TopoDS_Wire iw = intWire.Wire();
// I now that internal wire have non-opposite orientation
iw.Reverse();
// modifying face with internal hole
face = BRepBuilderAPI_MakeFace(face, iw);

I get a Runtime Error !!!

francisco castillo's picture

I am using this code without problems. Perhaps the wires are not planar or the hole wire is not inside the external one.

tmaire's picture

Hello Francisco,

I have found the problem ! My internal Wire was "disconnected".
Thank you very much for your help ;-)
Best regards.
thm

thierry MAIRE's picture

Thank you Francisco,

but this doesn't work !
this is my code :
// declarations
BRepBuilderAPI_MakeWire extWire;
BRepBuilderAPI_MakeWire intWire;
// 2 loops for adding edges
.
.
.
// getting the external TopoDS_Wire
TopoDS_Wire ew = extWire.Wire();
// creating the TopoDS_Face
TopoDS_Face face = BRepBuilderAPI_MakeFace(ew);
// getting the internal TopoDS_Wire
TopoDS_Wire iw = intWire.Wire();
// I now that internal wire have non-opposite orientation
iw.Reverse();
// modifying face with internal hole
face = BRepBuilderAPI_MakeFace(face, iw);

I get a Runtime Error !!!