A problem of self-made TopoDS_Face

Hi All,

I want to build a TopoDS_Face myself, to which I plan to make changes later.

Thus, for a starter I decided to make a copy of an original face via the combination of the geometry shape and the wire of it.

Here's the code:

TopoDS_Face retrieveFaceFrom(TopoDS_Face& oriFace) {
// get the geometry shape
Handle(Geom_Surface) gSurf = BRep_Tool::Surface(oriFace);

// get the wire
TopExp_Explorer ws(oriFace, TopAbs_WIRE);
TopoDS_Wire wire = TopoDS::Wire(ws.Current());

// make the face by combining the geom shape and wire
BRepBuilderAPI_MakeFace makeFace(gSurf, wire);
if (makeFace.IsDone()) {
return makeFace.Face();
}
else {
return TopoDS_Face();
}
}

It seems to work fine, but problems popped up when I tried to render the new face via triangulation:

TopoDS_Face face = retrieveFaceFrom(oriFace);
TopLoc_Location location;
Handle(Poly_Triangulation) triang = BRep_Tool::Triangulation(face, location, Poly_MeshPurpose_Presentation);

The problem is that the returned triangulation result is a null pointer, whilst it works fine with the original face.

Does anyone know what's going wrong with my new face?

Thanks.

Boqing Dong's picture

I found the answer.
I missed the manual building of the triangular faces.

Thank you for your attention.