scaling from script window
Posted: Fri May 20, 2022 6:56 am
Hi,
I'm trying to scale a model from the script window. I am unable to succeed. If I run it from the dialog everything is OK. In C:\TFM\set-de-escalado_vF.xm is the configuration file with the assignments of markers to the scale
The code I'm using is:
import os.path
myModel = modeling.Model(r'C:\TFM\gait2392_simbody_VF.osim')
state = myModel.initSystem()
scaleTool = modeling.ScaleTool(r'C:\TFM\set-de-escalado_vF.xml')
state = myModel.initSystem();
scaleTool.setSubjectMass(85)
scaleTool.setSubjectHeight(171);
scaleTool.setSubjectAge(30);
scaleTool.getModelScaler().setApply(True);
marcador = r"C:\TFM" + r'\OUT19_HG19_00PRE' + r'\coordenadas_OUT19_HG19_00PRE.trc'
scaleTool.getModelScaler().setMarkerFileName(marcador);
scaleTool.getModelScaler().setPreserveMassDist(True);
scaleTool.getModelScaler().setPrintResultFiles(True);
scaleTool.getModelScaler().setOutputModelFileName('scaled_model.osim');
scaleTool.getModelScaler().setOutputScaleFileName('Setup_Scale5.xml')
path2subject = scaleTool.getPathToSubject()
scaleTool.getModelScaler().processModel(myModel, path2subject, 85.);
state = myModel.initSystem();
scaleTool.run();
The error message is:
Attached I let the files.
Thank you very much.
--
Juanma Belda
I'm trying to scale a model from the script window. I am unable to succeed. If I run it from the dialog everything is OK. In C:\TFM\set-de-escalado_vF.xm is the configuration file with the assignments of markers to the scale
The code I'm using is:
import os.path
myModel = modeling.Model(r'C:\TFM\gait2392_simbody_VF.osim')
state = myModel.initSystem()
scaleTool = modeling.ScaleTool(r'C:\TFM\set-de-escalado_vF.xml')
state = myModel.initSystem();
scaleTool.setSubjectMass(85)
scaleTool.setSubjectHeight(171);
scaleTool.setSubjectAge(30);
scaleTool.getModelScaler().setApply(True);
marcador = r"C:\TFM" + r'\OUT19_HG19_00PRE' + r'\coordenadas_OUT19_HG19_00PRE.trc'
scaleTool.getModelScaler().setMarkerFileName(marcador);
scaleTool.getModelScaler().setPreserveMassDist(True);
scaleTool.getModelScaler().setPrintResultFiles(True);
scaleTool.getModelScaler().setOutputModelFileName('scaled_model.osim');
scaleTool.getModelScaler().setOutputScaleFileName('Setup_Scale5.xml')
path2subject = scaleTool.getPathToSubject()
scaleTool.getModelScaler().processModel(myModel, path2subject, 85.);
state = myModel.initSystem();
scaleTool.run();
The error message is:
Attached I let the files.
Thank you very much.
--
Juanma Belda