Cannot deform object using the mouse #5187
-
Dear all, I loaded a tetrahedron model and a visual model of an eye with muscles attached to it. However, I could not use the shift+left mouse click to use the spring force field or the bilateral interaction constraint to deform or displace the model. Below is my setting of the model: #mesh loader for msh
meshLoaderCoarse = root.addObject('MeshGmshLoader', name='meshLoaderCoarse', filename='C:/Users/chi.zhang/Desktop/orbit_SOFA/soft_tissue-models/orbit_soft_tissue_down.msh', scale=10.0)
meshLoaderFine = root.addObject('MeshOBJLoader', name='meshLoaderFine', filename='C:/Users/chi.zhang/Desktop/orbit_SOFA/soft_tissue-models/orbit_soft_tisue_vis.obj', scale=10.0)
# Creating the falling sphere object
plateNode = root.addChild("plate")
# plateNode.addObject('MechanicalObject', name="mstate", template="Rigid3", translation2=[0., 0., 0.], rotation2=[0., 0., 0.], showObjectScale=50)
# Creating the falling plateNode object
plateNode.addObject('EulerImplicitSolver', name='odesolver')
# plateNode.addObject('CGLinearSolver', name='Solver', iterations=25, tolerance=1e-05, threshold=1e-05)
plateNode.addObject('SparseLDLSolver', name='Solver')
#tetrahedron topology
plateNode.addObject('TetrahedronSetTopologyContainer', name='topo', src=meshLoaderCoarse.getLinkPath())
plateNode.addObject('TetrahedronSetGeometryAlgorithms', template='Vec3d', name='GeomAlgo')
plateNode.addObject('MechanicalObject', template='Vec3d', name='MechanicalModel', showObject=True)
plateNode.addObject('TetrahedronFEMForceField', name='FEM', youngModulus=1000, poissonRatio=0.47, method='large')
plateNode.addObject('LinearSolverConstraintCorrection') #need for gravity filed #LinearSolverConstraint
# plateNode.addObject('UncoupledConstraintCorrection', compliance=1e-9)
plateNode.addObject('MeshMatrixMass', massDensity=1, topology='@topo')
collision = plateNode.addChild('Collision')
collision.addObject('MeshTopology', src=meshLoaderFine.getLinkPath())
collision.addObject('MechanicalObject', name='CollisionMO')
collision.addObject('TriangleCollisionModel', name='CollisionModel')
collision.addObject('LineCollisionModel')
collision.addObject('PointCollisionModel')
collision.addObject('BarycentricMapping', name='CollisionMapping', input='@../MechanicalModel', output='@CollisionMO')
# Fine visual model for plate with tetrahedron
fineVisualModel = plateNode.addChild('FineVisualModel')
fineVisualModel.addObject('OglModel', name='VisualModel', src=meshLoaderFine.getLinkPath())
fineVisualModel.addObject('BarycentricMapping', name='Mapping', input='@../MechanicalModel', output='@VisualModel') Here are my sample tetrahedron and obj file and the full script. I also tried to use a simpler script for the liver model from SOFA tutorial to load the eye model with 'DefaultAnimationLoop' and 'UncoupledConstraintCorrection' and 'CGLLinearSolver':. Somehow it still did not work for my case, though it worked for the liver model from SOFA tutorial. Could it be the problem with the tetrahedron models I used? Thank you very much! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
I am very new to sofa aswell, and I have been recently trying to work with lagrangian solvers. Whatever I am suggesting is purely based on what I tried and I definitely think you should wait for the talented veterans of SOFA to help you in this, but I thought I would chip in, in the meantime. I had a similar issue as yours, these are the things I made that helped the model deform. (Again I am sorry if this didn't help)
|
Beta Was this translation helpful? Give feedback.
I am very new to sofa aswell, and I have been recently trying to work with lagrangian solvers. Whatever I am suggesting is purely based on what I tried and I definitely think you should wait for the talented veterans of SOFA to help you in this, but I thought I would chip in, in the meantime. I had a similar issue as yours, these are the things I made that helped the model deform. (Again I am sorry if this didn't help)