diff --git a/stltool.py b/stltool.py index ab5a682..329049a 100644 --- a/stltool.py +++ b/stltool.py @@ -1,4 +1,4 @@ -import sys +import sys, struct I=[ [1,0,0,0], @@ -56,7 +56,31 @@ class stl: return self.f=list(open(filename)) if not self.f[0].startswith("solid"): - print "Not an ascii stl solid" + print "Not an ascii stl solid - attempting to parse as binary" + f=open(filename,"rb") + buf=f.read(84) + while(len(buf)<84): + newdata=f.read(84-len(buf)) + if not len(newdata): + break + buf+=newdata + facetcount=struct.unpack_from("