26 May 2017 at 17 h 32 min #9192
I have some questions and I think it is better to ask them via an example. I would appreciate if anyone would kindly help me:
In the “TutorialMappingLiverBarycentric.scn”:
1. Why the visual mesh extension is different from the behavior mesh one?
Is there any reason that .obj should be used for visual model? I am asking this because if I use another extension for the visual model, namely .obj to .msh, the visual object disappears at the run.
2. How can I extract the mesh of the visual model? Using mesh exporter components just give me the behavior model.
3. How can I identify the force I apply to the object by mouse?
Thanks for any help in advance.
Zahra30 May 2017 at 16 h 53 min #9229
Let me answer point by point:
1. there is no reason imposing that the behavior and visual meshes must have the same extension. Both can use any format. What is important is that:
- visual model: requires a surface mesh
- behavior model : if volumetric object (3D cases), requires a volumetric mesh.
The .msh extension should work. Could you share the piece of XML code displaying your visual model ?
2. to export the visual model, use the OBJExporter. (the semantic of this class is actually not appropriate, it should be VisualModelExporter)
3. the force resulting from the interaction will appear in the “force” vector the MechanicalObject of the liver.
Hope this helps.
Hugo8 June 2017 at 20 h 53 min #9304
Thank you for your guidance.
1. One of my mistakes was that I did not know I should use a surface mesh for the visual model. Now I am using a surface mesh for visual model, however, again I can not see it in the run.
This is the visual part of the xml code:
<Node name="node3" > <OglModel template="ExtVec3f" name="visual" fileMesh="d:/work/phd/sofa/liver/liverfinal/testbygmsh/livertriangle181.gmsh" material="Default Diffuse 1 0.74902 0.74902 0 1 Ambient 1 0.2 0.2 0.2 1 Specular 0 1 1 1 1 Emissive 0 0 0 0 0 Shininess 0 45 " primitiveType="DEFAULT" blendEquation="GL_FUNC_ADD" sfactor="GL_SRC_ALPHA" dfactor="GL_ONE_MINUS_SRC_ALPHA" /> <BarycentricMapping template="Vec3d,ExtVec3f" name="barycentricMap2" input="@.." output="@visual" /> <MeshExporter name="meshExporter3" filename="c:/users/zahra/desktop/livertrianglenew181.gmsh" format="gmsh" edges="0" quads="0" tetras="0" hexas="0" exportEveryNumberOfSteps="1" exportAtBegin="1" exportAtEnd="1" /> </Node>
2. Must I just use OBJexporter, or I can use other exporters such as meshexporter? (I prefer to have it in .gmsh format to avoid mesh converting).
I use a high resolution mesh for behaviour model and a low resolution mesh for visual model.
When I use MeshExporter to export the visual model, the number of nodes of visual model are equal to the number of nodes in the behaviour model. How can I have a low resolution visual model?
3. You mean I should look at the force vector in mechanicalobject while I apply a force by mouse? It does not appear in the force vector. Should I export it somehow?
for more information, here you can find the .scn and mesh files:
Thank you very much for your kind helps.
Zahra9 June 2017 at 18 h 50 min #9307
1. Indeed you need a surface mesh. But it is still not working because you need to give the OglModel a OBJ mesh not a msh one.
2. Yes, I would advise to keep the ObjExporter .. try and tell me if it works. Saving a obj as a gmsh is not big deal.
3. The forces should appear in the MechanicalObject. Are you sure the vector is well updated in the GUI ?
Hugo10 June 2017 at 8 h 32 min #9310
1. It is solved, Thank you.
2. I tried ObjExporter in “TutorialMappingLiverBarycentric.scn” for exporting the visual model: The run window does not open, and just an empty obj file is created, and this warning appeared:
FROM SOFA [OUT] >> [WARNING] [SofaSimulationGraph] the library has not been cleaned up (sofa::simulation::graph::cleanup() has never been called, see sofa/helper/init.h)
3. Um…How I can make sure if the vector is well updated in the GUI? I just open the MechanicalObject and look at the force vector, while at the same time I am applying a force by mouse to the object.
Zahra10 June 2017 at 12 h 18 min #9312
1. Goooood !
2. Hmmm I did not really use it for a very long time. Maybe try with another exporter (VRKExporter) and specifying the field of position you want to export.
3. either in the GUI, there is an update button that should allow you to see the updated values (of forces for instance). Another solution would be to activate the flag verbose of your solver (I know it does exist for the EulerImplicit) it will print the position, velocity and force vector !
Hugo10 June 2017 at 16 h 57 min #9314
2. It seems that vtkexporter is a better choice.
3. Just for giving a feedback: Updating the force vector in MechanicalObject does not make any change in the force vector. Activating the verbose flag, after a few seconds, makes sofa stop working.
So I think I should change my approach to my purpose. Thank you for all your helps.
- You must be logged in to reply to this topic.