[Gmsh] Doubt about meshing closed STL shell

Christophe Geuzaine cgeuzaine at uliege.be
Tue Nov 5 17:07:53 CET 2019


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






More information about the gmsh mailing list