Advertisement
Guest User

Untitled

a guest
Mar 14th, 2016
650
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.96 KB | None | 0 0
  1.     your_mesh = mesh.Mesh.from_file('stlMidpoint.stl')
  2.     print your_mesh.vectors.shape
  3.     print your_mesh.points.shape
  4.     print type(your_mesh)
  5.  
  6.     print your_mesh.vectors[1,:,:]
  7.     print your_mesh.points[1,:]
  8.  
  9.     print your_mesh[0,:]
  10.     from mpl_toolkits import mplot3d
  11.     from matplotlib import pyplot
  12.    
  13.    
  14.     # Create a new plot
  15.     figure = pyplot.figure()
  16.     axes = mplot3d.Axes3D(figure)
  17.    
  18.     # Load the STL files and add the vectors to the plot
  19.     axes.add_collection3d(mplot3d.art3d.Poly3DCollection(your_mesh.vectors))
  20.    
  21.     # Auto scale to the mesh size
  22.     scale = your_mesh.points.flatten(-1)
  23.     axes.auto_scale_xyz(scale, scale, scale)
  24.    
  25.     figure.canvas.draw()
  26.     # Show the plot to the screen
  27.     pyplot.show()
  28.  
  29.     ## save
  30.     data = np.fromstring(figure.canvas.tostring_rgb(), dtype=np.uint8, sep='')
  31.     data = data.reshape(figure.canvas.get_width_height()[::-1] + (3,))
  32.  
  33.     print np.all(data == 0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement