Page 1 of 1

get location for muscle does not work in python

Posted: Thu Jul 06, 2023 8:52 am
by ebulygin
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?

Re: get location for muscle does not work in python

Posted: Thu Jul 06, 2023 12:05 pm
by mulladm
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

Re: get location for muscle does not work in python

Posted: Fri Jul 07, 2023 6:54 am
by ebulygin
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