Deform the Visual Model of an ElasticMaterialObject together with Force Fields #139
-
Hi Sofa community, I'm now working on a project which is very similar to the CableGripper tutorial. Everything works for now except for the model visualization part. Detailed descriptions are as follows. PurposeSimulate a cable driven elastic end effector, and make the "Visual Model" (STL) bend together with the "Force Fields" (VTK) visualization model. Part of the code
OS & VersionDebian Testing, Python3.9, SOFA V21.12.00. ProblemSTL is not bendingWhen the cable is actuated, the object (blue-ish "Force Fields", VTK) bends as expected, but the "Visual Models"/"OglModel" (STL) is kept straight. surfaceMeshFile is not visibleThe argument "surfaceMeshFileName=path+file_name+'.stl'" of eobject doesn't seem to work. No extra visualization except for the blue-ish Force Fields would show up whether the surfaceMeshFileName is provided or not. TrialsI've tried the CableGripper tutorial of Python2 version, where the STL model bends with the VTK model perfectly. Compared codes of Py2 and Py3 versions but found no big differences. It feels like that I'm missing the part to define the mapping between fields but got no idea on how to do it. Any hint or help is appreciated. Quinn |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
Hi Quinn, It's hard to see what could be wrong without your mesh files. When you say it does not bend:
As for the "no extra visualization except for the blue-ish Force Fields", there is a tab on the runSofa application's window named "View" where you can select what to display. Have you checked that the "Visual Models" check box is actually checked? Hope this help. |
Beta Was this translation helpful? Give feedback.
-
To get a deformable visual model of an ElasticMaterialObject, use a Vec4d surfaceColor, e.g. surfaceColor= [0.1, 0.2, 0.3, 1.0], when defining the object. If a Vec3d is used, a zero will be concatenated to the end, which makes the OglModel transparent. |
Beta Was this translation helpful? Give feedback.
To get a deformable visual model of an ElasticMaterialObject, use a Vec4d surfaceColor, e.g. surfaceColor= [0.1, 0.2, 0.3, 1.0], when defining the object.
If a Vec3d is used, a zero will be concatenated to the end, which makes the OglModel transparent.