Asymmetrical bone exchange

Hi,
I'm using Plug-in-Gait_Simple model to import squat motion capture c3d file.

I'm trying to change right femur and tibia by replacing stl files in Seg.any.

I intended to change only right bones, but left bones are also changed to the same shape, without being flipped left and right.

So I'm looking for function that changes the left and right sides to the same shape and I want to turn it off.

Can I know the location of this function?
Or can I replace bones only on the right side?

Thanks for your help.

Best regards

Hi JunSeo,

Welcome to the AnyScript forum!

I would suggest you to go through the scaling tutorial to make personalized models for your subject. Just changing the stl file will not scale the model, so you will end up visualizing the bone drawing that doesn't match the segment length or the nodes on the segment.

If you only want to visualize the bone, you can make a new AnyDrawSurf object in the leg to see the new stl file. To do that, you can open the scope to the leg in your model. You don't need to make changes to the body model files (Seg.any). So, you can go to your SubjectSpecificData.any file and type:

Main.HumanModel.BodyModel.Right.Leg.Seg.Thigh = {
  AnyDrawSurf NewFemur = {
    FileName = "__.stl"; // please type your stl file name here with the relative path to the stl file from the folder containing SubjectSpecificData.any
  };
};

Seg.any is made in such a way that it is reused for right and left side, so if you change something over there, it will be implemented on both right and left side. However, if you are using AMS v7.4.1 or later, you can use the "??=" operator instead of "=". This operator allows you to set some default value when you create an object with option of overwriting the value somewhere else in the model. So, in your Seg.any for the leg model, you can replace FileName = with FileName ??= for the bone drawing. This will take the default value as those specified in Seg.any. And then, you can overwrite the filename for the right side somewhere else in your model by typing:

Main.HumanModel.BodyModel.Left.Leg.Seg.Thigh.Drw3.FileName = ".stl" // complete path to your stl file

Likewise, you can do for other objects in AnyDrawSurf, like ScaleXYZ, RGB, etc.

Hope this helps!

Best regards,
Dave

Thanks for the kind answer.

I tried to add not only modified femur but also orthopedic femoral implant by including "additional stl.any" in main.

"additional stl.any" starts with
Main.HumanModel.BodyModel.Right.Leg.Seg.Thigh = {
AnyRefNode implant Node=
{
sRel = 0.001*{5, 0, 2};
...};

And then when I load the model, I found the error "ERROR(SCR.PRS11) : additional stl.any(1) : '.' unexpected".

I think there is no error in first sentence, the error message appears whatever I do.

Can I know how to fix this problem?

Thanks for your help.

Best regards

Hi Jun Seo,

The error you are facing is because the compiler expects Main = { to compile the model and instead finds Main.

Essentially, when you include a file in the Main file of a mocap model, you are working outside the scope of Main = { }; (that is defined inside #include "<ANYMOCAP_MODEL>"). Your code is trying to point to something in your model but it exists outside of Main = { };. This is not allowed. You can resolve the error by including your file in another place (for example, Trial/Subject/LabSpecificData.any) or by rewriting the code slightly to open the scope of Main before your additional code:

Main = {
  Main.HumanModel.BodyModel.Right.Leg.Seg.Thigh = {
    AnyRefNode implant Node= 
    // Please note that your code has a space
    // between implant and node. This is not allowed.
    {
    sRel = 0.001*{5, 0, 2};
    ...};
  }; 
};

I hope this helps!

Best regards,
Dave

1 Like