I ran into an obscure problem reading an .obj file into creator. It's unlikely anyone else is currently dealing with this, but since the problem is solved I thought I would post about it here in case anyone in the future has the same problem and searches for an answer.
The problem came from a Javascript application I'm writing which outputs a .obj file. The file loaded ok into Netfabb, but Creator rejected it with an error like "Non numerical value on line 6." No matter how much I stared at the file I could not see any non-numerical values on line 6.
The problem arose from the way I was writing the file in Javascript. I had a line in the code like this:
Code: Select all
str += "v " + A.x.toFixed(4) + " " + A.y.toFixed(4) + " " + height +"\n";
in which I am building up a string to write to a file in the .obj format for a vertex. In testing I had set height to 1.0 and didn't think to convert it to a string with .toFixed(). To all appearances the file that gets written looks fine, but Creator rejects it. It appears Javascript adds some extra characters you can't see and they break the Creator parser for .obj files, though I haven't investigated deeply enough to be sure. In any case, the problem was fixed by changing that code to this:
Code: Select all
str += "v " + A.x.toFixed(4) + " " + A.y.toFixed(4) + " " + height.toFixed(4) +"\n";