Menu

Save a surface mesh in STL format with Nglib

Help
2018-02-13
2018-02-19
  • Sushrut Pavanaskar

    Hi, I am trying to use Nglib to do some surface mesh regeneration. At the end of the day, I want to save the surface mesh it created into an STL format. I tried using Ng_SaveMesh but it creates a text format that is not STL (looks like its .vol). Can I do this using any call in Nglib? Basically, its the functionality in GUI where one first sets the "Export format" to STL and then uses Export Mesh. Thanks!

     
  • Christoph Wintersteiger

    Hi,

    you could use a python script

    from netgen.geom2d import unit_square
    
    mesh = unit_square.GenerateMesh(maxh=0.1)
    mesh.Export("mesh.stl","STL Format")
    

    This should have the same behavior as the Export Mesh in the GUI.
    There is also a "STL Extended Format".

    For further questions please use the forum on the NGSolve homepage.

    Regards
    Christoph

     

Log in to post a comment.