Page 1 of 1

Controlling the ModelVisualizer (changing background, size, etc) from Python

Posted: Thu Aug 24, 2017 7:59 pm
by manunez
Hi! I'm currently using Opensim 3.3 under a python wrapping, and I'm trying to visualise results using it's ModelVisualizer. However, from python I don't seem to have access to the underlying Simbody Visualizer. I'm trying to change it's parameters, such as with setMode, setBackgroundColor, etc. How could I achieve that?

For example:

Code: Select all

import opensim
my_model = opensim.Model('/home/j/gait2392_simbody_with_Muscle_Metabolic.osim')
my_model.setUseVisualizer(True)
my_state = my_model.initSystem()
my_model.getVisualizer().show(my_state)
visual = my_model.getVisualizer().getSimbodyVisualizer()

Code: Select all

print type(ba),dir(ba)
outputs:

Code: Select all

<type 'SwigPyObject'> ['__class__', '__cmp__', '__delattr__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__hex__', '__init__', '__int__', '__le__', '__long__', '__lt__', '__ne__', '__new__', '__oct__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'acquire', 'append', 'disown', 'next', 'own']
so I'm guessing I don't have access to the Simbody's visualizer itself. Any ideas?

Thanks in advance for your help