Question

I'm using the convert_obj_three.py [link] to convert a simple OBJ to the Three.js format.

I've tried first with a cube with a planar UV map, and it worked.
Now I'm trying with a sphere and a cilinder together and the script tells me:

C:\Python27\threejs>python.exe conv.py -i test.obj -o test.js -t binary
Converting [test.obj] into [test.js] ...
Traceback (most recent call last):
 File "conv.py", line 1582, in <module>
    convert_binary(infile, outfile)
 File "conv.py", line 1184, in convert_binary
    faces, vertices, uvs, normals, materials, mtllib = parse_obj(infile)
 File "conv.py", line 524, in parse_obj
    z = float(chunks[3])
ValueError: could not convert string to float: \

Even if I don't give the -t binary attribute.

The .OBJ is made with Rhinoceros 4.
You can download it here: http://www.filedropper.com/test_15

Can someone explain me where is the problem?

PS: I've also tried with just the sphere and the error is the same.

Était-ce utile?

La solution

Turn off the Rhino OBJ export option "Wrap long lines".

The conversion error is caused because of a continuation character at the end of the line. The parser was expecting the Z component but found the continuation character.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top