[Gmsh] Doubt about meshing closed STL shell

MA Ariza-Gracia miguel.ariza at artorg.unibe.ch
Wed Nov 6 09:24:58 CET 2019


Dear Dr Geuzaine,

I didn't check this example before sending the previous one.

I tried to adapt the previous python script to cope with the geometrical 
tolerance and the re-meshing. Now, it raises a "segmentation fault" 
error but it recognizes the nodes in the boundary and removes the 
duplicates.

Info    : Reading 'inclusion-1.stl'...
Info    : 15045 facets in solid 0 Created by Gmsh
Info    : Done reading 'inclusion-1.stl'
Info    : Reading 'inclusion-2.stl'...
Info    : 15045 facets in solid 0 Created by Gmsh
Info    : Done reading 'inclusion-2.stl'
Info    : Removing duplicate mesh vertices...
Info    : Found 255 duplicate vertices
Info    : Removed 255 duplicate mesh vertices
Info    : Done removing duplicate mesh vertices
Info    : Classifying surfaces (angle: 30)...
Info    : Found 1 model faces
Info    : Found 0 model edges
Info    : Done classifying surfaces (0.163405 s)
Info    : Creating geometry of discrete curves...
Info    : Done creating geometry of discrete curves (2e-06 s)
Info    : Creating geometry of discrete surfaces...
Segmentation fault (core dumped)

Enclosed a zip folder with the updated script

Best,

MA

On 05/11/2019 17:07, Christophe Geuzaine wrote:
> I've added a small example in demos/api showing how I would solve this problem:
>
> https://gitlab.onelab.info/gmsh/gmsh/blob/master/demos/api/glue_and_remesh_stl.py
>
> Christophe
>
>
>
>> On 5 Nov 2019, at 16:19, Christophe Geuzaine <cgeuzaine at uliege.be> wrote:
>>
>> Can you send the 2 STLs (I don't see them in the zip)?
>>
>> Christophe
>>
>>> On 1 Nov 2019, at 11:30, MA Ariza-Gracia <miguel.ariza at artorg.unibe.ch> wrote:
>>>
>>> Dear Dr Geuzaine, Dr Remacle, and the Gmsh community,
>>>
>>> first of all, thank you for sharing the software with us! I'm a postdoc working (mostly) in optics and I need to reconstruct some free-shape surfaces.
>>>
>>> My final goal is to create a volume mesh enclosed by two discrete STL surfaces (given by a point cloud). The pipeline to do so is as follows:
>>> 1) Read point clouds and triangulate using Delaunay (scipy.spatial)
>>>
>>> 2) Create a 2 discrete surfaces giving the node coordinates and the connectivity of the triangles
>>>
>>> 3) Create a volume using a surface loop on both surfaces
>>>
>>> 4) Mesh the volume
>>>
>>> 5) Exporting the mesh to Abaqus/LS-Dyna (whatever software)
>>>
>>>
>>>
>>> After reading the manual, tutorials and mailing list, the only approached that worked was the next one: having a single closed shell joining 'manually' the nodes in the boundary. I say manually because I needed to implement the substitution of the nodes myself and I couldn't do it using Gmsh using removeDuplicate and so on (i.e., I didn't know how to do it). After having a single closed shell without duplicate nodes and with the normals pointing outwards, I manage to mesh the volume inside the models (see manually-merged-thick.msh and manually-merged-thin.msh).
>>>
>>>
>>>
>>> However, as this is my first approach to Gmsh, this is not efficient and I would like to know if:
>>>
>>> 1) There is a more efficient procedure to, given two different STLs, mesh the volume enclosed by the two of them (as I said, I tried may approaches including the ones regarding Earth topology reconstruction in the mail list, but I couldn't find a proper solution).
>>>
>>> 2) There is a way of both remeshing the STLs AND meshing the volume at the same time. In one of the approaches, I parameterized the discrete STL surfaces with classifySurfaces and createGeometry (see the Jupyter notebook, three first attempts). This allowed me to re-mesh the STL surfaces but, unfortunately, I could not mesh the volume after (complaining about 0 elements in the volume). As my Delaunay triangulation is quite ugly, this would be my preferred option if you could give me a hint on how to proceed.
>>>
>>> 3) In the end, I will have two surfaces: one main surface with one inclusion inside itself. From what I've read, I know I cannot do Boolean operations (as I'm using meshes and discrete elements), so I would appreciate any hint on how to proceed in this regard.
>>>
>>>
>>>
>>> Files enclosed in compressed folder 'inquiry-gmsh.zip':
>>>
>>> 	• try-inquiry.ipynb: Jupyter notebook with the API code to create the surfaces
>>> 	• {anterior-lenticle-surface.txt, posterior-lenticle-surface.txt}: files containing the Cartesian point cloud
>>> 	• After running the code, it will generate:
>>> 		• thin-1.stl, thin-2.stl: surfaces used to generate the convex-convex thin lens
>>> 		• surface-1.stl, surface-2.stl: surfaces used to generate the concave-convex thick lens
>>> 		• shell-thin-lens.msh: attempt to mesh the volume of the thin mesh using: i) Two different STL surfaces (gmsh.merge); ii) remove duplicate coincident nodes (gmsh.removeDuplicateNodes); and iii) re-parameterizing
>>> 		• shell-concave2convex.msh: attempt to do the same as the previous one but with the thick lens (-> discard problems with sharp edges in the periphery)
>>> 		• merged-shell-concave2convex.msh: attempt to mesh the volume of the thick lens using: i) One single STL surface with duplicated nodes in the boundary; ii) Remove duplicated nodes using removeDuplicateNodes; iii) and classify surfaces + creating geometry
>>> 		• manually-merged-thick.msh and manually-merged-thin.msh: success BUT: i) I needed to remove myself the duplicated nodes; ii) If I try to parameterize the surface, I cannot mesh the volume inside but only the surfaces.
>>>
>>>
>>> Versions used:
>>>
>>>
>>> - Ubuntu 18.04
>>>
>>> - Gmsh 4.4.1 through the implementation in conda-forge
>>>
>>> - Python 3.7 with Anaconda
>>>
>>>
>>>
>>> Best regards,
>>>
>>>
>>> MA
>>>
>>> <inquiry-gmsh.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
>>
>>
>>
>>
>> _______________________________________________
>> 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 --------------
A non-text attachment was scrubbed...
Name: mesh-not-working-alternative.zip
Type: application/zip
Size: 787229 bytes
Desc: not available
URL: <http://onelab.info/pipermail/gmsh/attachments/20191106/983503e9/attachment-0001.zip>


More information about the gmsh mailing list