- This topic has 7 replies, 3 voices, and was last updated 5 years, 11 months ago by .
Viewing 8 posts - 1 through 8 (of 8 total)
Viewing 8 posts - 1 through 8 (of 8 total)
- You must be logged in to reply to this topic.
Home › Forum › SOFA › Programming with SOFA › [SOLVED] Could sofa use full Python instead of being embedded in XML file using component
Tagged: 64_bits, SOFA_1612, TetrahedralTensorMassForceField, Windows_7
hi,all
Does any one knows is it possible to step debug Python scene file instead of embedding the python script in xml.scn file using PythonScriptController?
Hi @xiaojuan
What do you mean exactly by “step debug Python scene file instead of embedding the python script” ?
Best
Hugo
hi @Hugo
I mean loading the python scene file directly instead of call the python script using PythonScriptController in xml scene file.
And step debugging is only allowed in cpp scene,right? I am thinking step debugging is simple in debugging a scene code.
Hi @xiaojuan
Are you already using Python in your simulation?
You can write a scene only in a .py file and run it with runSofa. However, as soon as you need interactions during the simulation (or printing information for your debugging) you need a PythonScriptController.
Another solution would be to compile SOFA in debug mode, not sure that’s what you want to do.
Best
Hugo
Thank you Hugo
I am exactly using python to interact with the scene, and need to print data to console platform. So, I used PythonScriptController component in xml.
I also tried to compile SOFA in debug mode in cpp project.However, it is very slow and time-consuming in compilation and debugging process.So,I gave up cpp compilation.
Alright, shall we close this topic then?
OK~
Hi xiaojuan,
I’m not sure I fully understand your question but you can use the classical python debugger pdb for stepping into the python code.
Extract from the doc: https://docs.python.org/2/library/pdb.html
“””
The typical usage to break into the debugger from a running program is to insert
import pdb; pdb.set_trace()
at the location you want to break into the debugger. You can then step through the code following this statement, and continue running without the debugger using the c command.
“””
I have never used it but I think it will do what you want.
WARNING
The forum has been moved to GitHub Discussions.
Old topics and replies are kept here as an archive.