Color change with force in ligament

Hi,

I was wondering if it is possible to change the color in a ligament line according to the force/strain that is present in that line, like it is possible with a muscle.
Thanks in advance!

Kind regards,
Laura

Hi Laura,
I just looked at the code and it looks like the objects AnyKinPLine and AnyDrawVector cannot use a parameterized color. I passed it on to our software developers to change this behavior. I believe this update will be available in the next release of AMS.

Kind regards,
Pavel

1 Like

Laura,
It turns out that there is a solution - one could you use AnyStyleDrawMaterial1 object to define a custom drawing behavior of an object.

AnyKinPLine pline = {
  AnyRefFrame &rf0 = Main.HumanModel.BodyModel.Trunk.SegmentsThorax.SkullSeg.SkullContactNode;
  AnyRefFrame &rf1 = Main.HumanModel.BodyModel.Trunk.SegmentsThorax.ThoraxSeg.LSNodeT11;
   
  AnyDrawPLine draw = {
    Thickness = 0.005;
    RGB={1,1,1};
    AnyFunInterpol funRGB = {
      Type=PiecewiseLinear;
      T = {-1, 0.0, 0.005, 0.01, 0.015, 0.02, 0.025, 5};
      Data = {
          {0.0,0.1, 0.2,    0.3,   0.4,  0.5, 0.6,   1},
          {0.0,0.1, 0.2,    0.3,   0.4,  0.5, 0.6,   1},
          {0.0,0.1, 0.2,    0.3,   0.4,  0.5, 0.6,   1}
      };
    };
    AnyStyleDrawMaterial1 test = {
      RGB = .funRGB(...strainparam);
    };
  };
};

In your case you would want to create a color table for each component as a function of strain/force using AnyFunInterpol with Type=PiecewiseLinear, similar to the muscle drawing. Please ensure extrapolative behavior is handled by adding some extra values.

Add this kind of drawing to the objects that you would like to color in this particular way and hide their default drawing.

Let me know if something is not clear.

Kind regards,
Pavel

1 Like

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