get location for muscle does not work in python

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Ekaterina Stansfield
Posts: 9
Joined: Mon Jul 03, 2017 5:37 am

get location for muscle does not work in python

Post by Ekaterina Stansfield » Thu Jul 06, 2023 8:52 am

Hi, I am struggling to get and update fixed points for muscle paths in python.

When using model.getMuscleList().getPathPointSet() I get an error "'AbstractPathPoint' object has no attribute 'get_location' ". I also cannot reach the vector value when running
state = model.initSystem()
loc = model.getMuscles().get(0).getGeometryPath().getPathPointSet().get(0).getLocation(state)

Can you help?

Tags:

User avatar
Dan Mulla
Posts: 15
Joined: Tue Nov 04, 2014 11:16 am

Re: get location for muscle does not work in python

Post by Dan Mulla » Thu Jul 06, 2023 12:05 pm

Hi Ekaterina,

Try the following to get XYZ locations of the origin

Code: Select all

state = model.initSystem()
muscle0 = model.getMuscles().get(0)
origin_x = muscle0.getGeometryPath().getCurrentPath(state).get(0).getLocation(state).get(0)
origin_y = muscle0.getGeometryPath().getCurrentPath(state).get(0).getLocation(state).get(1)
origin_z = muscle0.getGeometryPath().getCurrentPath(state).get(0).getLocation(state).get(2)
Dan

User avatar
Ekaterina Stansfield
Posts: 9
Joined: Mon Jul 03, 2017 5:37 am

Re: get location for muscle does not work in python

Post by Ekaterina Stansfield » Fri Jul 07, 2023 6:54 am

Thanks Dan. I'll give it a go. How can I update these XYZ?

is this right?

for i in range(0,3):
val = loc.get(i)
val = val + 1
loc.set(i, val)

K

POST REPLY