Page MenuHome

Cannot import PLY file generated by Rhinos3D 6.0
Closed, ResolvedPublic


System Information
Operating system: Ubuntu 18
Graphics card: Integrated Intel

Blender Version
Broken: 2.79b

Short description of error
Blender can not open a PLY file exported from Rhinos 6.0. Here the file:

When run through console, it reports:

Invalid header ('end_header' line not found!)
Invalid file

I checked with a hex editor, and the end_header line is there. Maybe there is a problem with carriage return vs newline?

Exact steps for others to reproduce the error
Open Blender from a terminal/console. Import into Blender the file linked above. Check the output in the terminal.


Event Timeline

Philipp Oeser (lichtwerk) changed the task status from Needs Triage to Confirmed.Jun 26 2020, 12:58 PM

Will confirm for now, apparently there is an issue with line termination, yes.
Not sure if it is against the specs, but using line in plyf [plyf is open(filepath, 'rb')] will not separate lines properly.
Tried using - that separates them properly - but has issues later on.
Needs more investigation...

FWIW: current stable version of Rhino is v6 (SR 27 I believe).

Importing the PLY file into Rhino v6, then re-exporting as PLY, then importing in Blender works just fine. Also an export from a clean Rhino file (with just that a box) work just fine.

Even a complex model exported as PLY with Rhino 6 imports fine in Blender (2.83.1)

Thanks. The files you provided are in ASCII format, whereas the original one is in binary format. Can you see if you can select the export option as binary in 6? Otherwise we do not know if the bug is still there in 6.0. Thanks!

Right, binary format indeed fails.

Upon a bit further inspection it turns out the PLY file you provided is exported with Rhino 6.

So binary PLY also fails in 2.83.1

Ferdy Mercury (ferdymercury) renamed this task from Cannot import PLY file generated by Rhinos 3.0 to Cannot import PLY file generated by Rhinos 6.0.Jun 27 2020, 9:57 PM
Ferdy Mercury (ferdymercury) renamed this task from Cannot import PLY file generated by Rhinos 6.0 to Cannot import PLY file generated by Rhinos3D 6.0.
Ferdy Mercury (ferdymercury) updated the task description. (Show Details)

Thanks Nathan. Sorry, I had a mind shortcut and transformed Rhinos3D 6.0 to Rhinos 3.0. Indeed, it is Rhinos 6.0 the original file.

Concerning line endings:

Header line endings
The specification explicitly states that lines in the header must end with carriage returns, but this rule doesn't seem to be followed by anyone, including the C-language PLY implementation by Greg Turk, the author of the format. Here, we stick to common practice and output Unix-style line endings (with no carriage returns) but accept any line ending style in input files.

Boils down to python expecting only \n as newline char in binary files... Truing to work around the issue currently, but it's a bit tricky :|

Note that it would fail as well with a text version of it if it was not using \n as return char.