MultiJoints + Scripting
Posted: Tue Aug 03, 2010 10:00 am
Is there a certain reason why MultiJoints aren't supported by RF's Python interface? It's not even possible to switch "Simulation" from "Inactive" to "Active".
Code: Select all
import os
import tempfile
def setMultiJointSimulation( mjname, status ):
# Compose XML code
xmlcode = '<?xml version="1.0" encoding="UTF-8"?>'
xmlcode += '<!DOCTYPE rfxml><rfxml version="0.2">'
xmlcode += '<nodes>'
xmlcode += '<node name="'
xmlcode += mjname
xmlcode += '" class="MultiJoint"><parameters>'
xmlcode += '<param name="Simulation"><enum_val><string>'
xmlcode += status
xmlcode += '</string></enum_val></param>'
xmlcode += '</parameters></node></nodes></rfxml>'
# Save to temporary file and import
tmp = tempfile.NamedTemporaryFile(suffix=".xml", delete=False)
tmp.write( xmlcode )
tmp.close()
scene.importFromXML(tmp.name,False,True)
os.remove(tmp.name)
scene.paint()
# Example
setMultiJointSimulation( "MultiJoint01", "Inactive" )