Added support for using TopoDS_Shape directly

This commit is contained in:
adam-urbanczyk 2020-06-30 21:56:26 +02:00
parent 2800d6c291
commit 242fb6caff
3 changed files with 26 additions and 0 deletions

View File

@ -1670,6 +1670,23 @@ namespace netgen
return occgeo;
}
OCCGeometry *FromOCC (const TopoDS_Shape& s)
{
OCCGeometry * occgeo;
occgeo = new OCCGeometry;
occgeo->shape = s;
occgeo->face_colours = Handle_XCAFDoc_ColorTool();
occgeo->face_colours.Nullify();
occgeo->changed = 1;
occgeo->BuildFMap();
occgeo->CalcBoundingBox();
PrintContents (occgeo);
return occgeo;
}
void OCCGeometry :: Save (string sfilename) const
{

View File

@ -452,6 +452,8 @@ namespace netgen
DLL_HEADER OCCGeometry * LoadOCC_IGES (const char * filename);
DLL_HEADER OCCGeometry * LoadOCC_STEP (const char * filename);
DLL_HEADER OCCGeometry * LoadOCC_BREP (const char * filename);
DLL_HEADER OCCGeometry * FromOCC (const TopoDS_Shape& s);
// Philippose - 31.09.2009
// External access to the mesh generation functions within the OCC

View File

@ -65,6 +65,13 @@ DLL_HEADER void ExportNgOCC(py::module &m)
return geo;
}), py::arg("filename"),
"Load OCC geometry from step, brep or iges file")
.def(py::init([] ( const TopoDS_Shape* s)
{
shared_ptr<OCCGeometry> geo;
geo.reset(FromOCC(*s));
return geo;
}), py::arg("shape"),
"Load OCC geometry from an existing TopoDS_Shape object")
.def(NGSPickle<OCCGeometry>())
.def("Glue", &OCCGeometry::GlueGeometry)
.def("Heal",[](OCCGeometry & self, double tolerance, bool fixsmalledges, bool fixspotstripfaces, bool sewfaces, bool makesolids, bool splitpartitions)