From c822caafe7d18f97993412f3cad8e4b8725665e3 Mon Sep 17 00:00:00 2001 From: Christopher Lackner Date: Thu, 17 Mar 2022 11:58:11 +0100 Subject: [PATCH] [occ] create solid from faces Needs shape consisting of topologically closed faces, for example from Solid(Glue(list_of_faces))` --- libsrc/occ/python_occ_shapes.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/libsrc/occ/python_occ_shapes.cpp b/libsrc/occ/python_occ_shapes.cpp index 4a4e021d..ca38c949 100644 --- a/libsrc/occ/python_occ_shapes.cpp +++ b/libsrc/occ/python_occ_shapes.cpp @@ -1453,7 +1453,20 @@ DLL_HEADER void ExportNgOCCShapes(py::module &m) return builder.Projection(); }) ; - py::class_ (m, "Solid"); + py::class_ (m, "Solid") + .def(py::init([](const TopoDS_Shape& faces) + { + BRep_Builder builder; + TopoDS_Shell shell; + builder.MakeShell(shell); + for(auto& face : GetFaces(faces)) + builder.Add(shell, face); + TopoDS_Solid solid; + builder.MakeSolid(solid); + builder.Add(solid, shell); + return solid; + }), "Create solid from shell. Shell must consist of topologically closed faces (share vertices and edges).") + ; py::class_ (m, "Compound") .def(py::init([](std::vector shapes, bool separate_layers) {