check for binary output for older occ versions

This commit is contained in:
Christopher Lackner 2025-04-14 08:34:59 +02:00
parent cb3eb0d355
commit b05c32675b

View File

@ -14,7 +14,9 @@
#pragma clang diagnostic push #pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations" #pragma clang diagnostic ignored "-Wdeprecated-declarations"
#if OCC_VERSION_MAJOR>=7 && OCC_VERSION_MINOR>=6
#include <BinTools_ShapeWriter.hxx> #include <BinTools_ShapeWriter.hxx>
#endif // OCC_VERSION_MAJOR>=7 && OCC_VERSION_MINOR>=4
#include <BOPAlgo_Builder.hxx> #include <BOPAlgo_Builder.hxx>
#include <BOPTools_AlgoTools.hxx> #include <BOPTools_AlgoTools.hxx>
#include <BRepAlgoAPI_Common.hxx> #include <BRepAlgoAPI_Common.hxx>
@ -840,8 +842,12 @@ DLL_HEADER void ExportNgOCCShapes(py::module &m)
{ {
if(binary) if(binary)
{ {
#if OCC_VERSION_MAJOR>=7 && OCC_VERSION_MINOR>=6
BinTools_FormatVersion v = version ? BinTools_FormatVersion(*version) : BinTools_FormatVersion_CURRENT; BinTools_FormatVersion v = version ? BinTools_FormatVersion(*version) : BinTools_FormatVersion_CURRENT;
BinTools::Write(shape, filename.c_str(), withTriangles, withNormals, v); BinTools::Write(shape, filename.c_str(), withTriangles, withNormals, v);
# else // OCC_VERSION_MAJOR>=7 && OCC_VERSION_MINOR>=6
throw Exception("Binary BREP export not supported in this version of OpenCascade");
#endif // OCC_VERSION_MAJOR>=7 && OCC_VERSION_MINOR>=6
} }
else else
{ {