mirror of
https://github.com/NGSolve/netgen.git
synced 2025-05-24 11:10:50 +05:00
allow set color = None occ shapes, set shape itself, not children
This commit is contained in:
parent
299fdbafdf
commit
558f6815ec
@ -940,13 +940,16 @@ DLL_HEADER void ExportNgOCCShapes(py::module &m)
|
|||||||
return py::none();
|
return py::none();
|
||||||
auto col = *OCCGeometry::GetProperties(self).col;
|
auto col = *OCCGeometry::GetProperties(self).col;
|
||||||
return py::cast(std::vector<double>({ col(0), col(1), col(2), col(3) }));
|
return py::cast(std::vector<double>({ col(0), col(1), col(2), col(3) }));
|
||||||
}, [](const TopoDS_Shape & self, std::vector<double> c) {
|
}, [](const TopoDS_Shape & self, std::optional<std::vector<double>> c) {
|
||||||
Vec<4> col(c[0], c[1], c[2], 1.0);
|
if(c.has_value())
|
||||||
if(c.size() == 4)
|
{
|
||||||
col[3] = c[3];
|
Vec<4> col((*c)[0], (*c)[1], (*c)[2], 1.0);
|
||||||
OCCGeometry::GetProperties(self).col = col;
|
if(c->size() == 4)
|
||||||
for(auto & s : GetHighestDimShapes(self))
|
col[3] = (*c)[3];
|
||||||
OCCGeometry::GetProperties(s).col = col;
|
OCCGeometry::GetProperties(self).col = col;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
OCCGeometry :: GetProperties(self).col = nullopt;
|
||||||
}, "color of shape as RGB - tuple")
|
}, "color of shape as RGB - tuple")
|
||||||
.def_property("layer", [](const TopoDS_Shape& self) {
|
.def_property("layer", [](const TopoDS_Shape& self) {
|
||||||
if (!OCCGeometry::HaveProperties(self))
|
if (!OCCGeometry::HaveProperties(self))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user