chiark / gitweb /
Fix loading binary stl
authorMartin Renold <martinxyz@gmx.ch>
Sun, 15 Jul 2012 07:47:50 +0000 (09:47 +0200)
committerMartin Renold <martinxyz@gmx.ch>
Sun, 15 Jul 2012 07:48:25 +0000 (09:48 +0200)
Cura/util/stl.py

index f157ce3197097d3a1b4416a4ed1eba0879934489..72b342541fdc58b2a92750797101f67b6143fc57 100644 (file)
@@ -11,8 +11,8 @@ class stlModel(mesh.mesh):
                f = open(filename, "rb")
                if f.read(5).lower() == "solid":
                        self._loadAscii(f)
-                       if len(self.faces) < 1:
-                               f.seek(6, os.SEEK_SET)
+                       if not self.faces:
+                               f.seek(5, os.SEEK_SET)
                                self._loadBinary(f)
                else:
                        self._loadBinary(f)
@@ -39,7 +39,7 @@ class stlModel(mesh.mesh):
 
        def _loadBinary(self, f):
                #Skip the header
-               f.read(80-6)
+               f.read(80-5)
                faceCount = struct.unpack('<I', f.read(4))[0]
                for idx in xrange(0, faceCount):
                        data = struct.unpack("<ffffffffffffH", f.read(50))