Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- your_mesh = mesh.Mesh.from_file('stlMidpoint.stl')
- print your_mesh.vectors.shape
- print your_mesh.points.shape
- print type(your_mesh)
- print your_mesh.vectors[1,:,:]
- print your_mesh.points[1,:]
- print your_mesh[0,:]
- from mpl_toolkits import mplot3d
- from matplotlib import pyplot
- # Create a new plot
- figure = pyplot.figure()
- axes = mplot3d.Axes3D(figure)
- # Load the STL files and add the vectors to the plot
- axes.add_collection3d(mplot3d.art3d.Poly3DCollection(your_mesh.vectors))
- # Auto scale to the mesh size
- scale = your_mesh.points.flatten(-1)
- axes.auto_scale_xyz(scale, scale, scale)
- figure.canvas.draw()
- # Show the plot to the screen
- pyplot.show()
- ## save
- data = np.fromstring(figure.canvas.tostring_rgb(), dtype=np.uint8, sep='')
- data = data.reshape(figure.canvas.get_width_height()[::-1] + (3,))
- print np.all(data == 0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement