Home › Forum › SOFA › Using SOFA › [SOLVED] exporting the visual model
Tagged: 64_bits, Linux_ubuntu, SOFA_1706
- This topic has 18 replies, 3 voices, and was last updated 5 years, 11 months ago by Zahra.
-
AuthorPosts
-
5 December 2018 at 12:30 #12542ZahraBlocked
Hi every body,
How I can export the visual model? As an example, in the scene “TutorialForceFieldLiverFEM.scn”, I tried to export the liver_smooth.obj using objExporter, as you can find here:
https://gist.github.com/zbounik/579655d1d753ab749158d8cf89e830f1
but it doesn’t work. I appreciate any guidance regarding this.
Best regards,
Zahra6 December 2018 at 22:12 #12543BineshBlockedHi @zahra
You can export a visual model with ObjExporter Component
Please give us your scene for better answerBest,
Behnam Binesh8 December 2018 at 14:40 #12544ZahraBlockedDear @Binesh,
Thank you for your reply. I have used the objExporter to extract the visual model, but as I have mentioned before, it doesn’t work. I get this error when I use objExporter:
FROM SOFA [ERR] >> terminate called after throwing an instance of ‘std::out_of_range’
what(): basic_string::substr: __pos (which is 26) > this->size() (which is 21)########## SIG 6 – SIGABRT: usually caused by an abort() or assert() ##########
FROM SOFA [OUT] >>
FROM SOFA [ERR] >> -> /home/zahra/sofa/build/v17.06/lib/libSofaHelper.so.17.06.02(sofa::helper::BackTrace::dump()+0x23) [0x7f49d3c5fc73]
-> /home/zahra/sofa/build/v17.06/lib/libSofaHelper.so.17.06.02(sofa::helper::BackTrace::sig(int)+0x19c) [0x7f49d3c5ffbc]
-> /lib/x86_64-linux-gnu/libc.so.6(+0x354b0) [0x7f49d32bc4b0]
-> /lib/x86_64-linux-gnu/libc.so.6(gsignal+0x38) [0x7f49d32bc428]
-> /lib/x86_64-linux-gnu/libc.so.6(abort+0x16a) [0x7f49d32be02a]
-> /usr/lib/x86_64-linux-gnu/libstdc++.so.6(__gnu_cxx::__verbose_terminate_handler()+0x16d) [0x7f49d38f684d]
-> /usr/lib/x86_64-linux-gnu/libstdc++.so.6(+0x8d6b6) [0x7f49d38f46b6]
-> /usr/lib/x86_64-linux-gnu/libstdc++.so.6(+0x8d701) [0x7f49d38f4701]
-> /usr/lib/x86_64-linux-gnu/libstdc++.so.6(+0x8d919) [0x7f49d38f4919]
-> /usr/lib/x86_64-linux-gnu/libstdc++.so.6(std::__throw_out_of_range_fmt(char const*, …)+0x107) [0x7f49d391d3f7]
-> /home/zahra/sofa/build/v17.06/lib/libSofaExporter.so.17.06.02(sofa::component::misc::OBJExporter::writeOBJ()+0xee2) [0x7f49c6510d72]FROM SOFA [ERR] >> -> /home/zahra/sofa/build/v17.06/lib/libSofaSimulationCore.so(sofa::simulation::InitVisitor::processNodeBottomUp(sofa::simulation::Node*)+0xd1) [0x7f49d5b59021]
-> /home/zahra/sofa/build/v17.06/lib/libSofaSimulationGraph.so.17.06.02(sofa::simulation::graph::DAGNode::executeVisitorBottomUp(sofa::simulation::Visitor*, std::__cxx11::list<sofa::simulation::graph::DAGNode*, std::allocator<sofa::simulation::graph::DAGNode*> >&)+0x57) [0x7f49d7985fd7]
-> /home/zahra/sofa/build/v17.06/lib/libSofaSimulationGraph.so.17.06.02(sofa::simulation::graph::DAGNode::doExecuteVisitor(sofa::simulation::Visitor*, bool)+0xc9) [0x7f49d7988c89]
-> /home/zahra/sofa/build/v17.06/lib/libSofaSimulationCore.so(sofa::simulation::Node::executeVisitor(sofa::simulation::Visitor*, bool)+0x144) [0x7f49d5b747e4]
-> /home/zahra/sofa/build/v17.06/lib/libSofaSimulationCore.so(sofa::simulation::Simulation::init(sofa::simulation::Node*)+0xeb) [0x7f49d5bc17cb]
-> /home/zahra/sofa/build/v17.06/bin/runSofa(main+0xe33) [0x407c53]
-> /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0) [0x7f49d32a7830]
-> /home/zahra/sofa/build/v17.06/bin/runSofa(_start+0x29) [0x408cd9]please find the scene here:
https://gist.github.com/zbounik/579655d1d753ab749158d8cf89e830f1
Best,
Zahra
10 December 2018 at 09:41 #12545BineshBlockedDear @zahra
Every thing is OK and your scene export the mesh correctly
please give us your ObjExporter code files :
ObjExporter.h
ObjExporter.cppBest,
Behnam Binesh10 December 2018 at 09:54 #12546ZahraBlockedDear @Binesh,
Thank you for your feedback. Please find the ObjExporter code files in the link below:
https://gist.github.com/zbounik/641aa66b47a0aa71e7bd745701013c7d
Best,
Zahra12 December 2018 at 20:39 #12580HugoKeymasterAny luck by checking the file @secretdevil ?
Thanks !Hugo
29 December 2018 at 07:54 #12694BineshBlocked30 December 2018 at 15:32 #12695ZahraBlockedDear @Binesh,
Thank you for your feedback. The ObjExporter code that I have sent to you is the original one and I did n’t change it.
Could you please explain what part of the code is incorrect?
Would you please share your ObjExporter files?
Best,
Zahra
31 December 2018 at 09:57 #12696BineshBlockedDear @zahra
Our OBJExporter code modified for our project and work correctly
You can download codes from my drop box
https://www.dropbox.com/sh/xsk3cyjtxpz94hl/AADFhHLk4FLGgRsvlApONrTca?dl=0Best,
Behnam Binesh
31 December 2018 at 13:57 #12697ZahraBlockedHi @Binesh,
Thank you very much for sharing your codes. But, I again got the same errors using them.
I found out what is causing the previously mentioned errors: changing the value of “exportEveryNumberOfSteps” from zero to any other number in the ObjExporter. I do not need this option at this stage of my work, so I can just use the “exportAtEnd” and get the visual model at the end of the simulation. However, if you probably find out the solution for exporting the Obj file at every number of steps, I would appreciate if you kindly let me know about it.
Best wishes,
Zahra
31 December 2018 at 14:22 #12698BineshBlockedHi @zahra
OOps! Error occurred, 😐
As a rule, there should be no error
Sorry, can you share your error again?31 December 2018 at 14:57 #12699ZahraBlockedDear @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]31 December 2018 at 16:03 #1270031 December 2018 at 16:31 #12701ZahraBlockedDear @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
31 December 2018 at 21:51 #12704BineshBlockedDear @zahra
Test below scene
Fix filename0 and filename1 Data with your home path directory 🙂<?xml version="1.0"?> <Node name="root" gravity="0 -9.81 0" dt="0.02" > <VisualStyle name="visualStyle1" displayFlags="showForceFields" /> <DefaultPipeline name="CollisionPipeline" verbose="0" /> <BruteForceDetection name="N2" /> <DefaultContactManager name="collision response" response="default" /> <DiscreteIntersection name="discreteIntersection1" /> <Node name="LiverFEM" gravity="0 -9.81 0" > <EulerImplicitSolver name="cg_odesolver" printLog="0" /> <CGLinearSolver template="GraphScattered" name="linear solver" iterations="25" tolerance="1e-09" threshold="1e-09" /> <MeshTopology name="mesh" fileTopology="mesh/liver.msh" /> <MechanicalObject template="Vec3d" name="dofs" position="0 0 0" velocity="0 0 0" force="0 0 0" externalForce="0 0 0" restScale="1" size="1" /> <TetrahedronFEMForceField template="Vec3d" name="FEM" poissonRatio="0.45" youngModulus="50" gatherPt=" " gatherBsize=" " /> <UniformMass template="Vec3d" name="mass" totalmass="1" filename="unused" /> <FixedConstraint template="Vec3d" name="FixedConstraint" indices="3 39 64" /> <Node name="Visu" gravity="0 -9.81 0" > <OglModel template="ExtVec3f" name="VisualModel" fileMesh="mesh/liver-smooth.obj" primitiveType="DEFAULT" blendEquation="GL_FUNC_ADD" sfactor="GL_SRC_ALPHA" dfactor="GL_ONE_MINUS_SRC_ALPHA" /> <BarycentricMapping template="Vec3d,ExtVec3f" name="visual mapping" input="@../dofs" output="@VisualModel" /> <OBJExporter name="oBJExporter1" listening="0" filename0="/home/simedix/E/e1" filename1="/home/simedix/E/e1" exportEveryNumberOfSteps="0" exportAtBegin="0" exportAtEnd="1" /> </Node> </Node> </Node>
1 January 2019 at 13:00 #12709ZahraBlockedHi @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,
Zahra1 January 2019 at 13:38 #12710ZahraBlockedHi 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,
Zahra1 January 2019 at 16:25 #12711BineshBlockedDear @zahra
This scene with “Every number of step” equal 0 and “Export at end” true work correctly,
By default, SOFA OBJExporter create obj file in each step and create many files for our mesh, So this is not good and we develop the code and export the mesh in 1 file,
2 address for file name is for our project and in default mode you don’t need to fill 2 address and file name 1 is enough,
Note that this objexporter do not create many files and every thing is in one fileBest,
Behnam Binesh
2 January 2019 at 13:40 #12714ZahraBlockedDear @Binesh,
Thank you very much for your explanation.
Best,
Zahra -
AuthorPosts
- You must be logged in to reply to this topic.