[NETGEN] Tag elements belonging to surfaces in CAD geometry

Hello! I am looking to mesh a very complex geometry that I have in a cad (step) file. After meshing I would like to export the mesh with boundary tags based on the surfaces in the original cad geometry. For example, if the shape were a cube, I would like to be able to specify that all mesh facets coming from the meshing of the “top” face of the cube have a certain tag, facets coming the “front” and “left” faces of the cube have a different tag, etcetera. The purpose of the tags is, of course, to apply boundary conditions later in my code.

I know one can tag geometry when building it with CSG but, as I said, my geometry comes from a CAD model and has thousands of faces in unknown order.
I can come up with geometric predicates to identify the surfaces I am interested into.

Is it possible to implement this with netgen? Can anyone share an example script or point me in the right direction?

I don’t care if it’s gonna be Python or C++, if I have to #include OpenCASCADE and use it directly. Everything works.

Thanks in advance for any help!
Massimiliano

yes you can do all this. There is just yet little documentation for this.

A starting point are these notebooks from the last usermeeting:
2d_occ.ipynb (17.6 KB)
3d_occ.ipynb (15.0 KB)

specifically section “Selection of shapes”

There is a bunch more stuff, if you look into the source code in netgen/libsrc/occ/python_occ_shape.cpp

If you have more specific questions feel free to ask!