mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-06 01:46:02 +08:00
Fix loading binary stl
This commit is contained in:
parent
4d9233de6d
commit
45a361c1ca
@ -11,8 +11,8 @@ class stlModel(mesh.mesh):
|
|||||||
f = open(filename, "rb")
|
f = open(filename, "rb")
|
||||||
if f.read(5).lower() == "solid":
|
if f.read(5).lower() == "solid":
|
||||||
self._loadAscii(f)
|
self._loadAscii(f)
|
||||||
if len(self.faces) < 1:
|
if not self.faces:
|
||||||
f.seek(6, os.SEEK_SET)
|
f.seek(5, os.SEEK_SET)
|
||||||
self._loadBinary(f)
|
self._loadBinary(f)
|
||||||
else:
|
else:
|
||||||
self._loadBinary(f)
|
self._loadBinary(f)
|
||||||
@ -39,7 +39,7 @@ class stlModel(mesh.mesh):
|
|||||||
|
|
||||||
def _loadBinary(self, f):
|
def _loadBinary(self, f):
|
||||||
#Skip the header
|
#Skip the header
|
||||||
f.read(80-6)
|
f.read(80-5)
|
||||||
faceCount = struct.unpack('<I', f.read(4))[0]
|
faceCount = struct.unpack('<I', f.read(4))[0]
|
||||||
for idx in xrange(0, faceCount):
|
for idx in xrange(0, faceCount):
|
||||||
data = struct.unpack("<ffffffffffffH", f.read(50))
|
data = struct.unpack("<ffffffffffffH", f.read(50))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user