A quite strange error occurs when use the "DBRep_IsoBuilder"

I try to get the hatch of shape, however, when I instance the class "DBRep_IsoBuilder", I get a so inexplicable bug. Let me give my simple demo first:

#include <BRepBuilderAPI_MakeEdge.hxx>
#include <gp_Pnt.hxx>
#include <TopoDS_Edge.hxx>
#include <BRepBuilderAPI_MakeWire.hxx>
#include <TopoDS_Wire.hxx>
#include <BRepBuilderAPI_MakeFace.hxx>
#include <TopoDS_Face.hxx>
#include <DBRep_IsoBuilder.hxx>

int main(int argc, char** argv)
{
    // build a topo_face
    Standard_Real theXmin = 0.0;
    Standard_Real theXmax = 2.0;
    Standard_Real theZmin = 0.0;
    Standard_Real theZmax = 2.0;
    Standard_Real theY = 0.0;
    gp_Pnt p1(theXmin, theY, theZmin);
    gp_Pnt p2(theXmax, theY, theZmin);
    gp_Pnt p3(theXmax, theY, theZmax);
    gp_Pnt p4(theXmin, theY, theZmax);
    TopoDS_Edge e1 = BRepBuilderAPI_MakeEdge(p1, p2);
    TopoDS_Edge e2 = BRepBuilderAPI_MakeEdge(p2, p3);
    TopoDS_Edge e3 = BRepBuilderAPI_MakeEdge(p3, p4);
    TopoDS_Edge e4 = BRepBuilderAPI_MakeEdge(p4, p1);
    TopoDS_Wire w = BRepBuilderAPI_MakeWire(e1, e2, e3, e4);
    TopoDS_Face top_face = BRepBuilderAPI_MakeFace(w);
    //
    DBRep_IsoBuilder IsoBuild(top_face, 100, 10);

    return 0;
}

The OCCT version I use is 7.6.0. What the demo do is just build a TopoDS_Face, and then get a DBRep_IsoBuilder instance.

First question: when I debug the demo, I get a exception from "Draw_Interpretor.cxx". I didn't call it, I thought this may because the constructor of "DBRep_IsoBuilder" call it. The error occur in the destructor of DBRep_IsoBuilder.

Second question: This is what make me feel unable to understand!!! I annotation the code: DBRep_IsoBuilder IsoBuild(top_face, 100, 10);

However, I get the same exception. The demo just only build a TopoDS_Face now. And after I call the constructor of "DBRep_IsoBuilder" and annotation it, I get the same bug, the code of build TopoDS_Face could not work.

Why? I'm so puzzle.

Kirill Gavrilov's picture

DBRep package belongs to Draw Harness application (DRAWEXE) - you need initialize Tcl interpreter (Draw_Interpretor) to use it. I'm not sure that DBRep_IsoBuilder class is what you are actually looking for in your quest.

linbei jianbaoxia's picture

Thanks for your help, I try to fill a shape with isolines, I will keep try.