mirror of
https://github.com/NGSolve/netgen.git
synced 2025-01-23 11:20:34 +05:00
OCC versions compatibility
This commit is contained in:
parent
dd1c130721
commit
d01bde60f6
@ -20,6 +20,14 @@
|
|||||||
#include <TDF_Attribute.hxx>
|
#include <TDF_Attribute.hxx>
|
||||||
#include <Standard_GUID.hxx>
|
#include <Standard_GUID.hxx>
|
||||||
|
|
||||||
|
#if OCC_VERSION_MAJOR>=7 && OCC_VERSION_MINOR>=2
|
||||||
|
#define OCC_HAVE_HISTORY
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if OCC_VERSION_MAJOR>=7 && OCC_VERSION_MINOR>=4
|
||||||
|
#define OCC_HAVE_DUMP_JSON
|
||||||
|
#endif
|
||||||
|
|
||||||
using namespace netgen;
|
using namespace netgen;
|
||||||
|
|
||||||
namespace netgen
|
namespace netgen
|
||||||
@ -85,6 +93,7 @@ DLL_HEADER void ExportNgOCC(py::module &m)
|
|||||||
builder.Perform();
|
builder.Perform();
|
||||||
cout << "glued together" << endl;
|
cout << "glued together" << endl;
|
||||||
|
|
||||||
|
#ifdef OCC_HAVE_HISTORY
|
||||||
Handle(BRepTools_History) history = builder.History ();
|
Handle(BRepTools_History) history = builder.History ();
|
||||||
|
|
||||||
for (auto & s : shapes)
|
for (auto & s : shapes)
|
||||||
@ -95,6 +104,7 @@ 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
|
||||||
|
|
||||||
auto geo = make_shared<OCCGeometry> (builder.Shape());
|
auto geo = make_shared<OCCGeometry> (builder.Shape());
|
||||||
ng_geometry = geo;
|
ng_geometry = geo;
|
||||||
@ -278,7 +288,9 @@ DLL_HEADER void ExportNgOCC(py::module &m)
|
|||||||
.def("__str__", [] (const TopoDS_Shape & shape)
|
.def("__str__", [] (const TopoDS_Shape & shape)
|
||||||
{
|
{
|
||||||
stringstream str;
|
stringstream str;
|
||||||
|
#ifdef OCC_HAVE_DUMP_JSON
|
||||||
shape.DumpJson(str);
|
shape.DumpJson(str);
|
||||||
|
#endif // OCC_HAVE_DUMP_JSON
|
||||||
return str.str();
|
return str.str();
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -316,6 +328,7 @@ DLL_HEADER void ExportNgOCC(py::module &m)
|
|||||||
// return BRepAlgoAPI_Common(shape1, shape2).Shape();
|
// return BRepAlgoAPI_Common(shape1, shape2).Shape();
|
||||||
|
|
||||||
BRepAlgoAPI_Common builder(shape1, shape2);
|
BRepAlgoAPI_Common builder(shape1, shape2);
|
||||||
|
#ifdef OCC_HAVE_HISTORY
|
||||||
Handle(BRepTools_History) history = builder.History ();
|
Handle(BRepTools_History) history = builder.History ();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -340,6 +353,7 @@ DLL_HEADER void ExportNgOCC(py::module &m)
|
|||||||
for (auto s : modlist)
|
for (auto s : modlist)
|
||||||
OCCGeometry::global_shape_names[s.TShape()] = name;
|
OCCGeometry::global_shape_names[s.TShape()] = name;
|
||||||
}
|
}
|
||||||
|
#endif // OCC_HAVE_HISTORY
|
||||||
|
|
||||||
return builder.Shape();
|
return builder.Shape();
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user