def preview_mesh(*args):
"""
This function plots numpy stl mesh objects entered into args. Note it will scale the preview plot based on the last mesh
object entered.
:param args: mesh objects to plot ex.- preview_mesh(mesh1, mesh2, mesh3)
:return:
"""
print ("...preparing preview...")
# Create a new plot
figure = pyplot.figure()
axes = mplot3d.Axes3D(figure)
for mesh_obj in args:
axes.add_collection3d(mplot3d.art3d.Poly3DCollection(mesh_obj.vectors))
# Auto scale to the mesh size. Note it will choose the last mesh
scale = mesh_obj.points.flatten(-1)
axes.auto_scale_xyz(scale, scale, scale)
# Show the plot to the screen
pyplot.show()
评论列表
文章目录