mirror of
https://github.com/NGSolve/netgen.git
synced 2025-01-11 21:50:34 +05:00
Return None if no color is set in shape
This commit is contained in:
parent
69025e5ef4
commit
ce8a73750e
@ -841,11 +841,11 @@ DLL_HEADER void ExportNgOCCShapes(py::module &m)
|
|||||||
hpref = max2(val, hpref);
|
hpref = max2(val, hpref);
|
||||||
}, "number of refinement levels for geometric refinement")
|
}, "number of refinement levels for geometric refinement")
|
||||||
|
|
||||||
.def_property("col", [](const TopoDS_Shape & self) {
|
.def_property("col", [](const TopoDS_Shape & self) -> py::object {
|
||||||
if(!OCCGeometry::HaveProperties(self) || !OCCGeometry::GetProperties(self).col)
|
if(!OCCGeometry::HaveProperties(self) || !OCCGeometry::GetProperties(self).col)
|
||||||
return std::vector<double>({ 0.2, 0.2, 0.2, 1. });
|
return py::none();
|
||||||
auto col = *OCCGeometry::GetProperties(self).col;
|
auto col = *OCCGeometry::GetProperties(self).col;
|
||||||
return 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::vector<double> c) {
|
||||||
Vec<4> col(c[0], c[1], c[2], 1.0);
|
Vec<4> col(c[0], c[1], c[2], 1.0);
|
||||||
if(c.size() == 4)
|
if(c.size() == 4)
|
||||||
|
Loading…
Reference in New Issue
Block a user