From 3b51664b59e1851ff0cd46118b86cbfd2d62d2fd Mon Sep 17 00:00:00 2001 From: Paul Baksic Date: Tue, 10 Dec 2024 15:28:07 +0100 Subject: [PATCH 1/2] Apply data name changes --- .../constraint/CableConstraint/CableSmoothActuation.py | 2 +- examples/component/constraint/CableConstraint/Finger.py | 4 ++-- .../component/constraint/CableConstraint/FingerWithSTLIB.py | 2 +- .../component/constraint/JointConstraint/JointConstraint.py | 2 +- .../constraint/SurfacePressureConstraint/Springy.py | 2 +- .../SurfacePressureConstraint/SurfacePressureConstraint.py | 2 +- .../UnilateralPlaneConstraint/ArticulatedTentacle.py | 2 +- .../CommunicationController/modules/accordion3.py | 2 +- .../controller/DataVariationLimiter/DataVariationLimiter.py | 2 +- .../thematicalDocs/T1-Elements_TetraHexaBeam/Beam/Beam.py | 2 +- .../T4-DirectActuation/Actuators/Cable/CableDisplacement.py | 4 ++-- .../T4-DirectActuation/Actuators/Cable/CableForce.py | 2 +- .../Actuators/Pneumatic/SurfaceConstraintPressure.py | 2 +- .../Actuators/Pneumatic/SurfaceConstraintVolume.py | 2 +- .../T4-DirectActuation/DriveTheRobot/Simulation.py | 6 +++--- .../PneunetGripper/details/step4-boundaryConditions.py | 2 +- .../details/step5-timeIntegrationAndMatrixSolver.py | 2 +- .../step6-pneumaticActuatorAndPythonScriptController.py | 2 +- .../tutorials/PneunetGripper/details/step7-grabTheCube.py | 2 +- .../tutorials/PneunetGripper/details/step7-withSTLIB.py | 2 +- examples/tutorials/PneunetGripper/pneunetgripper-tuto.md | 6 +++--- examples/tutorials/SoftArmGripper/scene.py | 4 ++-- examples/tutorials/SoftFingerDesign/details/fixing_box.py | 2 +- examples/tutorials/SoftFingerDesign/details/s90_servo.py | 2 +- examples/tutorials/Tripod/details/fixingbox.py | 2 +- examples/tutorials/Tripod/details/maze.py | 2 +- examples/tutorials/Tripod/details/s90servo.py | 2 +- examples/tutorials/Tripod/details/step8-maze.py | 2 +- examples/tutorials/Tripod/myproject/fixingbox.py | 2 +- examples/tutorials/Tripod/myproject/maze.py | 2 +- examples/tutorials/Tripod/myproject/parts/fixingbox.py | 2 +- examples/tutorials/Tripod/myproject/parts/maze.py | 2 +- examples/tutorials/Tripod/myproject/parts/s90servo.py | 2 +- examples/tutorials/Tripod/myproject/s90servo.py | 2 +- examples/tutorials/Tripod/myproject/step8-maze.py | 2 +- .../constraint/scenes/SurfacePressureConstraint.scn | 2 +- 36 files changed, 43 insertions(+), 43 deletions(-) diff --git a/examples/component/constraint/CableConstraint/CableSmoothActuation.py b/examples/component/constraint/CableConstraint/CableSmoothActuation.py index 30ea4db1..e2d17de1 100644 --- a/examples/component/constraint/CableConstraint/CableSmoothActuation.py +++ b/examples/component/constraint/CableConstraint/CableSmoothActuation.py @@ -53,7 +53,7 @@ def createScene(rootNode): bunny.addObject('FastTetrahedralCorotationalForceField', template='Vec3', name='FEM', method='large', poissonRatio='0.3', youngModulus='10000') bunny.addObject('BoxROI', name='boxROI', box=[-5, -5.0, -5, 5, -4.5, 5], drawBoxes=True) - bunny.addObject('RestShapeSpringsForceField', points='@boxROI.indices', stiffness='1e12') + bunny.addObject('RestShapeSpringsForceField', indices='@boxROI.indices', stiffness='1e12') bunny.addObject('GenericConstraintCorrection') diff --git a/examples/component/constraint/CableConstraint/Finger.py b/examples/component/constraint/CableConstraint/Finger.py index 57def8b5..d252965d 100644 --- a/examples/component/constraint/CableConstraint/Finger.py +++ b/examples/component/constraint/CableConstraint/Finger.py @@ -73,10 +73,10 @@ def createScene(rootNode): # RestShapeSpringsForceField is one way in Sofa to implement fixed point constraint. # Here the constraints are applied to the DoFs selected by the previously defined BoxROI - finger.addObject('RestShapeSpringsForceField', points=finger.roi.indices.getLinkPath(), stiffness=1e12) + finger.addObject('RestShapeSpringsForceField', indices=finger.roi.indices.getLinkPath(), stiffness=1e12) # It is also possible to simply set by hand the indices of the points you want to fix. - # finger.addObject('RestShapeSpringsForceField', points=[0, 1, 2, 11, 55], stiffness=1e12) + # finger.addObject('RestShapeSpringsForceField', indices=[0, 1, 2, 11, 55], stiffness=1e12) finger.addObject('GenericConstraintCorrection') diff --git a/examples/component/constraint/CableConstraint/FingerWithSTLIB.py b/examples/component/constraint/CableConstraint/FingerWithSTLIB.py index 98e256b4..0953930d 100644 --- a/examples/component/constraint/CableConstraint/FingerWithSTLIB.py +++ b/examples/component/constraint/CableConstraint/FingerWithSTLIB.py @@ -56,7 +56,7 @@ def createScene(rootNode): # RestShapeSpringsForceField is one way in Sofa to implement fixed point constraint. # Here the constraints are applied to the DoFs selected by the previously defined BoxROI - finger.addObject('RestShapeSpringsForceField', points='@ROI1.indices', stiffness=1e12) + finger.addObject('RestShapeSpringsForceField', indices='@ROI1.indices', stiffness=1e12) ########################################## # Cable # diff --git a/examples/component/constraint/JointConstraint/JointConstraint.py b/examples/component/constraint/JointConstraint/JointConstraint.py index d96431ba..0ed11ec6 100644 --- a/examples/component/constraint/JointConstraint/JointConstraint.py +++ b/examples/component/constraint/JointConstraint/JointConstraint.py @@ -38,7 +38,7 @@ def createScene(rootNode): object = simulation.addChild('Object') object.addObject('MechanicalObject', template='Vec1', position=0.) - object.addObject("RestShapeSpringsForceField", points=[0], stiffness=1e1) + object.addObject("RestShapeSpringsForceField", d_indices[0], stiffness=1e1) # Try to change the data field "value" from the GUI object.addObject('JointConstraint', template='Vec1', index=0, value=0, valueType="displacement", minDisplacement=-pi, maxDisplacement=pi) diff --git a/examples/component/constraint/SurfacePressureConstraint/Springy.py b/examples/component/constraint/SurfacePressureConstraint/Springy.py index 47cdec2a..ad900a3f 100644 --- a/examples/component/constraint/SurfacePressureConstraint/Springy.py +++ b/examples/component/constraint/SurfacePressureConstraint/Springy.py @@ -55,7 +55,7 @@ def createScene(rootNode): youngModulus=500) accordion.addObject('BoxROI', name='ROI1', box=[-2, -2, 0, 2, 2, 0.5], drawBoxes=True) - accordion.addObject('RestShapeSpringsForceField', points='@ROI1.indices', stiffness=1e12) + accordion.addObject('RestShapeSpringsForceField', indices='@ROI1.indices', stiffness=1e12) # accordion.addObject('FixedProjectiveConstraint', indices='@ROI1.indices') accordion.addObject('LinearSolverConstraintCorrection') diff --git a/examples/component/constraint/SurfacePressureConstraint/SurfacePressureConstraint.py b/examples/component/constraint/SurfacePressureConstraint/SurfacePressureConstraint.py index 51ca68f5..3a90f82e 100644 --- a/examples/component/constraint/SurfacePressureConstraint/SurfacePressureConstraint.py +++ b/examples/component/constraint/SurfacePressureConstraint/SurfacePressureConstraint.py @@ -49,7 +49,7 @@ def createScene(rootNode): bunny.addObject('BoxROI', name='boxROI', box=[-5, -7, -5, 5, -4.5, 5], drawBoxes=True, position="@tetras.rest_position", tetrahedra="@container.tetrahedra") - bunny.addObject('RestShapeSpringsForceField', points='@boxROI.indices', stiffness=1e12) + bunny.addObject('RestShapeSpringsForceField', indices='@boxROI.indices', stiffness=1e12) bunny.addObject('LinearSolverConstraintCorrection') # bunny/cavity diff --git a/examples/component/constraint/UnilateralPlaneConstraint/ArticulatedTentacle.py b/examples/component/constraint/UnilateralPlaneConstraint/ArticulatedTentacle.py index b4e3223b..8f06be9a 100644 --- a/examples/component/constraint/UnilateralPlaneConstraint/ArticulatedTentacle.py +++ b/examples/component/constraint/UnilateralPlaneConstraint/ArticulatedTentacle.py @@ -63,7 +63,7 @@ def createScene(rootNode): tentacle.addObject('TetrahedronFEMForceField', template='Vec3', name='FEM', method='large', poissonRatio=0.3, youngModulus=200) tentacle.addObject('BoxROI', name='ROI1', box=[[50, -20, 30],[75, 20, 50]], drawBoxes=True) - tentacle.addObject('RestShapeSpringsForceField', points='@ROI1.indices', stiffness=1e12) + tentacle.addObject('RestShapeSpringsForceField', indices='@ROI1.indices', stiffness=1e12) tentacle.addObject('LinearSolverConstraintCorrection') diff --git a/examples/component/controller/CommunicationController/modules/accordion3.py b/examples/component/controller/CommunicationController/modules/accordion3.py index d40c1f5c..6eaec093 100644 --- a/examples/component/controller/CommunicationController/modules/accordion3.py +++ b/examples/component/controller/CommunicationController/modules/accordion3.py @@ -13,7 +13,7 @@ def addAccordion(node, inverse=False): accordion.addObject('UniformMass', totalMass=0.030) accordion.addObject('TetrahedronFEMForceField', template='Vec3', name='FEM', method='large', poissonRatio=0.3, youngModulus=500) accordion.addObject('BoxROI', name='ROI1', box=[-2, -2, 0, 2, 2, 0.5], drawBoxes=True) - accordion.addObject('RestShapeSpringsForceField', points='@ROI1.indices', stiffness=1e12) + accordion.addObject('RestShapeSpringsForceField', indices='@ROI1.indices', stiffness=1e12) accordion.addObject('LinearSolverConstraintCorrection') # Pressure diff --git a/examples/component/controller/DataVariationLimiter/DataVariationLimiter.py b/examples/component/controller/DataVariationLimiter/DataVariationLimiter.py index da4c5c37..2f5651d6 100644 --- a/examples/component/controller/DataVariationLimiter/DataVariationLimiter.py +++ b/examples/component/controller/DataVariationLimiter/DataVariationLimiter.py @@ -94,7 +94,7 @@ def createScene(rootNode): youngModulus=500) accordion.addObject('BoxROI', name='ROI1', box=[-2, -2, 0, 2, 2, 0.5], drawBoxes=True) - accordion.addObject('RestShapeSpringsForceField', points='@ROI1.indices', stiffness=1e12) + accordion.addObject('RestShapeSpringsForceField', indices='@ROI1.indices', stiffness=1e12) accordion.addObject('LinearSolverConstraintCorrection') diff --git a/examples/thematicalDocs/T1-Elements_TetraHexaBeam/Beam/Beam.py b/examples/thematicalDocs/T1-Elements_TetraHexaBeam/Beam/Beam.py index 823e9567..f8b3a932 100644 --- a/examples/thematicalDocs/T1-Elements_TetraHexaBeam/Beam/Beam.py +++ b/examples/thematicalDocs/T1-Elements_TetraHexaBeam/Beam/Beam.py @@ -36,7 +36,7 @@ def createScene(rootNode): beam.addObject('BeamInterpolation', name='interpol', crossSectionShape='rectangular', lengthY=5, lengthZ=5, defaultYoungModulus=1.8e6) beam.addObject('AdaptiveBeamForceFieldAndMass', name="BeamForceField", computeMass=1, massDensity=0.001) - beam.addObject('RestShapeSpringsForceField', points=0, stiffness=100e10, angularStiffness=100e10) + beam.addObject('RestShapeSpringsForceField', indices=0, stiffness=100e10, angularStiffness=100e10) # Visualization visuNode = beam.addChild('visualization') diff --git a/examples/thematicalDocs/T4-DirectActuation/Actuators/Cable/CableDisplacement.py b/examples/thematicalDocs/T4-DirectActuation/Actuators/Cable/CableDisplacement.py index a67ebb8e..813f8c2d 100644 --- a/examples/thematicalDocs/T4-DirectActuation/Actuators/Cable/CableDisplacement.py +++ b/examples/thematicalDocs/T4-DirectActuation/Actuators/Cable/CableDisplacement.py @@ -53,10 +53,10 @@ def createScene(rootNode): # RestShapeSpringsForceField is one way in Sofa to implement fixed point constraint. # Here the constraints are applied to the DoFs selected by the previously defined BoxROI - finger.addObject('RestShapeSpringsForceField', points='@ROI.indices', stiffness=1e12) + finger.addObject('RestShapeSpringsForceField', indices='@ROI.indices', stiffness=1e12) # It is also possible to simply set by hand the indices of the points you want to fix. - # finger.addObject('RestShapeSpringsForceField', points=[0, 1, 2, 11, 55], stiffness=1e12) + # finger.addObject('RestShapeSpringsForceField', indices=[0, 1, 2, 11, 55], stiffness=1e12) finger.addObject('LinearSolverConstraintCorrection') diff --git a/examples/thematicalDocs/T4-DirectActuation/Actuators/Cable/CableForce.py b/examples/thematicalDocs/T4-DirectActuation/Actuators/Cable/CableForce.py index 9269c1df..2131addc 100644 --- a/examples/thematicalDocs/T4-DirectActuation/Actuators/Cable/CableForce.py +++ b/examples/thematicalDocs/T4-DirectActuation/Actuators/Cable/CableForce.py @@ -50,7 +50,7 @@ def createScene(rootNode): # RestShapeSpringsForceField is one way in Sofa to implement fixed point constraint. # Here the constraints are applied to the DoFs selected by the previously defined BoxROI - finger.addObject('RestShapeSpringsForceField', points='@ROI.indices', stiffness=1e12) + finger.addObject('RestShapeSpringsForceField', indices='@ROI.indices', stiffness=1e12) finger.addObject('LinearSolverConstraintCorrection') diff --git a/examples/thematicalDocs/T4-DirectActuation/Actuators/Pneumatic/SurfaceConstraintPressure.py b/examples/thematicalDocs/T4-DirectActuation/Actuators/Pneumatic/SurfaceConstraintPressure.py index 726ea218..392ab864 100644 --- a/examples/thematicalDocs/T4-DirectActuation/Actuators/Pneumatic/SurfaceConstraintPressure.py +++ b/examples/thematicalDocs/T4-DirectActuation/Actuators/Pneumatic/SurfaceConstraintPressure.py @@ -31,7 +31,7 @@ def createScene(rootNode): bunny.addObject('BoxROI', name='boxROI', box=[-5, -15, -5, 5, -4.5, 5], drawBoxes=True, position="@tetras.rest_position", tetrahedra="@container.tetrahedra") - bunny.addObject('RestShapeSpringsForceField', points='@boxROI.indices', stiffness=1e12) + bunny.addObject('RestShapeSpringsForceField', indices='@boxROI.indices', stiffness=1e12) bunny.addObject('LinearSolverConstraintCorrection') # bunny/cavity diff --git a/examples/thematicalDocs/T4-DirectActuation/Actuators/Pneumatic/SurfaceConstraintVolume.py b/examples/thematicalDocs/T4-DirectActuation/Actuators/Pneumatic/SurfaceConstraintVolume.py index fa3fa709..50d288a5 100644 --- a/examples/thematicalDocs/T4-DirectActuation/Actuators/Pneumatic/SurfaceConstraintVolume.py +++ b/examples/thematicalDocs/T4-DirectActuation/Actuators/Pneumatic/SurfaceConstraintVolume.py @@ -29,7 +29,7 @@ def createScene(rootNode): bunny.addObject('BoxROI', name='boxROI', box=[-5, -15, -5, 5, -4.5, 5], drawBoxes=True, position="@tetras.rest_position", tetrahedra="@container.tetrahedra") - bunny.addObject('RestShapeSpringsForceField', points='@boxROI.indices', stiffness=1e12) + bunny.addObject('RestShapeSpringsForceField', indices='@boxROI.indices', stiffness=1e12) bunny.addObject('LinearSolverConstraintCorrection') # bunny/cavity diff --git a/examples/thematicalDocs/T4-DirectActuation/DriveTheRobot/Simulation.py b/examples/thematicalDocs/T4-DirectActuation/DriveTheRobot/Simulation.py index d5958820..8593f190 100644 --- a/examples/thematicalDocs/T4-DirectActuation/DriveTheRobot/Simulation.py +++ b/examples/thematicalDocs/T4-DirectActuation/DriveTheRobot/Simulation.py @@ -63,11 +63,11 @@ def createScene(rootNode): showIndices=False, showIndicesScale=4e-5, position='@../robot/boxROI3.pointsInROI') - robot.addObject('RestShapeSpringsForceField', name='fixed1', points="@boxROI1.indices", + robot.addObject('RestShapeSpringsForceField', name='fixed1', indices="@boxROI1.indices", external_rest_shape="@RestPositionLeg0/meca0", stiffness=1e3) - robot.addObject('RestShapeSpringsForceField', name='fixed2', points="@boxROI2.indices", + robot.addObject('RestShapeSpringsForceField', name='fixed2', indices="@boxROI2.indices", external_rest_shape="@RestPositionLeg1/meca1", stiffness=1e3) - robot.addObject('RestShapeSpringsForceField', name='fixed3', points="@boxROI3.indices", + robot.addObject('RestShapeSpringsForceField', name='fixed3', indices="@boxROI3.indices", external_rest_shape="@RestPositionLeg2/meca2", stiffness=1e3) ############################### diff --git a/examples/tutorials/PneunetGripper/details/step4-boundaryConditions.py b/examples/tutorials/PneunetGripper/details/step4-boundaryConditions.py index bbe188b2..8e2d3f7a 100644 --- a/examples/tutorials/PneunetGripper/details/step4-boundaryConditions.py +++ b/examples/tutorials/PneunetGripper/details/step4-boundaryConditions.py @@ -26,7 +26,7 @@ def createScene(rootNode): finger.addObject('UniformMass', totalMass=0.04) boxROISubTopo = finger.addObject('BoxROI', name='boxROISubTopo', box=[-100, 22.5, -8, -19, 28, 8], strict=False) boxROI = finger.addObject('BoxROI', name='boxROI', box=[-10, 0, -20, 0, 30, 20], drawBoxes=True) - finger.addObject('RestShapeSpringsForceField', points=boxROI.indices.linkpath, stiffness=1e12, angularStiffness=1e12) + finger.addObject('RestShapeSpringsForceField', indices=boxROI.indices.linkpath, stiffness=1e12, angularStiffness=1e12) modelSubTopo = finger.addChild('SubTopology') modelSubTopo.addObject('MeshTopology', position='@loader.position', name='container', diff --git a/examples/tutorials/PneunetGripper/details/step5-timeIntegrationAndMatrixSolver.py b/examples/tutorials/PneunetGripper/details/step5-timeIntegrationAndMatrixSolver.py index 089b2a22..d7444693 100644 --- a/examples/tutorials/PneunetGripper/details/step5-timeIntegrationAndMatrixSolver.py +++ b/examples/tutorials/PneunetGripper/details/step5-timeIntegrationAndMatrixSolver.py @@ -32,7 +32,7 @@ def createScene(rootNode): finger.addObject('UniformMass', totalMass=0.04) boxROISubTopo = finger.addObject('BoxROI', name='boxROISubTopo', box=[-100, 22.5, -8, -19, 28, 8], strict=False) boxROI = finger.addObject('BoxROI', name='boxROI', box=[-10, 0, -20, 0, 30, 20], drawBoxes=True) - finger.addObject('RestShapeSpringsForceField', points=boxROI.indices.linkpath, stiffness=1e12, angularStiffness=1e12) + finger.addObject('RestShapeSpringsForceField', indices=boxROI.indices.linkpath, stiffness=1e12, angularStiffness=1e12) modelSubTopo = finger.addChild('SubTopology') modelSubTopo.addObject('MeshTopology', position='@loader.position', tetrahedra=boxROISubTopo.tetrahedraInROI.linkpath, diff --git a/examples/tutorials/PneunetGripper/details/step6-pneumaticActuatorAndPythonScriptController.py b/examples/tutorials/PneunetGripper/details/step6-pneumaticActuatorAndPythonScriptController.py index f8ae1416..da74c693 100644 --- a/examples/tutorials/PneunetGripper/details/step6-pneumaticActuatorAndPythonScriptController.py +++ b/examples/tutorials/PneunetGripper/details/step6-pneumaticActuatorAndPythonScriptController.py @@ -38,7 +38,7 @@ def createScene(rootNode): finger.addObject('UniformMass', totalMass=0.04) boxROISubTopo = finger.addObject('BoxROI', name='boxROISubTopo', box=[-100, 22.5, -8, -19, 28, 8], strict=False) boxROI = finger.addObject('BoxROI', name='boxROI', box=[-10, 0, -20, 0, 30, 20], drawBoxes=True) - finger.addObject('RestShapeSpringsForceField', points=boxROI.indices.linkpath, stiffness=1e12, angularStiffness=1e12) + finger.addObject('RestShapeSpringsForceField', indices=boxROI.indices.linkpath, stiffness=1e12, angularStiffness=1e12) finger.addObject('GenericConstraintCorrection') modelSubTopo = finger.addChild('SubTopology') diff --git a/examples/tutorials/PneunetGripper/details/step7-grabTheCube.py b/examples/tutorials/PneunetGripper/details/step7-grabTheCube.py index 831d5fd0..8ce4c7e7 100644 --- a/examples/tutorials/PneunetGripper/details/step7-grabTheCube.py +++ b/examples/tutorials/PneunetGripper/details/step7-grabTheCube.py @@ -115,7 +115,7 @@ def createScene(rootNode): boxROI = finger.addObject('BoxROI', name='boxROI', box=[-10, 0, -20, 0, 30, 20], doUpdate=False) boxROISubTopo = finger.addObject('BoxROI', name='boxROISubTopo', box=[-100, 22.5, -8, -19, 28, 8], strict=False) finger.addObject('RestShapeSpringsForceField', - points=boxROI.indices.linkpath, + indices=boxROI.indices.linkpath, stiffness=1e12, angularStiffness=1e12) finger.addObject('GenericConstraintCorrection') diff --git a/examples/tutorials/PneunetGripper/details/step7-withSTLIB.py b/examples/tutorials/PneunetGripper/details/step7-withSTLIB.py index 5d3d5971..3435dfc9 100644 --- a/examples/tutorials/PneunetGripper/details/step7-withSTLIB.py +++ b/examples/tutorials/PneunetGripper/details/step7-withSTLIB.py @@ -75,7 +75,7 @@ def createScene(rootNode): finger.integration.rayleighMass = 0.1 finger.addObject('BoxROI', name='boxROI', box=fingersParameters[i]['ROIBox'], drawBoxes=True, doUpdate=False) - finger.addObject('RestShapeSpringsForceField', points='@../Finger1/boxROI.indices', stiffness=1e12, + finger.addObject('RestShapeSpringsForceField', indices='@../Finger1/boxROI.indices', stiffness=1e12, angularStiffness=1e12) PneumaticCavity(surfaceMeshFileName=fingersCavitySurfaceMesh, diff --git a/examples/tutorials/PneunetGripper/pneunetgripper-tuto.md b/examples/tutorials/PneunetGripper/pneunetgripper-tuto.md index 060053bf..fcd8295a 100644 --- a/examples/tutorials/PneunetGripper/pneunetgripper-tuto.md +++ b/examples/tutorials/PneunetGripper/pneunetgripper-tuto.md @@ -62,7 +62,7 @@ To easily define the indices of the points which will be fixed, we use the boxRO ```python finger.addObject('BoxROI', name='boxROI', box=[-10, 0, -20, 0, 30, 20]) -finger.addObject('RestShapeSpringsForceField', points='@boxROI.indices', stiffness=1e12, angularStiffness=1e12) +finger.addObject('RestShapeSpringsForceField', indices='@boxROI.indices', stiffness=1e12, angularStiffness=1e12) ``` [Step4](details/step4-boundaryConditions.py) @@ -286,9 +286,9 @@ def createScene(rootNode): finger.addObject('BoxROI', name='boxROI', box=[-10, 0, -20, 0, 30, 20]) finger.addObject('BoxROI', name='boxROISubTopo', box=[-100, 22.5, -8, -19, 28, 8], strict=False) if i == 0: - finger.addObject('RestShapeSpringsForceField', points='@boxROI.indices', stiffness=1e12, angularStiffness=1e12) + finger.addObject('RestShapeSpringsForceField', indices='@boxROI.indices', stiffness=1e12, angularStiffness=1e12) else: - finger.addObject('RestShapeSpringsForceField', points='@../finger1/boxROI.indices', stiffness=1e12, angularStiffness=1e12) + finger.addObject('RestShapeSpringsForceField', indices='@../finger1/boxROI.indices', stiffness=1e12, angularStiffness=1e12) finger.addObject('LinearSolverConstraintCorrection', solverName='preconditioner') diff --git a/examples/tutorials/SoftArmGripper/scene.py b/examples/tutorials/SoftArmGripper/scene.py index c0d11a4f..920d13b5 100644 --- a/examples/tutorials/SoftArmGripper/scene.py +++ b/examples/tutorials/SoftArmGripper/scene.py @@ -39,7 +39,7 @@ def addArm(node): arm.addObject('MechanicalObject', template='Rigid3', name='dofs', showObject=True, showObjectScale=10) arm.addObject('UniformMass', indices=[4 * i + 1 for i in range(size)], totalMass=0.003 * size, showAxisSizeFactor=0.03) # set mass of each piece that connect the ribs - arm.addObject('RestShapeSpringsForceField', stiffness=1e12, angularStiffness=1e12, points=0) # fix base of the arm + arm.addObject('RestShapeSpringsForceField', stiffness=1e12, angularStiffness=1e12, indices=0) # fix base of the arm # sub topology to allow different ribs thickness for each section for i in range(params.Arm.nbSection): @@ -84,7 +84,7 @@ def addFinger(node, fingerId, translation, rotation): finger.addObject('TetrahedronFEMForceField', template='Vec3', name='FEM', method='large', poissonRatio=0.3, youngModulus=1.8e6) finger.addObject('BoxROI', name='boxROI', box=[-100, -20, -50, 100, 20, 50], drawBoxes=True) - finger.addObject('RestShapeSpringsForceField', points=finger.boxROI.indices.getLinkPath(), stiffness=1e12) + finger.addObject('RestShapeSpringsForceField', indices=finger.boxROI.indices.getLinkPath(), stiffness=1e12) visu[fingerId] = finger.addChild('Visualization') visu[fingerId].addObject('MeshSTLLoader', name="loader", filename=params.Simulation.path + "/mesh/finger.stl", diff --git a/examples/tutorials/SoftFingerDesign/details/fixing_box.py b/examples/tutorials/SoftFingerDesign/details/fixing_box.py index 4db1b924..09ae3e4b 100644 --- a/examples/tutorials/SoftFingerDesign/details/fixing_box.py +++ b/examples/tutorials/SoftFingerDesign/details/fixing_box.py @@ -21,5 +21,5 @@ def __init__(self, parent, target, name='FixingBox', target.addChild(c) c.addObject('RestShapeSpringsForceField', - points=self.node.BoxROI.getData('indices').getLinkPath(), + indices=self.node.BoxROI.getData('indices').getLinkPath(), stiffness=1e12) diff --git a/examples/tutorials/SoftFingerDesign/details/s90_servo.py b/examples/tutorials/SoftFingerDesign/details/s90_servo.py index 0c7a81c0..4d089c2a 100644 --- a/examples/tutorials/SoftFingerDesign/details/s90_servo.py +++ b/examples/tutorials/SoftFingerDesign/details/s90_servo.py @@ -74,7 +74,7 @@ def init(self): angle = self.addChild('Articulation') angle.addObject('MechanicalObject', name='dofs', template='Vec1', position=[[self.getData('angleIn')]], rest_position=self.getData('angleIn').getLinkPath()) - angle.addObject('RestShapeSpringsForceField', points=0, stiffness=1e9) + angle.addObject('RestShapeSpringsForceField', indices=0, stiffness=1e9) angle.addObject('UniformMass', totalMass=0.01) servoWheel = angle.addChild('ServoWheel') diff --git a/examples/tutorials/Tripod/details/fixingbox.py b/examples/tutorials/Tripod/details/fixingbox.py index 5eb73d56..606c735b 100644 --- a/examples/tutorials/Tripod/details/fixingbox.py +++ b/examples/tutorials/Tripod/details/fixingbox.py @@ -18,6 +18,6 @@ def FixingBox(parent, target, name='FixingBox', target.addChild(c) c.addObject('RestShapeSpringsForceField', - points=self.BoxROI.getData('indices').getLinkPath(), + indices=self.BoxROI.getData('indices').getLinkPath(), stiffness=1e12) return self diff --git a/examples/tutorials/Tripod/details/maze.py b/examples/tutorials/Tripod/details/maze.py index b751b25e..7f211dca 100644 --- a/examples/tutorials/Tripod/details/maze.py +++ b/examples/tutorials/Tripod/details/maze.py @@ -78,7 +78,7 @@ def createScene(rootNode): effector.addObject('CGLinearSolver', iterations=100, threshold=1e-5, tolerance=1e-5) effector.addObject('MechanicalObject', template='Rigid3', name='goalMO', position=[0, 40, 0, 0, 0, 0, 1], showObject=True, showObjectScale=10) - effector.addObject('RestShapeSpringsForceField', points=0, angularStiffness=1e5, stiffness=1e5) + effector.addObject('RestShapeSpringsForceField', indices=0, angularStiffness=1e5, stiffness=1e5) effector.addObject('UncoupledConstraintCorrection', compliance='1e-10 1e-10 0 0 1e-10 0 1e-10 ') # Open maze planning from JSON file diff --git a/examples/tutorials/Tripod/details/s90servo.py b/examples/tutorials/Tripod/details/s90servo.py index 42ef2332..7a198fa5 100644 --- a/examples/tutorials/Tripod/details/s90servo.py +++ b/examples/tutorials/Tripod/details/s90servo.py @@ -75,7 +75,7 @@ def __init__(self, *args, **kwargs): angle = self.addChild('Articulation') angle.addObject('MechanicalObject', name='dofs', template='Vec1', position=[[0]], rest_position=self.angleIn.getLinkPath()) - angle.addObject('RestShapeSpringsForceField', points=0, stiffness=1e9) + angle.addObject('RestShapeSpringsForceField', indices=0, stiffness=1e9) angle.addObject('UniformMass', totalMass=0.01) servoWheel = angle.addChild('ServoWheel') diff --git a/examples/tutorials/Tripod/details/step8-maze.py b/examples/tutorials/Tripod/details/step8-maze.py index 29feccd9..dd0c140a 100644 --- a/examples/tutorials/Tripod/details/step8-maze.py +++ b/examples/tutorials/Tripod/details/step8-maze.py @@ -16,7 +16,7 @@ def EffectorGoal(node, position): goal.addObject('EulerImplicitSolver', firstOrder=True) goal.addObject('CGLinearSolver', iterations=100, threshold=1e-12, tolerance=1e-10) goal.addObject('MechanicalObject', name='goalMO', template='Rigid3', position=position+[0., 0., 0., 1.], showObject=True, showObjectScale=10) - goal.addObject('RestShapeSpringsForceField', points=0, angularStiffness=1e5, stiffness=1e5) + goal.addObject('RestShapeSpringsForceField', indices=0, angularStiffness=1e5, stiffness=1e5) goal.addObject('UncoupledConstraintCorrection', compliance=[1e-10] * 7) return goal diff --git a/examples/tutorials/Tripod/myproject/fixingbox.py b/examples/tutorials/Tripod/myproject/fixingbox.py index 5eb73d56..606c735b 100644 --- a/examples/tutorials/Tripod/myproject/fixingbox.py +++ b/examples/tutorials/Tripod/myproject/fixingbox.py @@ -18,6 +18,6 @@ def FixingBox(parent, target, name='FixingBox', target.addChild(c) c.addObject('RestShapeSpringsForceField', - points=self.BoxROI.getData('indices').getLinkPath(), + indices=self.BoxROI.getData('indices').getLinkPath(), stiffness=1e12) return self diff --git a/examples/tutorials/Tripod/myproject/maze.py b/examples/tutorials/Tripod/myproject/maze.py index b751b25e..7f211dca 100644 --- a/examples/tutorials/Tripod/myproject/maze.py +++ b/examples/tutorials/Tripod/myproject/maze.py @@ -78,7 +78,7 @@ def createScene(rootNode): effector.addObject('CGLinearSolver', iterations=100, threshold=1e-5, tolerance=1e-5) effector.addObject('MechanicalObject', template='Rigid3', name='goalMO', position=[0, 40, 0, 0, 0, 0, 1], showObject=True, showObjectScale=10) - effector.addObject('RestShapeSpringsForceField', points=0, angularStiffness=1e5, stiffness=1e5) + effector.addObject('RestShapeSpringsForceField', indices=0, angularStiffness=1e5, stiffness=1e5) effector.addObject('UncoupledConstraintCorrection', compliance='1e-10 1e-10 0 0 1e-10 0 1e-10 ') # Open maze planning from JSON file diff --git a/examples/tutorials/Tripod/myproject/parts/fixingbox.py b/examples/tutorials/Tripod/myproject/parts/fixingbox.py index 6d42783a..cd9d3921 100644 --- a/examples/tutorials/Tripod/myproject/parts/fixingbox.py +++ b/examples/tutorials/Tripod/myproject/parts/fixingbox.py @@ -20,6 +20,6 @@ def FixingBox(parent, target, name='FixingBox', target.addChild(c) c.addObject('RestShapeSpringsForceField', - points=self.BoxROI.getData('indices').getLinkPath(), + indices=self.BoxROI.getData('indices').getLinkPath(), stiffness=1e12) return self diff --git a/examples/tutorials/Tripod/myproject/parts/maze.py b/examples/tutorials/Tripod/myproject/parts/maze.py index 9dba6ffc..949ca39d 100644 --- a/examples/tutorials/Tripod/myproject/parts/maze.py +++ b/examples/tutorials/Tripod/myproject/parts/maze.py @@ -56,7 +56,7 @@ def createScene(rootNode): effector.addObject('CGLinearSolver', iterations=100, threshold=1e-5, tolerance=1e-5) effector.addObject('MechanicalObject', template='Rigid3', name='goalMO', position=[0, 40, 0, 0, 0, 0, 1], showObject=True, showObjectScale=10) - effector.addObject('RestShapeSpringsForceField', points=0, angularStiffness=1e5, stiffness=1e5) + effector.addObject('RestShapeSpringsForceField', indices=0, angularStiffness=1e5, stiffness=1e5) effector.addObject('UncoupledConstraintCorrection', compliance='1e-10 1e-10 0 0 1e-10 0 1e-10 ') # Open maze planning from JSON file diff --git a/examples/tutorials/Tripod/myproject/parts/s90servo.py b/examples/tutorials/Tripod/myproject/parts/s90servo.py index 6f7b900d..51e6a5b0 100644 --- a/examples/tutorials/Tripod/myproject/parts/s90servo.py +++ b/examples/tutorials/Tripod/myproject/parts/s90servo.py @@ -75,7 +75,7 @@ def init(self): angle = self.addChild('Articulation') angle.addObject('MechanicalObject', name='dofs', template='Vec1', position=[[0]], rest_position=self.getData('angleIn').getLinkPath()) - angle.addObject('RestShapeSpringsForceField', points=0, stiffness=1e9) + angle.addObject('RestShapeSpringsForceField', indices=0, stiffness=1e9) angle.addObject('UniformMass', totalMass=0.01) servoWheel = angle.addChild('ServoWheel') diff --git a/examples/tutorials/Tripod/myproject/s90servo.py b/examples/tutorials/Tripod/myproject/s90servo.py index 42ef2332..7a198fa5 100644 --- a/examples/tutorials/Tripod/myproject/s90servo.py +++ b/examples/tutorials/Tripod/myproject/s90servo.py @@ -75,7 +75,7 @@ def __init__(self, *args, **kwargs): angle = self.addChild('Articulation') angle.addObject('MechanicalObject', name='dofs', template='Vec1', position=[[0]], rest_position=self.angleIn.getLinkPath()) - angle.addObject('RestShapeSpringsForceField', points=0, stiffness=1e9) + angle.addObject('RestShapeSpringsForceField', indices=0, stiffness=1e9) angle.addObject('UniformMass', totalMass=0.01) servoWheel = angle.addChild('ServoWheel') diff --git a/examples/tutorials/Tripod/myproject/step8-maze.py b/examples/tutorials/Tripod/myproject/step8-maze.py index 40891e15..64d28912 100644 --- a/examples/tutorials/Tripod/myproject/step8-maze.py +++ b/examples/tutorials/Tripod/myproject/step8-maze.py @@ -16,7 +16,7 @@ def EffectorGoal(node, position): goal.addObject('EulerImplicitSolver', firstOrder=True) goal.addObject('CGLinearSolver', iterations=100, threshold=1e-12, tolerance=1e-10) goal.addObject('MechanicalObject', name='goalMO', template='Rigid3', position=position+[0., 0., 0., 1.], showObject=True, showObjectScale=10) - goal.addObject('RestShapeSpringsForceField', points=0, angularStiffness=1e5, stiffness=1e5) + goal.addObject('RestShapeSpringsForceField', indices=0, angularStiffness=1e5, stiffness=1e5) goal.addObject('UncoupledConstraintCorrection', compliance=[1e-10] * 7) return goal diff --git a/tests/component/constraint/scenes/SurfacePressureConstraint.scn b/tests/component/constraint/scenes/SurfacePressureConstraint.scn index 937afbb6..4dcb6300 100644 --- a/tests/component/constraint/scenes/SurfacePressureConstraint.scn +++ b/tests/component/constraint/scenes/SurfacePressureConstraint.scn @@ -25,7 +25,7 @@ - + From 86e2b8d7bbcbbfc4f6d0e339ad14ee9e798b941e Mon Sep 17 00:00:00 2001 From: Paul Baksic Date: Tue, 10 Dec 2024 15:54:32 +0100 Subject: [PATCH 2/2] Fix name --- .../component/constraint/JointConstraint/JointConstraint.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/component/constraint/JointConstraint/JointConstraint.py b/examples/component/constraint/JointConstraint/JointConstraint.py index 0ed11ec6..10ad8d7d 100644 --- a/examples/component/constraint/JointConstraint/JointConstraint.py +++ b/examples/component/constraint/JointConstraint/JointConstraint.py @@ -38,7 +38,7 @@ def createScene(rootNode): object = simulation.addChild('Object') object.addObject('MechanicalObject', template='Vec1', position=0.) - object.addObject("RestShapeSpringsForceField", d_indices[0], stiffness=1e1) + object.addObject("RestShapeSpringsForceField", indices=[0], stiffness=1e1) # Try to change the data field "value" from the GUI object.addObject('JointConstraint', template='Vec1', index=0, value=0, valueType="displacement", minDisplacement=-pi, maxDisplacement=pi)