|
| 1 | +def createScene(rootNode): |
| 2 | + |
| 3 | + |
| 4 | + rootNode.addObject('RequiredPlugin', name="Shell") |
| 5 | + rootNode.addObject('RequiredPlugin', name='Sofa.Component.Constraint.Projective') # Needed to use components [FixedProjectiveConstraint] |
| 6 | + rootNode.addObject('RequiredPlugin', name='Sofa.Component.Engine.Select') # Needed to use components [BoxROI] |
| 7 | + rootNode.addObject('RequiredPlugin', name='Sofa.Component.IO.Mesh') # Needed to use components [MeshOBJLoader] |
| 8 | + rootNode.addObject('RequiredPlugin', name='Sofa.Component.LinearSolver.Direct') # Needed to use components [SparseLDLSolver] |
| 9 | + rootNode.addObject('RequiredPlugin', name='Sofa.Component.Mapping.Linear') # Needed to use components [IdentityMapping] |
| 10 | + rootNode.addObject('RequiredPlugin', name='Sofa.Component.Mass') # Needed to use components [UniformMass] |
| 11 | + rootNode.addObject('RequiredPlugin', name='Sofa.Component.ODESolver.Backward') # Needed to use components [EulerImplicitSolver] |
| 12 | + rootNode.addObject('RequiredPlugin', name='Sofa.Component.StateContainer') # Needed to use components [MechanicalObject] |
| 13 | + rootNode.addObject('RequiredPlugin', name='Sofa.Component.Topology.Container.Constant') # Needed to use components [MeshTopology] |
| 14 | + rootNode.addObject('RequiredPlugin', name='Sofa.GL.Component.Rendering3D') # Needed to use components [OglModel] |
| 15 | + rootNode.addObject('RequiredPlugin', name='Sofa.GUI.Component') # Needed to use components [AttachBodyButtonSetting] |
| 16 | + rootNode.addObject('RequiredPlugin', name='Sofa.Component.AnimationLoop') # Needed to use components [FreeMotionAnimationLoop] |
| 17 | + rootNode.addObject('RequiredPlugin', name='Sofa.Component.Constraint.Lagrangian.Correction') # Needed to use components [GenericConstraintCorrection] |
| 18 | + rootNode.addObject('RequiredPlugin', name='Sofa.Component.Constraint.Lagrangian.Solver') # Needed to use components [GenericConstraintSolver] |
| 19 | + rootNode.addObject('RequiredPlugin', name='Sofa.Component.Engine.Generate') # Needed to use components [NormalsFromPoints] |
| 20 | + rootNode.gravity = [0, -98.1, 0] |
| 21 | + rootNode.addObject('AttachBodyButtonSetting', stiffness=0.1) |
| 22 | + rootNode.addObject('FreeMotionAnimationLoop') |
| 23 | + rootNode.addObject('GenericConstraintSolver', maxIterations=1e3, tolerance=1e-3) |
| 24 | + |
| 25 | + square = rootNode.addChild('Square') |
| 26 | + square.addObject('EulerImplicitSolver') |
| 27 | + square.addObject('SparseLDLSolver') |
| 28 | + square.addObject('GenericConstraintCorrection') |
| 29 | + square.addObject('MeshOBJLoader', filename='mesh/square1.obj') |
| 30 | + square.addObject('MeshTopology', src=square.MeshOBJLoader.getLinkPath()) |
| 31 | + square.addObject('MechanicalObject', name="Object", template='Rigid3') |
| 32 | + square.addObject('NormalsFromPoints', name='NormalsFrom', position='@Object.position' ) |
| 33 | + square.addObject('UniformMass', totalMass=0.005) |
| 34 | + square.addObject('BoxROI', box=[0, 0.9, -0.1, 1, 1, 0.1], drawBoxes=True) |
| 35 | + square.addObject('FixedProjectiveConstraint', indices=square.BoxROI.indices.getLinkPath()) |
| 36 | + square.addObject('BezierTriangularBendingFEMForceField', youngModulus=1.7e3, |
| 37 | + poissonRatio=0.3, thickness=0.01, normals="@NormalsFrom.normals") |
| 38 | + |
| 39 | + visu = square.addChild('Visu') |
| 40 | + visu.addObject('OglModel', src=square.MeshTopology.getLinkPath()) |
| 41 | + visu.addObject('IdentityMapping') |
| 42 | + |
0 commit comments