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

@ -290,6 +290,7 @@ 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();

View File

@ -11,6 +11,7 @@
#include <meshing.hpp>
#include <Standard_Version.hxx>
#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"

View File

@ -7,9 +7,8 @@
#include <meshing.hpp>
#include <occgeom.hpp>
#include <Standard_Version.hxx>
#include <gp_Ax2.hxx>
#include <gp_Ax2.hxx>
#include <BRepPrimAPI_MakeSphere.hxx>
#include <BRepPrimAPI_MakeCylinder.hxx>
#include <BRepPrimAPI_MakeBox.hxx>
@ -20,10 +19,6 @@
#include <TDF_Attribute.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
#define OCC_HAVE_DUMP_JSON
#endif
@ -86,7 +81,6 @@ DLL_HEADER void ExportNgOCC(py::module &m)
.def(py::init([] (const std::vector<TopoDS_Shape> shapes)
{
cout << "start gluing" << endl;
BOPAlgo_Builder builder;
for (auto & s : shapes)
builder.AddArgument(s);
@ -387,6 +381,7 @@ DLL_HEADER void ExportNgOCC(py::module &m)
builder.Perform();
#ifdef OCC_HAVE_HISTORY
Handle(BRepTools_History) history = builder.History ();
for (auto & s : shapes)
@ -397,6 +392,7 @@ 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,6 +420,7 @@ 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();
});