Generating and reading BRep files

Hello,

I am relatively new to OpenCASCADE and as one of my first steps I want to create a BRep file, save it and then read it again. For this I made the attached cpp file.
In my example I create a tetrahedron and save the TopoDS_Shape with BRepTools::Write as a BRep file. But when I try to read it with BRepTools::Read I get the message "File was not written with this version of the topology". Also I get no results when exploring the shape with TopExp_Explorer.

Does anybody know where my mistake is?

Attachments: 
Thomas Anderson's picture

switch this:

// Read BRep
TopoDS_Face s;
BRep_Builder b;
std::istringstream is("tet.brep");
BRepTools::Read(s, is, b);

to this:

// Read BRep
TopoDS_Face s;
BRep_Builder b;
std::ifstream is;
is.open("tet.brep");
BRepTools::Read(s, is, b);
is.close();
Guido van Hilst not specified's picture

// Read BRep

I think you should change

TopoDS_Face s;

TopoDS_Shape s;