[Gmsh] Remeshing of STL file fails

Christophe Geuzaine cgeuzaine at uliege.be
Sun Mar 8 20:39:42 CET 2020


Dear Bruno,

It seems to work as expected here with Gmsh 4.5.4:

gmsh test0.stl -reparam 30
gmsh test0.msh -clmin 1 -clmax 1 -2

The resulting mesh is self-intersecting though, since the input STL is as well.

Christophe




> On 8 Mar 2020, at 20:30, Bruno <bruno.agostini at gmail.com> wrote:
> 
> Dear Gmsh users,
> 
> I am trying to remesh the STL file here attached, but after many trials I did not manage to make a working python script.
> 
> I used this base script:
> 
> """
> 
> import math
> import gmsh
> 
> gmsh.initialize()
> gmsh.option.setNumber("General.Terminal", 1)
> gmsh.option.setNumber("Mesh.Algorithm", 6)
> gmsh.option.setNumber("Mesh.Algorithm3D", 1)
> gmsh.option.setNumber("Mesh.CharacteristicLengthMin", 0.15/4)
> gmsh.option.setNumber("Mesh.CharacteristicLengthMax", 0.5*4)
> 
> gmsh.merge("test0.stl")
> 
> model = gmsh.model
> model.mesh.createTopology()
> model.mesh.classifySurfaces(0*math.pi/180, True, True, curveAngle = math.pi)
> model.mesh.createGeometry()
> 
> s = model.getEntities(2)
> l = model.geo.addSurfaceLoop([s[i][1] for i in range(len(s))])
> model.geo.addVolume([l])
> model.geo.synchronize()
> 
> model.mesh.reclassifyNodes()
> 
> model.mesh.generate(3)
> 
> gmsh.write("test0.msh")
> gmsh.fltk.run()
> gmsh.finalize()
> 
> """
> 
> with various combinations of LengthMin and LengthMax values, refine(), reclassifyNodes(), but I always get a "Could not recover boundary mesh: error 2" error (log attached).
> 
> Does that mean:
> 
> 1- my STL file if of insufficient quality (I this case, what should be improved?)
> 
> 2- I am not using the right gmsh options?
> 
> 3- gmsh is not the right tool to mesh this kind of model?
> 
> I would be grateful if somebody can point me to right direction.
> 
> 
> Best regards
> 
> Bruno
> 
> 
> <test0.zip><log.zip>_______________________________________________
> gmsh mailing list
> gmsh at onelab.info
> http://onelab.info/mailman/listinfo/gmsh

— 
Prof. Christophe Geuzaine
University of Liege, Electrical Engineering and Computer Science 
http://www.montefiore.ulg.ac.be/~geuzaine



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://onelab.info/pipermail/gmsh/attachments/20200308/fb73dbe6/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.png
Type: image/png
Size: 292511 bytes
Desc: not available
URL: <http://onelab.info/pipermail/gmsh/attachments/20200308/fb73dbe6/attachment-0001.png>


More information about the gmsh mailing list