From 69c6f55961bfc35c463793de3d6e6fcd0be60875 Mon Sep 17 00:00:00 2001 From: Christopher Lackner Date: Wed, 1 Sep 2021 12:53:39 +0200 Subject: [PATCH] Add properties .name and .maxh to ListOfShapes --- libsrc/occ/python_occ_shapes.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/libsrc/occ/python_occ_shapes.cpp b/libsrc/occ/python_occ_shapes.cpp index b2b7507f..10f79b7d 100644 --- a/libsrc/occ/python_occ_shapes.cpp +++ b/libsrc/occ/python_occ_shapes.cpp @@ -1422,6 +1422,28 @@ DLL_HEADER void ExportNgOCCShapes(py::module &m) } return CastShape(maxshape); }) + .def_property("name", [](ListOfShapes& shapes) + { + throw Exception("Cannot get property of ListOfShapes, get the property from individual shapes!"); + }, + [](ListOfShapes& shapes, std::string name) + { + for(auto& shape : shapes) + { + OCCGeometry::global_shape_properties[shape.TShape()].name = name; + } + }) + .def_property("maxh", [](ListOfShapes& shapes) + { + throw Exception("Cannot get property of ListOfShapes, get the property from individual shapes!"); + }, + [](ListOfShapes& shapes, double maxh) + { + for(auto& shape : shapes) + { + OCCGeometry::global_shape_properties[shape.TShape()].maxh = maxh; + } + }) ;