scaling from script window

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Juan-Manuel Belda-Lois
Posts: 6
Joined: Fri Jan 30, 2009 4:49 am

scaling from script window

Post by Juan-Manuel Belda-Lois » 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
Attachments
coordenadas_OUT19_HG01_00PRE.zip
.trc file for scaling
(2.6 KiB) Downloaded 4 times
gait2392_simbody_VF.osim
Model
(586.3 KiB) Downloaded 4 times
set-de-escalado_vF.xml
default setup for scaling
(31.5 KiB) Downloaded 4 times

Tags:

POST REPLY