GMSH Loader in Sofa v23.12.00 on Windows #4727
-
Hello, My colleague is trying to run my SOFA scene on her laptop, but she is not able to load the gmsh (.msh) file in SofaPython3. We have tried opening the "liver.msh" file from the example "examples/Demos/liver.scn". This works well when opening the XML-scene, but not when opening it from our python scene. I'm still using SOFA v22.06.00, while she is on SOFA v23.12.00. Everything works well on my laptop. Have there been any updates to the MeshGmshLoader in v23 that could cause this issue? Here is the scene we have tried: import Sofa
def createScene(rootNode):
rootNode.dt=0.01
rootNode.gravity=[0, -9.81e3, 0]
confignode = rootNode.addChild("Config")
confignode.addObject('RequiredPlugin', name="Sofa.Component.Collision.Geometry")
confignode.addObject('RequiredPlugin', name="SofaPython3", printLog=False)
confignode.addObject('OglSceneFrame', style="Arrows", alignment="TopRight")
rootNode.addObject('DefaultVisualManagerLoop')
rootNode.addObject('DefaultPipeline', name="pipeline", depth="6", verbose="0")
rootNode.addObject('BruteForceBroadPhase')
rootNode.addObject('BVHNarrowPhase')
rootNode.addObject('DefaultContactManager', name="response", response="FrictionContactConstraint")
rootNode.addObject('LocalMinDistance', alarmDistance="3.408", contactDistance="1.136", angleCone="0.0")
rootNode.addObject('FreeMotionAnimationLoop')
#rootNode.addObject('LCPConstraintSolver', tolerance="0.001", maxIt="1000", computeConstraintForces="True", mu="0.000001")
#rootNode.addObject('RequiredPlugin', name='Geomagic')
#driver = rootNode.addObject('GeomagicDriver', name='GeomagicDevice', deviceName="Default Device", scale="30", drawDeviceFrame="1", positionBase="0 0 0", drawDevice="0", orientationBase="0 0.707 0 -0.707") #scale attribute only affects position
#LIVER NODE BEGIN*************************************************************************************************************************************************************************
liver = rootNode.addChild('liver')
liver.gravity = [0, -9.81e3, 0]
liver.addObject('EulerImplicitSolver', name="cg_odesolver")
liver.addObject('CGLinearSolver', name="linear solver", iterations="25", tolerance="1e-09", threshold="1e-09")
liver.addObject('MeshGmshLoader', name="meshLoader", filename="mesh/liver.msh", rotation="90 270 -182", translation="0 -31.5 -26", scale3d="26 26 26")
liver.addObject('TetrahedronSetTopologyContainer', name="topo", src="@meshLoader")
liver.addObject('MechanicalObject', name="liverDofs", src="@meshLoader")
liver.addObject('TetrahedronSetGeometryAlgorithms', template="Vec3d", name="GeomAlgo")
liver.addObject('DiagonalMass', name="mass", massDensity="1.09e-9", topology="@topo", geometryState="@liverDofs")
liver.addObject('TetrahedralCorotationalFEMForceField', template="Vec3d", name="FEM", poissonRatio="0.29", youngModulus="5.05")
liver.addObject('PrecomputedConstraintCorrection', recompute="true")
liver.addObject('FixedConstraint', name="FixedConstraint", indices="1 2 5 6 7 11 12 13 14 15 16 17 18 19 20 21 22 23 24")
#LIVER NODE END***************************************************************************************************************************************************************************
return rootNode
# Function used only if this script is called from a python environment
if __name__ == '__main__':
main() |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
Hello! Maybe the version of SOFA could be the problem, but before that I think you may need to import the IO plugin, as: I hope this helps! |
Beta Was this translation helpful? Give feedback.
-
Hi @oystebje Thanks for noticing this. The topology components are getting stricter regarding the input info/mesh. |
Beta Was this translation helpful? Give feedback.
-
Hi @oystebje I tested your scene and except some warnings due to aliases or required plugin missing, it works fine on my side. But I'm on master, not 23.12. To investigate:
Hope it helps. |
Beta Was this translation helpful? Give feedback.
Hi @oystebje
I tested your scene and except some warnings due to aliases or required plugin missing, it works fine on my side. But I'm on master, not 23.12.
To investigate:
It is the same the "examples/Demos/liver.scn" but in python.
liver.addObject('TetrahedronSetTopologyContainer', name="topo", position="@meshLoader.position", tetrahedra="@meshLoader.tetrahedra")
passing only the points and tetrahedra, it will force the component to recompute the list of triangles and edges with the correct struct…