Statistiques
| Révision :

root / examples / AFM-plane.py @ 1

Historique | Voir | Annoter | Télécharger (3,28 ko)

1 1 rmalgat
import Sofa
2 1 rmalgat
3 1 rmalgat
poissonRatio = 0.49
4 1 rmalgat
youngModulus = 100
5 1 rmalgat
pressure = 5
6 1 rmalgat
7 1 rmalgat
indentorRadius = 0.3
8 1 rmalgat
9 1 rmalgat
def createScene(node):
10 1 rmalgat
11 1 rmalgat
    print 'Creation of Sofa SceneGraph'
12 1 rmalgat
13 1 rmalgat
    node.gravity = [0,0,0]
14 1 rmalgat
15 1 rmalgat
    node.createObject('RequiredPlugin', pluginName="Flexible")
16 1 rmalgat
    node.createObject('RequiredPlugin', pluginName="AFM_plane")
17 1 rmalgat
18 1 rmalgat
    node.createObject('VisualStyle', displayFlags = 'showVisual hideBehavior showCollisionModels')
19 1 rmalgat
    node.createObject('DefaultPipeline', name="DefaultCollisionPipeline",  verbose="0",  draw="0",  depth="6")
20 1 rmalgat
    node.createObject('BruteForceDetection', name="Detection")
21 1 rmalgat
    node.createObject('MinProximityIntersection', name="Proximity",  alarmDistance="0.05",  contactDistance="0.0")
22 1 rmalgat
    node.createObject('MyDefaultContactManager', name="Response",  response="default", responseParams="")
23 1 rmalgat
    node.createObject('TreeCollisionGroupManager', name="Group")
24 1 rmalgat
25 1 rmalgat
    node.createObject('CGLinearSolver', template="GraphScattered",iterations=500,threshold=1e-10,tolerance=1e-10)
26 1 rmalgat
    node.createObject('EulerImplicitSolver', rayleighStiffness=0.5,rayleighMass=0.5)
27 1 rmalgat
28 1 rmalgat
    node.createObject('GridMeshCreator', name='Grid', resolution="10 10", triangulate=1)
29 1 rmalgat
    node.createObject('MeshTopology', name='Topology',src="@Grid")
30 1 rmalgat
    node.createObject('MechanicalObject', name='DOFs', template="Vec3d")
31 1 rmalgat
    node.createObject('UniformMass',name='mass', template='Vec3d')
32 1 rmalgat
    node.createObject('FixedConstraint',template="Vec3d", indices="0 9 90 99" )
33 1 rmalgat
34 1 rmalgat
    ## Pressure
35 1 rmalgat
    node.createObject("SurfacePressureForceField",  pressure=pressure)
36 1 rmalgat
37 1 rmalgat
    ## Deformation, Stress and Strain
38 1 rmalgat
    node.createObject('BarycentricShapeFunction', template="ShapeFunctiond")
39 1 rmalgat
    deformation = node.createChild("deformation")
40 1 rmalgat
    deformation.createObject('TopologyGaussPointSampler',name='sampler', inPosition='@../Topology.position' , showSamples="false", method="0", order="1" )
41 1 rmalgat
    deformation.createObject('MechanicalObject', name='deform', template='F321')
42 1 rmalgat
    deformation.createObject('LinearMapping', template='Vec3d,F321')
43 1 rmalgat
    stressStrain = deformation.createChild('stressStrain')
44 1 rmalgat
    stressStrain.createObject('MechanicalObject', name='Strain',template='E321')
45 1 rmalgat
    stressStrain.createObject('CorotationalStrainMapping', template="F321,E321")
46 1 rmalgat
    stressStrain.createObject('HookeForceField', template="E321", youngModulus=youngModulus,poissonRatio=poissonRatio, viscosity=0  )
47 1 rmalgat
48 1 rmalgat
    ## Collision
49 1 rmalgat
    node.createObject('TriangleModel',contactStiffness=1000,group=0)
50 1 rmalgat
    node.createObject('LineModel',contactStiffness=1000,group=0)
51 1 rmalgat
    node.createObject('PointModel',contactStiffness=1000,group=0)
52 1 rmalgat
    Visu = node.createChild('Visu')
53 1 rmalgat
    Visu.createObject('OglModel')
54 1 rmalgat
    Visu.createObject('IdentityMapping', template='Vec3d,ExtVec3f')
55 1 rmalgat
56 1 rmalgat
    ## indentor
57 1 rmalgat
    indentor = node.createChild('indentor')
58 1 rmalgat
    indentor.createObject('MechanicalObject',name='indentor', position="0.5 0.5 2")
59 1 rmalgat
    indentor.createObject('UniformMass')
60 1 rmalgat
    indentor.createObject('ConstantForceField', points=0, force="0 0 -1")
61 1 rmalgat
    indentor.createObject('TSphereModel', radius= indentorRadius, ContactStiffness=1000, group=1)
62 1 rmalgat
    indentor.createObject('ProjectToLineConstraint',endTime='-1', indices=0, origin="0.5 0.5 2", direction="0 0 1")
63 1 rmalgat
    indentor.createObject('PointConstraint', endTime=3, indices=0)