10 December 2020 at 18:49 #17995
Dear SOFA Community,
I am trying to simulate two objects that are connected via connective tissue.
The easiest way to achieve a similar behavior is a
I would like to delete springs in this ForceField, when a certain force on the objects is exceeded. (Look into the mechanical object at specific indices, and trigger spring deletion, once
forceis too large.
body1.addObject( "StiffSpringForceField", template="Vec3d", name="SpringForceField", object1=body1.collisionMO.getLinkPath(), object2=body2.collisionMO.getLinkPath(), indices1=[78, 34], indices2=[88, 96], length=[28.4112, 29.8606], stiffness=1e04, damping=5 ) body1.init()
When I create the scene via
runSofa, the springs are visible in the object, and removing them during runtime works fine.
As a next step, I wanted to do the same thing from within a python script.
[, ]So the general shape of the DataField is correct, but I cannot access the springs.
What would be your approach to delete springs via python?
Deactivating all springs at once with
body1.SpringForceField.isCompliance = Trueworks fine, but I would like to delete individual springs.
SOFA version: v20.12_beta
SofaPython3 version: master (4566e4d83a126b7722cbeb824b38254e99d4cf73)16 December 2020 at 10:05 #18035jnbrunetModerator
Hey @scheikl ,
I think this is because the data
springis a vector of
sofa::component::interactionforcefield::LinearSpringobjects, and the latter class hasn’t been bound to python3 yet, hence why you are seeing a vector of empty values (SofaPython3 detects that it is a vector, but cannot convert the LinearSpring class).
If you have some time, would you be able to create a very basic python 3 scene using the
StiffSpringForceField. By basic I mean with the minimum number of components and plugins (for example, two objects attached and created from a
RegularGridTopologyso that we don’t have to add mesh files to the scene). I will try to add bindings for the
LinearSpringclass and this will help me to test the bindings.
J-N18 December 2020 at 23:25 #1806023 December 2020 at 11:26 #18079jnbrunetModerator23 December 2020 at 11:32 #1808028 December 2020 at 22:45 #18084
- You must be logged in to reply to this topic.