Skip to content

Muscle modeling updates #41

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
May 5, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 Muscle_modeling/_static/lesson1/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 Muscle_modeling/_static/lesson1/image5.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 Muscle_modeling/_static/lesson2/image3.gif
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 Muscle_modeling/_static/lesson2/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 Muscle_modeling/_static/lesson3/image1.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 Muscle_modeling/_static/lesson3/image2.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 Muscle_modeling/_static/lesson3/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 Muscle_modeling/_static/lesson4/image1.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 Muscle_modeling/_static/lesson4/image2.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 Muscle_modeling/_static/lesson4/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 Muscle_modeling/_static/lesson4/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 Muscle_modeling/_static/lesson4/image5.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 Muscle_modeling/_static/lesson5/image10.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 Muscle_modeling/_static/lesson5/image11.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 Muscle_modeling/_static/lesson5/image12.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 Muscle_modeling/_static/lesson5/image13.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 Muscle_modeling/_static/lesson5/image14.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 Muscle_modeling/_static/lesson5/image15.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 Muscle_modeling/_static/lesson5/image16.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 Muscle_modeling/_static/lesson5/image17.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 Muscle_modeling/_static/lesson5/image18.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 Muscle_modeling/_static/lesson5/image19.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 Muscle_modeling/_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 Muscle_modeling/_static/lesson5/image20.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 Muscle_modeling/_static/lesson5/image21.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 Muscle_modeling/_static/lesson5/image22.png
Binary file modified Muscle_modeling/_static/lesson5/image23.png
Binary file modified Muscle_modeling/_static/lesson5/image24.png
Binary file modified Muscle_modeling/_static/lesson5/image25.png
Binary file modified Muscle_modeling/_static/lesson5/image26.png
Binary file modified Muscle_modeling/_static/lesson5/image27.png
Binary file modified Muscle_modeling/_static/lesson5/image29.png
Binary file modified Muscle_modeling/_static/lesson5/image30.png
Binary file modified Muscle_modeling/_static/lesson5/image31.png
Binary file modified Muscle_modeling/_static/lesson5/image32.png
Binary file modified Muscle_modeling/_static/lesson5/image33.png
Binary file modified Muscle_modeling/_static/lesson5/image34.png
Binary file added Muscle_modeling/_static/lesson5/image35.png
Binary file modified Muscle_modeling/_static/lesson5/image5.png
Binary file modified Muscle_modeling/_static/lesson6/image2.png
Binary file modified Muscle_modeling/_static/lesson6/image4.gif
Binary file modified Muscle_modeling/_static/lesson6/image5.gif
Binary file modified Muscle_modeling/_static/lesson6/image6.gif
Binary file modified Muscle_modeling/_static/lesson6/image7.gif
Binary file modified Muscle_modeling/_static/lesson7/image1.png
Binary file modified Muscle_modeling/_static/lesson7/image10.png
Binary file modified Muscle_modeling/_static/lesson7/image11.png
Binary file modified Muscle_modeling/_static/lesson7/image2.gif
Binary file modified Muscle_modeling/_static/lesson7/image3.gif
Binary file modified Muscle_modeling/_static/lesson7/image5.gif
Binary file modified Muscle_modeling/_static/lesson7/image6.png
Binary file modified Muscle_modeling/_static/lesson7/image7.png
Binary file modified Muscle_modeling/_static/lesson7/image8.png
Binary file modified Muscle_modeling/_static/lesson7/image9.png
33 changes: 18 additions & 15 deletions Muscle_modeling/lesson1.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ SetInitialConditions operation, you should get the following picture:
```{image} _static/lesson1/image1.jpeg
:alt: simple model
:align: center
:width: 40%
```

The model has a driver, so you can run the kinematic analysis and see
Expand All @@ -101,6 +102,7 @@ picture until you get to the AnyMuscleModel.
```{image} _static/lesson1/image2.png
:alt: class tree
:align: center
:width: 45%
```

Notice that this class has three derived classes. These are more
Expand Down Expand Up @@ -187,14 +189,8 @@ simpler muscles of the body, primarily those in the extremities and the
spine. You can, in fact, make a pretty decent model of the legs entirely
with via point muscles.

