Trouble with adding .vtp file in matlab to model

The 2018 Fall Virtual Workshop will bring together a group of international scholars and OpenSim experts to help each other advance their research using modeling and simulation. This forum is a place to accelerate OpenSim based projects while also buildin
POST REPLY
User avatar
Robert Aguilar
Posts: 2
Joined: Tue Mar 21, 2017 6:38 pm

Trouble with adding .vtp file in matlab to model

Post by Robert Aguilar » Tue Oct 23, 2018 4:35 pm

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

User avatar
Christopher Dembia
Posts: 506
Joined: Fri Oct 12, 2012 4:09 pm

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

Post by Christopher Dembia » Tue Oct 23, 2018 5:08 pm

In 4.0, you want to try `rightShank.attachGeometry(Mesh('sphere.vtp'))`.

User avatar
Robert Aguilar
Posts: 2
Joined: Tue Mar 21, 2017 6:38 pm

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

Post by Robert Aguilar » Tue Oct 23, 2018 6:26 pm

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.

User avatar
Christopher Dembia
Posts: 506
Joined: Fri Oct 12, 2012 4:09 pm

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

Post by Christopher Dembia » Tue Oct 23, 2018 6:32 pm

Refer to Doxygen to see what function calls you should use in 4.0. https://simtk.org/api_docs/opensim/api_ ... metry.html

User avatar
Ayman Habib
Posts: 2248
Joined: Fri Apr 01, 2005 12:24 pm

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

Post by Ayman Habib » Wed Oct 24, 2018 11:26 am

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

POST REPLY