Page 1 of 1

Scale Tool Error in Python

Posted: Wed Jun 30, 2021 12:07 pm
by ahenry
Hello,
I am attempting to run the scale tool through python so I can scale a generic model to multiple different subjects and run batch IK. I have set up the XML file with what I believe to be the correct file paths for the generic model maker, model scaler, and marker placer. However, when I try to use the scaletool.run() command I receive a 'No model specified' error. Where else would I specify the model if I have already filled in the model file path for each of three main sections of the scale tool? I have attached my xml file for reference.

Re: Scale Tool Error in Python

Posted: Thu Jul 01, 2021 5:19 am
by tkuchida
I would first try moving all files to the same directory to confirm that everything runs properly. Next, you might try being consistent with whether you use "\" or "/" in the paths (you are currently switching halfway through the string). Finally, it's possible that OpenSim doesn't have access to the directory for some reason; you could try running in Admin mode to investigate.

Re: Scale Tool Error in Python

Posted: Thu Jul 01, 2021 6:50 am
by ahenry
Hi Thomas,
Thanks for your reply. I have moved everything to the same folder and have been able to load and edit the different files using the API. I have also changed my paths to consistently use "/" and even moved all files off of the google drive and onto my desktop in case there was an issue accessing cloud files. I am still running into the No model specified error even after running Spyder as an administrator. Is there another way of running in Admin mode to check for errors? Additionally, I have been able to successfully run the scale tool (both from the cloud and my desktop) through the GUI with the respective XML files. Any other insight would be appreciated.
Thanks,
Aaron

Re: Scale Tool Error in Python

Posted: Thu Jul 01, 2021 7:28 am
by ahenry
I removed all of the file paths to each of the individual files and was able to get the scale tool to at least run. It does not appear that a new scaled model file or additional scale related files are written, but I think this solved my original issue.

Re: Scale Tool Error in Python

Posted: Fri Jul 02, 2021 9:51 am
by aymanh
Hi Aaron,

While we can't test your setup file as is, since we don't have access to your model & marker files, the names/paths of the files appear to be too long and contain spaces which could be problematic (it's good that you removed the mix of forward/backward slashes as some back slashes could be misinterpreted as escape characters, recommend staying with forward slashes exclusively). There're flags that control the writing of files e.g.

Code: Select all

scaleTool.setPrintResultFiles(true)
that are not exposed as properties but are available to the API.

Please let us know if that works for you,
-Ayman

Re: Scale Tool Error in Python

Posted: Tue Jul 06, 2021 5:26 am
by ahenry
Hi Ayman,
I solved my issue by removing the full file path to each file (.xml,.osim,.trc,etc.) and only including the sub folder. In other words I cut out the 'C:\Users\User' in each file path and only used the subfolders that were part of the Python directory I was working in already.