Page 1 of 1

problem in adding a ligament as 'acl' to the a model

Posted: Thu Oct 28, 2021 1:31 pm
by mehran65
Hi there,
I have a problem in adding a ligament(https://simtk.org/frs/?group_id=933) same as 'ACL' to the model(gait2354). there is an error with the ''Add finalize Connections()'' issue. I followed the answers but it still not working and the error exists. what is your suggestion to solve it?
I attached the picture of the error and the codes.
Thanks.

Re: problem in adding a ligament as 'acl' to the a model

Posted: Thu Oct 28, 2021 10:35 pm
by tkuchida
what is your suggestion to solve it?
In your script that adds the ligament to the model, perhaps you have forgotten to call finalizeConnections() (or initSystem()) before saving the new model?

Re: problem in adding a ligament as 'acl' to the a model

Posted: Thu Oct 28, 2021 11:57 pm
by mehran65
Thanks for your response. I tried to add the ''finalize Connections()'' but it doesn't work. Maybe I added in the wrong position. In which line should I add the ''finalize Connections()''?

Re: problem in adding a ligament as 'acl' to the a model

Posted: Fri Oct 29, 2021 5:43 pm
by tkuchida
In what way doesn't it work? If an error is returned, there may be another issue. As an alternative, you could try calling initSystem() just before printing the model to file.

Re: problem in adding a ligament as 'acl' to the a model

Posted: Sat Oct 30, 2021 2:49 am
by mehran65
The ''finalizeConnections()'' error will appear.
I copied the codes here. Is it your mean? I added at the end of the codes(blue line).

<Ligament name="aACL">
<isDisabled>false</isDisabled>
<GeometryPath name="">
<PathPointSet name="">
<objects>
<PathPoint name="aACL_f">
<location> -0.009 -0.453 0.011 </location>
<VisibleObject name="">
<!--Set of geometry files and associated attributes, allow .vtp, .stl,
.obj-->
<GeometrySet name="">
<objects/>
<groups/>
</GeometrySet>
<!--Three scale factors for display purposes: scaleX scaleY scaleZ-->
<scale_factors> 1.00000000 1.00000000 1.00000000 </scale_factors>
<!--transform relative to owner specified as 3 rotations (rad) followed by
3 translations rX rY rZ tx ty tz-->
<transform> -0.00000000 0.00000000 -0.00000000 0.00000000 0.00000000 0.00000000 </transform>
<!--Whether to show a coordinate frame-->
<show_axes> false </show_axes>
<!--Display Pref. 0:Hide 1:Wire 3:Flat 4:Shaded Can be overriden for
individual geometries-->
<display_preference> 4 </display_preference>
</VisibleObject>
<body> femur_r </body>
</PathPoint>
<PathPoint name="aACL_t">
<location> 0.011 -0.034 0 </location>
<VisibleObject name="">
<!--Set of geometry files and associated attributes, allow .vtp, .stl,
.obj-->
<GeometrySet name="">
<objects/>
<groups/>
</GeometrySet>
<!--Three scale factors for display purposes: scaleX scaleY scaleZ-->
<scale_factors> 1.00000000 1.00000000 1.00000000 </scale_factors>
<!--transform relative to owner specified as 3 rotations (rad) followed by
3 translations rX rY rZ tx ty tz-->
<transform> -0.00000000 0.00000000 -0.00000000 0.00000000 0.00000000 0.00000000 </transform>
<!--Whether to show a coordinate frame-->
<show_axes> false </show_axes>
<!--Display Pref. 0:Hide 1:Wire 3:Flat 4:Shaded Can be overriden for
individual geometries-->
<display_preference> 4 </display_preference>
</VisibleObject>
<body> tibia_r </body>
</PathPoint>
</objects>
</PathPointSet>
<VisibleObject name="">
<!--Set of geometry files and associated attributes, allow .vtp, .stl,
.obj-->
<GeometrySet name="">
<objects/>
<groups/>
</GeometrySet>
<!--Three scale factors for display purposes: scaleX scaleY scaleZ-->
<scale_factors> 1.00000000 1.00000000 1.00000000 </scale_factors>
<!--transform relative to owner specified as 3 rotations (rad) followed by
3 translations rX rY rZ tx ty tz-->
<transform> -0.00000000 0.00000000 -0.00000000 0.00000000 0.00000000 0.00000000 </transform>
<!--Whether to show a coordinate frame-->
<show_axes> false </show_axes>
<!--Display Pref. 0:Hide 1:Wire 3:Flat 4:Shaded Can be overriden for
individual geometries-->
<display_preference> 4 </display_preference>
</VisibleObject>
</GeometryPath>
<resting_length>0.037</resting_length>
<!--stiffness of ligament in N/strain-->
<pcsa_force>3600</pcsa_force>
<SimmSpline name="force_length_curve">
<!--x is stretch, y is force in N-->
<x> 0.990000000000000 0.995000000000000 1 1.00500000000000 1.01000000000000 1.01500000000000 1.02000000000000 1.02500000000000 1.03000000000000 1.04000000000000 1.09000000000000 1.14000000000000 1.19000000000000 1.24000000000000 1.29000000000000 </x>
<y> 0 0 0 0.000208333333333333 0.000833333333333333 0.00187500000000000 0.00333333333333333 0.00520833333333333 0.00750000000000000 0.0133333333333333 0.0600000000000000 0.110000000000000 0.160000000000000 0.210000000000000 0.260000000000000 </y>
</SimmSpline>
</finalizeConnections(aACL)>
</Ligament>

Also, I tried with ''initSystem()''. It that same, it did not work. what's the problem can be?

Re: problem in adding a ligament as 'acl' to the a model

Posted: Sat Oct 30, 2021 10:15 am
by tkuchida
It is generally not recommended to add components to a model by editing the .osim file manually (particularly in version 4.0 and later). finalizeConnections() is something you would run in a script (e.g., Matlab or Python) before saving the .osim file, not something you add inside the .osim file.

Re: problem in adding a ligament as 'acl' to the a model

Posted: Sun Oct 31, 2021 2:37 am
by mehran65
Thanks. I got what is your mean. I just want to try to edit by Notepad++ to see the result. Nevertheless, in this case, (without using e.g., MATLAB or Python ) the there is no way to solve the error of '' finalizeConnections()''?

Re: problem in adding a ligament as 'acl' to the a model

Posted: Sun Oct 31, 2021 6:53 am
by tkuchida
The expected contents/format of the .osim file depends on the "OpenSimDocument Version" number at the top. For example, if the version number is greater than 40000, then I believe the PathPoints need a "socket_parent_frame" property that provides the full path to the parent frame. For example:

Code: Select all

<PathPoint name="myPathPoint1">
    <!--Path to a Component that satisfies the Socket 'parent_frame' of type PhysicalFrame (description: The frame in which this path point is defined.).-->
    <socket_parent_frame>/bodyset/femur_r</socket_parent_frame>
    <!--The fixed location of the path point expressed in its parent frame.-->
    <location>1.1 1.2 1.3</location>
</PathPoint>

Re: problem in adding a ligament as 'acl' to the a model

Posted: Tue Nov 02, 2021 5:43 am
by mehran65
Thanks a lot for your help.
I tried the structure codes witch you mentioned. It was helpful an worked. The new ligament add to my model. but there is problem the ligaments movement. I mean when I move the knee-angler-r (in the coordinate tab) the body will move without ligaments. I attached the Gif file of the it and also, the picture of the codes. what can be the problem?

Re: problem in adding a ligament as 'acl' to the a model

Posted: Fri Nov 05, 2021 1:05 am
by mehran65
tkuchida wrote:
Sun Oct 31, 2021 6:53 am
The expected contents/format of the .osim file depends on the "OpenSimDocument Version" number at the top. For example, if the version number is greater than 40000, then I believe the PathPoints need a "socket_parent_frame" property that provides the full path to the parent frame. For example:

Code: Select all

<PathPoint name="myPathPoint1">
    <!--Path to a Component that satisfies the Socket 'parent_frame' of type PhysicalFrame (description: The frame in which this path point is defined.).-->
    <socket_parent_frame>/bodyset/femur_r</socket_parent_frame>
    <!--The fixed location of the path point expressed in its parent frame.-->
    <location>1.1 1.2 1.3</location>
</PathPoint>
I found the solution. it was because of the wrong coding in some parts and coordinates. thanks for your help.