This project is composed of a Sofa plugin to embed a python interpreter into a Sofa based simulation as well as several python modules that exposes the different c++ components used in Sofa. The binding is designed to be idiomatic python3 API with tight integration for numpy. This project is in a WIP state, please use it only if you are willing to help in the developement.
- pybind11 (minimal 2.2.4)
- cmake (minimal 3.12)
- developement package for python3 (python3-dev)
Add this directory path in CMAKE_EXTERNAL_DIRECTORIES
.
NB: This plugin cannot be build through in-build process when the old SofaPython plugin is activated. To have both SofaPython3 and SofaPython you need to use out-of-tree build.
This plugin should compile with out-of-tree builds
Expose the base Sofa object to make a scene.
- binding of BaseObject, BaseNode, Base, BaseData [DONE]
- copy-less API to access the sofa Data containers [WIP]
- implement custom sofa object (ForceField, Controller) in python [POC]
- docstring with sphinx content [WIP]
Try it: python import Sofa
- access the runtime specific stuff (GUI, GLViewers, runSofa internal status) [POC]
- docstring with sphinx content [TBD]
Try it: python import SofaRuntime
- autogenerated documentation using sphinx [DONE]
- automated update the docs from the c++'s docstring: https://sofapython3.readthedocs.io/en/latest/ [WIP]
- code completion with common editor [WIP, some editor are not working with c++ modules]
- SofaPython3 is a plugin to include a python3 environment in a Sofa scene [DONE],
Try it: xml <RequiredPlugin='SofaPython3'/>
- Sofa and SofaRuntime are the python module that can be imported in any python interpreter (python3, ipython, jupyter)[DONE],
Try it: python python3 minimalscene.py
- Access to Sofa simulation within the MathLab python interpreter [WIP-POC].
- Make a full python GUI application (with UI framework like PySide2, pygame) and render an integrated sofa scene in an opengl context [POC]
- documentation extraction from .cpp (Thierry)
- refactoring the modules & SofaRuntime (Jean Nicolas)
- Data access & code cleaning (Bruno)
c1 = root.addChild("child1")
c2 = root.addChdil("child2")
o1 = root.addObject("MechanicalObject", dofs)
p = root.child1.child2.dofs.position ## Slow acces to data
p = root["child1.child2.dofs.position"] ## Ffast access
- improve onEvent() method in Controller (Bruno)
- autodoc & docstring generation on https://sofapython3.readthedocs.io/en/latest/ (Damien)