-
Bruno Marques replied to the topic SofaPython3 with Python 3.6 in the forum Programming with SOFA 6 months ago
Oh, yeah to encourage people to upgrade to 3.7 or 3.8 we have set the minimum python version supported to 3.7
To override that you will have to change it in the main CMakeLists.txt, line 68:
# Set the minimum python version to 3.7
set(PYBIND11_PYTHON_VERSION 3.7)If you change this value to 3.6 the error message should disappear. Tell me if…[Read more]
-
Bruno Marques replied to the topic SofaPython3 with Python 3.6 in the forum Programming with SOFA 6 months ago
We do not document the install of an extra python version on a linux distro because it is already relatively well documented on the net. ([see here for instance](https://hackersandslackers.com/multiple-versions-python-ubuntu/)
Usually the trick is to play with update-alternatives (on ubuntu at least) to set additional python versions.When it…[Read more]
-
Bruno Marques replied to the topic SofaPython3 with Python 3.6 in the forum Programming with SOFA 6 months ago
Hi @jlorenze,
I believe it it possible to get it to work without much effort. But there will be bugs in error reporting, because of exceptions that can’t be caught in python 3.6-3.7 because of a lack of multithreading support.
We thus chose not to support it (python 3.6 is now 4 years old anyway), and advise our users to install python 3.8+ on…[Read more] -
Bruno Marques replied to the topic Data.value vs Data.writeable() with SP3 in the forum Programming with SOFA 8 months, 3 weeks ago
Hi @AlbanOdot ,
*Here’s the short answer:*how to use writeable():
with self.CFF.forces.writeable() as cff:
cff[:] = linear_forces_amplitude * layerwhen should I use which:
in your caseself.CFF.forces.value = linear_force_amplitude * Layer
is as efficient as the writeable version*The long answer now:*
Your first…[Read more] -
Bruno Marques replied to the topic How to import numpy in python scripting of SOFA? in the forum Using SOFA 1 year, 8 months ago
Hi Zahra,
Sofa does not package numpy with its sources, so your problem, while indeed being an issue with concurrent versions of numpy on your system, is not linked to your install of SOFA. (as far as I know)
I’m no expert in this, but I’d guess that:
– you installed numpy either via your package manager (apt install python-numpy) or via pip…[Read more] -
Bruno Marques replied to the topic Using SOFA in the context of reinforcement leaening in the forum Using SOFA 1 year, 8 months ago
Hi and Welcome to Sofa!
Sadly, the runSofa GUI is not meant to allow stepping programmatically.
Luckily, there are some workarounds..:1. SofaPython3 is a plugin in development. It’s purpose is to provide python packages for SOFA, that will let you define your own simulation loop in python by calling SOFA’s animate / step methods manually from…[Read more]
-
Bruno Marques replied to the topic Fish eye cameras and anatomical model in SOFA in the forum Using SOFA 1 year, 9 months ago
Hi @Angela_Fifi,
As-is in SOFA, there’s no way of changing the camera’s intrinsic parameters using exisiting components.
There is a plugin, called SofaCV (computer vision) that contains a component called CalibratedCamera, and that can take OpenCV-style camera calibration data in the form of:
– A 3×4 matrix encoding both extrinsic and intrinsic…[Read more] -
Bruno Marques replied to the topic How to close the runSofa window/reinitialize it in python? in the forum Programming with SOFA 1 year, 10 months ago
Hi @Zahra
This is sadly a recurring issue with SOFA:
As of today, a simulation ran in the runSofa GUI can only be stopped or killed programatically (by usingnode.getRootContext().animate = False
or by for instance callingquit()
in the script to end the program.
There is no way to get from the “paused” state to the “animate” state of the…[Read more] -
Bruno Marques replied to the topic Initialize and read a data in the forum Programming with SOFA 1 year, 11 months ago
Bonjour Gaetan,
SOFA initialise ses composants en plusieurs étapes.
Tout d’abord, leconstructeur
de la classe est appelé. Les datafields sont initialisées à leurs valeurs par défaut.
Ensuite, la méthodeparse()
est appelée, et cette méthode va (justement) parser ton fichier de scène XML ou python, ou tonBaseObjectDescription
, en fonction…[Read more] -
Bruno Marques replied to the topic Problems with Modeler: Can't modify particle property and change componets order in the forum Getting Started 2 years ago
SOFA is more a simulation *Framework* as it is a simulation *Software*.
It’s programming language is C++, but (long ago), to simplify scripting, a system has been set in place to describe scenes with XML, and it’s been the main way to create SOFA scenes for a long time.
It’s now much more recommended to create scenes in Python. A Python plugin,…[Read more] -
Bruno Marques replied to the topic Problems with Modeler: Can't modify particle property and change componets order in the forum Getting Started 2 years ago
Hi @huntsmanydw,
I personally never used the SOFA modeler so I’m probably not the best suited to answer your question.. But be aware that the modeler, while being present in SOFA’s repository, is not much maintained anymore. While we still apply bugfixes to it, we very rarely add new features to it.
I don’t believe any of the two features you are…[Read more] -
Bruno Marques replied to the topic Stop Animation function in sofa in the forum Programming with SOFA 2 years ago
Hi @Tim,
That’s a good question. To my knowledge there’s no such mechanism.
I looked it up a little bit and it seems that the way the animation works in runSofa is that clicking on the animate button:
– triggers the loop that will call theRealGUI::step()
method.
– This method calls theSimulation::animate()
method that triggers the execution of 1…[Read more] -
Bruno Marques replied to the topic Stop Animation function in sofa in the forum Programming with SOFA 2 years, 1 month ago
Sorry, I replied a bit too fast the first time:
The results you’re getting means it works:What your code is doing is catching every AnimateEndEvent signals, and stopping the simulation each time.
The AnimateEndEvent’s name is misleading, I admit: it should actually be called “SimulationStepEndEvent”. This signal is sent at the end of each time…[Read more] -
Bruno Marques replied to the topic Building Stlib and integration with sofa in windows 10 in the forum Building SOFA 2 years, 1 month ago
Hi @himanshu,
I’m not a user of windows 10.. but it seems to me that you’re building SOFA without PLUGIN_SOFAPYTHON.– Have you built SOFA by yourself (from sources) or did you download the binaries?
If you built it yourself, you need to enable the SofaPython plugin in your cmake configuration (PLUGIN_SOFAPYTHON=ON)– Are you building the…[Read more]
-
Bruno Marques replied to the topic Stop Animation function in sofa in the forum Programming with SOFA 2 years, 1 month ago
@rubab123 Your mistake I suppose is that you declared an event pointer in your class declaration.
The prototype of the handleEvent function tells you that it takes a sofa::core::objectmodel::Event pointer as an argument, so that’s the one you have to work with. if you declare an Event* in your class, this one will of course be uninitialized hence…[Read more] -
Bruno Marques replied to the topic Stop Animation function in sofa in the forum Programming with SOFA 2 years, 1 month ago
@rubab123, after reading your last post on the other topic you opened, I’m quite confident that my initial reply answers your problem:
What you want, if I understood correctly, is to wait for a user to execute a simulation in SOFA that would gather some data on the user’s inputs (accuracy, speed…), and, once the simulation is performed, stop…[Read more]
-
Bruno Marques replied to the topic Stop Animation function in sofa in the forum Programming with SOFA 2 years, 1 month ago
Hi @rubab123,
I’m not sure if I understood correctly, but if what you want is stop / pause the simulation from within a component, you can do this by calling setAnimate(false) on the root context:
this->getContext()->getRootContext()->setAnimate(false);
You can also do this from PythonScriptControllers, if that’s more convenient to…[Read more]
-
Bruno Marques replied to the topic Problem when running SoftRobots python script (SOFA v18.12 on Ubuntu 16.04) in the forum Using SOFA 2 years, 1 month ago
Hi @nicklj,
Could you tell us more about your build setting?
– Which OS are you on?
– Did you manually activate / deactivate any option in cmake besides PLUGIN_SOFAPYTHON, SOFA_BUILD_METIS?
– Could you dump the whole output of runSofa on the problematic scene? -
Bruno Marques replied to the topic How to extract the surface of a volumeyric mesh in the forum Using SOFA 2 years, 6 months ago
Hi Zahra,
You might want to look at the “Tetra2TriangleTopologicalMapping” component.
You can find an example in the scene “examples/Components/topology/Tetra2TriangleTopologicalMapping.scn” -
Bruno Marques started the topic Anisotropic materials in SOFA? in the forum Using SOFA 2 years, 9 months ago
Hi!
I’d like to model deformations on anisotropic elasto-plastic materials in SOFA.
Does anyone have some experience with that?Thanks in advance!
- Load More