Code Monkey home page Code Monkey logo

stlib's Introduction

STLIB

Documentation

Sofa Template Library

This library should contain sofa scene template. It should contain common scene template used regularly to make the writing of scene with Sofa easy. The templates should be compatible with .pyscn and PSL scenes. The library also contains cool utility functions we should always consider to use.

from stlib3.scene import MainHeader
from stlib3.solver import DefaultSolver
from stlib3.physics.rigid import Cube, Sphere, Floor
from stlib3.physics.deformable import ElasticMaterialObject

def createScene(rootNode):
    MainHeader(rootNode)
    DefaultSolver(rootNode)
    
    Sphere(rootNode, name="sphere", translation=[-5.0, 0.0, 0.0])
    Cube(rootNode, name="cube", translation=[5.0,0.0,0.0])

    ElasticMaterialObject(rootNode, name="dragon",
                          volumeMeshFileName="mesh/liver.msh",
                          surfaceMeshFileName="mesh/dragon.stl",
                          translation=[0.0,0.0,0.0])

    Floor(rootNode, name="plane", translation=[0.0, -1.0, 0.0])

The API documentation is available at readthedocs

To build STLIB

There are two ways to compile plugins for SOFA. The most commonly used is the In-tree build, i.e. building the plugin while building SOFA from its sources on github. The second option, which is less commonly used but provides more flexibility, is the Out-of-tree build, where SOFA is pre-built and installed (from sources or by downloading its binaries) and the plugin is compiled as a standalone module, against the SOFA libraries

In-tree build

First you need to have SOFA on your machine, since to build STLIB you will need to build it through SOFA.

git clone https://github.com/sofa-framework/sofa.git

Then clone STLIB

git clone https://github.com/SofaDefrost/STLIB.git

In the configurations of SOFA build settings, set PLUGIN_SOFAPYTHON to ON and SOFA_EXTERNAL_DIRECTORIES to the absolute path of STLIB your_path/STLIB

Then build SOFA

Now you should be able to use import stlib in python from inside SOFA (running the .py from runSofa)

Out-of-tree build

Either Download the latest binary release or build and install from the sources, as described on sofa-framework's download page. Remember the installation directory, you will need it later on.

Then clone STLIB

git clone https://github.com/SofaDefrost/STLIB.git

create a build/ folder next to your STLIB repository's directory, and in CMake-gui, set the source folder with , and the newly created build folder with

In the configurations of STLIB build settings, add the following CMake entries: CMAKE_PREFIX_PATH = SOFA_INSTALLATION_DIRECTORY PLUGIN_SOFAPYTHON = ON SOFA_BUILD_METIS = ON

Configure, Generate, then build AND install the plugin. During the install step, STLIB will be deployed in SOFA's installation directory, and you will be able to use import stlib in python from inside SOFA (running the .py from runSofa)

stlib's People

Contributors

damienmarchal avatar eulaliecoevoet avatar guparan avatar alxbilger avatar marques-bruno avatar samfabrice avatar olivier-roussel avatar mthieffry avatar vannestefelix avatar olivier-goury avatar aboudfayad avatar louise-scherrer avatar pchaillo avatar adagolodjo avatar paulchaillou avatar fredroy avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.