Fix loading of ascii stl files with MacOS line-ends.

master
daid303 2012-10-04 12:24:43 +02:00
parent 76309c7f5b
commit 6edb5c29ca
1 changed files with 9 additions and 7 deletions

View File

@ -21,16 +21,18 @@ class stlModel(mesh.mesh):
def _loadAscii(self, f):
cnt = 0
for line in f:
if 'vertex' in line:
cnt += 1
for lines in f:
for line in lines.split('\r'):
if 'vertex' in line:
cnt += 1
self._prepareVertexCount(int(cnt))
f.seek(5, os.SEEK_SET)
cnt = 0
for line in f:
if 'vertex' in line:
data = line.split()
self.addVertex(float(data[1]), float(data[2]), float(data[3]))
for lines in f:
for line in lines.split('\r'):
if 'vertex' in line:
data = line.split()
self.addVertex(float(data[1]), float(data[2]), float(data[3]))
def _loadBinary(self, f):
#Skip the header