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

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Marcos Alfredo Núñez
Posts: 22
Joined: Thu Sep 01, 2016 1:41 pm

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

Post by Marcos Alfredo Núñez » Thu Aug 24, 2017 7:59 pm

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

POST REPLY