How does input 'locj'/'loci' works in User Subroutine like 'cnfsub'?
Hello Everyone
In MotionSolve Reference Guide, the CNFSUB has a attribute names 'LOCI', and is descriped as follows:
LOCI [double precision]: An array that contains the position vector of the contact point on I_GRAPHICS_ID with respect to the origin of the I_GRAPHICS_ID reference marker, resolved in the I_GRAPHICS_ID reference marker coordinate system.
Seems it will give a coordinate of contactpoint, I tried to use this in my python subroutine. But when I output the value of loci in my script, it goes like:
6.2222448500049076e+175, 4.784135253072429e+180, 1.6937441873438465e+190
or:
0, 4.784135253072429e-310, 1.6937441873438465e-300
all through the simulation with no noticeable changes. I tried to use the official example program provided, the same problem occers.
However, the simulation goes with out error. Figure below is a contact force curve of a gear pair, looks normal too.

Does anyone have an idea about making LOCI works correctly? There are some calculation that the coordinate of contact point to be used.
Sincere gratitude,
Garand
Find more posts tagged with
Hello,
I work on this for several days. Now I don't think I misunderstood the description in the help. However loci continues to not work properly. Does this mean that there is some sort of bug or failure that prevents the subroutine from working properly, at least in MothonSolve V.2021?
Please give me a confirm if so, so that i do not spend more time on this problem.
Sincerely,
Garand
Hello @Garand,
apologies for the long waiting. It seems that currently we have some issues with LOCI, LOCJ. Could you please provide more information regarding your application so that we might provide a potential workaround for you? You can also share the model. If you do please go to File→ Export→ Model and check archive and zip options.
Best regards,
Orestes
Hello Orestis,
I am also experiencing the same issue with Garand. In my case, the arrays loci/locj consistently return very small values, close to zero. I am currently working with MotionSolve version 2025.1 on a gear pair contact model that uses a user CNFSUB subroutine. According to the documentation, I expected the arrays to provide the coordinates of the contact point relative to the body marker. Could you please advise if there is a way to resolve this issue, or if there is an alternative approach to obtain the same information?
Thank you very much for your support.
Best regards,
Nefeli


Hello @Nefeli_gki_02,
we have no fix yet for LOCI/LOCJ. Depending on your application you could use GAP. Some workaround was discussed also in another post. you can check it here
Why MotionView UserSubroutine "sysfnc" returns all 0? - Altair Community
Hope this helps!
Best regards,
Orestes
Hi Garand, can you share your CNFSUB python subroutine? If you dont want to share it publicly can you share it privately with me <apertosa@altair.com> I might be able to take a look.
Alternatively I can see if my simple model that uses a CNFSUB returns the expected results for a simple case and that would be useful to ensure that there are no obvious issues.
Hello,
I work on this for several days. Now I don't think I misunderstood the description in the help. However loci continues to not work properly. Does this mean that there is some sort of bug or failure that prevents the subroutine from working properly, at least in MothonSolve V.2021?
Please give me a confirm if so, so that i do not spend more time on this problem.
Sincerely,
Garand
My MotionView version is V.2021, by the way.