How to define forces along SPLines

Hello, I’m using the AnyBody modeling system (version 7.2.3) to create a Knee Simulator-like system.
To replicate the geometry of ligaments withing the intact knee, I am using AnyKinSPLine elements, and have been trying to replicate the ligament tensions which form on either insertion sites of the ligament using AnyForce3D.
So far, I have been able to use the ligament length to determine the ligament tensions, but have been unable to line the force vectors with the ligament fibers at each insertion site.
Can somebody help me align the force vectors with the fiber orientation?

Best Regards

Kazuki

Hi Kwazuki,

AnyForce3D is used to create a 3D force in a point, it does not use a measure.

This is contrast to AnyForce which applies a force to a measure in this case the SPLine measure. So the force in the ligaments should be applied using AnyForce this will automatically ensure the force is along the direction of the line.

Please also see this tutorial:
https://anyscript.org/tutorials/Muscle_modeling/lesson7.html

In principle you could make both approaches work in the same way but it would be troublesome like you have found.

Best regards
Søren

Hello Soren,

Thank you for your swift response.
I had not known that AnyForce3D did not use a measure.
I have since fixed the issue using AnyForce and resolved the problem.
Thank you for sharing your knowledge.

Upon fixing this issue, I have been facing another issue.
The locations of the ligament insertions (defined by AnyRefNode) happened to be underneath the STL surface.
Although I can manually re-locate the node locations, is there a more efficient way available to overcome this issue?

Sorry for the inconvenience, but the answers would be of great help to me.
Best regards.

Kazuki

Hi Kazuki,

I would import the STL into the program Meshlab and use the function PickPoints if you need to select multiple points.

Best regards
Søren

Dear Mr. Søren

Thank you for the suggestion.
I have tried using MeshLab, and it seems to be working fine.

Going back to the original question, upon integrating the ligament force into my knee model, I have been facing another problem.
When I was confirming the functionality of AnyForce, I have been using the ligament length (Lt) as a threshold (L0 being the threshold length) and outputting a constant value as ligament force as shown below.

     AnyForce LigForce1  = {
       AnyVar L0 = 2.2;
       AnyVar Lt = .LigMeas1.Pos;
       AnyRefFrame &ref = .stat.OrgPoint;
       AnyKinMeasure &meas = .LigMeas1;
       #include "LigForce.any"
       //The contents of LigForce.any is the following
       //    AnyFloat Val = iffun(gteqfun(Lt, L0), -100, 0);
       F = Val;
       AnyDrawForce drwForce = {};
     };

This has been working fine but in order to integrate the force into my knee model, I wanted to calculate the outputted force based on the current ligament length, so I changed the "LigForce.any" as the following.

AnyFloat Val = iffun(gteqfun(Lt, L0), -k * (Lt - L0), 0);

After making this change, the following error has been popping up.

ERROR(SCR.EXP0) : -- : 'F' : Error in expression. Please refer to the following error messages for details ...
ERROR(SCR.EXP1) : -- : Operator '=' : Illegal operation for given argument types : 'AnyFloat' '=' 'AnyFloat[1]'

I'm guessing that this error stems from the fact that the "F" in AnyForce is a vector whereas the "Val" that I have defined is a float. But the same code seems to exist within the "TKA-KneeBendDemo.any" file included in the install of AnyBody.

Is there anything I can do to fix this issue?

Best regards.
Kazuki

Hi Kazuki,

I think the line

AnyVar Lt = .LigMeas1.Pos;

Is wrong it will give you a vector.. so it should be

AnyVar Lt = .LigMeas1.Pos[0];

secondly i think the line

AnyFloat Val = iffun(gteqfun(Lt, L0), -k * (Lt - L0), 0);

should be

AnyFloat Val = {iffun(gteqfun(Lt, L0), -k * (Lt - L0), 0.0)};

Last thing

F = Val;

should be

F = {Val};

This is because F is a vector.

Best regards
Søren

I forgot to mention you can also consider to use the built in ligament force model see
https://anyscript.org/tutorials/Muscle_modeling/lesson7.html

Hello Søren

I'm sorry for the late reply.
Since the last suggestion that you have provided me with, I have been able to fix the problems at hand.
Thank you very much for your help.

In the last reply, you have suggested using the built-in ligament force model.
I was confused about whether you were implying that I could use the AnyLigament model instead of the AnyKinSPLine, or if you were suggesting that there was a way to place ligament models around the bone STLs.
Is it possible to place ligament models using the AnyLigament element along the bone STLs?

I'm sorry for the endless questions, and the inconvenience it causes.
But any answer would be of great help to my knowledge and modeling.

Best regards
Kazuki

Hi Kazuki,

No problem about the questions.

I just wanted to highligt that we have a force model for ligaments using the object AnyLigamentModelPol this you could use instead of the line

AnyFloat Val = iffun(gteqfun(Lt, L0), -k * (Lt - L0), 0);

This object deals only with the force not the line of action. You can use the SPLine to make the ligament wrap around bones this will give you a kinematic measure.

With the kinematic measure you can apply a force model lige the AnyLigamentModelPol or the if sentence you listed.

Hope it helps

Best regards
Søren

Hello Søren

Happy New Year, and thank you for your help.

I think I understand what you mean.
Since the SPLine provides me with a kinematic measure, it is possible to use the length of the SPLine to calculate the ligament force using AnyLigamentModelPol.
Therefore, combining these two elements would provide me with a SPLine that wraps around the STL models while the ligament forces are properly calculated.
I will give it a try.

Thank you again for your help.

Best Regards
Kazuki

Happy new year,

Exactly, the SPLine will wrap on geometrical objects like cylinders spheres which can represent the STL surface, in the locations where the wrapping occurs.

Best regards
Søren

This topic was automatically closed 125 days after the last reply. New replies are no longer allowed.