Home › Forum › SOFA › Using SOFA › [SOLVED] Tetrahedral mesh generation
Tagged: 64_bits, Linux_ubuntu, Mesh, Plugin_SoftRobots, SOFA, SOFA_1906, stl
- This topic has 7 replies, 2 voices, and was last updated 4 years, 6 months ago by Owen.
-
AuthorPosts
-
14 April 2020 at 23:57 #15759OwenBlocked
Hello,
I am trying to simulate a soft pneumatic actuator on SOFA. The problem I am having is that SOFA crashes immediately after I run the code using CGAL plugin to convert my stl model into a vtu file containing the volumetric mesh. I am guessing there must be something wrong with my code which caused a failure in mesh generation. Can anyone have a look on the code and my stl file and give me some advice on this? Any suggestion would be greatly appreciated!
Thank you.
OwenCode:
import Sofa import math import os path = os.path.dirname(os.path.abspath(__file__))+'/data/mesh/' def createScene(rootNode): rootNode.createObject('RequiredPlugin', pluginName='CGALPlugin') node = rootNode.createChild('node') node.createObject('MeshSTLLoader',name='mesh',filename=path+'Test2.stl') node.createObject('MeshGenerationFromPolyhedron',name='gen',template='Vec3d',inputPoints='@mesh.position', inputTriangles='@mesh.triangles',drawTetras='1', cellSize='1.5', facetSize='1.5', cellRatio='2', facetApproximation='0.15' ) node.createObject('Mesh', position='@gen.outputPoints', tetrahedra='@gen.outputTetras') node.createObject('VTKExporter', filename=path+'Test2', edges='0', tetras='1', exportAtBegin='1') node.createObject('OglModel', src="@mesh", color="0.0 0.7 0.7 0.5") return rootNode
15 April 2020 at 00:00 #15760OwenBlockedThe link to the STL files was lost somehow… I hope this one works
https://drive.google.com/drive/folders/1U1tdDmSaEXBaW1JNx1Qad-OtlfkTK8ES?usp=sharing
16 April 2020 at 16:06 #15791HugoKeymasterHey @qwe12050
Thanks for your question.
This is related to the specific SoftRobot plugin and its tutorial.However, I took a look at the meshes used in the tutorial (which I do not actually). One is very thin (yarn) and the other one has large area and thin borders.
Choosing the right parameters of this MeshGenerationFromPolyhedron component (based on CGAL as you understood) is therefore tricky. You have to make sure you allow CGAL to use a broad range of element size. I would therefore play with: facetSize, facetApproximation, cellSize and cellRatio. The latter must can be increased to allow local change of size between elements. FYI, the CGAL function called is :
CGAL::make_mesh_3<C3t3>(domain, criteria, no_perturb(), no_exude())
Let me know if this helps.
Best wishes,Hugo
18 April 2020 at 13:06 #15809OwenBlockedHi Hugo,
Thank you very much for your reply!
You are absolutely right about the meshes. The thin borders caused my problem. I have managed to simulate the actuator after I removed them. So thank you!
My next step is to simulate an assembly of two of this actuator. However, I couldn’t find a tutorial on how to define the connection between two bodies on SOFA. Could you give me some hints?
Cheers!
Owen20 April 2020 at 14:09 #15863HugoKeymasterHey @qwe12050
Could you share with the community the parameters you used to get it working?
Depending on the type of animation loop you are using, I would have two solutions:
– the most appropriate constraint to attach physically two objects would be the BilateralInteractionConstraint (requiring a FreeMotionAnimationLoop)
– the second would be the AttachConstraint, a project constraint ensuring that at the end of the time step, the desired points of both objects are in the same location.Best,
Hugo
20 April 2020 at 19:33 #15884OwenBlockedHi Hugo,
Sure, after removing the borders, I used cellSize=’2′, facetSize=’2′, cellRatio=’2′, facetApproximation=’0.15′. However, they only give me an acceptable mesh because I am running SOFA on my laptop which is not very powerful.
I guess I will start with BilateralInteractionConstraint. Is there any example code I can take a look?
Many thanks,
Owen20 April 2020 at 23:02 #15885HugoKeymasterHey @qwe12050
Yes definitely: you can take a look at the example scene in examples/Components/constraint/BilateralInteractionConstraint.scn
I let you close the topic whenever it suits you.
Best,Hugo
21 April 2020 at 15:48 #15899OwenBlockedThank you Hugo. I am gonna close the topic now.
Owen
-
AuthorPosts
- You must be logged in to reply to this topic.