From 8b2a2340e7c8422fc94f6cdd90bce2154b1b0354 Mon Sep 17 00:00:00 2001 From: Christopher Lackner Date: Mon, 13 Sep 2021 18:15:50 +0200 Subject: [PATCH] Multiplication of ListOfShapes to find common shapes --- libsrc/occ/python_occ_shapes.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/libsrc/occ/python_occ_shapes.cpp b/libsrc/occ/python_occ_shapes.cpp index aadda7d8..0983721b 100644 --- a/libsrc/occ/python_occ_shapes.cpp +++ b/libsrc/occ/python_occ_shapes.cpp @@ -101,6 +101,15 @@ public: } return maxshape; } + ListOfShapes operator*(const ListOfShapes& other) const + { + ListOfShapes common; + for(const auto& shape : (*this)) + for(const auto& shape_o : other) + if(shape.IsSame(shape_o)) + common.push_back(shape); + return common; + } }; @@ -1451,6 +1460,7 @@ DLL_HEADER void ExportNgOCCShapes(py::module &m) selected.push_back(s); return selected; }) + .def(py::self * py::self) .def("Sorted",[](ListOfShapes self, gp_Vec dir) {