AnyMoCap / BVH_Xsens (AMMR): model runs if I only edit SubjectSpecificData, but any new .any file I include causes parser errors ('.' unexpected, '{' unexpected, 'AnyFolder' when 'Main' was expected)

Hello,

I am working with the AnyMoCap BVH_Xsens example in AMMR and I am running into a persistent parsing issue when trying to add any new AnyScript code.

Software:
AnyBody Modeling System 8.1.x (Faculty Research License)

Model:
AMMR → Application → MocapExamples → BVH_Xsens (AnyMoCap framework)

Goal:
I imported my own Xsens BVH file and can successfully run the full example pipeline (MarkerTracking and InverseDynamicStudy). However, I cannot add any additional AnyScript code via a new .any file, even a very simple test, without getting syntax/parser errors.

What works:

  1. I navigated to:
    C:\AnyBody\AMMR\Application\MocapExamples\BVH_Xsens
  2. I copied my BVH file into:
    BVH_Xsens\BVH-files
    The file is copied successfully.
  3. In the Subjects folder, I copied an existing subject/trial folder, renamed it to my subject identifier (for example: S_H\S_H_Trial01), and loaded Main.any from that folder.
  4. Initially, many files were read-only due to Windows permissions. I removed the read-only attribute at the AMMR folder level (right click → Properties → uncheck Read-only, apply to subfolders and files).
  5. I edited only SubjectSpecificData.any (for example, body mass and body height). After this change, the model loads and RunAnalysis works correctly.

So the baseline AnyMoCap example works, and editing the provided hook files works.

What does NOT work:

As soon as I try to add any new AnyScript code, the model fails during parsing.

For example, I created a new file called TestFolder.any in the same directory as Main.any and added the following minimal content:

Main.TestFolder =
{
AnyIntVar TestValue = 1;
};

Then I added this line to Main.any (after the AnyMoCap model include):

#include "TestFolder.any"

This immediately causes parsing errors when loading the model.

Typical errors I see:

  • ERROR(SCR.PRS11): '{' unexpected
  • ERROR(SCR.PRS11): '.' unexpected
  • ERROR(SCR.PRS12): 'AnyFolder' when 'Main' was expected

These errors occur before any analysis runs.

Observations:

  • The model works as long as I only edit existing files pulled in via #path (SubjectSpecificData.any, TrialSpecificData.any).
  • Any attempt to include a new .any file causes parsing errors, even with very simple content.
  • I have tried different file names, moving the include line, and simplifying the code further, but the result is always the same.
  • This makes me suspect there are specific constraints on how the BVH_Xsens / AnyMoCap example is intended to be extended.

My question:

What is the correct and supported way to add custom AnyScript code to the AnyMoCap BVH_Xsens example?

Is it expected that users should only modify SubjectSpecificData.any and TrialSpecificData.any?
If it is possible to include new files, what scope or structure should the included file have?

I am not trying to apply external forces yet; I am only trying to understand why any new code added via a separate .any file fails to parse.

Thank you very much for your help.


Hello Sondos,

Welcome to the AnyScript Forum! Firstly, can I please ask you to update your affiliation in the user profile to write your organization name?

I am not sure why you are seeing the AMMR files as read only. Are you working in the installation directory? Have you copied the files yourself from the installation directory? The AMMR files in the installation directory are marked as read-only to prevent accidental changes. Please see this page and its subpages to understand how to work with AMMR.

Regarding the error you are seeing, please update the code to

Main = {
  AnyFolder TestFolder = {
    AnyIntVar TestValue = 1;
  };
};

You are outside the scope of Main at the place where you typed your code. Therefore, you must open the scope of Main, and then inside Main, you can use the full statements like Main.TestFolder. Also, you have to define TestFolder somewhere in your model using the AnyFolder class. Main.TestFolder looks for an object called TestFolder, and you will get an unresolved object error, if you haven't defined it correctly.

I strongly recommend you spend some time going through the tutorials before you start working on your own models.

Best regards,
Dave