From f53dad83aec59c9893b40b5bad3ef423478380dd Mon Sep 17 00:00:00 2001 From: Matthias Hochsteger Date: Wed, 1 Sep 2021 14:38:45 +0200 Subject: [PATCH] layer property for Solid2d --- libsrc/geom2d/csg2d.cpp | 4 ++++ libsrc/geom2d/csg2d.hpp | 7 +++++++ libsrc/geom2d/python_geom2d.cpp | 1 + 3 files changed, 12 insertions(+) diff --git a/libsrc/geom2d/csg2d.cpp b/libsrc/geom2d/csg2d.cpp index dd8cf21a..dfee7fba 100644 --- a/libsrc/geom2d/csg2d.cpp +++ b/libsrc/geom2d/csg2d.cpp @@ -2183,7 +2183,11 @@ shared_ptr CSG2d :: GenerateSplineGeometry() } } if(!is_solid_degenerated) + { geo->SetMaterial(dom, s.name); + if(s.layer != 1) + geo->SetDomainLayer(dom, s.layer); + } else dom--; // degenerated solid, use same domain index again } diff --git a/libsrc/geom2d/csg2d.hpp b/libsrc/geom2d/csg2d.hpp index afc1e654..fbe705a9 100644 --- a/libsrc/geom2d/csg2d.hpp +++ b/libsrc/geom2d/csg2d.hpp @@ -630,6 +630,7 @@ struct Solid2d { Array polys; + int layer = 1; string name = MAT_DEFAULT; Solid2d() = default; @@ -708,6 +709,12 @@ struct Solid2d return *this; } + Solid2d & Layer(int layer_) + { + layer = layer_; + return *this; + } + Box<2> GetBoundingBox() const; }; diff --git a/libsrc/geom2d/python_geom2d.cpp b/libsrc/geom2d/python_geom2d.cpp index 83e44f6c..dc14bd67 100644 --- a/libsrc/geom2d/python_geom2d.cpp +++ b/libsrc/geom2d/python_geom2d.cpp @@ -433,6 +433,7 @@ NGCORE_API_EXPORT void ExportGeom2d(py::module &m) .def("Mat", &Solid2d::Mat) .def("BC", &Solid2d::BC) .def("Maxh", &Solid2d::Maxh) + .def("Layer", &Solid2d::Layer) .def("Copy", [](Solid2d & self) -> Solid2d { return self; }) .def("Move", &Solid2d::Move)