diff options
Diffstat (limited to 'stl.py')
-rw-r--r-- | stl.py | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -2,9 +2,13 @@ import numpy as np import string import struct from geometry import Mesh +import bz2 def mesh_from_stl(filename): - f = open(filename) + if filename.endswith('.bz2'): + f = bz2.BZ2File(filename) + else: + f = open(filename) buf = f.read(200) f.close() @@ -15,7 +19,10 @@ def mesh_from_stl(filename): return mesh_from_ascii_stl(filename) def mesh_from_ascii_stl(filename): - f = open(filename) + if filename.endswith('.bz2'): + f = bz2.BZ2File(filename) + else: + f = open(filename) vertices = [] triangles = [] |