IGES import with NGS-Py possible?

Hi everybody,
Just a simple question, is it possible to import IGES (or STL, STEP, whatever) data into Netgen using the Python interface? I couldn’t find anything in the documentation nor in the forum.
Thanks in advance for any response
Ingo

Hi ingo,

Maybe this will help:

import netgen.stl as stl
geo2 = stl.LoadSTLGeometry("input.stl")
m2 = geo2.GenerateMesh (maxh=0.05)

Best,
Dow

If you’ve compiled netgen with occ support (or used one of the installers) then you can load step files as well:

from netgen import NgOCC
geo = NgOCC.LoadOCCGeometry("geo.step")

Best
Christopher

I do the following and everything works well:

from netgen import NgOCC geo1 = NgOCC.OCCGeometry("geo1.stp") geo2 = NgOCC.OCCGeometry("geo2.stp")

But when I try to do this

final = geo1 - geo2

Netgen gives an error “unsupported operand type for -”.

Is it possible to work with STEP geometry using the Python interface?

Thanks in advance for any response.

Hi, manipulating step geometries is not possible in NGSolve. You need to use a geometric modeller for that (for example open source tool Opencascade). Then you can load the final geometry and mesh it using Netgen.