Netgen - OpenCascade Geometry

Hello Netgen-Community,

we have now a Python wrapper for OCCT modeling within Netgen !

It is available in recent nightly versions, and you can find the docs here:

In the wrapper we aim in bringing most of the structure of OCCT to Python. If you are familiar with the C++ interface of Open Cascade you will recognize many classes.

The wrapper is work in progress, more features will come in in near future.

Your feedback is warmly welcome. Please let us know if you are missing features from OCCT in the Py-interface.

Enjoy the new possibilities !


Hi Joachim,

the documentation looks really promising. I am looking forward to future features in this direction.
Unfortanetly the new version is not yet available via conda. It would be great if this could be done soon.

Best regards and thanks a lot for your work

Hi, you can try it using the nightly version of netgen+ngsolve available on conda via tha package ngsolve-nightly.


Also the latest nightly seems to be a version prior to the OCC python wrapper. Conda says the latest ngsolve-nightly is version 6.2.2103.98 and the latest netgen-nightly is 6.2.2103.80. In the documentation, it looks like you are using 6.2.2104.XX.
Best regards

Hi Nils,

Thanks for the hint. The upload of new nightly builds was blocked due to limited storage on anaconda. This issue is resolved (some old versions were removed), a new version should be available within the next three hours.


Hi Joachim,

That is a great feature, thanks for the implementation!
I tried to reimplement some of my SALOME scripts using the new feature.
I found that revolutions were only possible for faces.
OpenCascade allows one to revolve also edges and wires.
I’d suggest to include this in the interface.
My own patch (without much knowledge of the OCC interface) is in a PR on github.
I tested it locally but please consider the PR only as a suggestion and not a well-developed patch.


Hi Julius,

thank you for the feature request, it was very easy to add. We can now revolve all kind of shapes OCC supports. It’s available in the latest nightly.

That is the kind of feedback which is now most helpful.

Best, Joachim

It would be great if we could also generate 2D geometries with OCCGeometry.

from netgen.occ import *
import ngsolve

geometry = WorkPlane().Line(1).Rotate(90).Line(1).Rotate(90).Line(1).Close().Face()
mesh = ngsolve.Mesh(OCCGeometry(geometry).GenerateMesh())

leads to a 3D mesh where problems occur if the specialcf.normal is calculated.

Best regards

Hi Nils,

yes, this is already available:

OCCGeometry(geometry, dim=2)

The occ-geometry is always 3D. With dim=2 the faces are the volumes, and edges are boundaries.

Here is also a very recent example:

Best, Joachim