Page 1 of 1

Get location of a muscle path point as a Vec3 Type - Doesn't work?!

Posted: Mon May 15, 2023 7:15 am
by imihasan
Hi Everyone,

I'm trying access the location of a path point of a muscle in a the parent body which is an abstract property. I use the following lines of code

Code: Select all

OpenSim::AbstractProperty* loc = osimModel.getMuscles().get(1).getGeometryPath().getPathPointSet().get(1).getPropertyByIndex(2).clone(); //Get Location In Body
loc->getValue<Vec3>(); //Get value as Vec3 
Whenever I try to run, I get these errors.

Code: Select all

1>customizeModel.obj : error LNK2019: unresolved external symbol "public: class OpenSim::Array<class SimTK::Vec<3,double,1> > const & __cdecl OpenSim::Property_Deprecated::getValueArray<class SimTK::Vec<3,double,1> >(void)const " (??$getValueArray@V?$Vec@$02N$00@SimTK@@@Property_Deprecated@OpenSim@@QEBAAEBV?$Array@V?$Vec@$02N$00@SimTK@@@1@XZ) referenced in function "public: class SimTK::Vec<3,double,1> const & __cdecl OpenSim::AbstractProperty::getValue<class SimTK::Vec<3,double,1> >(int)const " (??$getValue@V?$Vec@$02N$00@SimTK@@@AbstractProperty@OpenSim@@QEBAAEBV?$Vec@$02N$00@SimTK@@H@Z)

1>customizeModel.obj : error LNK2019: unresolved external symbol "public: class SimTK::Vec<3,double,1> const & __cdecl OpenSim::Property_Deprecated::getValue<class SimTK::Vec<3,double,1> >(void)const " (??$getValue@V?$Vec@$02N$00@SimTK@@@Property_Deprecated@OpenSim@@QEBAAEBV?$Vec@$02N$00@SimTK@@XZ) referenced in function "public: class SimTK::Vec<3,double,1> const & __cdecl OpenSim::AbstractProperty::getValue<class SimTK::Vec<3,double,1> >(int)const " (??$getValue@V?$Vec@$02N$00@SimTK@@@AbstractProperty@OpenSim@@QEBAAEBV?$Vec@$02N$00@SimTK@@H@Z)
 : fatal error LNK1120: 2 unresolved externals
Any Idea how to solve this issue?

Thanks in Advance!

Re: Get location of a muscle path point as a Vec3 Type - Doesn't work?!

Posted: Thu May 18, 2023 4:58 am
by tkuchida
Perhaps you're looking for the PathPoint::getLocation() method (https://simtk.org/api_docs/opensim/api_ ... a0e2258120)? The code would look something like this:

Code: Select all

State& state = osimModel.initSystem();
Vec3 loc = osimModel.getMuscles().get(0).getGeometryPath().getPathPointSet().get(0).getLocation(state);

Re: Get location of a muscle path point as a Vec3 Type - Doesn't work?!

Posted: Thu May 18, 2023 5:19 am
by imihasan
Thanks professor Tom for the input! That actually gives access to the path points location without any problems. It works for both getting wrapping points and insertion points.

I was sort of curious to get insertion points locations as they are considered abstract properties of the path point set of a muscle. I just didn't understand why accessing location doesn't work with getValue<Vec3>() from the path point set. However, I can get the value as a string using loc->toString().