Tagged: volumetric mesh
31 May 2019 at 18 h 51 min #13560
I am trying to create a volumetric mesh for a single woven T-yarn, I am using this example https://project.inria.fr/softrobot/documentation/volumetric-mesh-generation-using-cgal-plugin/
The link of Woven T-yarn is available here: https://drive.google.com/open?id=1QtvQ46axkVYtxHKpWnZPfaPTyIhAP7NT
I am trying to tune the following parameters:
facetSize, facetApproximation, cellRatio, cellSize
I dont know what I am missing, I used GMSH to create volume mesh and I have also check non-mainfoldness.
The result I got:
[WARNING] [MeshGenerationFromPolyhedron(gen)] 71 points are not connected to the mesh.
[INFO] [VTKExporter(VTKExporter)] VTKExporter: found topology Mesh
[INFO] [VTKExporter(VTKExporter)] ### VTKExporter[VTKExporter] ###
Nb points: 34
Nb edges: 0
Nb triangles: 0
Nb quads: 0
Nb tetras: 30
Nb hexas: 0
Total nb cells: 30
Thanks,7 June 2019 at 13 h 53 min #13593
At my best knowledge, some parameters (facetSize and cellSize) depend on the dimension. They therefore need to be set accordingly.
If you do not succeed, you can share your mesh so that we can assist you.
Hugo8 June 2019 at 19 h 44 min #13610
Thanks Hugo, exactly, I have to tune some parameters likely the facetSize, however, the scene is crashing and I got this error:
The error: CGAL::Polyhedron_incremental_builder_3:: lookup_halfedge(): input error: facet 10500 shares a halfedge from vertex 255 to vertex 256 with facet 324.
I am doing that as you can see in the screenshot: there is no volumetric mesh created while I am tuning parameters before scene is giving error:http://www.filedropper.com/scene
The STL file is here:http://www.filedropper.com/1tyarn_1
Thanks,9 June 2019 at 23 h 02 min #136159 June 2019 at 23 h 49 min #13616
Here is another example of knitted single S yarn ( fabric), I got the following error in
lookup_halfedge(): input error: facet 200 shares a halfedge from vertex 54 to vertex 126 with facet 199.11 June 2019 at 19 h 00 min #13627
Is your problem the same than the issue reported in the other topic: Volumetric Mesh Generation Error ?
Is it related to the SoftRobot plugin? or the CGAL one ?
Hugo11 June 2019 at 22 h 10 min #13633
About mesh generation, CGAL is rather hard to use.
If you prefer it is possible to rely on GMESH for meshing.
Stefan Escaida and I made helping function for that STLIB/SoftRobots plugins.
It is undocumented feature in:
But there is “createScene” function that will behave as an example if the .py files are loaded in Sofa.
If you need more help please tell.12 June 2019 at 15 h 31 min #13638
@Hugo, it is indeed related to this issue, I can close the other question. This is an issue is related to CGAL and SoftRobots as well since the example is created for obtaining the volumetric mesh of soft pneumatic gripper as illustrated in this example:
@Damien, Thanks so much for your help, the current plugin is CGAL that I am using in sofa, actually, I am following this example, https://project.inria.fr/softrobot/documentation/volumetric-mesh-generation-using-cgal-plugin/
The idea is I have used GMSH earlier to have a volume mesh and later importing it in sofa example, I have this following for instance:
lookup_halfedge(): input error: facet 264 shares a halfedge from vertex 0 to vertex 1 with facet 0.
I don’t know whether this error implies an error at the mesh itself, anyway, I am sharing the steps I did before using SOFA volumetric mesh generation example:
1- I have an STL model on single woven T-yarn (Fabric), the file is attached: https://gofile.io/?c=KKaqnp
2- I used GMSH for adding a physical volume and created a 3d mesh, afterward, I refined the mesh by splitting, the mesh is attached: https://gofile.io/?c=OU59Nj
@Damien is STLIB an external plugin or a plugin in sofa/src/applications/plugins, I would be grateful for hints on how I can install STILB. At the moment, I add an entry in cmkae-gui for STLIB in src/applications/plugins, however, it seems not to be read while configuration.
Thanks for the help!19 June 2019 at 18 h 18 min #1378419 June 2019 at 19 h 01 min #13788
as Damien mentioned, we are working on a functionality to simplify the meshing procedure by scripting Gmsh with python from within Sofa (STLIB). In a few days we will have something (updated) available to the public.
I saw the geometries for the T-Yarn and I’m not sure it will be possible to mesh it. If I understand correctly you have two flat stripes overlapping, forming a T-shape. However, your surface mesh has no volume. Hence, it is impossible to generate a volumetric mesh with CGAL or Gmsh. Can you correct this? Your S-Yarn on the other hand looks like it would work. Can you upload the STL somewhere and I will make a test.
Stefan20 June 2019 at 9 h 45 min #13794
I tend to be rather busy so forgot to reply immediately so thank for the poke,
About STLIB, Thank for the poke, STLIB is an external plugin available at
It should be installed in the same way as you did for SoftRobots.
To ease installation of plugins with dependencies recommand the use of sofa-spm which will track the dependencies for you.
Documentation is here:
https://github.com/SofaDefrost/SPM20 June 2019 at 14 h 43 min #13832
Thanks so much for your help! I do agree that the T-yarn surface mesh doesn’t has a volume, however, while using the knitted S-yarn, the same problem appears.
I am forwarding the STL files, I would be grateful for a solution as I am using gmsh for adding a physical volume, but still, I cannot add to the Tyarn20 June 2019 at 14 h 53 min #13833
Thanks so much! I think I am missing how to create the CmakeLists.txt in the plugin folder, could you please inform me the how to write the exact file, as I want to add the plugin folder not only STLIB folder.
I should write Cmakelists.txt that add plugins, but I don’t know how to write those line exactly.
sofa_add_plugins21 June 2019 at 10 h 13 min #13838
If you use sofa-spm it will generate the CMakeLists.txt for you 🙂
Here is a cut & past from one of my CMakeLists.txt:
sofa_add_plugin(SofaPython3 SofaPython3) sofa_add_plugin(STLIB STLIB) sofa_add_plugin(SoftRobots SoftRobots) sofa_add_plugin(SoftRobots.Inverse SoftRobots.Inverse) sofa_add_plugin(SofaQtQuick SofaQtQuick)
Then I add the directory that contains this CMakeLists.txt in the EXTERNAL_DIRECTORIES at the configuration to compile Sofa.24 June 2019 at 17 h 16 min #13851
so, last week I had a look at the issue. I was able to mesh the S-yarn with CGAL, i.e. with the VolumetricMeshGeneration example:
However, I had to follow two steps:
1) Repair the original file, because the mesh had holes in it. Here is the repaired version:
2) Change the parameters, because the units of the file seem to be in cm:
I also tried to mesh it with Gmsh and had moderate success. It didn’t work by loading the (repaired) stl-file into Gmsh. Therefore, the binding we made in Sofa does not work either. Apparently it is not straightforward to mesh stl files with Gmsh. I had to follow the tutorial/example number 13 on their website:
To achieve good results with Gmsh you will need to look into some parameters, I think.
I know all this is fiddly, but it also was hard to pinpoint the problem, because the original geometries were partially broken (no volume or holes). To be sure the problem is not on the geometry itself, I recommend trying the meshers with geometry that is known to work. If it doesn’t work on your files, it is possible that the geometry you are trying to mesh is actually broken.
Stefan3 July 2019 at 13 h 44 min #13897
@Stefan, thanks so much indeed your help! You are right, I think there is a problem in the mesh, however, I would like to know how you repaired as I have to do that for the woven T-yarn, I am lacking skills in meshing, so any hints would be appreciated.
I am still much afraid as after asking we figured that SOFA is not dedicated to fabric simulation especially when it comes to knitted or woven yarn, maybe I am mistaken, but so far the only example is the piece of fabric, but still not the yarn level simulation and later on we also have to map smart material.
Thanks for your help!3 July 2019 at 13 h 59 min #13898
Clearly SOFA is not dedicated to fabric simulation, it is a general purpose modeling and simulation framework for deformable object.
The problem with modelling is that you need to know what is the dynamic behavior you want to simulate to select the most appropriate mechanial model. If the dynamic behavior can be approximated well enough with kind of 2D mass-spring system or 2D shell assemblies you have existing components for that. If you need something else you may need to implement it. A lot of people are doing that but sadely they don’t put the results in open-source…so to bad for us. Now, as long as you have the equations there is no problem in implementing a specific fabric/yarn oriented model in SOFA allowing it to interact with the other simulated object. If you need help on that I think there is some people that can guide you.
Regards,4 July 2019 at 11 h 07 min #13903
@MA, you’re welcome! Although, I admit, it was a little bit of annoying work ^^
For repairing the mesh of the S-Yarn I used Blender. I could clearly see that there was a hole on one of the ends. I selected the corresponding vertices and created new faces. I think Meshlab is also quite powerful with automated functionality to improve mesh quality, etc. Just search online for something like “repair mesh with Blender/Meshlab” and you will have a few cues.
Looking at the fact that your meshes are quite simple, it occurred to me that it might be a good idea to just create them yourself, for instance using Blender or FreeCAD. My workflow would be to create a very basic geometry, like a cube, export it and then create a volumetric mesh. You will see if it works for this basic example. (In fact, to debug your problem with the volumetric meshing I created a simple cube in Blender, for which it worked.) Then, you take it from there to the more advanced shape. If you put some time into it, it should not be a problem for you to create the S-Yarn or the Woven Yarn yourself.
Just as a tip: if you create the mesh in FreeCAD and export it to brep-format, which is a parametric format, you will be able to mesh it perfectly with Gmsh. If you export it to a stl-file it will be easier to use the VolumetricMeshGeneration example.
Stefan8 July 2019 at 17 h 08 min #13918
Thanks so much, Stefan, Indeed it was helpful and thank you once again for your help indeed appreciated! I am trying to do as you advised, I will share updates.
Thanks,8 July 2019 at 19 h 44 min #13919
Hi Stefan, I tried using meshlab and it is indeed powerful, however, there is an error in the mesh I cannot solve:
add_vertex_to_facet(): input error: disconnected facet complexes at vertex 4:
involved facets are: 360 359 358 2 3 4 (closed cycle) and.
I am trying to figure out how to merge facet, I will try.
The file: https://gofile.io/?c=EC1ZXt11 July 2019 at 21 h 08 min #13933
I come back to your issue.
Apparently you want to mesh this yarn surface (stl) mesh, right ?
Since it is very thin, all meshers will struggle in the meshing process.
What do you want exactly to model from this mesh again ?
Where do you want to be accurate in simulation ?
Hugo13 July 2019 at 0 h 10 min #13946
Hi @ Hugo
Thanks so much for your reply! I have to disclaimer that I am not expert at meshing, however, I am struggling in figuring out how to solve the error as @stefan highlighted I used meshlab and it is quite helpful, however, I still getting an error.
What do you want exactly to model from this mesh again?
I am expecting to add forces to the yarn and see how it deform for different material properties, later I can design different knitted or woven yarn and test them mechanically through simulation.
Where do you want to be accurate in a simulation?
This is a good question and I am afraid I don’t have an exact answer since the fabric is viscoelastic material and highly nonlinear, I found other researchers simulate textile using material point method, however, I am interested to do through SOFA.
Thanks,29 July 2019 at 15 h 31 min #14021
Are there updates concerning the mesh, I still cannot solve the error?
Best,29 July 2019 at 16 h 22 min #14028
It seems many questions are still open. You should maybe work on this first, before going into the simulation.
It is difficult to model cloth from the yarn scale. Both on the meshing and simulation standpoint.
What is your final objective in term of modeling?
Note that pseudo of Stefan is @sescaida
Hugo29 July 2019 at 16 h 44 min #14030
The ultimate goal in modeling is generating internal forces that can actuate the yarn, firstly, I am expecting to import this mesh in SOFA and apply external forces to measure the strain, stress, friction among stitches and sliding as well.
This would help me in testing different geometrical shapes for making sure that there is force cancellation among stitches that could help in actuating the yarn by using pneumatic actuators.
The bottom line is: testing the mechanical properties of different geometrical shapes woven/knitted yarns that could be best to be actuated and also be used for the haptic interface.
- You must be logged in to reply to this topic.