From 8c14a01f6936a3d9bbc12d3fd6e68f00aa43f75e Mon Sep 17 00:00:00 2001 From: Paul Baksic Date: Tue, 10 Dec 2024 15:50:41 +0100 Subject: [PATCH 1/3] Apply data name change --- examples/3instruments.scn | 2 +- examples/3instruments_collis.scn | 2 +- examples/SingleBeamDeployment.scn | 2 +- examples/SingleBeamDeploymentCollision.scn | 2 +- examples/Tool_from_loader.scn | 2 +- examples/python3/Cochlear-Implant-Insertion/Scene_Cochlea.py | 2 +- examples/python3/SingleBeamDeployment.py | 2 +- examples/python3/SingleBeamDeploymentCollision.py | 2 +- examples/python3/beamadapter/parts/instrument.py | 4 ++-- 9 files changed, 10 insertions(+), 10 deletions(-) diff --git a/examples/3instruments.scn b/examples/3instruments.scn index 755c085ec..21625081b 100644 --- a/examples/3instruments.scn +++ b/examples/3instruments.scn @@ -85,7 +85,7 @@ controlledInstrument='0' startingPos='0 0 0 0 -0.7071068 0 0.7071068' speed='2' instruments='InterpolCatheter InterpolGuide InterpolCoils' /> - + diff --git a/examples/3instruments_collis.scn b/examples/3instruments_collis.scn index e01fcb9da..3af83e98d 100644 --- a/examples/3instruments_collis.scn +++ b/examples/3instruments_collis.scn @@ -102,7 +102,7 @@ - + diff --git a/examples/SingleBeamDeployment.scn b/examples/SingleBeamDeployment.scn index d84ea4732..7b0feb0aa 100644 --- a/examples/SingleBeamDeployment.scn +++ b/examples/SingleBeamDeployment.scn @@ -40,7 +40,7 @@ rotationInstrument="0 0 0" step="0.5" speed="0.5" listening="1" controlledInstrument="0"/> - + diff --git a/examples/SingleBeamDeploymentCollision.scn b/examples/SingleBeamDeploymentCollision.scn index f8afde1da..5b2390ab5 100644 --- a/examples/SingleBeamDeploymentCollision.scn +++ b/examples/SingleBeamDeploymentCollision.scn @@ -59,7 +59,7 @@ listening="1" controlledInstrument="0"/> - + diff --git a/examples/Tool_from_loader.scn b/examples/Tool_from_loader.scn index 1b09e0984..fdb7b8a51 100644 --- a/examples/Tool_from_loader.scn +++ b/examples/Tool_from_loader.scn @@ -56,7 +56,7 @@ /> - + diff --git a/examples/python3/Cochlear-Implant-Insertion/Scene_Cochlea.py b/examples/python3/Cochlear-Implant-Insertion/Scene_Cochlea.py index 51e3c07ee..a7bcbedbe 100644 --- a/examples/python3/Cochlear-Implant-Insertion/Scene_Cochlea.py +++ b/examples/python3/Cochlear-Implant-Insertion/Scene_Cochlea.py @@ -60,7 +60,7 @@ def createScene(rootNode): InstrumentCombined.addObject('AdaptiveBeamForceFieldAndMass', name="CatheterForceField", massDensity="0.000005", interpolation="@InterpolCatheter", printLog=False) InstrumentCombined.addObject('LinearSolverConstraintCorrection', printLog=False, wire_optimization="true") InstrumentCombined.addObject("FixedProjectiveConstraint", indices="0") - InstrumentCombined.addObject('RestShapeSpringsForceField', name="MeasurementFF", points="@m_ircontroller.indexFirstNode", stiffness="1e10", recompute_indices="1", angularStiffness="1e10", external_rest_shape="@../RefStartingPos/ReferencePos", external_points="0", drawSpring="1", springColor="1 0 0 1") + InstrumentCombined.addObject('RestShapeSpringsForceField', name="MeasurementFF", indices="@m_ircontroller.indexFirstNode", stiffness="1e10", recompute_indices="1", angularStiffness="1e10", external_rest_shape="@../RefStartingPos/ReferencePos", externalIndices="0", drawSpring="1", springColor="1 0 0 1") CollisInstrumentCombined = InstrumentCombined.addChild('CollisInstrumentCombined') CollisInstrumentCombined.addObject('EdgeSetTopologyContainer', name="collisEdgeSet") diff --git a/examples/python3/SingleBeamDeployment.py b/examples/python3/SingleBeamDeployment.py index daf321da4..4c3c76c0c 100644 --- a/examples/python3/SingleBeamDeployment.py +++ b/examples/python3/SingleBeamDeployment.py @@ -45,7 +45,7 @@ def createScene(rootNode): rotationInstrument=[0, 0, 0], step=0.5, speed=0.5, listening=True, controlledInstrument=0) BeamMechanics.addObject('FixedProjectiveConstraint', indices=0, name='FixedConstraint') - BeamMechanics.addObject('RestShapeSpringsForceField', name="RestSPForceField", points='@DeployController.indexFirstNode', angularStiffness=1e8, stiffness=1e8) + BeamMechanics.addObject('RestShapeSpringsForceField', name="RestSPForceField", indices='@DeployController.indexFirstNode', angularStiffness=1e8, stiffness=1e8) def main(): diff --git a/examples/python3/SingleBeamDeploymentCollision.py b/examples/python3/SingleBeamDeploymentCollision.py index 79c532aea..4a64f608e 100644 --- a/examples/python3/SingleBeamDeploymentCollision.py +++ b/examples/python3/SingleBeamDeploymentCollision.py @@ -54,7 +54,7 @@ def createScene(rootNode): listening=True, controlledInstrument=0) BeamMechanics.addObject('LinearSolverConstraintCorrection', wire_optimization='true', printLog=False) BeamMechanics.addObject('FixedProjectiveConstraint', indices=0, name='FixedConstraint') - BeamMechanics.addObject('RestShapeSpringsForceField', points='@DeployController.indexFirstNode', angularStiffness=1e8, stiffness=1e8) + BeamMechanics.addObject('RestShapeSpringsForceField', indices='@DeployController.indexFirstNode', angularStiffness=1e8, stiffness=1e8) BeamCollis = BeamMechanics.addChild('CollisionModel') diff --git a/examples/python3/beamadapter/parts/instrument.py b/examples/python3/beamadapter/parts/instrument.py index 2fab3fed0..34fb2468e 100644 --- a/examples/python3/beamadapter/parts/instrument.py +++ b/examples/python3/beamadapter/parts/instrument.py @@ -53,7 +53,7 @@ def combineInstruments(node, xtip=[1, 0, 0], instruments=['guide'], controlledInstrument=controlledInstrument) InstrumentCombined.addObject('LinearSolverConstraintCorrection', wire_optimization='true', printLog=False) InstrumentCombined.addObject('FixedConstraint', indices=0, name='FixedConstraint') - InstrumentCombined.addObject('RestShapeSpringsForceField', points='@m_ircontroller.indexFirstNode', + InstrumentCombined.addObject('RestShapeSpringsForceField', indices='@m_ircontroller.indexFirstNode', angularStiffness=1e8, stiffness=1e8) return (InstrumentCombined) @@ -90,7 +90,7 @@ def createInstrumentsCombined(node, xtip=[1, 0, 0], instruments=['guide'], controlledInstrument=controlledInstrument) InstrumentCombined.addObject('LinearSolverConstraintCorrection', wire_optimization='true', printLog=False) InstrumentCombined.addObject('FixedConstraint', indices=0, name='FixedConstraint') - InstrumentCombined.addObject('RestShapeSpringsForceField', points='@m_ircontroller.indexFirstNode', + InstrumentCombined.addObject('RestShapeSpringsForceField', indices='@m_ircontroller.indexFirstNode', angularStiffness=1e8, stiffness=1e8) # Collision model From cba9a31e984f12e6ef0eb661efa2d9baa4c6b193 Mon Sep 17 00:00:00 2001 From: Paul Baksic Date: Tue, 4 Mar 2025 17:21:17 +0100 Subject: [PATCH 2/3] Use FixedweakConstraint instead when possible --- examples/3instruments.scn | 2 +- examples/3instruments_collis.scn | 2 +- examples/SingleBeamDeployment.scn | 2 +- examples/SingleBeamDeploymentCollision.scn | 2 +- examples/Tool_from_loader.scn | 2 +- examples/python3/SingleBeamDeployment.py | 2 +- examples/python3/SingleBeamDeploymentCollision.py | 2 +- examples/python3/beamadapter/parts/instrument.py | 4 ++-- .../component/BeamProjectionDifferenceMultiMapping.py | 6 +++--- 9 files changed, 12 insertions(+), 12 deletions(-) diff --git a/examples/3instruments.scn b/examples/3instruments.scn index 21625081b..940cbb71c 100644 --- a/examples/3instruments.scn +++ b/examples/3instruments.scn @@ -85,7 +85,7 @@ controlledInstrument='0' startingPos='0 0 0 0 -0.7071068 0 0.7071068' speed='2' instruments='InterpolCatheter InterpolGuide InterpolCoils' /> - + diff --git a/examples/3instruments_collis.scn b/examples/3instruments_collis.scn index 3af83e98d..bc570f5bd 100644 --- a/examples/3instruments_collis.scn +++ b/examples/3instruments_collis.scn @@ -102,7 +102,7 @@ - + diff --git a/examples/SingleBeamDeployment.scn b/examples/SingleBeamDeployment.scn index 7b0feb0aa..052ffdb4b 100644 --- a/examples/SingleBeamDeployment.scn +++ b/examples/SingleBeamDeployment.scn @@ -40,7 +40,7 @@ rotationInstrument="0 0 0" step="0.5" speed="0.5" listening="1" controlledInstrument="0"/> - + diff --git a/examples/SingleBeamDeploymentCollision.scn b/examples/SingleBeamDeploymentCollision.scn index 5b2390ab5..feab76032 100644 --- a/examples/SingleBeamDeploymentCollision.scn +++ b/examples/SingleBeamDeploymentCollision.scn @@ -59,7 +59,7 @@ listening="1" controlledInstrument="0"/> - + diff --git a/examples/Tool_from_loader.scn b/examples/Tool_from_loader.scn index fdb7b8a51..86325848c 100644 --- a/examples/Tool_from_loader.scn +++ b/examples/Tool_from_loader.scn @@ -56,7 +56,7 @@ /> - + diff --git a/examples/python3/SingleBeamDeployment.py b/examples/python3/SingleBeamDeployment.py index 4c3c76c0c..76772fdd7 100644 --- a/examples/python3/SingleBeamDeployment.py +++ b/examples/python3/SingleBeamDeployment.py @@ -45,7 +45,7 @@ def createScene(rootNode): rotationInstrument=[0, 0, 0], step=0.5, speed=0.5, listening=True, controlledInstrument=0) BeamMechanics.addObject('FixedProjectiveConstraint', indices=0, name='FixedConstraint') - BeamMechanics.addObject('RestShapeSpringsForceField', name="RestSPForceField", indices='@DeployController.indexFirstNode', angularStiffness=1e8, stiffness=1e8) + BeamMechanics.addObject('FixedWeakConstraint', name="RestSPForceField", indices='@DeployController.indexFirstNode', angularStiffness=1e8, stiffness=1e8) def main(): diff --git a/examples/python3/SingleBeamDeploymentCollision.py b/examples/python3/SingleBeamDeploymentCollision.py index 4a64f608e..e404baf5a 100644 --- a/examples/python3/SingleBeamDeploymentCollision.py +++ b/examples/python3/SingleBeamDeploymentCollision.py @@ -54,7 +54,7 @@ def createScene(rootNode): listening=True, controlledInstrument=0) BeamMechanics.addObject('LinearSolverConstraintCorrection', wire_optimization='true', printLog=False) BeamMechanics.addObject('FixedProjectiveConstraint', indices=0, name='FixedConstraint') - BeamMechanics.addObject('RestShapeSpringsForceField', indices='@DeployController.indexFirstNode', angularStiffness=1e8, stiffness=1e8) + BeamMechanics.addObject('FixedWeakConstraint', indices='@DeployController.indexFirstNode', angularStiffness=1e8, stiffness=1e8) BeamCollis = BeamMechanics.addChild('CollisionModel') diff --git a/examples/python3/beamadapter/parts/instrument.py b/examples/python3/beamadapter/parts/instrument.py index 34fb2468e..4663df117 100644 --- a/examples/python3/beamadapter/parts/instrument.py +++ b/examples/python3/beamadapter/parts/instrument.py @@ -53,7 +53,7 @@ def combineInstruments(node, xtip=[1, 0, 0], instruments=['guide'], controlledInstrument=controlledInstrument) InstrumentCombined.addObject('LinearSolverConstraintCorrection', wire_optimization='true', printLog=False) InstrumentCombined.addObject('FixedConstraint', indices=0, name='FixedConstraint') - InstrumentCombined.addObject('RestShapeSpringsForceField', indices='@m_ircontroller.indexFirstNode', + InstrumentCombined.addObject('FixedWeakConstraint', indices='@m_ircontroller.indexFirstNode', angularStiffness=1e8, stiffness=1e8) return (InstrumentCombined) @@ -90,7 +90,7 @@ def createInstrumentsCombined(node, xtip=[1, 0, 0], instruments=['guide'], controlledInstrument=controlledInstrument) InstrumentCombined.addObject('LinearSolverConstraintCorrection', wire_optimization='true', printLog=False) InstrumentCombined.addObject('FixedConstraint', indices=0, name='FixedConstraint') - InstrumentCombined.addObject('RestShapeSpringsForceField', indices='@m_ircontroller.indexFirstNode', + InstrumentCombined.addObject('FixedWeakConstraint', indices='@m_ircontroller.indexFirstNode', angularStiffness=1e8, stiffness=1e8) # Collision model diff --git a/examples/python3/component/BeamProjectionDifferenceMultiMapping.py b/examples/python3/component/BeamProjectionDifferenceMultiMapping.py index e6ae96504..5eff1eb20 100644 --- a/examples/python3/component/BeamProjectionDifferenceMultiMapping.py +++ b/examples/python3/component/BeamProjectionDifferenceMultiMapping.py @@ -49,7 +49,7 @@ def createScene(rootnode): fixing = particles.addChild('FixingConstraintParticle1') beam.addChild(fixing) fixing.addObject('MechanicalObject', template='Rigid3', position=[0, 0, 0, 0, 0, 0, 0]) - fixing.addObject('RestShapeSpringsForceField', stiffness=1e6, angularStiffness=1e6) + fixing.addObject('FixedWeakConstraint', stiffness=1e6, angularStiffness=1e6) fixing.addObject('BeamProjectionDifferenceMultiMapping', directions=[1, 1, 1, 1, 1, 1, 1], # The three positions and rotations input1=particles.getMechanicalState().linkpath, @@ -63,7 +63,7 @@ def createScene(rootnode): sliding = particles.addChild('SlidingConstraintParticle2') beam.addChild(sliding) sliding.addObject('MechanicalObject', template='Rigid3', position=[0, 0, 0, 0, 0, 0, 0]) - sliding.addObject('RestShapeSpringsForceField', stiffness=1e6, angularStiffness=0) + sliding.addObject('FixedWeakConstraint', stiffness=1e6, angularStiffness=0, fixAll=True) sliding.addObject('BeamProjectionDifferenceMultiMapping', directions=[0, 1, 1, 1, 1, 1, 1], # Only y, z positions to allow the particle to slide on the beam # but this time we add the three rotations @@ -77,7 +77,7 @@ def createScene(rootnode): sliding = particles.addChild('SlidingConstraintParticle3') beam.addChild(sliding) sliding.addObject('MechanicalObject', template='Rigid3', position=[0, 0, 0, 0, 0, 0, 0]) - sliding.addObject('RestShapeSpringsForceField', stiffness=1e6, angularStiffness=1e6) + sliding.addObject('FixedWeakConstraint', stiffness=1e6, angularStiffness=1e6, fixAll=True) sliding.addObject('BeamProjectionDifferenceMultiMapping', directions=[0, 1, 1, 0, 0, 0, 0], # Only y, z positions to allow the particle to slide on the beam input1=particles.getMechanicalState().linkpath, From 87c5c8c585bc6be54195219251960e5c27b06424 Mon Sep 17 00:00:00 2001 From: Paul Baksic Date: Thu, 3 Apr 2025 12:37:58 +0200 Subject: [PATCH 3/3] Fix scene test --- examples/python3/Cochlear-Implant-Insertion/Scene_Cochlea.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/python3/Cochlear-Implant-Insertion/Scene_Cochlea.py b/examples/python3/Cochlear-Implant-Insertion/Scene_Cochlea.py index a7bcbedbe..b0332dc12 100644 --- a/examples/python3/Cochlear-Implant-Insertion/Scene_Cochlea.py +++ b/examples/python3/Cochlear-Implant-Insertion/Scene_Cochlea.py @@ -60,7 +60,7 @@ def createScene(rootNode): InstrumentCombined.addObject('AdaptiveBeamForceFieldAndMass', name="CatheterForceField", massDensity="0.000005", interpolation="@InterpolCatheter", printLog=False) InstrumentCombined.addObject('LinearSolverConstraintCorrection', printLog=False, wire_optimization="true") InstrumentCombined.addObject("FixedProjectiveConstraint", indices="0") - InstrumentCombined.addObject('RestShapeSpringsForceField', name="MeasurementFF", indices="@m_ircontroller.indexFirstNode", stiffness="1e10", recompute_indices="1", angularStiffness="1e10", external_rest_shape="@../RefStartingPos/ReferencePos", externalIndices="0", drawSpring="1", springColor="1 0 0 1") + InstrumentCombined.addObject('RestShapeSpringsForceField', name="MeasurementFF", indices="@m_ircontroller.indexFirstNode", stiffness="1e10", angularStiffness="1e10", external_rest_shape="@../RefStartingPos/ReferencePos", externalIndices="0", drawSpring="1", springColor="1 0 0 1") CollisInstrumentCombined = InstrumentCombined.addChild('CollisInstrumentCombined') CollisInstrumentCombined.addObject('EdgeSetTopologyContainer', name="collisEdgeSet")