difficulty importing external wavefront files (from Blender or Meshlab)

49 views
Skip to first unread message

Emily Leigh

unread,
Sep 19, 2024, 9:23:32 PM9/19/24
to ProjectChrono
Hi!

I am encountering difficulty importing external wavefront files to Pychrono (win-64_pychrono-8.00-py39_3631), as in wavefront files as exported from Blender. I recreated the problem with some of the wavefront files included in the Pychrono code distribution, after I imported these wavefront files into Blender and then re-exported them. I was also able to create the same problem by importing the wavefront files into Meshlab (2020.07, portable Windows version) and re-exporting them several different ways.

Could you comment on the EXACT export options that might be used to save a wavefront file that's able to be successfully imported to Pychrono?

#----------------------------------------------------
import pychrono as chrono

try:
    mesh = chrono.ChTriangleMeshConnected()
    success = mesh.LoadWavefrontMesh(chrono.etChronoDataFile('models/bulldozer/shoe_view.obj')) #OK!

    if not success:
        print("Try 1 (native Wavefront)=>Error loading mesh!")

except Exception as e:
    print("An error occurred: ", e)

try:
    mesh = chrono.ChTriangleMeshConnected()
    success = mesh.LoadWavefrontMesh(chrono.etChronoDataFile('models/RE-EXPORT/shoe_view_out.obj')) #FAIL!

    if not success:
        print("Try 2 (Wavefront imported into MeshLab and re-exported)=>Error loading mesh!")

except Exception as e:
    print("An error occurred: ", e)
#----------------------------------------------------
Code output looks like this:    

Error loading OBJ file ...path2file...
tiny_obj warning message:
tiny_obj error message:  Cannot open file ...path2file...

Try 2 (Wavefront imported into MeshLab and re-exported)=>Error loading mesh!

JINGQUAN WANG

unread,
Sep 19, 2024, 10:27:01 PM9/19/24
to ProjectChrono
Hi Emily,

Can you please check that if you setup the correct data path? E.g.:
"""
!!!! Set this path before running the demo!
"""
chrono.SetChronoDataPath(chrono.GetChronoDataPath())
veh.SetDataPath(chrono.GetChronoDataPath() + 'vehicle/')
Best,
Jingquan

Emily Leigh

unread,
Sep 21, 2024, 8:52:09 AM9/21/24
to ProjectChrono
Hi!

So, I did not realize I needed to reset the data path if attempting to import wavefront files from various different locations. It's a little misleading that the code error message spits back the whole path to the wavefront file (looks right) and says it can't read it.

I am now having good results importing wavefront files where I reset the Chrono data path to the base wavefront directory before attempting to import the wavefront file.

Thanks for the tip, Jingquan!

-Emily

Reply all
Reply to author
Forward
0 new messages