Home › Forum › SOFA › Using SOFA › [SOLVED] BUG-Visualising VTK Mesh in SOFA
Tagged: 64_bits, MacOS, Plugin_SoftRobots, SOFA_1706, VTK mesh generation
- This topic has 11 replies, 2 voices, and was last updated 5 years, 4 months ago by
MA.
-
AuthorPosts
-
8 October 2019 at 16:38 #14361
MA
BlockedHello,
I am trying to visualize the VTK mesh of the bunny mesh.It gives the following error
[INFO] [SceneCheckerVisitor] Finished validating node "root". [INFO] [SofaViewer] QtViewer::keyPressEvent, CONTROL pressed [ERROR] [MeshVTKLoader] Error while parsing XML
The code for visualizing the VTK is
import Sofa import os path = os.path.dirname(os.path.abspath(__file__))+'/mesh/' def createScene(rootNode): rootNode.createObject('VisualStyle', displayFlags='showForceFields showBehaviorModels') rootNode.createObject('RequiredPlugin', pluginName='CGALPlugin') rootNode.createObject('RequiredPlugin', pluginName='SofaExporter') rootNode.findData('gravity').value='-9810 0 0'; node = rootNode.createChild('node') node.createObject('MeshVTKLoader',name='mesh',filename=path+'bunny0.vtu') node.createObject('MeshGenerationFromPolyhedron', name='gen',inputPoints='@mesh.position', inputTriangles='@mesh.triangles', drawTetras='1') node.createObject('Mesh', position='@gen.outputPoints', tetrahedra='@gen.outputTetras') return rootNode
I dont know wether this is a bug,I just simply reproduced the same code of bunny example.
11 October 2019 at 19:34 #14394Hugo
KeymasterHi @ma1991
Are you sure of your path?
could you also try doing filename=str(path)+’bunny0.vtu’ ?[ERROR] [MeshVTKLoader] Error while parsing XML
this sounds like something wrong is passed as argument to the MeshVTKLoader and can not be parsed.Best
Hugo
13 October 2019 at 22:48 #14398MA
BlockedHi @Hugo,
Thanks for the help. the error was due to the path in the tutorial page is missing https://project.inria.fr/softrobot/documentation/volumetric-mesh-generation-using-cgal-plugin/
Now the problem is the generated VTK mesh has a problem, I check my mesh and has no error, however, I don’t know why when I am exporting the generated VTK mesh using MeshVTKLoader it gives me the following error:
[ERROR] [TetrahedronFEMForceField(TetrahedronFEMForceField)] object must have a tetrahedric topology. The component is inactivated. To remove this error message please add a tetrahedric topology component to your scene.
What does that mean?in the scene example of soft robots plugin, they have this component included
I am attaching my OBJ file as I am concerned that I am not getting an accurate VTK mesh and maybe it would cause that error
the. file:
https://gofile.io/?c=H65JiD18 October 2019 at 18:56 #14415Hugo
KeymasterHi @ma1991
Here the error is clear: the TetrahedronFEMForceField can not work properly without a tetrahedral topology on which to compute the integration of the linear elasticitic constitutive law.
Could you share the generated VTK mesh? I would guess that something went wrong with your meshing step.
Best,
Hugo
19 October 2019 at 11:45 #14419MA
BlockedHi @hugo,
Thanks! I think the problem from my mesh since it didn’t conform for FEM, I tried a new simple one
Here is the OBJ file:https://gofile.io/?c=X0Hm6U
Here the VTK file: https://gofile.io/?c=gFZfJ0
I tried to reconstruct the vtu mesh in ParaView, but the same issue.
Thanks so much for your help.
22 October 2019 at 14:08 #14427Hugo
KeymasterHi Marwa @ma1991
Indeed, your vtu mesh is only a surface and do not include any volumetric element (no tetrahedron). Have a look at the screenshot (crop in the volume of the mesh, only the surface appears):
Best
Hugo
22 October 2019 at 14:19 #14434MA
BlockedHi Hugo,
This issue is solved, it was a mistake at the skin of the mesh and also because of the inverted normals I was trying to create faces manually.
Thanks for the help:)
22 October 2019 at 14:22 #14435MA
BlockedI still have a question when you convert from ObJ to vtk mesh, I am pressing ctr+E to export, the file I get is vtu and I have to reconstruct the mesh at Paraview as follows here:https://www.sofa-framework.org/community/doc/using-sofa/components/misc/vtkexport/
While I struggle to know whether I have to wait until simulations end to exports vtu file or just press ctr+E to export.
22 October 2019 at 14:32 #14437Hugo
KeymasterHi @ma1991
You have two options: you can either export at begin (exportAtBegin=”1″) or at end (exportAtEnd=”1″)
Note that obj are surface-only format, while vtk is a format for both surface and volume meshed.
Best wishes
Hugo
22 October 2019 at 14:36 #14438MA
BlockedThanks, it could be a dumb question, it would be a difference if we select at the begin or end. Yes, I know obj is surface-format, but I don’t know why SOFA doesn’t accept transforming from STL to vtk?
22 October 2019 at 14:53 #14439Hugo
KeymasterHi @ma1991
No dumb question here.
When things are misunderstood, it means it can be better explained.You can actually load or export both STL and VTK. So the transformation of one into the other should be not prob.
Hugo
22 October 2019 at 14:55 #14440 -
AuthorPosts
- You must be logged in to reply to this topic.