From 0454f3e2dd0bbcaafa877b9635a60e44f4459f4d Mon Sep 17 00:00:00 2001 From: Paul Baksic Date: Tue, 10 Dec 2024 16:18:27 +0100 Subject: [PATCH 1/3] apply data name change --- examples/python3/NeedleInsertion-predefinedPath.py | 2 +- examples/python3/PNLS_Example3.py | 4 ++-- examples/python3/cosserat/CosseratBase.py | 4 ++-- examples/python3/cosserat/cosseratObject.py | 4 ++-- examples/python3/cosserat/createFemRegularGrid.py | 4 ++-- examples/python3/cosserat/nonLinearCosserat.py | 4 ++-- examples/python3/tutorial/formation/chiba/Actuator.py | 2 +- examples/python3/tutorial/formation/chiba/actuator_v1.py | 2 +- examples/python3/tutorial/scene_w9991.py | 2 +- examples/python3/useful/header.py | 2 +- examples/python3/wip/completDirectNeedleInsertion.py | 2 +- tutorial/text/cosserat_tutorial.md | 2 +- tutorial/tuto_scenes/step1.py | 4 ++-- tutorial/tuto_scenes/tuto_1.py | 4 ++-- tutorial/tuto_scenes/tuto_1_6dofs.py | 4 ++-- tutorial/tuto_scenes/tuto_2.py | 4 ++-- tutorial/tuto_scenes/tuto_2_6dofs.py | 4 ++-- tutorial/tuto_scenes/tuto_4.py | 4 ++-- tutorial/tuto_scenes/tuto_5.py | 4 ++-- tutorial/tuto_scenes/tuto_compare_2.py | 4 ++-- 20 files changed, 33 insertions(+), 33 deletions(-) diff --git a/examples/python3/NeedleInsertion-predefinedPath.py b/examples/python3/NeedleInsertion-predefinedPath.py index aa81171d..611e4932 100644 --- a/examples/python3/NeedleInsertion-predefinedPath.py +++ b/examples/python3/NeedleInsertion-predefinedPath.py @@ -119,7 +119,7 @@ def createScene(rootNode): RigidBaseMO = rigidBaseNode.addObject('MechanicalObject', template='Rigid3d', name="RigidBaseMO", position="0 0 0 0 0 0 1", showObject='1', showObjectScale='5.') rigidBaseNode.addObject('RestShapeSpringsForceField', name='spring', stiffness="50000", - angularStiffness="50000", external_points="0", mstate="@RigidBaseMO", points="0", + angularStiffness="50000", externalIndices="0", mstate="@RigidBaseMO", indices="0", template="Rigid3d") ############### diff --git a/examples/python3/PNLS_Example3.py b/examples/python3/PNLS_Example3.py index 2aab3f4d..784bbd5f 100644 --- a/examples/python3/PNLS_Example3.py +++ b/examples/python3/PNLS_Example3.py @@ -118,8 +118,8 @@ def createScene(rootNode): showObjectScale=0.3, position=[length, 0, 0, 0, 0, 0, 1], showObject=True) beamFrame.addObject('RestShapeSpringsForceField', name='spring', - stiffness=1e8, angularStiffness=1e8, external_points=0, - external_rest_shape=controlMo.getLinkPath(), points=nbFrames, template="Rigid3d") + stiffness=1e8, angularStiffness=1e8, externalIndices=0, + external_rest_shape=controlMo.getLinkPath(), indices=nbFrames, template="Rigid3d") cosseratNode = nonLinearCosserat.legendreControlPointsNode diff --git a/examples/python3/cosserat/CosseratBase.py b/examples/python3/cosserat/CosseratBase.py index d0948d82..9a8580c4 100644 --- a/examples/python3/cosserat/CosseratBase.py +++ b/examples/python3/cosserat/CosseratBase.py @@ -162,9 +162,9 @@ def _addRigidBaseNode(self): name="spring", stiffness=1e8, angularStiffness=1.0e8, - external_points=0, + externalIndices=0, mstate="@RigidBaseMO", - points=0, + indices=0, template="Rigid3d", ) return rigidBaseNode diff --git a/examples/python3/cosserat/cosseratObject.py b/examples/python3/cosserat/cosseratObject.py index 619e82c1..5abf88f8 100644 --- a/examples/python3/cosserat/cosseratObject.py +++ b/examples/python3/cosserat/cosseratObject.py @@ -254,9 +254,9 @@ def addRigidBaseNode(self): name="spring", stiffness=1e8, angularStiffness=1.0e8, - external_points=0, + externalIndices=0, mstate="@RigidBaseMO", - points=0, + indices=0, template="Rigid3d", ) return rigidBaseNode diff --git a/examples/python3/cosserat/createFemRegularGrid.py b/examples/python3/cosserat/createFemRegularGrid.py index a8d15e5d..c7f557c8 100644 --- a/examples/python3/cosserat/createFemRegularGrid.py +++ b/examples/python3/cosserat/createFemRegularGrid.py @@ -33,7 +33,7 @@ def createFemCube(parentNode): gelNode.addObject('TetrahedronFEMForceField', template='Vec3d', name='FEM', method='large', poissonRatio='0.45', youngModulus='100') gelNode.addObject('BoxROI', name='ROI1', box='40 -17 -10 100 -14 10', drawBoxes='true') - gelNode.addObject('RestShapeSpringsForceField', points='@ROI1.indices', stiffness='1e12') + gelNode.addObject('RestShapeSpringsForceField', indices='@ROI1.indices', stiffness='1e12') surfaceNode = gelNode.addChild("surfaceNode") surfaceNode.addObject('TriangleSetTopologyContainer', name="surfContainer", src="@../../GelSurface/Container") @@ -72,7 +72,7 @@ def createFemCubeWithParams(parentNode, geometry): gelNode.addObject('TetrahedronFEMForceField', template='Vec3d', name='FEM', method='large', poissonRatio=geometry.poissonRatio, youngModulus=geometry.youngModulus) gelNode.addObject('BoxROI', name='ROI1', box=geometry.box, drawBoxes='true') - gelNode.addObject('RestShapeSpringsForceField', points='@ROI1.indices', stiffness='1e12') + gelNode.addObject('RestShapeSpringsForceField', indices='@ROI1.indices', stiffness='1e12') surfaceNode = gelNode.addChild("surfaceNode") surfaceNode.addObject('TriangleSetTopologyContainer', name="surfContainer", diff --git a/examples/python3/cosserat/nonLinearCosserat.py b/examples/python3/cosserat/nonLinearCosserat.py index 90e3022e..073a4e47 100644 --- a/examples/python3/cosserat/nonLinearCosserat.py +++ b/examples/python3/cosserat/nonLinearCosserat.py @@ -126,8 +126,8 @@ def addRigidBaseNode(self): # to a control object in order to be able to drive it. if int(self.attachingToLink.value): rigidBaseNode.addObject('RestShapeSpringsForceField', name='spring', - stiffness=1e14, angularStiffness=1.e14, external_points=0, - mstate="@RigidBaseMO", points=0, template="Rigid3d") + stiffness=1e14, angularStiffness=1.e14, externalIndices=0, + mstate="@RigidBaseMO", indices=0, template="Rigid3d") return rigidBaseNode def addLegendrePolynomialsNode(self): diff --git a/examples/python3/tutorial/formation/chiba/Actuator.py b/examples/python3/tutorial/formation/chiba/Actuator.py index b1a52af5..776990a3 100644 --- a/examples/python3/tutorial/formation/chiba/Actuator.py +++ b/examples/python3/tutorial/formation/chiba/Actuator.py @@ -32,7 +32,7 @@ def createScene(rootNode): finger.addObject('BoxROI', name='boxROISubTopo', box=[23, -10, -8, 26, 10, 8], strict=False, drawBoxes=True) finger.addObject('BoxROI', name='boxROISubTopo2', box=[0, -10, -4, 28, 10, -2], strict=False, drawBoxes=True) finger.addObject('BoxROI', name='boxROI', box=[-2, -10, -20, 2, 10, 20], drawBoxes=True) - finger.addObject('RestShapeSpringsForceField', points='@boxROI.indices', stiffness=1e12, angularStiffness=1e12) + finger.addObject('RestShapeSpringsForceField', indices='@boxROI.indices', stiffness=1e12, angularStiffness=1e12) finger.addObject('LinearSolverConstraintCorrection') #Plastic Part modelSubTopo = finger.addChild('modelSubTopo') diff --git a/examples/python3/tutorial/formation/chiba/actuator_v1.py b/examples/python3/tutorial/formation/chiba/actuator_v1.py index 22ddca89..e489217c 100644 --- a/examples/python3/tutorial/formation/chiba/actuator_v1.py +++ b/examples/python3/tutorial/formation/chiba/actuator_v1.py @@ -31,7 +31,7 @@ def createScene(root_node): finger.addObject('BoxROI', name='boxROISubTopo', box=[23, -10, -8, 26, 10, 8], strict=False, drawBoxes=True) finger.addObject('BoxROI', name='boxROISubTopo2', box=[0, -10, -4, 28, 10, -2], strict=False, drawBoxes=True) finger.addObject('BoxROI', name='boxROI', box=[-2, -10, -20, 2, 10, 20], drawBoxes=True) - finger.addObject('RestShapeSpringsForceField', points='@boxROI.indices', stiffness=1e12, angularStiffness=1e12) + finger.addObject('RestShapeSpringsForceField', indices='@boxROI.indices', stiffness=1e12, angularStiffness=1e12) finger.addObject('LinearSolverConstraintCorrection') # Plastic Part modelSubTopo = finger.addChild('modelSubTopo') diff --git a/examples/python3/tutorial/scene_w9991.py b/examples/python3/tutorial/scene_w9991.py index 0a81c81e..0600654d 100644 --- a/examples/python3/tutorial/scene_w9991.py +++ b/examples/python3/tutorial/scene_w9991.py @@ -16,7 +16,7 @@ def _add_rigid_base(p_node): position="0 0 0 0 0 0. 1", showObject=1, showObjectScale="0.1") rigid_base_node.addObject('RestShapeSpringsForceField', template="Rigid3d", name="spring", stiffness=stiffness_param, angularStiffness=stiffness_param, - mstate="@cosserat_base_mo", external_points="0", points="0") + mstate="@cosserat_base_mo", externalIndices="0", indices="0") return rigid_base_node diff --git a/examples/python3/useful/header.py b/examples/python3/useful/header.py index 9f3cbad2..b4b58e4e 100644 --- a/examples/python3/useful/header.py +++ b/examples/python3/useful/header.py @@ -169,7 +169,7 @@ def addFEMObject(parentNode, path): fingerSolver.addObject('BoxROI', name='ROI1', box='-18 -15 -8 2 -3 8', drawBoxes='true') fingerSolver.addObject('RestShapeSpringsForceField', - points='@ROI1.indices', stiffness='1e12') + indices='@ROI1.indices', stiffness='1e12') ########################################## # Cable points # ########################################## diff --git a/examples/python3/wip/completDirectNeedleInsertion.py b/examples/python3/wip/completDirectNeedleInsertion.py index 48a0fabd..17fd0434 100644 --- a/examples/python3/wip/completDirectNeedleInsertion.py +++ b/examples/python3/wip/completDirectNeedleInsertion.py @@ -109,7 +109,7 @@ def createScene(rootNode): position="0 0 0 0 0 0 1", translation="-40. 0. 0.", showObject='1', showObjectScale='5.') rigidBaseNode.addObject('RestShapeSpringsForceField', name='spring', stiffness="50000", - angularStiffness="50000", external_points="0", mstate="@RigidBaseMO", points="0", + angularStiffness="50000", externalIndices="0", mstate="@RigidBaseMO", indices="0", template="Rigid3d") ############################################# diff --git a/tutorial/text/cosserat_tutorial.md b/tutorial/text/cosserat_tutorial.md index ccfc1c66..8e826d05 100644 --- a/tutorial/text/cosserat_tutorial.md +++ b/tutorial/text/cosserat_tutorial.md @@ -86,7 +86,7 @@ Now, we'll dive into the essential part – configuring the Cosserat plugin with def _add_rigid_base(p_node): rigid_base_node = p_node.addChild('rigid_base') rigid_base_node.addObject('MechanicalObject', template='Rigid3d', name="cosserat_base_mo", position="0 0 0 0 0 0. 1", showObject=1, showObjectScale='0.1') - rigid_base_node.addObject('RestShapeSpringsForceField', name='spring', stiffness=stiffness_param, angularStiffness=stiffness_param, external_points="0", mstate="@cosserat_base_mo", points="0", template="Rigid3d") + rigid_base_node.addObject('RestShapeSpringsForceField', name='spring', stiffness=stiffness_param, angularStiffness=stiffness_param, externalIndices="0", mstate="@cosserat_base_mo", indices="0", template="Rigid3d") return rigid_base_node ``` diff --git a/tutorial/tuto_scenes/step1.py b/tutorial/tuto_scenes/step1.py index 1f09985b..b046afd1 100644 --- a/tutorial/tuto_scenes/step1.py +++ b/tutorial/tuto_scenes/step1.py @@ -31,8 +31,8 @@ def _add_rigid_base(p_node): position="0 0 0 0 0 0. 1", showObject=1, showObjectScale='0.1') rigid_base_node.addObject('RestShapeSpringsForceField', name='spring', stiffness=stiffness_param, - angularStiffness=stiffness_param, external_points="0", mstate="@cosserat_base_mo", - points="0", template="Rigid3d") + angularStiffness=stiffness_param, externalIndices="0", mstate="@cosserat_base_mo", + indices="0", template="Rigid3d") return rigid_base_node diff --git a/tutorial/tuto_scenes/tuto_1.py b/tutorial/tuto_scenes/tuto_1.py index 421a6b17..4b3b826f 100644 --- a/tutorial/tuto_scenes/tuto_1.py +++ b/tutorial/tuto_scenes/tuto_1.py @@ -21,9 +21,9 @@ def _add_rigid_base(p_node): name="spring", stiffness=stiffness_param, angularStiffness=stiffness_param, - external_points="0", + externalIndices="0", mstate="@cosserat_base_mo", - points="0", + indices="0", template="Rigid3d", ) return rigid_base_node diff --git a/tutorial/tuto_scenes/tuto_1_6dofs.py b/tutorial/tuto_scenes/tuto_1_6dofs.py index af723fb0..d7e2ac9b 100644 --- a/tutorial/tuto_scenes/tuto_1_6dofs.py +++ b/tutorial/tuto_scenes/tuto_1_6dofs.py @@ -12,8 +12,8 @@ def _add_rigid_base(p_node): position="0 0 0 0 0 0. 1", showObject=1, showObjectScale='0.1') rigid_base_node.addObject('RestShapeSpringsForceField', name='spring', stiffness=stiffness_param, - angularStiffness=stiffness_param, external_points="0", mstate="@cosserat_base_mo", - points="0", template="Rigid3d") + angularStiffness=stiffness_param, externalIndices="0", mstate="@cosserat_base_mo", + indices="0", template="Rigid3d") return rigid_base_node diff --git a/tutorial/tuto_scenes/tuto_2.py b/tutorial/tuto_scenes/tuto_2.py index 8c0ca1b6..ab5f6a7b 100644 --- a/tutorial/tuto_scenes/tuto_2.py +++ b/tutorial/tuto_scenes/tuto_2.py @@ -19,9 +19,9 @@ def _add_rigid_base(p_node): name="spring", stiffness=stiffness_param, angularStiffness=stiffness_param, - external_points="0", + externalIndices="0", mstate="@cosserat_base_mo", - points="0", + indices="0", template="Rigid3d", ) return rigid_base_node diff --git a/tutorial/tuto_scenes/tuto_2_6dofs.py b/tutorial/tuto_scenes/tuto_2_6dofs.py index 3cf3c975..e1822434 100644 --- a/tutorial/tuto_scenes/tuto_2_6dofs.py +++ b/tutorial/tuto_scenes/tuto_2_6dofs.py @@ -15,8 +15,8 @@ def _add_rigid_base(p_node): position="0 0 0 0 0 0. 1", showObject=1, showObjectScale='0.1') rigid_base_node.addObject('RestShapeSpringsForceField', name='spring', stiffness=stiffness_param, - angularStiffness=stiffness_param, external_points="0", mstate="@cosserat_base_mo", - points="0", template="Rigid3d", activeDirections=[0,1,1,1,1,1,1]) + angularStiffness=stiffness_param, externalIndices="0", mstate="@cosserat_base_mo", + indices="0", template="Rigid3d", activeDirections=[0,1,1,1,1,1,1]) return rigid_base_node diff --git a/tutorial/tuto_scenes/tuto_4.py b/tutorial/tuto_scenes/tuto_4.py index f6a34c83..2ac2da4c 100644 --- a/tutorial/tuto_scenes/tuto_4.py +++ b/tutorial/tuto_scenes/tuto_4.py @@ -118,8 +118,8 @@ def createScene(root_node): showObject=True) if controller_type == 3: cosserat_frames.addObject('RestShapeSpringsForceField', name='spring', stiffness=0., angularStiffness=1.e8, - external_points=0, external_rest_shape=controller_state.getLinkPath(), - points=geoParams.nbFrames, template="Rigid3d") + externalIndices=0, external_rest_shape=controller_state.getLinkPath(), + indices=geoParams.nbFrames, template="Rigid3d") solver_node.addObject(ForceController(forceNode=const_force_node, frame_node=cosserat_frames, force_type=controller_type, tip_controller=controller_state)) diff --git a/tutorial/tuto_scenes/tuto_5.py b/tutorial/tuto_scenes/tuto_5.py index 99f5d7f3..2d741c21 100644 --- a/tutorial/tuto_scenes/tuto_5.py +++ b/tutorial/tuto_scenes/tuto_5.py @@ -158,8 +158,8 @@ def createScene(root_node): # showObject=True) # # cosserat_frames.addObject('RestShapeSpringsForceField', name='spring', stiffness=1e8, angularStiffness=1e8, - # external_points=0, external_rest_shape=controller_state.getLinkPath(), - # points=geoParams.nbFrames, template="Rigid3d") + # externalIndices=0, external_rest_shape=controller_state.getLinkPath(), + # indices=geoParams.nbFrames, template="Rigid3d") # # solver_node.addObject(ForceController(forceNode=const_force_node, frame_node=cosserat_frames, force_type=3, # tip_controller=controller_state)) diff --git a/tutorial/tuto_scenes/tuto_compare_2.py b/tutorial/tuto_scenes/tuto_compare_2.py index faf12613..4f7c21da 100644 --- a/tutorial/tuto_scenes/tuto_compare_2.py +++ b/tutorial/tuto_scenes/tuto_compare_2.py @@ -23,8 +23,8 @@ def _add_rigid_base(p_node, _name='rigid_base'): position="0 0 0 0 0 0. 1", showObject=0, showObjectScale='0.') rigid_base_node.addObject('RestShapeSpringsForceField', name='spring', stiffness=stiffness_param, - angularStiffness=stiffness_param, external_points="0", mstate="@cosserat_base_mo", - points="0", template="Rigid3d", activeDirections=[1,1,1,1,1,1,1]) + angularStiffness=stiffness_param, externalIndices="0", mstate="@cosserat_base_mo", + indices="0", template="Rigid3d", activeDirections=[1,1,1,1,1,1,1]) return rigid_base_node From 0c88aebf9b8b12a8a3a47a4788629110ba8916e8 Mon Sep 17 00:00:00 2001 From: Paul Baksic Date: Tue, 4 Mar 2025 17:24:02 +0100 Subject: [PATCH 2/3] Use FixedweakConstraint instead when possible --- .gitignore | 34 +------------------ .../python3/NeedleInsertion-predefinedPath.py | 4 +-- examples/python3/cosserat/CosseratBase.py | 3 +- examples/python3/cosserat/cosseratObject.py | 3 +- .../python3/cosserat/createFemRegularGrid.py | 4 +-- .../python3/cosserat/nonLinearCosserat.py | 4 +-- .../tutorial/formation/chiba/Actuator.py | 2 +- .../tutorial/formation/chiba/actuator_v1.py | 2 +- examples/python3/tutorial/scene_w9991.py | 2 +- examples/python3/useful/header.py | 2 +- .../wip/completDirectNeedleInsertion.py | 4 +-- tutorial/text/cosserat_tutorial.md | 2 +- .../geo_cable_driven_cosserat_beam.py | 5 ++- ...geo_cosserat_cable_driven_cosserat_beam.py | 5 ++- tutorial/tuto_scenes/step1.py | 4 +-- tutorial/tuto_scenes/tuto_1.py | 3 +- tutorial/tuto_scenes/tuto_1_6dofs.py | 4 +-- tutorial/tuto_scenes/tuto_2_6dofs.py | 4 +-- tutorial/tuto_scenes/tuto_3.py | 3 +- tutorial/tuto_scenes/tuto_4.py | 3 +- tutorial/tuto_scenes/tuto_compare_2.py | 4 +-- 21 files changed, 31 insertions(+), 70 deletions(-) diff --git a/.gitignore b/.gitignore index 331e485c..f59ec20a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,33 +1 @@ -*.pyc -build/ -dist/ -htmlcov/ -.ropeproject/ -MANIFEST -control/_version.py -__conda_*.txt -record.txt -build.log -*.egg-info/ -.eggs/ -*.view -*.log -venv/ -.coverage -doc/_build -doc/generated -examples/.ipynb_checkpoints/ -.settings/org.eclipse.core.resources.prefs -.pydevproject -.project -Untitled*.ipynb -*.idea/ -# Files created by or for emacs (RMM, 29 Dec 2017) -*~ -TAGS -python/ -scenes/ -.DS_Store/ -.DS_Store -.vscode/ -.vscode +* \ No newline at end of file diff --git a/examples/python3/NeedleInsertion-predefinedPath.py b/examples/python3/NeedleInsertion-predefinedPath.py index 611e4932..cd94ba2e 100644 --- a/examples/python3/NeedleInsertion-predefinedPath.py +++ b/examples/python3/NeedleInsertion-predefinedPath.py @@ -118,8 +118,8 @@ def createScene(rootNode): rigidBaseNode = cableNode.addChild('rigidBase') RigidBaseMO = rigidBaseNode.addObject('MechanicalObject', template='Rigid3d', name="RigidBaseMO", position="0 0 0 0 0 0 1", showObject='1', showObjectScale='5.') - rigidBaseNode.addObject('RestShapeSpringsForceField', name='spring', stiffness="50000", - angularStiffness="50000", externalIndices="0", mstate="@RigidBaseMO", indices="0", + rigidBaseNode.addObject('FixedWeakConstraint', name='spring', stiffness="50000", + angularStiffness="50000", mstate="@RigidBaseMO", indices="0", template="Rigid3d") ############### diff --git a/examples/python3/cosserat/CosseratBase.py b/examples/python3/cosserat/CosseratBase.py index 76fe35fe..a1b1121d 100644 --- a/examples/python3/cosserat/CosseratBase.py +++ b/examples/python3/cosserat/CosseratBase.py @@ -246,11 +246,10 @@ def createScene(rootNode): # Create a cosserat = solverNode.addChild(CosseratBase(parent=solverNode, beam_params=Params)) cosserat.rigidBaseNode.addObject( - "RestShapeSpringsForceField", + "FixedWeakConstraint", name="spring", stiffness=1e8, angularStiffness=1.0e8, - externalIndices=0, # mstate="@RigidBaseMO", indices=0, template="Rigid3d" diff --git a/examples/python3/cosserat/cosseratObject.py b/examples/python3/cosserat/cosseratObject.py index 5abf88f8..f14ff35f 100644 --- a/examples/python3/cosserat/cosseratObject.py +++ b/examples/python3/cosserat/cosseratObject.py @@ -250,11 +250,10 @@ def addRigidBaseNode(self): if int(self.attachingToLink.value): print("Adding the rest shape to the base") rigidBaseNode.addObject( - "RestShapeSpringsForceField", + "FixedWeakConstraint", name="spring", stiffness=1e8, angularStiffness=1.0e8, - externalIndices=0, mstate="@RigidBaseMO", indices=0, template="Rigid3d", diff --git a/examples/python3/cosserat/createFemRegularGrid.py b/examples/python3/cosserat/createFemRegularGrid.py index c7f557c8..03f860f5 100644 --- a/examples/python3/cosserat/createFemRegularGrid.py +++ b/examples/python3/cosserat/createFemRegularGrid.py @@ -33,7 +33,7 @@ def createFemCube(parentNode): gelNode.addObject('TetrahedronFEMForceField', template='Vec3d', name='FEM', method='large', poissonRatio='0.45', youngModulus='100') gelNode.addObject('BoxROI', name='ROI1', box='40 -17 -10 100 -14 10', drawBoxes='true') - gelNode.addObject('RestShapeSpringsForceField', indices='@ROI1.indices', stiffness='1e12') + gelNode.addObject('FixedWeakConstraint', indices='@ROI1.indices', stiffness='1e12') surfaceNode = gelNode.addChild("surfaceNode") surfaceNode.addObject('TriangleSetTopologyContainer', name="surfContainer", src="@../../GelSurface/Container") @@ -72,7 +72,7 @@ def createFemCubeWithParams(parentNode, geometry): gelNode.addObject('TetrahedronFEMForceField', template='Vec3d', name='FEM', method='large', poissonRatio=geometry.poissonRatio, youngModulus=geometry.youngModulus) gelNode.addObject('BoxROI', name='ROI1', box=geometry.box, drawBoxes='true') - gelNode.addObject('RestShapeSpringsForceField', indices='@ROI1.indices', stiffness='1e12') + gelNode.addObject('FixedWeakConstraint', indices='@ROI1.indices', stiffness='1e12') surfaceNode = gelNode.addChild("surfaceNode") surfaceNode.addObject('TriangleSetTopologyContainer', name="surfContainer", diff --git a/examples/python3/cosserat/nonLinearCosserat.py b/examples/python3/cosserat/nonLinearCosserat.py index 073a4e47..74304db0 100644 --- a/examples/python3/cosserat/nonLinearCosserat.py +++ b/examples/python3/cosserat/nonLinearCosserat.py @@ -125,8 +125,8 @@ def addRigidBaseNode(self): # one can choose to set this to false and directly attach the beam base # to a control object in order to be able to drive it. if int(self.attachingToLink.value): - rigidBaseNode.addObject('RestShapeSpringsForceField', name='spring', - stiffness=1e14, angularStiffness=1.e14, externalIndices=0, + rigidBaseNode.addObject('FixedWeakConstraint', name='spring', + stiffness=1e14, angularStiffness=1.e14, mstate="@RigidBaseMO", indices=0, template="Rigid3d") return rigidBaseNode diff --git a/examples/python3/tutorial/formation/chiba/Actuator.py b/examples/python3/tutorial/formation/chiba/Actuator.py index 776990a3..41fe18a7 100644 --- a/examples/python3/tutorial/formation/chiba/Actuator.py +++ b/examples/python3/tutorial/formation/chiba/Actuator.py @@ -32,7 +32,7 @@ def createScene(rootNode): finger.addObject('BoxROI', name='boxROISubTopo', box=[23, -10, -8, 26, 10, 8], strict=False, drawBoxes=True) finger.addObject('BoxROI', name='boxROISubTopo2', box=[0, -10, -4, 28, 10, -2], strict=False, drawBoxes=True) finger.addObject('BoxROI', name='boxROI', box=[-2, -10, -20, 2, 10, 20], drawBoxes=True) - finger.addObject('RestShapeSpringsForceField', indices='@boxROI.indices', stiffness=1e12, angularStiffness=1e12) + finger.addObject('FixedWeakConstraint', indices='@boxROI.indices', stiffness=1e12, angularStiffness=1e12) finger.addObject('LinearSolverConstraintCorrection') #Plastic Part modelSubTopo = finger.addChild('modelSubTopo') diff --git a/examples/python3/tutorial/formation/chiba/actuator_v1.py b/examples/python3/tutorial/formation/chiba/actuator_v1.py index e489217c..ca6b01fa 100644 --- a/examples/python3/tutorial/formation/chiba/actuator_v1.py +++ b/examples/python3/tutorial/formation/chiba/actuator_v1.py @@ -31,7 +31,7 @@ def createScene(root_node): finger.addObject('BoxROI', name='boxROISubTopo', box=[23, -10, -8, 26, 10, 8], strict=False, drawBoxes=True) finger.addObject('BoxROI', name='boxROISubTopo2', box=[0, -10, -4, 28, 10, -2], strict=False, drawBoxes=True) finger.addObject('BoxROI', name='boxROI', box=[-2, -10, -20, 2, 10, 20], drawBoxes=True) - finger.addObject('RestShapeSpringsForceField', indices='@boxROI.indices', stiffness=1e12, angularStiffness=1e12) + finger.addObject('FixedWeakConstraint', indices='@boxROI.indices', stiffness=1e12, angularStiffness=1e12) finger.addObject('LinearSolverConstraintCorrection') # Plastic Part modelSubTopo = finger.addChild('modelSubTopo') diff --git a/examples/python3/tutorial/scene_w9991.py b/examples/python3/tutorial/scene_w9991.py index 0600654d..115399c4 100644 --- a/examples/python3/tutorial/scene_w9991.py +++ b/examples/python3/tutorial/scene_w9991.py @@ -14,7 +14,7 @@ def _add_rigid_base(p_node): rigid_base_node = p_node.addChild('rigid_base') rigid_base_node.addObject('MechanicalObject', template="Rigid3d", name="cosserat_base_mo", position="0 0 0 0 0 0. 1", showObject=1, showObjectScale="0.1") - rigid_base_node.addObject('RestShapeSpringsForceField', template="Rigid3d", name="spring", + rigid_base_node.addObject('FixedWeakConstraint', template="Rigid3d", name="spring", stiffness=stiffness_param, angularStiffness=stiffness_param, mstate="@cosserat_base_mo", externalIndices="0", indices="0") return rigid_base_node diff --git a/examples/python3/useful/header.py b/examples/python3/useful/header.py index d7b035f4..6f55fc83 100644 --- a/examples/python3/useful/header.py +++ b/examples/python3/useful/header.py @@ -156,7 +156,7 @@ def addSolverNode(parent_node, name='solverNode', template='CompressedRowSparseM def attach_mesh_with_springs(mesh_node, _box='-18 -15 -8 2 -3 8'): mesh_node.addObject('BoxROI', name='ROI1', box=_box, drawBoxes='true') - mesh_node.addObject('RestShapeSpringsForceField', + mesh_node.addObject('FixedWeakConstraint', indices='@ROI1.indices', stiffness='1e12') def attach_3d_points_to_meca_with_barycentric_mapping(parent_node, name='node_name', diff --git a/examples/python3/wip/completDirectNeedleInsertion.py b/examples/python3/wip/completDirectNeedleInsertion.py index 17fd0434..5fde7353 100644 --- a/examples/python3/wip/completDirectNeedleInsertion.py +++ b/examples/python3/wip/completDirectNeedleInsertion.py @@ -108,8 +108,8 @@ def createScene(rootNode): RigidBaseMO = rigidBaseNode.addObject('MechanicalObject', template='Rigid3d', name="RigidBaseMO", position="0 0 0 0 0 0 1", translation="-40. 0. 0.", showObject='1', showObjectScale='5.') - rigidBaseNode.addObject('RestShapeSpringsForceField', name='spring', stiffness="50000", - angularStiffness="50000", externalIndices="0", mstate="@RigidBaseMO", indices="0", + rigidBaseNode.addObject('FixedWeakConstraint', name='spring', stiffness="50000", + angularStiffness="50000", mstate="@RigidBaseMO", indices="0", template="Rigid3d") ############################################# diff --git a/tutorial/text/cosserat_tutorial.md b/tutorial/text/cosserat_tutorial.md index 8e826d05..cc272c6c 100644 --- a/tutorial/text/cosserat_tutorial.md +++ b/tutorial/text/cosserat_tutorial.md @@ -86,7 +86,7 @@ Now, we'll dive into the essential part – configuring the Cosserat plugin with def _add_rigid_base(p_node): rigid_base_node = p_node.addChild('rigid_base') rigid_base_node.addObject('MechanicalObject', template='Rigid3d', name="cosserat_base_mo", position="0 0 0 0 0 0. 1", showObject=1, showObjectScale='0.1') - rigid_base_node.addObject('RestShapeSpringsForceField', name='spring', stiffness=stiffness_param, angularStiffness=stiffness_param, externalIndices="0", mstate="@cosserat_base_mo", indices="0", template="Rigid3d") + rigid_base_node.addObject('FixedWeakConstraint', name='spring', stiffness=stiffness_param, angularStiffness=stiffness_param, mstate="@cosserat_base_mo", indices="0", template="Rigid3d") return rigid_base_node ``` diff --git a/tutorial/tuto_scenes/geo_cable_driven_cosserat_beam.py b/tutorial/tuto_scenes/geo_cable_driven_cosserat_beam.py index d4bebc90..303c0601 100644 --- a/tutorial/tuto_scenes/geo_cable_driven_cosserat_beam.py +++ b/tutorial/tuto_scenes/geo_cable_driven_cosserat_beam.py @@ -65,12 +65,11 @@ def createScene(root_node): beam = solver_node.addChild(CosseratBase(parent=solver_node, beam_params=Params)) # Attach beam base using a spring force field beam.rigidBaseNode.addObject( - "RestShapeSpringsForceField", + "FixedWeakConstraint", name="spring", stiffness=1e8, angularStiffness=1.0e8, - external_points=0, - points=0, + indices=0, template="Rigid3d" ) diff --git a/tutorial/tuto_scenes/geo_cosserat_cable_driven_cosserat_beam.py b/tutorial/tuto_scenes/geo_cosserat_cable_driven_cosserat_beam.py index a7e28c81..83897bfd 100644 --- a/tutorial/tuto_scenes/geo_cosserat_cable_driven_cosserat_beam.py +++ b/tutorial/tuto_scenes/geo_cosserat_cable_driven_cosserat_beam.py @@ -76,12 +76,11 @@ def createScene(root_node): beam = solver_node.addChild(CosseratBase(parent=solver_node, beam_params=Params)) # Attach beam base using a spring force field beam.rigidBaseNode.addObject( - "RestShapeSpringsForceField", + "FixedWeakConstraint", name="spring", stiffness=1e8, angularStiffness=1.0e8, - external_points=0, - points=0, + indices=0, template="Rigid3d" ) diff --git a/tutorial/tuto_scenes/step1.py b/tutorial/tuto_scenes/step1.py index b046afd1..427db907 100644 --- a/tutorial/tuto_scenes/step1.py +++ b/tutorial/tuto_scenes/step1.py @@ -30,8 +30,8 @@ def _add_rigid_base(p_node): rigid_base_node.addObject('MechanicalObject', template='Rigid3d', name="cosserat_base_mo", position="0 0 0 0 0 0. 1", showObject=1, showObjectScale='0.1') - rigid_base_node.addObject('RestShapeSpringsForceField', name='spring', stiffness=stiffness_param, - angularStiffness=stiffness_param, externalIndices="0", mstate="@cosserat_base_mo", + rigid_base_node.addObject('FixedWeakConstraint', name='spring', stiffness=stiffness_param, + angularStiffness=stiffness_param, mstate="@cosserat_base_mo", indices="0", template="Rigid3d") return rigid_base_node diff --git a/tutorial/tuto_scenes/tuto_1.py b/tutorial/tuto_scenes/tuto_1.py index 82ac5e33..589f5b16 100644 --- a/tutorial/tuto_scenes/tuto_1.py +++ b/tutorial/tuto_scenes/tuto_1.py @@ -18,11 +18,10 @@ def _add_rigid_base(p_node, positions=None): showObjectScale="0.1", ) rigid_base_node.addObject( - "RestShapeSpringsForceField", + "FixedWeakConstraint", name="spring", stiffness=stiffness_param, angularStiffness=stiffness_param, - externalIndices="0", mstate="@cosserat_base_mo", indices="0", template="Rigid3d", diff --git a/tutorial/tuto_scenes/tuto_1_6dofs.py b/tutorial/tuto_scenes/tuto_1_6dofs.py index d7e2ac9b..98124642 100644 --- a/tutorial/tuto_scenes/tuto_1_6dofs.py +++ b/tutorial/tuto_scenes/tuto_1_6dofs.py @@ -11,8 +11,8 @@ def _add_rigid_base(p_node): rigid_base_node.addObject('MechanicalObject', template='Rigid3d', name="cosserat_base_mo", position="0 0 0 0 0 0. 1", showObject=1, showObjectScale='0.1') - rigid_base_node.addObject('RestShapeSpringsForceField', name='spring', stiffness=stiffness_param, - angularStiffness=stiffness_param, externalIndices="0", mstate="@cosserat_base_mo", + rigid_base_node.addObject('FixedWeakConstraint', name='spring', stiffness=stiffness_param, + angularStiffness=stiffness_param, mstate="@cosserat_base_mo", indices="0", template="Rigid3d") return rigid_base_node diff --git a/tutorial/tuto_scenes/tuto_2_6dofs.py b/tutorial/tuto_scenes/tuto_2_6dofs.py index e1822434..20dcac3f 100644 --- a/tutorial/tuto_scenes/tuto_2_6dofs.py +++ b/tutorial/tuto_scenes/tuto_2_6dofs.py @@ -14,8 +14,8 @@ def _add_rigid_base(p_node): rigid_base_node.addObject('MechanicalObject', template='Rigid3d', name="cosserat_base_mo", position="0 0 0 0 0 0. 1", showObject=1, showObjectScale='0.1') - rigid_base_node.addObject('RestShapeSpringsForceField', name='spring', stiffness=stiffness_param, - angularStiffness=stiffness_param, externalIndices="0", mstate="@cosserat_base_mo", + rigid_base_node.addObject('FixedWeakConstraint', name='spring', stiffness=stiffness_param, + angularStiffness=stiffness_param, mstate="@cosserat_base_mo", indices="0", template="Rigid3d", activeDirections=[0,1,1,1,1,1,1]) return rigid_base_node diff --git a/tutorial/tuto_scenes/tuto_3.py b/tutorial/tuto_scenes/tuto_3.py index b0e81371..f5b94398 100644 --- a/tutorial/tuto_scenes/tuto_3.py +++ b/tutorial/tuto_scenes/tuto_3.py @@ -28,11 +28,10 @@ def createScene(root_node): beam = solver_node.addChild(CosseratBase(parent=solver_node, params=Params)) # Attach beam base using a spring force field beam.rigidBaseNode.addObject( - "RestShapeSpringsForceField", + "FixedWeakConstraint", name="spring", stiffness=1e8, angularStiffness=1.0e8, - externalIndices=0, indices=0, template="Rigid3d" ) diff --git a/tutorial/tuto_scenes/tuto_4.py b/tutorial/tuto_scenes/tuto_4.py index b2d53da3..cea645f6 100644 --- a/tutorial/tuto_scenes/tuto_4.py +++ b/tutorial/tuto_scenes/tuto_4.py @@ -110,11 +110,10 @@ def createScene(root_node): # create cosserat Beam cosserat_beam = solver_node.addChild(CosseratBase(parent=solver_node, params=Params)) cosserat_beam.rigidBaseNode.addObject( - "RestShapeSpringsForceField", + "FixedWeakConstraint", name="spring", stiffness=1e8, angularStiffness=1.0e8, - externalIndices=0, indices=0, template="Rigid3d" ) diff --git a/tutorial/tuto_scenes/tuto_compare_2.py b/tutorial/tuto_scenes/tuto_compare_2.py index 4f7c21da..1a50e04f 100644 --- a/tutorial/tuto_scenes/tuto_compare_2.py +++ b/tutorial/tuto_scenes/tuto_compare_2.py @@ -22,8 +22,8 @@ def _add_rigid_base(p_node, _name='rigid_base'): rigid_base_node.addObject('MechanicalObject', template='Rigid3d', name="cosserat_base_mo", position="0 0 0 0 0 0. 1", showObject=0, showObjectScale='0.') - rigid_base_node.addObject('RestShapeSpringsForceField', name='spring', stiffness=stiffness_param, - angularStiffness=stiffness_param, externalIndices="0", mstate="@cosserat_base_mo", + rigid_base_node.addObject('FixedWeakConstraint', name='spring', stiffness=stiffness_param, + angularStiffness=stiffness_param, mstate="@cosserat_base_mo", indices="0", template="Rigid3d", activeDirections=[1,1,1,1,1,1,1]) return rigid_base_node From d0939349d0d2cf2b99161b0ca690641635b7e8d7 Mon Sep 17 00:00:00 2001 From: Paul Baksic Date: Tue, 4 Mar 2025 17:25:03 +0100 Subject: [PATCH 3/3] Restore gitignore --- .gitignore | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index f59ec20a..331e485c 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,33 @@ -* \ No newline at end of file +*.pyc +build/ +dist/ +htmlcov/ +.ropeproject/ +MANIFEST +control/_version.py +__conda_*.txt +record.txt +build.log +*.egg-info/ +.eggs/ +*.view +*.log +venv/ +.coverage +doc/_build +doc/generated +examples/.ipynb_checkpoints/ +.settings/org.eclipse.core.resources.prefs +.pydevproject +.project +Untitled*.ipynb +*.idea/ +# Files created by or for emacs (RMM, 29 Dec 2017) +*~ +TAGS +python/ +scenes/ +.DS_Store/ +.DS_Store +.vscode/ +.vscode