From 411a850d41e301d60c3aa800c1b26359b1c8c6ac Mon Sep 17 00:00:00 2001 From: Joachim Schoeberl Date: Mon, 26 Jul 2021 22:50:59 +0200 Subject: [PATCH] checking for occ-has-history --- libsrc/occ/occgeom.cpp | 5 +++-- libsrc/occ/occgeom.hpp | 8 ++++++++ libsrc/occ/python_occ.cpp | 18 ++++++++---------- 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/libsrc/occ/occgeom.cpp b/libsrc/occ/occgeom.cpp index b4c44f68..b46749a1 100644 --- a/libsrc/occ/occgeom.cpp +++ b/libsrc/occ/occgeom.cpp @@ -289,7 +289,8 @@ namespace netgen ; } #endif - + +#ifdef OCC_HAVE_HISTORY Handle(BRepTools_History) history = aBuilder.History (); for (TopExp_Explorer e(shape, TopAbs_SOLID); e.More(); e.Next()) @@ -298,7 +299,7 @@ namespace netgen for (auto mods : history->Modified(e.Current())) OCCGeometry::global_shape_names[mods.TShape()] = name; } - +#endif // OCC_HAVE_HISTORY // result of the operation shape = aBuilder.Shape(); diff --git a/libsrc/occ/occgeom.hpp b/libsrc/occ/occgeom.hpp index bede0fc5..411f5ac1 100644 --- a/libsrc/occ/occgeom.hpp +++ b/libsrc/occ/occgeom.hpp @@ -11,6 +11,7 @@ #include +#include #include "BRep_Tool.hxx" #include "Geom_Curve.hxx" #include "Geom2d_Curve.hxx" @@ -87,6 +88,13 @@ #include "StlAPI_Writer.hxx" #include "STEPControl_StepModelType.hxx" +#if OCC_VERSION_MAJOR>=7 && OCC_VERSION_MINOR>=4 +#define OCC_HAVE_HISTORY +#endif + + + + namespace netgen { #include "occmeshsurf.hpp" diff --git a/libsrc/occ/python_occ.cpp b/libsrc/occ/python_occ.cpp index 23779300..7fb99e15 100644 --- a/libsrc/occ/python_occ.cpp +++ b/libsrc/occ/python_occ.cpp @@ -7,9 +7,8 @@ #include #include -#include -#include +#include #include #include #include @@ -20,10 +19,6 @@ #include #include -#if OCC_VERSION_MAJOR>=7 && OCC_VERSION_MINOR>=4 -#define OCC_HAVE_HISTORY -#endif - #if OCC_VERSION_MAJOR>=7 && OCC_VERSION_MINOR>=4 #define OCC_HAVE_DUMP_JSON #endif @@ -86,7 +81,6 @@ DLL_HEADER void ExportNgOCC(py::module &m) .def(py::init([] (const std::vector shapes) { - cout << "start gluing" << endl; BOPAlgo_Builder builder; for (auto & s : shapes) builder.AddArgument(s); @@ -386,7 +380,8 @@ DLL_HEADER void ExportNgOCC(py::module &m) builder.AddArgument(e.Current()); builder.Perform(); - + +#ifdef OCC_HAVE_HISTORY Handle(BRepTools_History) history = builder.History (); for (auto & s : shapes) @@ -397,7 +392,8 @@ DLL_HEADER void ExportNgOCC(py::module &m) for (auto mods : modlist) OCCGeometry::global_shape_names[mods.TShape()] = name; } - +#endif // OCC_HAVE_HISTORY + return builder.Shape(); }); @@ -415,6 +411,7 @@ DLL_HEADER void ExportNgOCC(py::module &m) if (builder.HasWarnings()) builder.DumpWarnings(cout); +#ifdef OCC_HAVE_HISTORY Handle(BRepTools_History) history = builder.History (); for (TopExp_Explorer e(shape, TopAbs_SOLID); e.More(); e.Next()) @@ -423,7 +420,8 @@ DLL_HEADER void ExportNgOCC(py::module &m) for (auto mods : history->Modified(e.Current())) OCCGeometry::global_shape_names[mods.TShape()] = name; } - +#endif // OCC_HAVE_HISTORY + return builder.Shape(); });