Reg AnyPyTools

I would like to inform that your guidelines and suggestions have helped me a lot in learning AnyBody very quickly. Sorry for troubling you with more and more queries. I have been working on pipelining as you mentioned in one of the previous mails about AnyMOperationacro. It was very interesting to learn about it. I did a bit more search about pipelining in Anybody and found that in June 2015 there have been a webinar in introducing Python libraries for Anybody Operations. It felt very comfortable for me to work on that. Also the simulations were performed in a much faster rate as I could enable parallel processing.

I have been trying out to solve this pipelining problem but got stuck in a single point. I am getting an error using SetValue command in AnyPyTools. I was trying to send the arguments to Main.TrialSpecificData.NameOfFile for each trial using the SetValue operation using AnyMacro. In that I get an error stating as below:



I am attaching my code along with this mail just in case if you need to inspect it. I have made the Arguments as the name of c3d files in the input folder and I wish to use SetValue to change its value while Batch processing. The test.py is the pyscript that I am working on. Could you please let me know where I could be going wrong? Can we give the strings as input in SetValue if so is it any different from the way I did it? Also, how could I set a variable before loading the model in the Macro?

Kind Regards
Vishal

P.S: Please remove the .txt to make it as py script. I added it for the ease of uploading it here. Thank you!

Hi Vishal,

There were some syntax related issues with your test.py file and I have attached the new modified version of the simulation folder that you sent us. To use the set value operation, your target variable needs to be designated as a ‘Design Variable’. This also indicates their ‘Evaluation Moment’ (described in the Anyscript reference manual) which tells us which stage the variable will be used at during the model loading process. Design variables will appear in your GUI model tree with the word (Editable*) after the variable name.

You can in fact designate an new variable that you create as a design variable using the syntax VarType varname = DesignVar(Value). Some variables cannot be set as design variables since they are needed at the very initial stages of loading the model. Your c3d file name is one of them. So I have set it’s value to a variable FS, which is initiated using a define statement (Which are the very first bits of code parsed during model loading) through the anypytools macro commands (See line 11 of test.py). Hope this helps.

Regards
Ananth
AnyBody Support

Dear Ananth,

Thanks a lot for explaining me about the errors. This has made it much easier. :slight_smile:

Best regards
Vishal