How to display .stl files so that they can be deformed by mouse dragging #5193
-
I'm a SOFA beginner. I want to use the finger.stl file that comes with sofa to realize the elastic deformation of the model. <?xml version="1.0"?>
<Node name="root" dt="0.01" gravity="0 0 0">
<RequiredPlugin name="Sofa.Component.IO.Mesh"/> <!-- Needed to use components [MeshOBJLoader] -->
<RequiredPlugin name="Sofa.Component.LinearSolver.Iterative"/> <!-- Needed to use components [CGLinearSolver] -->
<RequiredPlugin name="Sofa.Component.Mass"/> <!-- Needed to use components [MeshMatrixMass] -->
<RequiredPlugin name="Sofa.Component.ODESolver.Backward"/> <!-- Needed to use components [EulerImplicitSolver] -->
<RequiredPlugin name="Sofa.Component.SceneUtility"/> <!-- Needed to use components [InfoComponent] -->
<RequiredPlugin name="Sofa.Component.SolidMechanics.FEM.Elastic"/> <!-- Needed to use components [TriangleFEMForceField] -->
<RequiredPlugin name="Sofa.Component.StateContainer"/> <!-- Needed to use components [MechanicalObject] -->
<RequiredPlugin name="Sofa.Component.Topology.Container.Dynamic"/> <!-- Needed to use components [TriangleSetTopologyContainer] -->
<RequiredPlugin name="Sofa.GL.Component.Rendering3D"/> <!-- Needed to use components [OglModel] -->
<RequiredPlugin name="Sofa.Component.Mapping.Linear"/> <!-- Needed to use components [IdentityMapping] -->
<RequiredPlugin name="Sofa.Component.Constraint.Projective"/> <!-- Needed to use components [FixedProjectiveConstraint] -->
<DefaultAnimationLoop/>
<MeshSTLLoader name="meshLoader" filename="finger.stl" />
<Node name="finger">
<EulerImplicitSolver/>
<CGLinearSolver iterations="200" tolerance="1e-09" threshold="1e-09"/>
<TriangleSetTopologyContainer src="@../meshLoader" name="topo" />
<MechanicalObject template="Vec3d" name="MechanicalModel" showObject="false" />
<!--<FixedProjectiveConstraint name="FixedProjectiveConstraint" indices="1" />-->
<MeshMatrixMass massDensity="1" topology="@topo"/>
<TriangleFEMForceField name="FEM" youngModulus="1000" poissonRatio="0.4" method="large"/>
<Node name="ExtractSurface">
<Node name="Visual">
<OglModel name="VisualModel" color="red"/>
<IdentityMapping name="Mapping" input="@../.." output="@VisualModel"/>
</Node>
</Node>
</Node>
</Node> Please tell me how I can change the Node named finger to achieve the effect I want. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Hello ! You are using a TriangleFEMForceField. This only gives stiffness on the element itself, but noting between elements. Meaning that no bending between triangles is computed : thus the resulting 'cloth-like' behavior. For the lack of internal structure, it might be because the stl file only contains surface triangle and is meant either for contact handling or visualization (I don't know what is in this file, I am just pointing potential issues, but the fact that you are using a TriangleFEMForceField makes me think that you tried with a TerahedronFEMForceField but it didn't work because no Tetrahedron were present in the loaded topo...) What I suggest is to make sure first that the loaded topology contains volumetric elements: either tetrahedron or hexaedron. Then, use the corresponding forcefield : TerahedronFEMForceField or HexaedronFEMForceField Tell me how it goes ! |
Beta Was this translation helpful? Give feedback.
Hello !
You are using a TriangleFEMForceField. This only gives stiffness on the element itself, but noting between elements. Meaning that no bending between triangles is computed : thus the resulting 'cloth-like' behavior.
For the lack of internal structure, it might be because the stl file only contains surface triangle and is meant either for contact handling or visualization (I don't know what is in this file, I am just pointing potential issues, but the fact that you are using a TriangleFEMForceField makes me think that you tried with a TerahedronFEMForceField but it didn't work because no Tetrahedron were present in the loaded topo...)
What I suggest is to make sure first that the lo…