Page 1 of 1

How to remove joints from a body

Posted: Tue Oct 22, 2013 8:49 pm
by leonard
Hello, everyone

I have a question about how to remove joints from the body.
For example, I want to modify "BothLegs" model. And I tried to remove the body "lcalcn".
I also need to remove the joint between "lcalcn" and "ltoes" first.
If I don't do that, there will be some error "Invalid parent body (lcalcn) specified in joint ltoe".
But I did it. The CustomJoint "ltoe" still is in the body "ltoes" in osim file.

My code as below:

Code: Select all

OpenSim::JointSet& jointSet = osimModel.updJointSet();
const OpenSim::Body& ltoes = osimModel.getBodySet().get("ltoes");
const OpenSim::Joint& ltoeJoint2 = ltoes.getJoint();  
isLtoeRemoved = jointSet.remove(&ltoeJoint2);
if(isLtoeRemoved)
  cout << "I have romoved it, " << ltoeJoint2.getName() << endl;
Million thanks,
Leo

Re: How to remove joints from a body

Posted: Wed Oct 23, 2013 9:19 am
by mbebelveras
Hi Leo,

I don't know if I understand right your problem, but you can "remove " the joint making it a "WeldJoint":

http://simtk-confluence.stanford.edu:80 ... JointTypes

There is this model leg6dof9musc.osim that comes with the newest version of open sim (you can find it here also http://simtk-confluence.stanford.edu:80 ... tal+Models) where the joints between toes and calc. and calc. and talus were "removed". You still have different bodies but they don't move one in relation to the other.

Hope it helps,
Bel