Page 1 of 1

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

Posted: Tue Apr 17, 2018 6:38 pm
by mfanton
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

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

Posted: Wed Apr 18, 2018 12:59 am
by chrisdembia
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>'))

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

Posted: Wed Apr 18, 2018 10:17 am
by mfanton
Geometry.safeDownCast(body.getComponent('<geom-name>'))
This worked, thanks!