rodrigorc / papercraft

Papercraft is a tool to unwrap 3D models.
GNU General Public License v3.0
124 stars 1 forks source link

Cannot import .obj file #1

Closed vanneop closed 1 year ago

vanneop commented 1 year ago

Installed papercraft on Windows 10, 64-bit. When I try to import an obj file, I get the following error message:

Error reading Wavefront file C:\Users\vn\build\papercraft\body.obj

Caused by: 0: Error reading matlib file C:\Users\vn\build\papercraft\ 1: The system cannot find the path specified. (os error 3)

Is this error message caused by something being wrong in my installation, or it has to do with papercraft itself?

Thanks

rodrigorc commented 1 year ago

The OBJ format contains the path of the matlib file that defines the material. Some programs like to add here an absolute path, so if you save your file as c:\users\vanneop\body.obj, the mtl file will be c:\users\vanneop\body.mtl. But then if you move the file somewhere else the mtl file reference may be broken.

As a workaround, I try to read the mtl with that absolute path, and then, if not found, I remove the directory part and search it in the same directory as the obj file.

Can you try opening the body.obj file with notepad, looking for the mtllib line and checking whether the referenced file exists? If it does not, try looking for it wherever you found the original OBJ and move it to the same directory.

Alternatively you can delete the line with mtllib and any other usemtl from the file.

vanneop commented 1 year ago

Thank you very much for your help. After I corrected the .mtl file path in the .obj file everything worked fine. Thank you for providing such a useful tool.

On Thu, 27 Oct 2022 at 05:53, Rodrigo Rivas Costa @.***> wrote:

The OBJ format contains the path of the matlib file that defines the material. Some programs like to add here an absolute path, so if you save your file as c:\users\vanneop\body.obj, the mtl file will be c:\users\vanneop\body.mtl. But then if you move the file somewhere else the mtl file reference may be broken.

As a workaround, I try to read the mtl with that absolute path, and then, if not found, I remove the directory part and search it in the same directory as the obj file.

Can you try opening the body.obj file with notepad, looking for the mtllib line and checking whether the referenced file exists? If it does not, try looking for it wherever you found the original OBJ and move it to the same directory.

Alternatively you can delete the line with mtllib and any other usemtl from the file.

— Reply to this email directly, view it on GitHub https://github.com/rodrigorc/papercraft/issues/1#issuecomment-1293482935, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKKRXJ6QR5AXKMM4YAMWQZTWFJ3M5ANCNFSM6AAAAAARMSRA74 . You are receiving this because you authored the thread.Message ID: @.***>