From ca0201b30185c05a6f455252d44f3ba2cf4e1737 Mon Sep 17 00:00:00 2001 From: Joachim Schoeberl Date: Sun, 25 Jul 2021 01:26:09 +0200 Subject: [PATCH] OCCGeometry from list of shapes --- libsrc/occ/python_occ.cpp | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/libsrc/occ/python_occ.cpp b/libsrc/occ/python_occ.cpp index 385e35b2..ecd0f7d1 100644 --- a/libsrc/occ/python_occ.cpp +++ b/libsrc/occ/python_occ.cpp @@ -70,11 +70,33 @@ DLL_HEADER void ExportNgOCC(py::module &m) geo->BuildFMap(); geo->CalcBoundingBox(); - // PrintContents (geo); - cout << "bounding box = " << geo->GetBoundingBox() << endl; return geo; }), py::arg("shape"), "Create Netgen OCCGeometry from existing TopoDS_Shape") + + .def(py::init([] (const std::vector shapes) + { + BOPAlgo_Builder aBuilder; + + // Setting arguments + TopTools_ListOfShape aLSObjects; + /* + for (TopExp_Explorer exp_solid(shape, TopAbs_SOLID); exp_solid.More(); exp_solid.Next()) + aLSObjects.Append (exp_solid.Current()); + */ + for (auto & s : shapes) + aLSObjects.Append (s); + aBuilder.SetArguments(aLSObjects); + aBuilder.Perform(); + + auto geo = make_shared (aBuilder.Shape()); + ng_geometry = geo; + geo->BuildFMap(); + geo->CalcBoundingBox(); + return geo; + }), py::arg("shape"), + "Create Netgen OCCGeometry from existing TopoDS_Shape") + .def(py::init([] (const string& filename) { shared_ptr geo;