stlib.scene

Templates for most of the common scene setups.

Content:

Scene Scene(SofaObject) Create a scene with default properties.
MainHeader(node[, gravity, dt, plugins, …]) Args:
ContactHeader(applyTo, alarmDistance, …[, …]) Args:
Node(parentNode, name) Create a new node in the graph and attach it to a parent node.
Wrapper(node, attachedFunction, datacache) Args:

stlib.scene.Scene

class stlib.scene.Scene(SofaObject)[source]

Create a scene with default properties.

Arg:

node (Sofa.Node) the node where the scene will be attached

gravity (vec3f) the gravity of the scene

dt (float) the dt time

plugins (list(str)) set of plugins that are used in this scene

repositoryPath (list(str)) set of path where to read the data from

doDebug (bool) activate debugging facility (to print text)

There is method to add default solver and default contact management on demand.

addSolver()[source]
addContact(alarmDistance, contactDistance, frictionCoef=0.0)[source]
cls

alias of Scene

definedloc = ('/home/docs/checkouts/readthedocs.org/user_builds/stlib/checkouts/latest/docs/sphinx/source/../../../python/stlib/scene/__init__.py', 72)

stlib.scene.Interaction

class stlib.scene.Interaction(parent, targets)[source]

Store a list of mechanical object to interact with

Args:

targets ([objects]) the object to interact with and that don’t have a solver
cls

alias of Interaction

definedloc = ('/home/docs/checkouts/readthedocs.org/user_builds/stlib/checkouts/latest/docs/sphinx/source/../../../python/stlib/scene/interaction.py', 5)

stlib.scene.MainHeader

stlib.scene.MainHeader(node, gravity=[0.0, -9.8, 0.0], dt=0.01, plugins=[], repositoryPaths=[], doDebug=False)[source]
Args:

gravity (vec3f): define the gravity vector.

dt (float): define the timestep.

plugins (list str): list of plugins to load

repositoryPaths (list str): list of path to the specific data repository

Structure:
rootNode : {
    gravity : gravity,
    dt : dt,
    VisualStyle,
    RepositoryPath,
    RequiredPlugin,
    OglSceneFrame,
    FreeMotionAnimationLoop,
    GenericConstraintSolver,
    DiscreteIntersection
}

stlib.scene.ContactHeader

stlib.scene.ContactHeader(applyTo, alarmDistance, contactDistance, frictionCoef=0.0)[source]
Args:

applyTo (Sofa.Node): the node to attach the object to

alarmDistance (float): define the distance at which the contact are integrated into
the detection computation.
contactDistance (float): define the distance at which the contact response is
integrated into the computation.
frictionCoef (float, default=0.0): optional value, set to non-zero to enable
a global friction in your scene.
Structure:
rootNode : {
    CollisionPipeline,
    BruteForceBroadPhase,
    BVHNarrowPhase,
    RuleBasedContactManager,
    LocalMinDistance
}

stlib.scene.Node

stlib.scene.Node(parentNode, name)[source]

Create a new node in the graph and attach it to a parent node.

stlib.scene.Wrapper

class stlib.scene.Wrapper(node, attachedFunction, datacache)[source]
Args:

node : the current node we are working on

attachedFunction : the function that will be called at each object creation

to do some stuff replace/insert/delete …

This function will take as arguments the node, the type of the object to create, datacache & also the current arguments of the object .

This function as to return a tuple containing parameters of the object we want to create (ie: his type and a dictionary with all the other arguments) or None

datacache : the data we will use in our attachedFunction as parameters or else

createObject(type, **kwargs)[source]
createChild(name)[source]
__getattr__(value)[source]