A note on NetGen

People use this famous open-sourced mesher as a cost-efficient (well, just free) tool for quality mesh generation. At some point we also felt the urge to have a fancy mesher instead of the low-poly faceter provided with OpenCascade.

NetGen rocks.

Here is the Tcl script that generates meshes for all STEP files in a folder:

This script iterates all STEP files in a directory and attempts to generate surface meshes for them. The idea behind this script was to pressure-test the mesher and see how reliable, fast and accurate it is. The result was not Okay: NetGet just hits jackpot. It is slow, unreliable, and not accurate. I don’t know how folks from Salome and other teams handle it or if they apply some therapy on the vanilla NetGen. I’m almost convinced that this mesher is barely usable in industrial projects, at least in batch processes, where punctual success is nothing. Quite often NetGen stalls on moderate-size models or finishes with some fancy exceptions like this:

NetGen rocks all the time.

As for accuracy, the visually appealing meshes are not as perfect as they pretend to be. The precision loss is especially visible at round holes. For example, instead of sweeping a constant polygonal pattern along a bore, NetGen randomly distorts the corresponding cylinder, maybe for the sake of a better aspect ratio. The later property is kind of desired for finite element simulations. But, in less-demanding computer graphics it is the shape that dominates the party. Such issues might remain unnoticed until you start using such meshes for computations that require high accuracy (e.g., manufacturability tests).

NetGen accuracy is not perfect.

The batch job scripted above aims at checking the meshes analytically, without any visual assessment. That’s where Analysis Situs CLI (Command Line Interface) can help: no UI, no 3D, just computation.

Analysis Situs CLI.

Batch processing is a headless thing. We can analytically verify if a mesh is good or broken by running check-facets command of Analysis Situs. A good mesh should not contain any dangling elements, like free edges or vertices. Neither it should expose any degenerated triangles or inconsistent normal fields.

Corrupted mesh.

Just to conclude on this topic: take care to get (buy) a good mesher. There are companies that ground their entire business on developing and maintaining quality grid generators. It would probably be wise to invest into a mesher to avoid surprises later on. Still, I do not really want to pick on NetGen as a product that much. It is open-sourced and it can work well in interactive workflows where you’re working with a single part without much automation.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store