Part: set explicit format version number for BRep files to support all OCC versions

This commit is contained in:
wmayer
2021-12-11 23:31:41 +01:00
parent 17836f5d39
commit f212a8ef76
2 changed files with 28 additions and 22 deletions

View File

@@ -1024,13 +1024,28 @@ void TopoShape::exportStep(const char *filename) const
void TopoShape::exportBrep(const char *filename) const
{
#if OCC_VERSION_HEX >= 0x070600
if (!BRepTools::Write(this->_Shape,encodeFilename(filename).c_str(), Standard_False, Standard_False, TopTools_FormatVersion_VERSION_1))
throw Base::FileException("Writing of BREP failed");
#else
if (!BRepTools::Write(this->_Shape,encodeFilename(filename).c_str()))
throw Base::FileException("Writing of BREP failed");
#endif
}
void TopoShape::exportBrep(std::ostream& out) const
{
BRepTools::Write(this->_Shape, out);
// See TopTools_FormatVersion of OCCT 7.6
enum {
VERSION_1 = 1,
VERSION_2 = 2,
VERSION_3 = 3
};
BRepTools_ShapeSet SS(Standard_False);
SS.SetFormatNb(VERSION_1);
SS.Add(this->_Shape);
SS.Write(out);
SS.Write(this->_Shape, out);
}
void TopoShape::exportBinary(std::ostream& out)