accessing Displayer for a body through Matlab API (opensim 4.0)

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Michael Fanton
Posts: 11
Joined: Sun Jan 22, 2017 12:21 pm

accessing Displayer for a body through Matlab API (opensim 4.0)

Post by Michael Fanton » Tue Apr 17, 2018 6:38 pm

Hello,

I am trying to access the Displayer of an Opensim body using the MATLAB API in Opensim 4.0. Basically, I want to change the color and display properties of my bodies in my simulation. Of course this can be done manually by editing the XML file but I was hoping to do it through a MATLAB command.

I've done some searching on the forum and it seems like in previous versions of Opensim you could use the command:

displayer = body.GetDisplayer()

(referencing this thread: viewtopicPhpbb.php?f=91&t=3844&p=8559&start=0&view=)

However, this command does not seem to be working in Opensim 4.0. Are there any alternatives to accessing a body's display preferences?

Thanks,
Michael

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

Re: accessing Displayer for a body through Matlab API (opensim 4.0)

Post by Christopher Dembia » Wed Apr 18, 2018 12:59 am

You may be able to use body.get_attached_geometry(). If you know the name of the geometry, you could maybe use Geometry.safeDownCast(body.getComponent('<geom-name>'))

User avatar
Michael Fanton
Posts: 11
Joined: Sun Jan 22, 2017 12:21 pm

Re: accessing Displayer for a body through Matlab API (opensim 4.0)

Post by Michael Fanton » Wed Apr 18, 2018 10:17 am

Geometry.safeDownCast(body.getComponent('<geom-name>'))
This worked, thanks!

POST REPLY