How to load *.in2d file and create in python

Hello!

I create *.in2d files from gmsh .geo files and want to create mesh in netgen.
Could you please inform me which command should i use to load *.in2d geometry in python API without GUI?

Thank you in advance!

Thanks for the reply!

Maybe I didn’t phrase it correctly.

I want to generate a mesh using Netgen via *in2d files.
NETGEN GUI has an option to load geometry *in2d files, and I just want to know if there is a way to do this using Python API in Netgen.

For example, you can load OCC geometry using the command:
geo = OCCGeometry(stp_file)

Is there similar command for *.in2d file?

1 Like

Nergen has its own in2d file which is not the same as gmesh. you can either convert it to step which netgen can read or remodel the geometry from python.
Not sure how much functionality gmsh geo files have but I think a small converter should also be possible

Thanks for your reply, Christopher!

Yes, Netgen has its own in2d files and i create them. I can load them with Netgen GUI. What I want to know is how to do the same thing not through GUI but through a Python script.

P.S. It was my mistake to write about gmsh, please forget about it.

Ahh

from netgen.geom2d import SplineGeometry
geo = SplineGeometry("geo.in2d")
mesh = geo.GenerateMesh(maxh=0.2)
mesh.Save("mesh.vol.gz")

Thank you so much!

Just what I needed!