Page 1 of 1

Error Loading Mesh File

Posted: Tue Dec 31, 2019 5:09 pm
by choltkamp1
Hello all, I have been trying to solve this issue for quite some time now but haven't been able to have any breakthrough. I am getting the following error message when I try to run the scale tool in opensim from the GUI.

"Error loading mesh file: tibial_plane.obj. The file should exist in the same folder with the model.
Loading is aborted."

The respective .obj file is clearly in the same folder as the model.

I am also able to load the unscaled model into the GUI with no issues.

This issue only happens when I use the scale tool on this model. The model does have contact geometries in it and the respective .obj file is the file in the contact mesh section of the model. Any reason as to why this error is occuring?

Thanks in advance!

Colin

attached in the .osim model with contact geometries

Re: Error Loading Mesh File

Posted: Wed Jan 01, 2020 9:38 pm
by aymanh
Hi Colin,

Thanks for reporting. There's an open issue regarding this here: https://github.com/opensim-org/opensim-core/issues/246 as discussed there the core issue is that:
- Geometry and Contact mesh files are not embedded in the model file but are referenced by name.
- The actual file resolution from the name depends on the directory in which the model file lives.
- When a model is scaled (whether in GUI or API) it lives in memory with no file/directory association as such both Geometry and Mesh files can't be located (if default Geometry files are used this is not an issue).
- If the scaled model is saved to the same folder as the pre-scaled model then it all works upon reloading the scaled model from file. This is a reasonable workaround for now. I will add a reference with the issue/bug report while we investigate fixes/solutions.

Best regards,
-Ayman

Re: Error Loading Mesh File

Posted: Thu May 07, 2020 9:01 am
by karltiemann
Hi Colin,

Sorry to revive an old post but did you ever find a solution to this issue? I'm using the exact same model as you and having the same error when I try and run the scale tool. Also Ayman, I am unsure what you mean by the workaround you mentioned? I am unable to get any output from the scale tool and so no scaled model gets saved.

Many thanks,

Karl

Re: Error Loading Mesh File

Posted: Thu May 07, 2020 10:34 am
by aymanh
Hi Karl,

Not sure what platform you're on but you could run the scale tool from the command line, from the directory containing the original model and contact mesh files, specify the output scaled model file name in the xml setup file and then load the scaled model in the application.

Instructions for running command line tools are available here
https://simtk-confluence.stanford.edu/d ... +Utilities

A fix to handle loading the scaled model in the application without missing mesh files (without going through this workaround) will be available in the next public release.

Please let us know how that goes,
-Ayman

Re: Error Loading Mesh File

Posted: Fri May 08, 2020 9:46 am
by karltiemann
Hi Ayman,

That worked! Thanks for clarifying, I was stuck on this for a while. Glad to hear there will be a fix in the next release.

Thanks,

Karl

Re: Error Loading Mesh File

Posted: Wed Jun 28, 2023 2:39 am
by andreabraschi
Hi both,

may I ask you if any of you had success in solving this issue?

It appears that I'm dealing with a similar situation: I've created 2 contact geometries as `opensim.ContactMesh()` objects and attached a .stl file to each one of them. I can load the model in the GUI no problem and even use the 'Simulate' tool in the GUI.

However, I've been trying to run Forward Dynamics via the Python (version 3.9) API for OpenSim 4.4. Before running the simulations, I've added the `StatesTrajectoryReporter` and changed the level of default activation of specific muscles. When I then run the `model.initSystem()` method, I get the same error saying that one of the specified .stl files should be in the same directory as the model. The .stl file clearly is as I can load the model both in the GUI and via the API with no problem and I doubt that the issue is related to the .stl file itself?

Just wanted to ask if this was a bug that can be fixed somehow?

Many thanks in advance,
Andrea