GUI scripting plot problem
Posted: Wed Jan 28, 2015 11:47 am
Hi,
I'm trying to use the GUI python scripting to plot tendon force of a muscle from different models and compare them.
I manage to do it in different plotter panels (one per each model), but when I try to plot every curve in the same panel, it does not work. It plots again the tendon force from the first model I loaded, despite I load a different model.
This is my code:
It looks like OpenSim changes the current model when I plot in a panel where I have already plotted a curve from a previous model.
This obviously does not happen when I simply use the GUI and I change current model by double-clicking on the name of the second model.
Any suggestion?
Thanks
Alessandro
I'm trying to use the GUI python scripting to plot tendon force of a muscle from different models and compare them.
I manage to do it in different plotter panels (one per each model), but when I try to plot every curve in the same panel, it does not work. It plots again the tendon force from the first model I loaded, despite I load a different model.
This is my code:
Code: Select all
mus = "recfem_r"
dof = "knee_angle_r"
# Load first model
loadModel(modelName)
myModel = getCurrentModel()
plotterPanel = createPlotterPanel(mus+" tendon force VS Knee Angle ")
crv_base = addAnalysisCurve(plotterPanel, "tendon force", mus, dof)
setCurveLegend(crv_base, "baseline")
# Load second model
loadModel(modelName_2)
myModel = getCurrentModel()
# plotterPanel_2 = createPlotterPanel(mus+" tendon force VS Knee Angle ")
# crv = addAnalysisCurve(plotterPanel_2, "tendon force", mus, dof)
# Instead of generating a new panel, I call the variable of the first panel plotterPanel
crv = addAnalysisCurve(plotterPanel, "tendon force", mus, dof)
setCurveLegend(crv, mus+"_2")
This obviously does not happen when I simply use the GUI and I change current model by double-clicking on the name of the second model.
Any suggestion?
Thanks
Alessandro