From c032ad58cae3716b6d95f87dd3ef6fe3477a6fe8 Mon Sep 17 00:00:00 2001 From: Christopher Lackner Date: Mon, 26 Aug 2024 16:37:50 +0200 Subject: [PATCH] add property setter for index and edgenr for segment --- libsrc/meshing/python_mesh.cpp | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/libsrc/meshing/python_mesh.cpp b/libsrc/meshing/python_mesh.cpp index 46bd540a..1e9314cb 100644 --- a/libsrc/meshing/python_mesh.cpp +++ b/libsrc/meshing/python_mesh.cpp @@ -568,14 +568,24 @@ DLL_HEADER void ExportNetgenMeshing(py::module &m) li.append (py::cast(self.surfnr2)); return li; })) - .def_property_readonly("index", FunctionPointer([](const Segment &self) -> size_t - { - return self.si; - })) - .def_property_readonly("edgenr", FunctionPointer([](const Segment & self) -> size_t - { - return self.edgenr; - })) + .def_property("index", + [](const Segment &self) -> size_t + { + return self.si; + }, + [](Segment& self, int index) + { + self.si = index; + }) + .def_property("edgenr", + [](const Segment & self) -> size_t + { + return self.edgenr; + }, + [](Segment& self, int edgenr) + { + self.edgenr = edgenr; + }) .def_property("singular", [](const Segment & seg) { return seg.singedge_left; }, [](Segment & seg, double sing) { seg.singedge_left = sing; seg.singedge_right=sing; })