From 16736eeae08d9627ad751c65919900ae9191a08f Mon Sep 17 00:00:00 2001 From: Anthony LaTorre Date: Sat, 7 May 2011 20:32:35 -0400 Subject: tie fighter --- stl.py | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) (limited to 'stl.py') diff --git a/stl.py b/stl.py index b300554..076c739 100644 --- a/stl.py +++ b/stl.py @@ -1,15 +1,30 @@ import numpy as np +import struct def pull_vertices(filename): f = open(filename) - vertices = [] + vertex = [] for line in f: if not line.strip().startswith('vertex'): continue - vertices.append([float(s) for s in line.strip().split()[1:]]) + vertex.append([float(s) for s in line.strip().split()[1:]]) - return np.array(vertices) + f.close() + return np.array(vertex) -if __name__ == '__main__': - print pull_vertices('models/MiniFig.STL') +def pull_vertices_binary(filename): + f = open(filename) + + f.read(80) + triangles = struct.unpack('