Fix loading of ascii stl files with MacOS line-ends.
This commit is contained in:
parent
76309c7f5b
commit
6edb5c29ca
1 changed files with 9 additions and 7 deletions
|
@ -21,16 +21,18 @@ class stlModel(mesh.mesh):
|
||||||
|
|
||||||
def _loadAscii(self, f):
|
def _loadAscii(self, f):
|
||||||
cnt = 0
|
cnt = 0
|
||||||
for line in f:
|
for lines in f:
|
||||||
if 'vertex' in line:
|
for line in lines.split('\r'):
|
||||||
cnt += 1
|
if 'vertex' in line:
|
||||||
|
cnt += 1
|
||||||
self._prepareVertexCount(int(cnt))
|
self._prepareVertexCount(int(cnt))
|
||||||
f.seek(5, os.SEEK_SET)
|
f.seek(5, os.SEEK_SET)
|
||||||
cnt = 0
|
cnt = 0
|
||||||
for line in f:
|
for lines in f:
|
||||||
if 'vertex' in line:
|
for line in lines.split('\r'):
|
||||||
data = line.split()
|
if 'vertex' in line:
|
||||||
self.addVertex(float(data[1]), float(data[2]), float(data[3]))
|
data = line.split()
|
||||||
|
self.addVertex(float(data[1]), float(data[2]), float(data[3]))
|
||||||
|
|
||||||
def _loadBinary(self, f):
|
def _loadBinary(self, f):
|
||||||
#Skip the header
|
#Skip the header
|
||||||
|
|
Loading…
Reference in a new issue