I am looking for some example text in how the color of a body can me changed in a python script. The body was created using:
block.addDisplayGeometry("PART.obj")
I have tried using the DisplayGeometry class under openSim to no avail.
Thanks!
Brad
setColor In Python Script
- Ayman Habib
- Posts: 2235
- Joined: Fri Apr 01, 2005 12:24 pm
Re: setColor In Python Script
Hi Brad,
The distribution include a script to set color in the GUI. If you want to set the color from a generic Python script you'd use the following code snippet:
Hope this helps,
-Ayman
The distribution include a script to set color in the GUI. If you want to set the color from a generic Python script you'd use the following code snippet:
Code: Select all
pelvis = model.getBodySet().get('pelvis')
displayer = pelvis.getDisplayer()
geometrySet = displayer.getGeometrySet()
gi = geometrySet.get(0)
gi.setColor([1, 0, .5])
-Ayman
- Brad Humphreys
- Posts: 79
- Joined: Thu Feb 03, 2011 11:32 am
Re: setColor In Python Script
Ayman,
Thanks! Works great. IMHO, this would be a good example for documentation of the python scripting. While "color" is a bit secondary, your code snippet maps/keys well to the doxygen documentation hierarchy.
Brad
Thanks! Works great. IMHO, this would be a good example for documentation of the python scripting. While "color" is a bit secondary, your code snippet maps/keys well to the doxygen documentation hierarchy.
Brad