https://github.com/alxbilger/jsonreader
SOFA plugin adding the ability to read SOFA scenes written in the json format
https://github.com/alxbilger/jsonreader
json sofa-framework
Last synced: 10 months ago
JSON representation
SOFA plugin adding the ability to read SOFA scenes written in the json format
- Host: GitHub
- URL: https://github.com/alxbilger/jsonreader
- Owner: alxbilger
- License: mit
- Created: 2022-10-21T14:55:44.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-02-23T15:25:20.000Z (over 3 years ago)
- Last Synced: 2025-07-13T14:46:44.567Z (11 months ago)
- Topics: json, sofa-framework
- Language: C++
- Homepage: https://alxbilger.github.io/JsonReader/
- Size: 2.1 MB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README

[](https://alxbilger.github.io/JsonReader/)
JsonReader
SOFA plugin adding the ability to read SOFA scenes written in the json format
# Usage
```
runSofa -l JsonReader path/to/scene.json
```
# Examples
Examples are provided in the `scenes` folder.
A SOFA scene written in json looks like:
```json
{
"Node": {
"name": "root",
"dt": "0.02",
"gravity": "0 -10 0",
"printLog": "true",
"Node": {
"name": "plugins",
"RequiredPlugin":[
{"name":"Sofa.Component.Constraint.Projective"},
{"name":"Sofa.Component.Engine.Select"},
{"name":"Sofa.Component.LinearSolver.Direct"},
{"name":"Sofa.Component.Mass"},
{"name":"Sofa.Component.ODESolver.Backward"},
{"name":"Sofa.Component.SolidMechanics.FEM.Elastic"},
{"name":"Sofa.Component.StateContainer"},
{"name":"Sofa.Component.Topology.Container.Grid"},
{"name":"Sofa.Component.Visual"}
]
},
"VisualStyle": { "displayFlags": "showBehaviorModels showForceFields" },
"DefaultAnimationLoop": { "name": "animationLoop" },
"DefaultVisualManagerLoop": { "name": "visualLoop" },
"EulerImplicitSolver": {
"name": "odesolver",
"rayleighStiffness": "0.1",
"rayleighMass": "0.1"
},
"MechanicalObject": { "name": "DoFs" },
"UniformMass": {
"name": "mass",
"totalMass": "320"
},
"RegularGridTopology": {
"name": "grid",
"nx": "4",
"ny": "4",
"nz": "20",
"xmin": "9",
"xmax": "6",
"ymin": "0",
"ymax": "3",
"zmin": "0",
"zmax": "19"
},
"BoxROI": {
"name": "box",
"box": "10 -1 -0.0001 -5 4 0.0001"
},
"FixedConstraint": { "indices": "@box.indices" },
"EigenSimplicialLDLT": {
"template": "CompressedRowSparseMatrixMat3x3d",
"ordering": "Natural"
},
"HexahedronFEMForceField": {
"name": "FEM",
"youngModulus": "4000",
"poissonRatio": "0.3",
"method": "large"
}
}
}
```
# Compilation
See documentation on the SOFA website to compile an external plugin: https://www.sofa-framework.org/community/doc/plugins/build-a-plugin-from-sources/
## Dependencies
Only SOFA is a dependency