- This topic has 3 replies, 2 voices, and was last updated 6 years, 4 months ago by .
Viewing 4 posts - 1 through 4 (of 4 total)
Viewing 4 posts - 1 through 4 (of 4 total)
- You must be logged in to reply to this topic.
Home › Forum › SOFA › Using SOFA › [SOLVED] Can SOFA be called from my system python as part of a larger tool chain?
Tagged: 64_bits, batch analysis python, Linux_ubuntu, SOFA_1712
I am trying to use SOFA as part of a toolchain.
My use case is to create some input files with certain python modules, call and run SOFA with these files, export the simulation results such as displacement after n time steps, then analyze the results in numpy. To be clear, I have written some of my own custom data generators that would be irritating to integrate and debug with the “runSOFA mypython.py” method. I would prefer to keep them isolated from one another.
I don’t see a clear recipe to do this in the forums. Particularly I find it painful to work with the vtk format and would prefer to simply save a node after n iterations, then manually parse through the xml.
Does anyone have suggestions on how best to do this?
Thanks
Although I would still like to know the answer to the python question, I have been able to solve my problem.
I am using batch mode for -n cycles and writing the final output from a VTKExporter with XMLformat=”1″ and exportAtEnd=”1″
I can then treat these files as xml in the later part of my tool chain.
Just leaving this up in case anyone has the basic question of running the simulator for n cycles and then collecting output for processing.
Hi @mjbarrow
there is actually a specific tool for running several simulations in SOFA with Python: sofa-launcher. It is an python API launching SOFA simulation that can be called from a Python script.
The advantage of this tool is that simulations are executed parallel, i.e. independently.
Unfortunately I don’t have experience with it. I will try to find a bit of time to test it.
Cheers
Hugo
Otherwise the use of VTKExporter is good solution for export as discussed in your other topic.
WARNING
The forum has been moved to GitHub Discussions.
Old topics and replies are kept here as an archive.