Place the cursor right after the end brace of the musle model,
right-click the AnyMuscleViaPoint class in the tree, and insert an
instance of it:

```{image} _static/lesson1/image3.png
:alt: class tree AnyMuscleViaPoint
:align: center
```
Place the cursor right after the end brace of the musle model, in the Class
List scroll down to find AnyMuscleViaPoint and insert an instance of it:

```AnyScriptDoc
AnyMuscleModel SimpleModel = {
Expand All @@ -203,14 +199,19 @@ AnyMuscleModel SimpleModel = {
//Vol0 = 0;
};

§ AnyMuscleViaPoint <ObjectName> = {
//RefFrames = ;
//Surfaces = ;
AnyMuscleModel &<Insert name0> = <Insert object reference (or full object definition)>;
§AnyViaPointMuscle <ObjectName> =
{
//viewForce.Visible = Off;
//MetabModel = Null;
//FatigueModel = Null;
//MuscleModel = Null;
//viewMuscle.Visible = Off;
AnyRefFrame &<Insert name0> = <Insert object reference (or full object definition)>;
AnyRefFrame &<Insert name1> = <Insert object reference (or full object definition)>;
//AnyRefFrame &<Insert name2> = <Insert object reference (or full object definition)>; You can make any number of these objects!
};§
//AnyRefFrame &<Insert name2> = <Insert object reference (or full object definition)>;
//AnyRefFrame &<Insert name3> = <Insert object reference (or full object definition)>; You can make any number of AnyRefFrame objects!
AnyMuscleModel &<Insert name0> = <Insert object reference (or full object definition)>;
};§
```

Let us start by filling out what we can and removing what we have no use
Expand Down Expand Up @@ -272,11 +273,13 @@ Notice that we have added an AnyDrawMuscle object to the definition.
Like other classes in AnyScript, muscles are not drawn in the Model View
window unless you specifically ask for it. When you load the model and
run the SetInitialConditions study you will get the following picture
(if your model does not load, and you cannot find the error, {download}`clickhere to download a model that works <Downloads/MuscleDemo.1.any>`):
(if your model does not load, and you cannot find the error,
{download}`click here to download a model that works <Downloads/MuscleDemo.1.any>`):

```{image} _static/lesson1/image4.jpeg
:alt: simple model with muscle
:align: center
:width: 40%
```

Notice that the muscle is now able to balance the gravity, and we are
Expand Down
16 changes: 6 additions & 10 deletions Muscle_modeling/lesson2.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,13 @@ value leading to the following display of the muscle:
```{image} _static/lesson2/image1.jpeg
:alt: simple model with muscle
:align: center
:width: 40%
```

Let us play around with the settings a bit. An easy way to display all
the settings is to discard our manually defined AnyDrawMuscle object and
insert a template from the class tree instead:

```{image} _static/lesson2/image2.gif
:alt: class tree AnyDrawMuscle
:align: center
```

Erase the previous AnyDrawMuscle, right-click the AnyDrawMuscle in the
Let us play around with the settings a bit. An easy way to display all the
settings is to discard our manually defined AnyDrawMuscle object and insert a
template from the class list instead. Find the AnyDrawMuscle object in the Class
List, erase the previous AnyDrawMuscle, right-click the AnyDrawMuscle in the
tree view, and insert an instance:

```AnyScriptDoc
Expand Down Expand Up @@ -174,6 +169,7 @@ the red shade of the muscle changes as its activity grows:
```{image} _static/lesson2/image4.jpeg
:alt: Simple model two positions
:align: center
:width: 80%
```

When the activity is zero, the color defaults to a rather pale red. You
Expand Down
3 changes: 3 additions & 0 deletions Muscle_modeling/lesson3.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ exclusively have wrapping muscles.
```{image} _static/lesson3/image1.jpeg
:alt: Old leg Muscle wrapping
:align: center
:width: 25%
```

*Most muscles in the legs can be modeled
Expand All @@ -35,6 +36,7 @@ reasonably with via point muscles.*
```{image} _static/lesson3/image2.jpeg
:alt: Deltoid muscles
:align: center
:width: 25%
```

*The deltoid muscle wraps over the head
Expand Down Expand Up @@ -134,6 +136,7 @@ The figure below shows the result:
```{image} _static/lesson3/image3.jpeg
:alt: Simple model with via point muscle
:align: center
:width: 40%
```

A muscle can pass through an unlimited number of via points, and the
Expand Down
30 changes: 15 additions & 15 deletions Muscle_modeling/lesson4.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,14 @@ statement, and change the cylinder parameters as shown below:
  AnyRefNode CylCenter = {
    sRel = {0, 0, -0.2};

   §AnySurfCylinder WrapSurf = {
      Radius = 0.15;
      Length = 0.4;
//CapRatio = 0.1;
//CapRatio2 = 0.1;
AnyDrawParamSurf drw = {};
    §AnySurfCylinder WrapSurf = {
Radius = 0.15;
Length = 0.4;
//CapRatio = 0.1;
//CapRatio2 = 0.1;
AnyDrawParamSurf drw = {};
    };§
  };

};  // Global reference frame
```

