Is there a way to remove a WeldJoint using the API?
Posted: Tue Oct 31, 2023 5:37 am
Hello everyone,
I would like to know if there is a way to remove a WeldJoint from a model using the API.
I have successfully added the WeldJoint using the following code snippet:
Code
However, I am uncertain about the procedure to remove it.
I attempted to delete the <WeldJoint name="joint"> from the osim file, but encountered an error when loading the model into OpenSim: "Attempting to assign an invalid SimTK::MobilizedBodyIndex in Object 'x' of type Physical OffsetFrame. Thrown at PhysicalFrame.cpp73 in setMobilizedBodyIndex()".
If anyone can provide insight into the correct method for deleting the <WeldJoint name="joint">, I would greatly appreciate your assistance.
I would prefer learning how to do it in the API, but if it is just easier messing with the osim file, that is fine by me.
Thank you in advance for your assistance!
Best regards,
Ana
---
I would like to know if there is a way to remove a WeldJoint from a model using the API.
I have successfully added the WeldJoint using the following code snippet:
Code
Code: Select all
joint = osim.WeldJoint("joint_1_2",
model.getBodySet().get("body1"),
osim.Vec3(0, 0, 0),
osim.Vec3(0, 0, 0),
model.getBodySet().get("body2"),
osim.Vec3(0, 0, 0),
osim.Vec3(0, 0, 0))
model.addJoint(joint)
I attempted to delete the <WeldJoint name="joint"> from the osim file, but encountered an error when loading the model into OpenSim: "Attempting to assign an invalid SimTK::MobilizedBodyIndex in Object 'x' of type Physical OffsetFrame. Thrown at PhysicalFrame.cpp73 in setMobilizedBodyIndex()".
If anyone can provide insight into the correct method for deleting the <WeldJoint name="joint">, I would greatly appreciate your assistance.
I would prefer learning how to do it in the API, but if it is just easier messing with the osim file, that is fine by me.
Thank you in advance for your assistance!
Best regards,
Ana
---