Dear all,
I am trying to change insertion point of a ligament and see the effect on ligament load. As I have to do this for 100 runs, I am trying to do this as batch process in matlab. The problem is that, I do not want to create 100 models, save them with different names and then run IK for them. I just want to change a single parameter (the attachment point) of the model and run IK without saving the new model somewhere. How can I access to this parameter in matlab, change it dynamically and run IK in a loop?
Any information is highly appreciated.
Kind regards,
Hamed
Change ligament insertion point in a matlab loop
- Seyyed Hamed Hosseini Nasab
- Posts: 18
- Joined: Mon Jan 25, 2016 3:32 am
Re: Change ligament insertion point in a matlab loop
You can drill down to the pathpoints of a muscle. Looks something like
Code: Select all
model = Mode(pathtomodel)
s = model.initSystem()
gpath = model.getMuscles().get('rect_fem_r').getGeometryPath()
pathpoint = gpath.getPathPointSet().get(0)
location = Vec3(0.1, 0.1, 0.1)
pathpoint.setLocation(s, location)
- Seyyed Hamed Hosseini Nasab
- Posts: 18
- Joined: Mon Jan 25, 2016 3:32 am
Re: Change ligament insertion point in a matlab loop
Thanks a lot James. I tried the same for a ligament, and it works.
Regards,
Hamed
Regards,
Hamed
- Alicia Blasi-Toccacceli
- Posts: 6
- Joined: Mon Nov 04, 2019 2:26 am
Re: Change ligament insertion point in a matlab loop
Hello,
Sorry for reopening this old topic, but I am trying to change muscle insertion with Python and it does not work.
In fact, the code above proposed by jimmy does in theory exactly what I want but when I run a similar code, I got an error for the last line with the setLocation function.
AttributeError: AbstractPathPoint object has no attribute setLocation.
I saw in the doxygen API documentation that the function setLocation is usable with the PathPoint class, but not with AbstractPathPoint class like here. Is there a way to use PathPoint object to achieve the desired goal? Or any other solution?
Thank you in advance for any advice or tips.
Alicia Blasi-Toccaceli
Sorry for reopening this old topic, but I am trying to change muscle insertion with Python and it does not work.
In fact, the code above proposed by jimmy does in theory exactly what I want but when I run a similar code, I got an error for the last line with the setLocation function.
AttributeError: AbstractPathPoint object has no attribute setLocation.
I saw in the doxygen API documentation that the function setLocation is usable with the PathPoint class, but not with AbstractPathPoint class like here. Is there a way to use PathPoint object to achieve the desired goal? Or any other solution?
Thank you in advance for any advice or tips.
Alicia Blasi-Toccaceli
- Ayman Habib
- Posts: 2252
- Joined: Fri Apr 01, 2005 12:24 pm
Re: Change ligament insertion point in a matlab loop
Hello,
The API has changed in version 4.0 after the code snippet was shared, you should use the documentation for the version you have, accessible from the application/GUI. A guide to use doxygen is here https://simtk-confluence.stanford.edu/d ... ng+Doxygen
For this specific situation, the method setLocation is not available to the base class AbstractPathPoint, however if you know the exact type of PathPoint you're dealing with (PathPoint, ConditionalPathPoint, ....) you can use "safedowncast" method to the proper type to use it, for example: then ppt will have access to the method setLocation.
Hope this helps,
-Ayman
The API has changed in version 4.0 after the code snippet was shared, you should use the documentation for the version you have, accessible from the application/GUI. A guide to use doxygen is here https://simtk-confluence.stanford.edu/d ... ng+Doxygen
For this specific situation, the method setLocation is not available to the base class AbstractPathPoint, however if you know the exact type of PathPoint you're dealing with (PathPoint, ConditionalPathPoint, ....) you can use "safedowncast" method to the proper type to use it, for example:
Code: Select all
ppt = PathPoint.safeDownCast(abstractPathPoint)
Hope this helps,
-Ayman
- Alicia Blasi-Toccacceli
- Posts: 6
- Joined: Mon Nov 04, 2019 2:26 am
Re: Change ligament insertion point in a matlab loop
Thank you so much for the advice, now it works perfectly!
Regards,
Alicia
Regards,
Alicia