Expand All @@ -86,6 +85,7 @@ to be inserted symmetrically about the xy plane as illustrated below:
```{image} _static/lesson4/image1.jpeg
:alt: Wrap cylinder
:align: center
:width: 60%
```

The cylinder direction is always z in the coordinate direction of the
Expand Down Expand Up @@ -115,6 +115,7 @@ AnyRefNode CylCenter = {
```{image} _static/lesson4/image2.jpeg
:alt: Wrap cylinder rotated
:align: center
:width: 60%
```

There are a couple of things to notice about the cylinder: First of all
Expand Down Expand Up @@ -258,13 +259,13 @@ we can easily change the via point muscle, Muscle1,  to wrap over the
cylinder even though it also has a via point:

```AnyScriptDoc
Any§ShortestPath§Muscle Muscle1 = {
§AnyMuscleShortestPath§ Muscle1 = {
  AnyMuscleModel &Model = .SimpleModel;
  AnyRefFrame &Orig = .GlobalRef.M1Origin;
  AnyRefFrame &Via = .Arm.ViaPoint;
§ AnySurface &srf = .GlobalRef.CylCenter.WrapSurf;§
§AnySurface &srf = .GlobalRef.CylCenter.WrapSurf;§
  AnyRefFrame &Ins = .Arm.M1Insertion;
 §SPLine.StringMesh = 20;§
  §SPLine.StringMesh = 20;§
  AnyDrawMuscle drw = {
    Bulging = 2;
    ColorScale = 1;
Expand All @@ -281,16 +282,14 @@ us the following result:
```{image} _static/lesson4/image4.jpeg
:alt: Wrap cylinder two muscles
:align: center
:width: 70%
```

As you can see, both muscles are now wrapping over the cylinder, and we
can run the InverseDynamics analysis. It seems to work, but the system
provides the following warning:

`WARNING - Via-point 'Main.MyModel.GlobalRef.M1Origin' on
'Main.MyModel.Muscle1.SPLine'`
`is located below the wrapping surface
'Main.MyModel.GlobalRef.CylCenter.WrapSurf'.`
`WARNING(OBJ.MCH.KIN7): MuscleDemo.Ini.any(75): Muscle1.SPLine: Penetration of surface: WrapSurf: Via-point 'M1Origin' on 'SPLine' is located below the wrapping surface'WrapSurf`

This is a warning that you will see rather frequently when working with
complex models with wrapping. The warning comes when one of the end
Expand Down Expand Up @@ -328,7 +327,7 @@ AnyMuscleShortestPath Muscle2 = {
  AnySurface &srf = .GlobalRef.CylCenter.WrapSurf;
  AnyRefFrame &Ins = .Arm.M2Insertion;
  SPLine.StringMesh = 20;
 §SPLine.InitWrapPosVectors = {{-0.2, -0.2, 0}, {-0.05, -0.2, 0}};§
  §SPLine.InitWrapPosVectors = {{-0.2, -0.2, 0}, {-0.05, -0.2, 0}};§
  AnyDrawMuscle drw = {
    Bulging = 2;
    ColorScale = 1;
Expand All @@ -354,6 +353,7 @@ the cylinder:
```{image} _static/lesson4/image5.jpeg
:alt: Wrap cylinder Init wrap vectors
:align: center
:width: 60%
```

If you keep pressing the step button you will see how the muscle now
Expand Down
Loading