diff --git a/libsrc/csg/csgeom.hpp b/libsrc/csg/csgeom.hpp index c419c9a4..f5cb21a4 100644 --- a/libsrc/csg/csgeom.hpp +++ b/libsrc/csg/csgeom.hpp @@ -367,6 +367,11 @@ namespace netgen NgArray bcmodifications; + + map, string> named_edges; + + + virtual int GenerateMesh (shared_ptr & mesh, MeshingParameters & mparam) override; void AddSplineSurface (shared_ptr ss) { spline_surfaces.Append(ss); } diff --git a/libsrc/csg/edgeflw.cpp b/libsrc/csg/edgeflw.cpp index ab736f91..d89e2fd9 100644 --- a/libsrc/csg/edgeflw.cpp +++ b/libsrc/csg/edgeflw.cpp @@ -485,6 +485,29 @@ namespace netgen layer, mesh); } + + + { + // named edge ? + // cout << "check edge name, size = " << geometry.named_edges.size() << endl; + // for (auto pair : geometry.named_edges) + // cout << "key = " << get<0> (pair.first) << "-" << get<1> (pair.first) << ", val = " << pair.second << endl; + + Surface * sp1 = const_cast (geometry.GetSurface(s1)); + Surface * sp2 = const_cast (geometry.GetSurface(s2)); + // cout << "sp1 = " << sp1 << ", sp2 = " << sp2 << endl; + + auto ptr = geometry.named_edges.find(tuple(sp1, sp2)); + if (ptr != geometry.named_edges.end()) + for (int i = 0; i < refedges.Size(); i++) + mesh.SetCD2Name(refedges[i].edgenr, ptr->second); + + ptr = geometry.named_edges.find(tuple(sp2, sp1)); + if (ptr != geometry.named_edges.end()) + for (int i = 0; i < refedges.Size(); i++) + mesh.SetCD2Name(refedges[i].edgenr, ptr->second); + } + for(int i=0; i(geometry.GetSurface(refedges[i].surfnr1)); diff --git a/libsrc/csg/python_csg.cpp b/libsrc/csg/python_csg.cpp index c5616e5c..a48475e0 100644 --- a/libsrc/csg/python_csg.cpp +++ b/libsrc/csg/python_csg.cpp @@ -569,7 +569,16 @@ However, when r = 0, the top part becomes a point(tip) and meshing fails! py::arg("solid1"), py::arg("solid2"), py::arg("trafo")=Transformation<3>(Vec<3>(0,0,0)) ) - + .def("NameEdge", [] (CSGeometry & self, shared_ptr s1, shared_ptr s2, string name) + { + Array surfs1, surfs2; + s1->GetSolid()->ForEachSurface( [&surfs1] (Surface * s, bool inv) { surfs1.Append(s); }); + s2->GetSolid()->ForEachSurface( [&surfs2] (Surface * s, bool inv) { surfs2.Append(s); }); + for (auto s1 : surfs1) + for (auto s2 : surfs2) + self.named_edges[tuple(s1,s2)] = name; + }) + .def("AddPoint", [] (CSGeometry & self, Point<3> p, int index) -> CSGeometry& { self.AddUserPoint(CSGeometry::UserPoint(p, index));