[Gmsh] Remeshing of STL file fails

Bruno bruno.agostini at gmail.com
Mon Mar 9 19:04:36 CET 2020


Dear Christophe,

Thank you very much for your answer, that was very helpful. I managed to 
improve the quality of the STL quite a lot, and that allowed gmsh to 
mesh properly the model even without reparametrization. (gmsh seems to 
be OK even with a couple of self-intersections left).

I also found the "regularization of high order elements" in high order 
tools to be very effective to allow gmsh to 3D mesh my STLs.

I was looking in the demos and examples a script that would reproduce 
this, but I could not find one. Is there such a script?

Thank you for creating gmsh, that's an awesome tool!

Bruno


On 08.03.20 20:39, Christophe Geuzaine wrote:
>
> 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 
>> <mailto: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 <mailto: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/20200309/a1e7d1b3/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/20200309/a1e7d1b3/attachment-0001.png>


More information about the gmsh mailing list