Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Wed Jan 23 13:13:55 2019
@author: zahra
"""
import Sofa
def createScene(rootNode):
$MeshFormat
2.2 0 8
$EndMeshFormat
$Nodes
35
1 -0.61499337 -0.0484317699 5.36816453
2 0.812514411 -0.224246388 3.92371916
3 -0.286570095 0.448780059 4.16442226
4 -2.21090404 0.754796302 1.79384971
5 -1.53226451 1.92160278 2.16019369
import Sofa
#import numpy as np
#import os
#import os
#from time import gmtime, strftime
import time
#from datetime import datetime
############## to count the simulation time
$MeshFormat
2.2 0 8
$EndMeshFormat
$Nodes
35
1 -0.61499337 -0.0484317699 5.36816453
2 0.812514411 -0.224246388 3.92371916
3 -0.286570095 0.448780059 4.16442226
4 -2.21090404 0.754796302 1.79384971
5 -1.53226451 1.92160278 2.16019369
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Mon Jan 7 06:28:55 2019
@author: zahra
"""
import Sofa
#import time
<?xml version="1.0"?>
<Node name="root" gravity="0 -9.81 0" dt="0.02" >
<VisualStyle name="visualStyle1" displayFlags="showForceFields" />
<DefaultPipeline name="CollisionPipeline" verbose="0" />
<BruteForceDetection name="N2" />
<DefaultContactManager name="collision response" response="default" />
<DiscreteIntersection name="discreteIntersection1" />
<Node name="LiverFEM" gravity="0 -9.81 0" >
<EulerImplicitSolver name="cg_odesolver" printLog="0" />
<CGLinearSolver template="GraphScattered" name="linear solver" iterations="25" tolerance="1e-09" threshold="1e-09" />
/******************************************************************************
* SOFA, Simulation Open-Framework Architecture, v17.06 *
* (c) 2006-2017 INRIA, USTL, UJF, CNRS, MGH *
* *
* This program is free software; you can redistribute it and/or modify it *
* under the terms of the GNU Lesser General Public License as published by *
* the Free Software Foundation; either version 2.1 of the License, or (at *
* your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, but WITHOUT *
/******************************************************************************
* SOFA, Simulation Open-Framework Architecture, v17.06 *
* (c) 2006-2017 INRIA, USTL, UJF, CNRS, MGH *
* *
* This program is free software; you can redistribute it and/or modify it *
* under the terms of the GNU Lesser General Public License as published by *
* the Free Software Foundation; either version 2.1 of the License, or (at *
* your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, but WITHOUT *
@zbounik
zbounik / gist:579655d1d753ab749158d8cf89e830f1
Created December 5, 2018 10:07
TutorialForceFieldLiverFEM with objexporter
<?xml version="1.0"?>
<Node name="root" gravity="0 -9.81 0" dt="0.02" >
<VisualStyle name="visualStyle1" displayFlags="showForceFields" />
<DefaultPipeline name="CollisionPipeline" verbose="0" />
<BruteForceDetection name="N2" />
<DefaultContactManager name="collision response" response="default" />
<DiscreteIntersection name="discreteIntersection1" />
<Node name="LiverFEM" gravity="0 -9.81 0" >
<EulerImplicitSolver name="cg_odesolver" printLog="0" />
<CGLinearSolver template="GraphScattered" name="linear solver" iterations="25" tolerance="1e-09" threshold="1e-09" />
[WARNING] [DAGNode(root)] Sofa.Node.createObject(DefaultPipeline) called on a node(root) that is already initialized
[WARNING] [DAGNode(root)] Sofa.Node.createObject(BruteForceDetection) called on a node(root) that is already initialized
[WARNING] [DAGNode(root)] Sofa.Node.createObject(DefaultContactManager) called on a node(root) that is already initialized
[WARNING] [DAGNode(root)] Sofa.Node.createObject(DiscreteIntersection) called on a node(root) that is already initialized
[ERROR] [SofaPython] cannot open file:liver_controller.py
[ERROR] [PythonScript] IOError: [Errno 2] No such file or directory: 'liver_controller.py'
[ERROR] [PythonScriptController(PythonScriptController)] load error (file 'liver_controller.py' not parsable)
[WARNING] [DAGNode(root)] Sofa.Node.createObject(PythonScriptController) called on a node(root) that is already initialized