Sofa.Core

General description

Contains the general object hierarchy and data structures

A SOFA simulation is referred as a “scene”. A scene contains several object. Each object is implemented as the aggregation of components. Groups of component are grouped and organized logically using a specific container called Node. Nodes are hierarchically organized in a scene graph. For more, see the SOFA lexicography.

Commonly used classes:

Node

A Node stores other nodes and components.

Object

Base class for components which can be added in a simulation

Controller

Overridable class for user interaction on SOFA Components

ForceFieldVec3d

Overridable class to create your own customized force field

Data

Public attribute of a Component (C++ class) visible and accessible to the user (read/write)

Example

import Sofa.Core

# Create a new node
n = Sofa.Core.Node("MyNode")

# Create a new node
n = Sofa.Core.Node("MyNode"")
# Add a child node name 'Node2'
n.addChild("Node2")

# Add a mechanical component to MyNode
n.addObject("MechanicalObject", name="dofs")

Sofa.Simulation.init(root)
Sofa.Simulation.print(root)

API Table of Content

Classes

Base

Base class of the scene graph hierarchy

BaseContext

Base class for Context classes, storing shared variables and parameters

BaseMeshTopology

API providing all topology-related functions

BaseNode

Base class for simulation node

BasePrefab

Base class for prefabs (for more see Sofa.prefab)

Camera

API dedicated to the control of the Camera in SOFA

ClassEntry

Record storing information about a class

ContactListener

Component dedicated to the monitoring of the collision information between models

Context

Implementation of BaseContext, storing all shared parameters in Datas

Controller

Overridable class for user interaction on SOFA Components

Data

Public attribute of a Component (C++ class) visible and accessible to the user (read/write)

DataContainer

Classic python container implemented for SOFA data fields

DataContainerContextManager

Container managing context data

DataDict

Exposes the data of a sofa object in a way similar to a normal python dictionnary

DataDictIterator

Iterator reimplemented to fit dataDict

DataEngine

Class computing a set of Data outputs from a set of Data inputs

DataLink

Stores the connection between two object of type Data

DataString

Data of type string

DataVectorString

Data of type vector<string>

ForceFieldRigid2d

Overridable class to create your own customized force field

ForceFieldRigid3d

Overridable class to create your own customized force field

ForceFieldVec1d

Overridable class to create your own customized force field

ForceFieldVec2d

Overridable class to create your own customized force field

ForceFieldVec3d

Overridable class to create your own customized force field

ForceFieldVec6d

Overridable class to create your own customized force field

Link

Connection created between Data instances of two different Components

LinkPath

Hold a linkpath to an object or a data

MassRigid2d

Component defining the mass of an object

MassRigid3d

Component defining the mass of an object

MassVec1d

Component defining the mass of an object

MassVec2d

Component defining the mass of an object

MassVec3d

Component defining the mass of an object

MassVec6d

Component defining the mass of an object

Node

A Node stores other nodes and components.

NodeIterator

Iterator on nodes

Object

Base class for components which can be added in a simulation

ObjectFactory

Class used to register and dynamically create objects

PointSetTopologyModifier

Topology modifications associated to a set of points

PrefabLink

Link to a prefab

RawPrefab

Prefabs are python templates for a SOFA scene

Topology

Compatibility topology class (against BaseMeshTopology)