Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
52c823a
Tutorial snippet updates
Aug 22, 2024
84cb065
Tutorial images and text changes
Aug 27, 2024
df15765
Tutorial snippets in Getting started
Aug 29, 2024
af6da1a
Tutorial snippets in Modeling the human body
Sep 3, 2024
6bc9a6a
Created whole folders for snippet files
melund Sep 6, 2024
8890a32
Update tests
melund Sep 6, 2024
118df15
Used cmd.exe to create lib in ci test
melund Sep 6, 2024
894e204
Merge commit '118df158da292f4b7f185ff8d0172692779da1e9'
Sep 6, 2024
1ffaf07
Merge branch 'TutorialUpdates2' of https://github.com/AnyBody/tutoria…
Sep 6, 2024
2183a40
Updates to tutorial Modeling the Human Body. New folder structure
Sep 11, 2024
bddb3ca
Final updates to the first 4 tutorials.
Sep 13, 2024
951b153
Update file paths in lesson1.md
Sep 13, 2024
d2dcdd0
rename1
Sep 13, 2024
bae2a0a
rename2
Sep 13, 2024
11e4537
Tutorial updates - file structure, images and more
Sep 16, 2024
fa547b9
Update file path in lesson2.md
Sep 16, 2024
d511125
Different updates to the first few tutorials
Sep 20, 2024
b157b32
Text and general structure updates to the first few tutorials
Sep 25, 2024
46c3ef3
Merge remote-tracking branch 'origin/master' into TutorialUpdates2
Sep 25, 2024
a95c9c3
Updates of code snippets, images and other stuff in A Study of Studies
Sep 27, 2024
e3cb1ac
Mainly changes to Parameter Studies and Optimization Tutorial. Many f…
Oct 23, 2024
7074c5a
Merge branch 'master' into ParameterStudies
melund Nov 13, 2024
7deddc6
Update python dependencies
melund Nov 13, 2024
40d0226
A few language corrections
melund Nov 13, 2024
acf7f2c
Fixed backslashes
melund Nov 13, 2024
f54c52a
Fixed more backslashes
melund Nov 13, 2024
8d64074
Fixed more isues with win/linux compat
melund Nov 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified A_Getting_started/_static/lesson2/image2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 13 additions & 5 deletions A_Getting_started/lesson2.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@

# Lesson 2: Controlling the Posture

The Standing Model's posture is defined by the angles at the anatomical joints.
The script editor currently shows the main file of the model, which includes the
line of code `Main = {}`. Any basic AnyScript contains a main file that defines
the model's structure and the operations to be performed on the model.

These specifications have been collected in one of the model files, "Mannequin.any". Scroll
down to the line which says `#include "Model\Mannequin.any"`.
The `Mannequin.any` file, included in the main file, determines the posture of
the Standing Model by specifying the angles at the anatomical joints.

Scroll down to the line that says `#include "Model\Mannequin.any"`.

## Mannequin file structure

Expand All @@ -16,7 +20,7 @@ down to the line which says `#include "Model\Mannequin.any"`.
:end-before: //# END SNIPPET 1
```

**This line means that your model will include the "Mannequin.any" file located in the Model folder,
**This line means that your model will include the content of the "Mannequin.any" file located in the Model folder,
within the main file.**

Double-clicking the file name in the editor window after loading
Expand Down Expand Up @@ -76,7 +80,11 @@ Simulation based analyses in AnyBody are termed "Studies".

- **Kinematics**: Runs Kinematic analysis
- **InverseDynamics**: Runs Inverse dynamic analysis
- **InitialConditions**: Runs only the first time step of Kinematics. Useful for testing and debugging.

To view all available operations in the model, click the "Open Operation Tree"
button and navigate to "Main" > "Study". For example, the "InitialConditions"
operation runs only the first time step of the kinematic analysis, which is
useful for testing and debugging.

```{image} _static/lesson2/image2.png
:alt: Operations drop down menu
Expand Down
4 changes: 2 additions & 2 deletions A_Getting_started/lesson3.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ values. You will find the folder in the tree here:
:align: center
```

**Navigate to the "Right.Leg.JointReactionForce" folder
by expanding the tree view like this**:
**👉 Now** navigate to the "Right.Leg.JointReactionForce" folder
by expanding the tree view like this:

```{image} _static/lesson3/image6.png
:alt: Model tree forces
Expand Down
Binary file not shown.
Binary file modified A_Getting_started_anyscript/_static/lesson4/image1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified A_Getting_started_anyscript/_static/lesson5/image1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified A_Getting_started_anyscript/_static/lesson5/image2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified A_Getting_started_anyscript/_static/lesson6/image3.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified A_Getting_started_anyscript/_static/lesson6/image4.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified A_Getting_started_anyscript/_static/lesson6/image5.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion A_Getting_started_anyscript/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ simplified model of an arm.**

