diff --git a/libsrc/occ/occ_utils.hpp b/libsrc/occ/occ_utils.hpp index 85ae0ad1..67050d3e 100644 --- a/libsrc/occ/occ_utils.hpp +++ b/libsrc/occ/occ_utils.hpp @@ -230,13 +230,13 @@ namespace netgen bool openmin = false, openmax = false; DirectionalInterval (gp_Vec adir) : dir(adir) { ; } - DirectionalInterval (const DirectionalInterval & i2) - : dir(i2.dir), minval(i2.minval), maxval(i2.maxval) { ; } + DirectionalInterval (const DirectionalInterval & i2) = default; DirectionalInterval operator< (double val) const { DirectionalInterval i2 = *this; i2.maxval = val; + i2.openmax = true; return i2; } @@ -244,9 +244,25 @@ namespace netgen { DirectionalInterval i2 = *this; i2.minval = val; + i2.openmin = true; return i2; } + DirectionalInterval operator<= (double val) const + { + DirectionalInterval i2 = *this; + i2.maxval = val; + i2.openmax = false; + return i2; + } + + DirectionalInterval operator>= (double val) const + { + DirectionalInterval i2 = *this; + i2.minval = val; + i2.openmin = false; + return i2; + } DirectionalInterval Intersect (const DirectionalInterval & i2) { diff --git a/libsrc/occ/python_occ_basic.cpp b/libsrc/occ/python_occ_basic.cpp index 276e783e..05fdb1ee 100644 --- a/libsrc/occ/python_occ_basic.cpp +++ b/libsrc/occ/python_occ_basic.cpp @@ -103,6 +103,14 @@ DLL_HEADER void ExportNgOCCBasic(py::module &m) cout << IM(6) << "vec, gt v - " << netgen::occ2ng(v) << ", val = " << val << endl; return DirectionalInterval(v) > val; }) + .def("__le__", [](gp_Vec v, double val) + { + return DirectionalInterval(v) <= val; + }) + .def("__ge__", [](gp_Vec v, double val) + { + return DirectionalInterval(v) >= val; + }) ; py::class_(m, "gp_Dir", "3d OCC direction") diff --git a/libsrc/occ/python_occ_shapes.cpp b/libsrc/occ/python_occ_shapes.cpp index 7f5ba84b..fc3a99bb 100644 --- a/libsrc/occ/python_occ_shapes.cpp +++ b/libsrc/occ/python_occ_shapes.cpp @@ -1589,7 +1589,7 @@ DLL_HEADER void ExportNgOCCShapes(py::module &m) { ListOfShapes selected; for (auto s : self) - if (interval.Contains(Center(s))) + if (interval.Contains(Center(s), GetBoundingBox(s).Diam() * 1e-7)) selected.push_back(s); return selected; })