From 65960d04f32122b336843ac8521c49d2533a8f3d Mon Sep 17 00:00:00 2001 From: Alex Bilger Date: Fri, 29 Nov 2024 17:31:29 +0100 Subject: [PATCH] fix scene nonLinearCosserat.py (#137) --- examples/python3/cosserat/nonLinearCosserat.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/examples/python3/cosserat/nonLinearCosserat.py b/examples/python3/cosserat/nonLinearCosserat.py index 901bb273..90e3022e 100644 --- a/examples/python3/cosserat/nonLinearCosserat.py +++ b/examples/python3/cosserat/nonLinearCosserat.py @@ -51,7 +51,7 @@ class NonLinearCosserat(Sofa.Prefab): Cosserat Mapping // it allow the transfer from the local to the global frame } """ - properties = [ + prefabParameters = [ {'name': 'name', 'type': 'string', 'help': 'Node name', 'default': 'Cosserat'}, {'name': 'position', 'type': 'Rigid3d::VecCoord', 'help': 'Cosserat base position', 'default': [[0., 0., 0., 0, 0, 0, 1.]]}, @@ -67,7 +67,7 @@ class NonLinearCosserat(Sofa.Prefab): 'default': 0.0}, {'name': 'attachingToLink', 'type': 'string', 'help': 'a rest shape force field will constraint the object ' 'to follow arm position', 'default': '1'}, - {'name': 'showObject', 'type': 'string', 'help': ' Draw object arrow ', 'default': '0'}] + {'name': 'showObject', 'type': 'string', 'help': ' Draw object arrow ', 'default': '1'}] def __init__(self, *args, **kwargs): Sofa.Prefab.__init__(self, *args, **kwargs) @@ -193,11 +193,11 @@ def addCosseratFrame(self, framesF, curv_abs_inputS, curv_abs_outputF): def createScene(rootNode): rootNode.addObject('RequiredPlugin', name='plugins', pluginName=[pluginList, - ['SofaEngine', 'SofaLoader', 'SofaSimpleFem', - 'SofaExporter']]) + ['Sofa.Component.Visual']]) rootNode.addObject('VisualStyle', displayFlags='showVisualModels showBehaviorModels hideCollisionModels ' - 'hideBoundingCollisionModels hireForceFields ' + 'hideBoundingCollisionModels hideForceFields ' 'hideInteractionForceFields hideWireframe') + rootNode.addObject('DefaultAnimationLoop') rootNode.findData('dt').value = 0.01 # rootNode.findData('gravity').value = [0., -9.81, 0.] rootNode.findData('gravity').value = [0., 0., 0.] @@ -213,12 +213,11 @@ def createScene(rootNode): # solverNode.addObject('CGLinearSolver', tolerance=1.e-12, iterations=1000, threshold=1.e-18) needCollisionModel = 0 # use this if the collision model if the beam will interact with another object - nonLinearCosserat = solverNode.addChild( - NonLinearCosserat(parent=solverNode, cosseratGeometry=nonLinearConfig, useCollisionModel=needCollisionModel, - name="cosserat", radius=0.1, legendreControlPoints=initialStrain, order=3)) + nonLinearCosserat = NonLinearCosserat(parent=solverNode, cosseratGeometry=nonLinearConfig, + useCollisionModel=needCollisionModel, name="cosserat", radius=0.1, legendreControlPoints=initialStrain, order=3) beamFrame = nonLinearCosserat.cosseratFrame beamFrame.addObject('ConstantForceField', name='constForce', showArrowSize=1.e-8, indices=12, - force=[0., 0., 0., 0., 0., 450.]) + forces=[0., 0., 0., 0., 0., 450.]) return rootNode