Determine CAD patch/surface of the surface element from Ng_mesh


When using multiple CAD/STL patches to mesh a geometry, we can loop over faces using list obtained via Ng_GetSurfaceElement() from nglib C++ API, however I am unable to determine the CAD patch number/name associated with a given face from this list.

How can one obtain this information regarding each face?


the index in the surface element gives you the facedescriptor index. And in the facedescriptor the surfnr tells you the shape number in the faces array that holds the shape.

For stl the info is in the geompointinfo, for each point of the surface element there is the info in which stl triangle it is located.

I am unable to determine any functions in the C++ api to yield the face descriptor info for a given surface element.

I was able to use GeomInfo after adding functionality to api and re-compiling the library, however, the point based info does not appear to be a accurate mapping of surface elements to surface number.

The api is legacy and not really maintained. Just build your own interface using the netgen c++ classes.

The mesh has GetFaceDescriptor(Element2d) and then the resulting facedescriptor has GetSurfNr

1 Like