separate_layers now also working for 2d occ geometries

This commit is contained in:
Christopher Lackner 2023-06-28 15:59:04 +02:00
parent fffe1831a3
commit 143f113d78
2 changed files with 18 additions and 3 deletions

View File

@ -486,13 +486,21 @@ namespace netgen
int maxlayer = 1;
int dom = 0;
for (TopExp_Explorer e(geom.GetShape(), TopAbs_SOLID); e.More(); e.Next(), dom++)
for(const auto& s : GetSolids(geom.GetShape()))
{
auto& props = OCCGeometry::GetProperties(e.Current());
if(!OCCGeometry::HaveProperties(s))
continue;
auto& props = OCCGeometry::GetProperties(s);
maxhdom[dom] = min2(maxhdom[dom], props.maxh);
maxlayer = max2(maxlayer, props.layer);
dom++;
}
for(const auto& f : GetFaces(geom.GetShape()))
if(OCCGeometry::HaveProperties(f))
maxlayer = max2(maxlayer, OCCGeometry::GetProperties(f).layer);
for(const auto& e : GetEdges(geom.GetShape()))
if(OCCGeometry::HaveProperties(e))
maxlayer = max2(maxlayer, OCCGeometry::GetProperties(e).layer);
mesh.SetMaxHDomain (maxhdom);

View File

@ -846,6 +846,13 @@ DLL_HEADER void ExportNgOCCShapes(py::module &m)
col[3] = c[3];
OCCGeometry::GetProperties(self).col = col;
}, "color of shape as RGB - tuple")
.def_property("layer", [](const TopoDS_Shape& self) {
if (!OCCGeometry::HaveProperties(self))
return 1;
return OCCGeometry::GetProperties(self).layer;
}, [](const TopoDS_Shape& self, int layer) {
OCCGeometry::GetProperties(self).layer = layer;
}, "layer of shape")
.def("UnifySameDomain", [](const TopoDS_Shape& shape,
bool edges, bool faces,
bool concatBSplines)