summaryrefslogtreecommitdiff
path: root/stl.py
diff options
context:
space:
mode:
authorAnthony LaTorre <tlatorre9@gmail.com>2011-08-03 14:33:39 -0400
committerAnthony LaTorre <tlatorre9@gmail.com>2011-08-03 14:33:39 -0400
commit4e1047698bad5a600dd6a2aaa825667fc3617b07 (patch)
tree0fe658ce1f3fd2ef272997d800757056cfd18291 /stl.py
parent4bf95f452e3275c12026b16b51dc646846598f19 (diff)
parent91bf7a2e2371a321b3bd402810cfe3b2774e2777 (diff)
downloadchroma-4e1047698bad5a600dd6a2aaa825667fc3617b07.tar.gz
chroma-4e1047698bad5a600dd6a2aaa825667fc3617b07.tar.bz2
chroma-4e1047698bad5a600dd6a2aaa825667fc3617b07.zip
merge heads
Diffstat (limited to 'stl.py')
-rw-r--r--stl.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/stl.py b/stl.py
index f88c3fa..9a63306 100644
--- a/stl.py
+++ b/stl.py
@@ -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 = []