Each lesson (after lesson 1) begins with a link to a file containing the
AnyScript code that has been introduced until that point. If you have a problem getting your to code work, simply
download the file and start from there.
download the demo files and start from there.

Let's get started with {doc}`Lesson 1: Basic concepts <lesson1>`
14 changes: 9 additions & 5 deletions A_Getting_started_anyscript/lesson1.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ To create an AnyScript model from scratch, go to "File menu -> New from template
which you choose "Basic Main" and provide a "Target Name" (e.g.,
*NewModel*) and click OK. This is similar to {ref}`this step <model-templates>` from the previous tutorial.

The new file that opens up in the text editor contains a basic skeleton
for your model, based on a built-in template.

```{image} _static/lesson1/image2.png
:alt: Script editor
:class: bg-primary
:width: 100%
:align: center
```

The new file that opens up in the text editor contains a basic skeleton
for your model, based on a built-in template.

## What are Classes?

Let's have a look at what the system has generated for you. If you ignore most of the text and comments (green lines beginning with {literal}`//`),
Expand Down Expand Up @@ -51,8 +51,8 @@ Main = {
```


What you see is a hierarchy of braces - the outermost pair of braces is named `Main = {`.
Everything else in the model goes between these braces.
What you see is a hierarchy of braces - the outermost pair of braces is named `Main = {}`.
Everything else in the model goes between these braces, and any basic AnyScript must contain this Main folder.

"MyModel" (of class type `AnyFolder`) is simply an
organizational folder for containing the entire model you are going to
Expand All @@ -69,6 +69,10 @@ All changes you need to do in your model will be highlighted in <span style="col

**👉 Now** reename `MyStudy` to `ArmModelStudy`, and replace all occurences of `MyModel` with `ArmModel`.

:::{note}
Generally, when declaring an object in AnyScript, you typically start with the class type, followed by a chosen object name, and then assign it a value. The value can be a number, a string, or another object.
`<ClassName> <objectname> = <value>;`
:::


## What does this file contain so far?
Expand Down
4 changes: 2 additions & 2 deletions A_Getting_started_anyscript/lesson2.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ because it's defined to look exactly the same and is loaded exactly on top of th
To solve this problem, you can change the initial/load time position of the two segments by adjusting
r0 (translation w.r.t global frame at load-time) and Axes0 (rotation matrix w.r.t global frame at load-time).

**Remember that your simulation, will only use these load-time positions as an initial guess, on the way to
enforcing specified motions and constraints (such as joints between segments). More on this in the next lesson.**
Remember that your simulation, will only use these load-time positions as an initial guess, on the way to
enforcing specified motions and constraints (such as joints between segments). More on this in the next lesson.

For now, let us first change `r0` - the global position of the segment at load-time.

Expand Down
13 changes: 10 additions & 3 deletions A_Getting_started_anyscript/lesson3.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,16 +86,23 @@ purpose, we have the lines:
:end-before: //# END SNIPPET 1
```

**They refer to two nodes that we created earlier, located on the `GlobalRef` and `UpperArm`
segments. Notice the two dots in front of the names. They signify that
They refer to two previously created nodes located on the `GlobalRef` and `UpperArm` segments, using their
**relative folder paths**. Notice the two dots in front of the names. They signify that
the `GlobalRef` and `Segs` folders are defined two levels outside the folder
we are writing into, in the model tree.**
we are writing into, in the model tree.

If you neglected the two dots, then AnyBody would search for the two objects in the "Shoulder" folder and fail
to find them. This "dot" system is quite similar to the system you may
know from directory structures in Dos, Windows, Unix, or just about any
other computer operating system.

:::{seealso}
:class: dropdown
**Absolute folder path** is another way to refer to objects in AnyScript and wil be used later in this tutorial. Absolute references are made by the complete name of an object. The complete name specifies all folders from the root,
i.e. from Main, and to the object like for instance:
`Main.<foldername>.<subfoldername>.<objectname>`
:::

(reference-objects)=

## Reference objects and the ‘&’ symbol
Expand Down
2 changes: 1 addition & 1 deletion A_Getting_started_anyscript/lesson5.md
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ should see this:
:::{note}
:class: margin
Applied forces do not have to be constant. They can change with time
and other properties in the model. Please refer to the {doc}`tutorial onforces <../The_mechanical_elements/intro>` for more
and other properties in the model. Please refer to the {doc}`tutorial on forces <../The_mechanical_elements/intro>` for more
details.
:::

Expand Down
11 changes: 7 additions & 4 deletions A_Getting_started_anyscript/lesson6.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,12 @@ An STL (or other geometrical) object's axes are always oriented parallel to the
By visualizing the palm node's local reference system, you will realize that the dumbbell needs to be rotated 90 degrees
about the local Y-axis.

**Therefore to rotate the dumbbell by 90 degrees about the Y axis, you must rotate the "PalmNode" by 90 degrees w.r.t its parent
frame, i.e. the "ForeArm". While the vector sRel denotes the "PalmNode's" relative location,you can add a rotation matrix
ARel (optinal property) which will orient "PalmNode" w.r.t "ForeArm".**
To rotate the dumbbell by 90 degrees around the Y-axis, adjust the orientation
of the `PalmNode`, where the dumbbell is attached. The `sRel` vector specifies
the position of the `PalmNode` relative to its parent frame, `ForeArm`. By
adding the optional `ARel` property, you can set the orientation of the
`PalmNode`. Set `ARel` to a rotation matrix that rotates 90 degrees around the
Y-axis to correctly orient the dumbbell.

You can use the `RotMat` function to generate the 3x3 rotation matrix:

Expand All @@ -132,4 +135,4 @@ The RGB property specifies the blend of colors Red, Green, and Blue on a normali
```

This completes the Getting Started with AnyScript tutorial. The final
result of your efforts is in {download}`demo.arm2d.any <Downloads/demo.arm2d.any>`.
result of your efforts is in {download}`demo.arm2d.zip <Downloads/demo.arm2d.zip>`.
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#path __BM_PLUGIN_FILE__ "BodyModelConfiguration.any"
#define BM_CONFIG_PLUGIN __BM_PLUGIN_FILE__

// -----------------------------------------------------------------------------------
// The BodyModel configuration can be modified using BodyModel GUI plugin
// or by manually editing this file.
//
// Please see this this file for more information on the options:
// #path HTML_DOC "<AMMR_PATH_DOC>/bm_config/index.html"
// -----------------------------------------------------------------------------------

// Enable the TLEM2 lower extremity model
#define BM_LEG_MODEL _LEG_MODEL_TLEM2_

// Excluding the muscles in the trunk segments
#define BM_TRUNK_MUSCLES OFF
// Excluding the left arm segments
#define BM_ARM_LEFT OFF
// Excluding the right arm segments
#define BM_ARM_RIGHT OFF
// Excluding the left leg segments
#define BM_LEG_LEFT OFF
// Excluding the muscles in the right leg segments
#define BM_LEG_MUSCLES_RIGHT _MUSCLES_SIMPLE_
// Excluding the default drivers for the human model
#define BM_MANNEQUIN_DRIVER_DEFAULT OFF
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@

DrawSettings = {


//This is the color definitions of the nodes and segments
Colors = {
AnyBodyRed = {149/256,51/256,55/256}; //AnyBody standard red
AnyBodyGreen = {47/256,131/256,80/256}; //AnyBody standard green
AnyBodyBlue = {82/256,85/256,111/256}; //AnyBody standard blue
AnyBodyYellow= {235/256,197/256,17/256}; //AnyBody standard yellow
AnyBodyPaleYellow = {248/256,204/256,115/256}; //AnyBody standard pale yellow
AnyBodyGrey = {153/256,153/256,153/256}; //AnyBody standard grey

Nodes = AnyBodyPaleYellow;
Segments = AnyBodyPaleYellow;
};

Muscle = {
RGB = .Colors.AnyBodyRed;
Visible =On;
DrawScaleOnOff =Off;
Bulging =0.0;
ColorScale =1.0;
RGBColorScale = {0.957031, 0.785156, 0.785156};
MaxStress = 2500000.000000; //N/m^2 //This number is for graphics only!
Opacity =1.0;
DrawScale = {
EnableCreasing = Off;
CreasingAngle = 0.524;
EnableWireframe = Off;
EnableSmoothing = On;
Param = 0.0;
ParamArray = {0.0, 0.167, 0.333, 0.5, 0.667, 0.833, 1.0};
RGBArray = {{0.0, 0.0, 0.6}, {0.0, 0.0, 1.0}, {0.0, 1.0, 1.0}, {0.0, 1.0, 0.0}, {1.0, 1.0, 0.0}, {1.0, 0.0, 0.0}, {0.6, 0.0, 0.0}};
OpacityArray = {1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0};
};
};


BonesOpacity = {

GlobalCoef = 1;

Skull = 1*GlobalCoef;
Thorax = 1*GlobalCoef;
Pelvis = 1*GlobalCoef;
Sacrum = 1*GlobalCoef;
L5 = 1*GlobalCoef;
L4 = 1*GlobalCoef;
L3 = 1*GlobalCoef;
L2 = 1*GlobalCoef;
L1 = 1*GlobalCoef;

RightFoot = 1*GlobalCoef;
RightShank = 1*GlobalCoef;
RightThigh = 1*GlobalCoef;

LeftFoot = 1*GlobalCoef;
LeftShank = 1*GlobalCoef;
LeftThigh = 1*GlobalCoef;


RightClavicula = 1*GlobalCoef;
RightScapula = 1*GlobalCoef;
RightHumerus = 1*GlobalCoef;
RightUlna = 1*GlobalCoef;
RightRadius = 1*GlobalCoef;
RightHand = 1*GlobalCoef;

LeftClavicula = 1*GlobalCoef;
LeftScapula = 1*GlobalCoef;
LeftHumerus = 1*GlobalCoef;
LeftUlna = 1*GlobalCoef;
LeftRadius = 1*GlobalCoef;
LeftHand = 1*GlobalCoef;


// For leg TD only.
RightTalus = 1*GlobalCoef;
RightPatella = 1*GlobalCoef;

LeftTalus = 1*GlobalCoef;
LeftPatella = 1*GlobalCoef;


// For detailed cervical model only.
C1 = 1*GlobalCoef;
C2 = 1*GlobalCoef;
C3 = 1*GlobalCoef;
C4 = 1*GlobalCoef;
C5 = 1*GlobalCoef;
C6 = 1*GlobalCoef;
C7 = 1*GlobalCoef;
};



SegmentAxes ={
RGB ={0,0,1};
ScaleXYZ ={0.0001,0.00001,0.00001};
};
BML ={
ScaleXYZ ={0.0006,0.0006,0.0006};
RGB = .Colors.AnyBodyBlue;
};
JointAxesProximal = {
RGB = .Colors.AnyBodyRed;
ScaleXYZ = {0.015,0.015,0.015};
};
JointAxesDistal = {
RGB = .Colors.AnyBodyGreen;
ScaleXYZ = {0.01,0.01,0.01};
};


SegmentNodes ={
ScaleXYZ ={0.0005,0.0005,0.0005};
RGB = .Colors.AnyBodyRed;
};
WrapGeometry = {
RGB ={1,1,1};
};

DrawSettingsSupport= {
Lin = {
ScaleFactor=0.004;
RGB = {0,0,1};
Thickness = 0.004;
HeadThickness = 2*Thickness;
HeadLength = 3*Thickness;
};
Rot = {
ScaleFactor=0.08;
RGB = {1,0,0};
Thickness = 0.075;
HeadThickness = 2*Thickness;
HeadLength = 5*Thickness;
};
};


Marker = {
Color={0,0,1};
Radius=0.00;
};

}; //DrawSettings
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
//This is a place holder for the modeling of the environment.
AnyFolder Environment = {
AnyFixedRefFrame GlobalRef = {
viewRefFrame.Visible=On;
viewRefFrame.ScaleXYZ = 0.5*{1,1,1};

AnyRefNode Hpoint = {
sRel = {-0.75, 0.5, 0};
};
};

AnySeg Pedal = {
viewInertia.Visible = On;
Mass = 2;
Jii = {0.05, 0.001, 0.05};
AnyRefNode Hinge = {
sRel = {0, -0.15, 0};
};
AnyRefNode FootNode = {
sRel = {0, 0.15, 0};
};
};

AnyRevoluteJoint HingeJoint = {
Axis = z;
AnyFixedRefFrame &Ground = .GlobalRef;
AnyRefNode &Pedal = .Pedal.Hinge;
};

AnyForce Spring = {
AnyRevoluteJoint &Hinge = .HingeJoint;
F = -0.0*.HingeJoint.Pos;
};
};
Loading