diff --git a/libsrc/meshing/python_mesh.cpp b/libsrc/meshing/python_mesh.cpp index a15dfc14..5b5d28fc 100644 --- a/libsrc/meshing/python_mesh.cpp +++ b/libsrc/meshing/python_mesh.cpp @@ -606,7 +606,34 @@ DLL_HEADER void ExportNetgenMeshing(py::module &m) [](FaceDescriptor & self) -> string { return self.GetBCName(); }, [](FaceDescriptor & self, string name) { self.SetBCName(new string(name)); } // memleak ) - .def_property("color", &FaceDescriptor::SurfColour, &FaceDescriptor::SetSurfColour ) + .def_property("color", + [](const FaceDescriptor& self) + { + auto sc = self.SurfColour(); + return py::tuple(sc[0], sc[1], sc[2]); + }, + [](FaceDescriptor& self, py::tuple col) + { + Vec<4> sc = 1; + sc[0] = py::cast(col[0]); + sc[1] = py::cast(col[1]); + sc[2] = py::cast(col[2]); + if(py::len(col) > 3) + sc[3] = py::cast(col[3]); + self.SetSurfColour(sc); + } + ) + .def_property("transparency", + [](const FaceDescriptor& self) + { + return self.SurfColour()[3]; + }, + [](FaceDescriptor& self, double val) + { + auto sc = self.SurfColour(); + sc[3] = val; + self.SetSurfColour(sc); + }) ;