Forum Replies Created
-
AuthorPosts
-
ZahraBlocked
Dear @Bruno Marques,
Thank you for your kind reply, and sorry for the late reply, my code were running so I couldn’t try your hint and give you the feedback sooner.
I tried your hints, I uninstalled everything, including Anaconda and numpy, until there was no numpy there. I then reinstalled Anaconda, and the problem persists. At least it’s helpful to know that it has nothing to do with SOFA libraries. May I ask if you are using Anaconda for python scripting?
Thanks for your explanation on SofaNumpy, and on your news about SofaPython3. Would SofaPython3 plugin have this feature that we can import sofa module directly in Spyder?
Regarding restoring the mentioned code, thank you for encouraging me. I would like to contribute SOFA and challenge myself in the pull requesting, but restoring this code doesn’t motivate me that much. I also didn’t feel that confident at this moment for it.
Best regards,
Zahra
ZahraBlockedHi again!
I still have a big challenge with this problem. I appreciate if anyone can help me to fix this.
When I import numpy in a python file, it works with no error. But when I import numpy in a Scene controller, I receive the following error:ImportError: cannot import name _distributor_init
File “/home/zahra/sofa/Work/test/AttachLiverSurface_controller.py”, line 18, in <module>
import numpy
File “/home/zahra/anaconda2/lib/python2.7/site-packages/numpy/__init__.py”, line 140, in <module>
from . import _distributor_init[ERROR] [SofaPython] Script (file:AttachLiverSurface_controller) import error
[ERROR] [PythonScriptController(PythonScriptController)] load error (file ‘/home/zahra/sofa/Work/test/AttachLiverSurface_controller.py’ not parsable)The python scene and the controller are accessible here:
The main python file:
https://gist.github.com/zbounik/fa61c74209a6dbc85cacbe170f9f17b5the controller:
https://gist.github.com/zbounik/569971d696522a2b5b4088888a535dd0the input mesh files:
https://gist.github.com/zbounik/0525820bbe52a9b74b421d3785048259Thanks for any help.
Best,
ZahraZahraBlockedDear Erik,
Thank you very much for your hint. Yes, the normal data field in OglModel is what I was looking for, and now I can access and use it.
Dear @Hugo,
Thank you for your reply. Erik’s guidance solved this issue, and so I think there is no need anymore to pull-request it.
Best wishes,
Zahra
15 May 2019 at 13:13 in reply to: [SOLVED] How to export .OBJ files at specified time steps, before ending the animation? #1347911 May 2019 at 17:32 in reply to: [SOLVED] How to export .OBJ files at specified time steps, before ending the animation? #13472ZahraBlockedHi @Hugo,
Wow! That’s great! Thank you so much.
What about using the filemesh format in OGLModel? Should it be in the format of OBJ? As when I use other formats, there is no visual model in the run window.
Best,
ZahraZahraBlockedDear @Hugo,
Thank you very much for the working code.
Regarding using constraints, I’m not sure about it. If I use fixed constraints, should I need GenericConstraintSolver?
I also tried the documentation to understand if I may later need to use collision, uni/bilateralconstraints (as I am not familiar with their usage), but the documentation on those subjects is not complete yet.As I’m not an expert in Mechanics, I am wondering if the above code is enough for simulating a resting tissue on a surface with a friction between them. I appreciate if you kindly guide me regarding that.
Best regards,
Zahra6 May 2019 at 14:12 in reply to: [SOLVED] How to export .OBJ files at specified time steps, before ending the animation? #13459ZahraBlockedHi @Hugo,
Thank you for your guidance. Before trying other tricks, I need to give more information on my problem, as you may know other more straight ways for solving it.
Yes, there are bothering problems with OBJExporter. In fact, I prefer to extract the visual mesh in GMSH format, but when I use the meshExporter in the visual node, it still extracts the deformation mesh and not the visual mesh. Is there any other way to solve this problem?
I have another question here: the filemesh in OGLModel must be in the format of OBJ? As if I use other formats, there would be no visual model in the run window.
Thanks in advance,
Zahra
30 April 2019 at 17:51 in reply to: [SOLVED] How to export .OBJ files at specified time steps, before ending the animation? #13446ZahraBlockedDear @Hugo,
I use this controller to, each time, apply different forces on a number of nodes on the mesh, to have a variety of liver deformations. For example, the force of magnitude -20 is applied on the node 88, and after the accumulative time steps of 0.5, the deformed mesh is saved. Then the simulation resets (by resetting the mechanicalObject’s positions and velocities). Afterwards, the force of magnitude -10 is applied and again the deformed mesh is saved. In my code the lengths of i(which defines the applied forces) and j(which defines the indices on which the forces are applied) are high, but I changed the uploaded one to decrease the execution time for anyone who wants to try it.
Best,
Zahra30 April 2019 at 16:06 in reply to: [SOLVED] How to close the runSofa window/reinitialize it in python? #13445ZahraBlockedYes, Thanks.
ZahraBlockedDear @Hugo,
I need to simulate the friction between a surface and a soft tissue so that the tissue won’t slip on the surface. For this purpose, @Antonin advised me to use the following components:
On the root node:
– FreeMotionAnimationLoop
– CollisionResponse with mu close to 1 (I used mu=0.9)
– GenericConstraintSolverHe also suggested adding MechanicalObject not just in the liver node but also on the surface node, and adding the UncoupledConstraintCorrection component for each MechanicalObject. For the simulation, he mentioned that I should use TetrahedralCorotationalFEMForceField for the liver node and also TriangularFEMForceField for the surface node.
His suggestion resulted in this:
https://gist.github.com/zbounik/fd54f80ae5b2a0155bb7396c0e220b1bbut it still doesn’t work. I guess the problem comes from the incorrect link for the position of the triangular mesh in the MechanicalObject component, but I don’t know how to set a correct linking.
Thanks for your help in advance,
ZahraZahraBlockedHi,
maybe this is simple question but I’am confused.
I am doing this as @Hugo mentioned: “load *.obj mesh in blender, export in *.stl, then load the *.stl in the software gmesh and export a *.msh format.” but there is some translation and rotation when I load the .obj file in blender. Anybody knows how I can have the exact file without translation and rotation?Best,
Zahra23 April 2019 at 15:55 in reply to: [SOLVED] How to close the runSofa window/reinitialize it in python? #13427ZahraBlockedHi @Bruno Marques,
Thank you for your reply. I read the related post. At least now I know this is not possible with the current GUI and I should make some kind of hacking.
Best,
Zahra23 April 2019 at 12:22 in reply to: [SOLVED] How to export .OBJ files at specified time steps, before ending the animation? #13423ZahraBlockedHi again,
To add more clarity to my question, I’m posting the related files here:
This is my main python file:
https://gist.github.com/zbounik/fa61c74209a6dbc85cacbe170f9f17b5the controller:
https://gist.github.com/zbounik/569971d696522a2b5b4088888a535dd0
the input mesh files:
https://gist.github.com/zbounik/0525820bbe52a9b74b421d3785048259In the main file, if I disable the “controller” and run the file, the obj mesh is extracted correctly. However, if I enable the controller and run the main file again, the obj meshes are not extracted. Any help is appreciated.
Best,
ZahraZahraBlockedHi @Antonin,
I hope you are still willing to guide me, sorry I could hardly concentrate on the work.
I tried your hints, but I still doesn’t succeed. I guess the problem comes from the incorrect link for the position of the triangular mesh in the MechanicalObject component, but I don’t know how to set a correct linking. Would you please guide me through this?
You can find the modified python script in below:
https://gist.github.com/zbounik/fd54f80ae5b2a0155bb7396c0e220b1b
Thank you in advance,
Zahra
ZahraBlockedDear @Antonin,
Thank you so much for your explanation, and I again must apologize for this delay in responding. I will try your hints and give you the feedback as soon as possible.
Best regards,
ZahraZahraBlockedDear Antonin,
Thank you very much for your reply. Your way in explaining is very educative to me.
I have a question here. The reason for using “surface_fine” part in my code just is to extract the surface of the tissue, but I do not want it to have a real skin. If I add mechanicalObject, TriangularFEMForceField and TTriangleModel to the surface_fine node, it means that the tissue has a skin on it. If I do not add them, there wouldn’t be any friction, right? Is there any way I can solve this issue?
Best,
Zahra
ZahraBlockedDear @AntOnin,
Thank you very much for your thorough reply. I also apologize for the delay in response as since then, I was out of the lab for a while.
I considered the points you have mentioned, I also checked out the examples in the SOFA source. However, it did n’t work again. I am wondering if I ignore any necessary component.
I appreciate if you have a look on my code:
https://gist.github.com/zbounik/812ba1e8accbe8b66ea8b79c08048e2c
The .gmsh file:
https://gist.github.com/zbounik/658313e81f77b8c56163801b0d392702Thank you for your time, and best regards,
Zahra
ZahraBlockedDear @Ant0nin,
Thank you for your explanation. I tried your suggestion, but it didn’t work. Even when there is no force other than the gravity, the object is rotating on the surface.
For more clarity, I share my python script below. I would appreciate if you kindly have a look on it.
The input mesh and the python script:
https://gist.github.com/zbounik/5727030a0e57d934b798da32c71c92cbBest,
ZahraZahraBlockedDear @Hugo,
Thank you for suggesting the AdvancedTimer. I read the explanation but I didn’t understand how to use it.
Where should I add “-c $INT” to activate the option in runSofa?
Also, I do not understand how I should use this:
sofa::helper::AdvancedTimer::stepBegin(“Build linear equation”);Is it to be used in a c++ code?
Isn’t there any equivalent command in python?
Best,
ZahraZahraBlockedDear @Binesh,
Thank you very much for your explanation.
Best,
ZahraZahraBlockedHi again,
I should add that, I tested your modified scene using sofa 18.06 and the obj file is also exported at every number of steps. So I think the problem is completely solved. Thank you very much for your kind help (I am still curious to know why adding two filename solved the issue!).
Best,
ZahraZahraBlockedHi @Binesh,
Thank you for the scene. It now works when the value of “exportEveryNumberOfSteps” is set to 1 (although it doesn’t export at every number of steps). But finally the errors vanished 🙂
Emm…can I ask how did you know adding two filename even with the same path and name would solve the issue? (When I open the scene with Modeler, there is just a place for one filename). I even receive the warning that these attributes (filename0 and filename1) are unused.
Best regards,
ZahraZahraBlockedDear @Binesh,
I have used a simple scene from the tutorial. Please find it from the link below:
https://gist.github.com/zbounik/739e5be65469f17ba49c7477b6030373
Best,
Zahra
ZahraBlockedDear @Binesh,
Please find the errors below:
FROM SOFA [ERR] >> terminate called after throwing an instance of ‘std::out_of_range’
what(): basic_string::substr: __pos (which is 42) > this->size() (which is 37)FROM SOFA [OUT] >>
FROM SOFA [ERR] >>
########## SIG 6 – SIGABRT: usually caused by an abort() or assert() ##########FROM SOFA [ERR] >> -> /home/zahra/sofa/Sofa17.06/build/lib/libSofaHelper.so.17.06.02(sofa::helper::BackTrace::dump()+0x23) [0x7f8bc55e6c73]
-> /home/zahra/sofa/Sofa17.06/build/lib/libSofaHelper.so.17.06.02(sofa::helper::BackTrace::sig(int)+0x19c) [0x7f8bc55e6fbc]
-> /lib/x86_64-linux-gnu/libc.so.6(+0x354b0) [0x7f8bc49fb4b0]
-> /lib/x86_64-linux-gnu/libc.so.6(gsignal+0x38) [0x7f8bc49fb428]
-> /lib/x86_64-linux-gnu/libc.so.6(abort+0x16a) [0x7f8bc49fd02a]
-> /usr/lib/x86_64-linux-gnu/libstdc++.so.6(__gnu_cxx::__verbose_terminate_handler()+0x16d) [0x7f8bc503584d]
-> /usr/lib/x86_64-linux-gnu/libstdc++.so.6(+0x8d6b6) [0x7f8bc50336b6]
-> /usr/lib/x86_64-linux-gnu/libstdc++.so.6(+0x8d701) [0x7f8bc5033701]
-> /usr/lib/x86_64-linux-gnu/libstdc++.so.6(+0x8d919) [0x7f8bc5033919]
-> /usr/lib/x86_64-linux-gnu/libstdc++.so.6(std::__throw_out_of_range_fmt(char const*, …)+0x107) [0x7f8bc505c3f7]
-> /home/zahra/sofa/Sofa17.06/build/lib/libSofaExporter.so.17.06.02(sofa::component::misc::OBJExporter::writeOBJ()+0xee2) [0x7f8bb835ed72]
-> /home/zahra/sofa/Sofa17.06/build/lib/libSofaSimulationCore.so(sofa::simulation::CleanupVisitor::processNodeTopDown(sofa::simulation::Node*)+0x240) [0x7f8bc74d5ff0]FROM SOFA [ERR] >> -> /home/zahra/sofa/Sofa17.06/build/lib/libSofaSimulationGraph.so.17.06.02(sofa::simulation::graph::DAGNode::executeVisitorTopDown(sofa::simulation::Visitor*, std::__cxx11::list<sofa::simulation::graph::DAGNode*, std::allocator<sofa::simulation::graph::DAGNode*> >&, std::map<sofa::simulation::graph::DAGNode*, sofa::simulation::graph::DAGNode::StatusStruct, std::less<sofa::simulation::graph::DAGNode*>, std::allocator<std::pair<sofa::simulation::graph::DAGNode* const, sofa::simulation::graph::DAGNode::StatusStruct> > >&, sofa::simulation::graph::DAGNode*)+0x2d9) [0x7f8bc930f9b9]
-> /home/zahra/sofa/Sofa17.06/build/lib/libSofaSimulationGraph.so.17.06.02(sofa::simulation::graph::DAGNode::executeVisitorTopDown(sofa::simulation::Visitor*, std::__cxx11::list<sofa::simulation::graph::DAGNode*, std::allocator<sofa::simulation::graph::DAGNode*> >&, std::map<sofa::simulation::graph::DAGNode*, sofa::simulation::graph::DAGNode::StatusStruct, std::less<sofa::simulation::graph::DAGNode*>, std::allocator<std::pair<sofa::simulation::graph::DAGNode* const, sofa::simulation::graph::DAGNode::StatusStruct> > >&, sofa::simulation::graph::DAGNode*)+0x397) [0x7f8bc930fa77]
-> /home/zahra/sofa/Sofa17.06/build/lib/libSofaSimulationGraph.so.17.06.02(sofa::simulation::graph::DAGNode::executeVisitorTopDown(sofa::simulation::Visitor*, std::__cxx11::list<sofa::simulation::graph::DAGNode*, std::allocator<sofa::simulation::graph::DAGNode*> >&, std::map<sofa::simulation::graph::DAGNode*, sofa::simulation::graph::DAGNode::StatusStruct, std::less<sofa::simulation::graph::DAGNode*>, std::allocator<std::pair<sofa::simulation::graph::DAGNode* const, sofa::simulation::graph::DAGNode::StatusStruct> > >&, sofa::simulation::graph::DAGNode*)+0x397) [0x7f8bc930fa77]
-> /home/zahra/sofa/Sofa17.06/build/lib/libSofaSimulationGraph.so.17.06.02(sofa::simulation::graph::DAGNode::doExecuteVisitor(sofa::simulation::Visitor*, bool)+0xae) [0x7f8bc930fc6e]
-> /home/zahra/sofa/Sofa17.06/build/lib/libSofaSimulationCore.so(sofa::simulation::Node::executeVisitor(sofa::simulation::Visitor*, bool)+0x144) [0x7f8bc74fb7e4]
-> /home/zahra/sofa/Sofa17.06/build/lib/libSofaSimulationCore.so(sofa::simulation::Simulation::unload(boost::intrusive_ptr<sofa::simulation::Node>)+0x5f) [0x7f8bc754746f]
-> /home/zahra/sofa/Sofa17.06/build/bin/runSofa(main+0xfc3) [0x407e13]
-> /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0) [0x7f8bc49e6830]
-> /home/zahra/sofa/Sofa17.06/build/bin/runSofa(_start+0x29) [0x408d39] -
AuthorPosts