Setting up a sequence for meshing a .step file

Hello, I am very new to Netgen/NGSolve and am curious if the following is possible: I have a 3D .step geometry with a void inside (a solid sphere with a small cube cut out of the middle of it - see attached). So far I can import this geometry into netgen with a python script and mesh the volume. I would like to first mesh the surface of the cube with a very refined mesh and let that surface mesh seed the volume mesh (with elements growing in size away from the cube). Is it possible to sequence a meshing process like this using a python script? If so, can you point me to where I could find the syntax? Thanks.


From other threads I found some basic information in help queries within Python 3.7. I’m using Jupyter so in my case I ran:


in the output window a box comes up in which you can enter the help search term. I found some basic documenation with the following searches:


Based on these sources I came up with the following code:

from netgen.occ import *

geo = OCCGeometry('C:/00_Temp/SphereMinusCube.step')

for x in range(1,7):
mesh = geo.GenerateMesh(maxh = 50,grading = 0.5)

#mesh.Save('C:/00_Temp/SphereMinusCube.vol')from netgen.occ import *

A couple of follow-up questions:

  1. How do I assign faces 1 through 7 of the .step file to a boundary condition (for example, bc1) and assign face 0 of the .step file to a second boundary condition (bc2)?

  2. Is there a command that will return the number of faces in a .step model?

  3. Is there a command that will return the surface mesh information for a specific surface (i.e. number of triangle elements etc.)?