@@ -60,9 +60,16 @@ location of the file is shown in the title bar:
6060```
6161
6262:::{warning}
63- If you saved your model in an other location be
63+ If you saved your model in another location be
6464sure to modify the {file}` ../libdef.any ` file so it points
6565to AMMR repository you want to use.
66+
67+ The following line should always refer correctly to the libdef file
68+ regardless of where you save your model.
69+
70+ ``` AnyScriptDoc
71+ #include "<ANYBODY_PATH_INSTALLDIR>/AMMR/libdef.any"
72+ ```
6673:::
6774
6875(loading-a-model)=
@@ -88,7 +95,7 @@ another file loading priority by right-clicking its tab and select “Load Model
8895## The model view
8996
9097When loading is completed, the Model View window opens and shows the standing
91- model: ( You can open it manually from View -> Model Views) .
98+ model. You can open it manually from View -> Model Views.
9299
93100``` {image} _static/lesson1/image_5.png
94101:alt: Model view
@@ -110,5 +117,149 @@ functions, so keyboard shortcuts have been provided:
110117- If you have a scrolling wheel on your mouse, this will zoom the model
111118 in and out.
112119
120+ ## Understanding the AnyScript Model Structure
121+
122+ This Human Standing Model is a model from the AnyBody Managed Model Repository
123+ (AMMR). It uses the [ Human Model] ( https://anyscript.org/ammr/beta/body/models.html#the-body-model )
124+ from the AMMR, which is used by most models you will encounter when using the AMMR.
125+ Regardless of complexity, all models share a common structure used to set them
126+ up.
127+
128+ The models will typically have the following overall structure (* notice* , the
129+ AnyScript below is not excatly the same as the Standing Model used in this
130+ tutorial, but contains the same overall structure):
131+
132+ ``` AnyScriptDoc
133+ // Include the libdef file from the AMMR
134+ #include "libdef.any"
135+
136+ Main =
137+ {
138+ // Define the BodyModel configuration
139+ #include "Model/BodyModelConfiguration.any"
140+
141+ // Include the Human model from AMMR
142+ #include "<ANYBODY_PATH_BODY>/HumanModel.any"
143+
144+ // Define desired posture or movement of the model
145+ #include "Model\Mannequin.any"
146+
147+ // Compose the model
148+ AnyFolder Model =
149+ {
150+ AnyFolder &BodyModel = .HumanModel.BodyModel;
151+ AnyFolder Drivers = {...};
152+ AnyFolder Environment = {...};
153+ };
154+
155+ // Configuring the Study
156+ AnyBodyStudy Study =
157+ {
158+ AnyFolder &Model= .Model;
159+ Gravity = {0.0, -9.81,0.0}; // Gravity Vector
160+ nStep = 10; // Number of steps
161+ tStart = 0; // Start time
162+ tEnd = 10.0; // End time
163+ };
164+ };
165+ ```
166+
167+ Let us go through the different components of this structure to understand how they work.
168+
169+ ### Path to AMMR:
170+
171+ :::{note}
172+ :class: margin
173+ You can open a file by double-clicking on its name in the AnyScript.
174+ :::
175+
176+ ``` AnyScriptDoc
177+ #include "libdef.any"
178+ ```
179+
180+ This means your model will include the content of the file called ` libdef.any ` .
181+ This file references to another ` libdef.any ` file located at the top-level
182+ folder of the AMMR, which specifies the AMMR directories to use in your model.
183+ You can have multiple versions of AMMR available on your computer, and this
184+ points to the version you wish to use. This line should be at the very beginning
185+ of your ` main.any ` file.
186+
187+ ### Configuring the Human Model:
188+
189+ ``` AnyScriptDoc
190+ Main =
191+ {
192+ // Define the BodyModel configuration
193+ #include "Model/BodyModelConfiguration.any"
194+ ```
195+
196+ Here, the main declaration of the model, ` Main = {} ` , is initiated, and this file now
197+ becomes the main model file. All basic AnyScript contains a main file that
198+ defines the model’s structure, contents and the operations to be performed.
199+
200+ The file ` BodyModelConfiguration.any ` is included, which defines what parts of the
201+ human body model are included, through a number of switches called Body Model
202+ (BM) parameters. BM parameters are always prefixed with ` BM_ ` inside AnyScript.
203+ The values of these parameters are defined by ` #define ` and ` #path ` statements.
204+
205+ ### Including the Human Model
206+
207+ ``` AnyScriptDoc
208+ #include "<ANYBODY_PATH_BODY>/HumanModel.any"
209+ ```
210+
211+ The AMMR contains multiple musculoskeletal models. The above line includes the
212+ Human Model from the AMMR. The file path ` <ANYBODY_PATH_BODY> ` is defined in
213+ ` libdef.any ` .
214+
215+ It is important that the above configuration statements are placed
216+ before this line.
217+
218+ ### Defining the Posture and Movement
219+
220+ ``` AnyScriptDoc
221+ #include "Model\Mannequin.any"
222+ ```
223+
224+ This includes the file ` Mannequin.any ` which defines the posture and movement of
225+ the human body model.
226+
227+ ### Composing the Model
228+
229+ ``` AnyScriptDoc
230+ AnyFolder Model =
231+ {
232+ AnyFolder &BodyModel = .HumanModel.BodyModel;
233+ AnyFolder Drivers = {...};
234+ AnyFolder Environment = {...};
235+ };
236+ ```
237+
238+ This is where we combine the ` Body ` from the Human Model with extra things like
239+ drivers, external loads, and constraints. It could also be any models of the
240+ environment which the body interacts with or many other things.
241+
242+ ### The Study section
243+
244+ ``` AnyScriptDoc
245+ AnyBodyStudy Study =
246+ {
247+ AnyFolder &Model= .Model;
248+ Gravity = {0.0, -9.81,0.0}; // Gravity Vector
249+ nStep = 10; // Number of steps
250+ tStart = 0; // Start time
251+ tEnd = 10.0; // End time
252+ };
253+ ```
254+
255+ The ` AnyBodyStudy ` is where you configure and define your simulation. It
256+ specifies start and end times of the simulation, and the number of steps. It also
257+ configures which solvers are used.
258+
259+ Only the model elements which are referenced to within the Study will be
260+ included in the simulation. In this case, the line ` AnyFolder &Model= .Model; `
261+ references to the Model folder, meaning everything in the Model folder is part of the
262+ simulation.
263+
113264You can now proceed to {doc}` lesson2 ` .
114265
0 commit comments