checking for occ-has-history

This commit is contained in:
Joachim Schoeberl 2021-07-26 22:50:59 +02:00
parent 4da7f6ac72
commit 411a850d41
3 changed files with 19 additions and 12 deletions

View File

@ -289,7 +289,8 @@ namespace netgen
; ;
} }
#endif #endif
#ifdef OCC_HAVE_HISTORY
Handle(BRepTools_History) history = aBuilder.History (); Handle(BRepTools_History) history = aBuilder.History ();
for (TopExp_Explorer e(shape, TopAbs_SOLID); e.More(); e.Next()) for (TopExp_Explorer e(shape, TopAbs_SOLID); e.More(); e.Next())
@ -298,7 +299,7 @@ namespace netgen
for (auto mods : history->Modified(e.Current())) for (auto mods : history->Modified(e.Current()))
OCCGeometry::global_shape_names[mods.TShape()] = name; OCCGeometry::global_shape_names[mods.TShape()] = name;
} }
#endif // OCC_HAVE_HISTORY
// result of the operation // result of the operation
shape = aBuilder.Shape(); shape = aBuilder.Shape();

View File

@ -11,6 +11,7 @@
#include <meshing.hpp> #include <meshing.hpp>
#include <Standard_Version.hxx>
#include "BRep_Tool.hxx" #include "BRep_Tool.hxx"
#include "Geom_Curve.hxx" #include "Geom_Curve.hxx"
#include "Geom2d_Curve.hxx" #include "Geom2d_Curve.hxx"
@ -87,6 +88,13 @@
#include "StlAPI_Writer.hxx" #include "StlAPI_Writer.hxx"
#include "STEPControl_StepModelType.hxx" #include "STEPControl_StepModelType.hxx"
#if OCC_VERSION_MAJOR>=7 && OCC_VERSION_MINOR>=4
#define OCC_HAVE_HISTORY
#endif
namespace netgen namespace netgen
{ {
#include "occmeshsurf.hpp" #include "occmeshsurf.hpp"

View File

@ -7,9 +7,8 @@
#include <meshing.hpp> #include <meshing.hpp>
#include <occgeom.hpp> #include <occgeom.hpp>
#include <Standard_Version.hxx>
#include <gp_Ax2.hxx>
#include <gp_Ax2.hxx>
#include <BRepPrimAPI_MakeSphere.hxx> #include <BRepPrimAPI_MakeSphere.hxx>
#include <BRepPrimAPI_MakeCylinder.hxx> #include <BRepPrimAPI_MakeCylinder.hxx>
#include <BRepPrimAPI_MakeBox.hxx> #include <BRepPrimAPI_MakeBox.hxx>
@ -20,10 +19,6 @@
#include <TDF_Attribute.hxx> #include <TDF_Attribute.hxx>
#include <Standard_GUID.hxx> #include <Standard_GUID.hxx>
#if OCC_VERSION_MAJOR>=7 && OCC_VERSION_MINOR>=4
#define OCC_HAVE_HISTORY
#endif
#if OCC_VERSION_MAJOR>=7 && OCC_VERSION_MINOR>=4 #if OCC_VERSION_MAJOR>=7 && OCC_VERSION_MINOR>=4
#define OCC_HAVE_DUMP_JSON #define OCC_HAVE_DUMP_JSON
#endif #endif
@ -86,7 +81,6 @@ DLL_HEADER void ExportNgOCC(py::module &m)
.def(py::init([] (const std::vector<TopoDS_Shape> shapes) .def(py::init([] (const std::vector<TopoDS_Shape> shapes)
{ {
cout << "start gluing" << endl;
BOPAlgo_Builder builder; BOPAlgo_Builder builder;
for (auto & s : shapes) for (auto & s : shapes)
builder.AddArgument(s); builder.AddArgument(s);
@ -386,7 +380,8 @@ DLL_HEADER void ExportNgOCC(py::module &m)
builder.AddArgument(e.Current()); builder.AddArgument(e.Current());
builder.Perform(); builder.Perform();
#ifdef OCC_HAVE_HISTORY
Handle(BRepTools_History) history = builder.History (); Handle(BRepTools_History) history = builder.History ();
for (auto & s : shapes) for (auto & s : shapes)
@ -397,7 +392,8 @@ DLL_HEADER void ExportNgOCC(py::module &m)
for (auto mods : modlist) for (auto mods : modlist)
OCCGeometry::global_shape_names[mods.TShape()] = name; OCCGeometry::global_shape_names[mods.TShape()] = name;
} }
#endif // OCC_HAVE_HISTORY
return builder.Shape(); return builder.Shape();
}); });
@ -415,6 +411,7 @@ DLL_HEADER void ExportNgOCC(py::module &m)
if (builder.HasWarnings()) if (builder.HasWarnings())
builder.DumpWarnings(cout); builder.DumpWarnings(cout);
#ifdef OCC_HAVE_HISTORY
Handle(BRepTools_History) history = builder.History (); Handle(BRepTools_History) history = builder.History ();
for (TopExp_Explorer e(shape, TopAbs_SOLID); e.More(); e.Next()) 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())) for (auto mods : history->Modified(e.Current()))
OCCGeometry::global_shape_names[mods.TShape()] = name; OCCGeometry::global_shape_names[mods.TShape()] = name;
} }
#endif // OCC_HAVE_HISTORY
return builder.Shape(); return builder.Shape();
}); });