Page 1 of 1

Trouble with adding .vtp file in matlab to model

Posted: Tue Oct 23, 2018 4:35 pm
by raaguilar62
I am trying to add a .vtp to my model and it keeps giving me the error below
No appropriate method, property, or field attachMeshGeometry for class org.opensim.modeling.Body.

Error in GenerateLegworksModel (line 23)
rightShank.attachMeshGeometry('sphere.vtp');


I have tried both addDisplayGeometry(...) and attachMeshGeometry(...)
Our mentors mentiod it the api may have change for opensim 4.0
I am using matlabR2014 and opensim 4.0

Re: Trouble with adding .vtp file in matlab to model

Posted: Tue Oct 23, 2018 5:08 pm
by chrisdembia
In 4.0, you want to try `rightShank.attachGeometry(Mesh('sphere.vtp'))`.

Re: Trouble with adding .vtp file in matlab to model

Posted: Tue Oct 23, 2018 6:26 pm
by raaguilar62
awesome that worked but I received an error in my next line which is:
rightShank.getDisplayer().setScaleFactors([PylonLength/10, PylonLength, PylonLength/10]);


same error
No appropriate method, property, or field getDisplayer for class org.opensim.modeling.Body.

Re: Trouble with adding .vtp file in matlab to model

Posted: Tue Oct 23, 2018 6:32 pm
by chrisdembia
Refer to Doxygen to see what function calls you should use in 4.0. https://simtk.org/api_docs/opensim/api_ ... metry.html

Re: Trouble with adding .vtp file in matlab to model

Posted: Wed Oct 24, 2018 11:26 am
by aymanh
Hello,

I'm not sure if you're actually using Sphere or the name of the file happens to be sphere.vtp by accident. If the former, then you can use proper Geometry subclasses (Sphere, Cylinder, Torus, Ellipsoid, Brick) directly rather than using Mesh.

You can check the Doxygen documentation for available primitives and options.

Hope this helps,
-Ayman