In [ ]:
import k3d
import vtk
import numpy as np
from k3d.helpers import download
from pyunpack import Archive
import ipywidgets as widgets

filename = download('https://github.com/To-Fujita/Babylon.js_3D_Graphics/raw/master/scenes/stl/Cute%20Darth%20Vader.stl')

reader = vtk.vtkSTLReader()
reader.SetFileName(filename)
reader.Update()

qualityFilter = vtk.vtkMeshQuality()
qualityFilter.SetInputData(reader.GetOutput()) 
qualityFilter.SetTriangleQualityMeasureToArea()
qualityFilter.SetQuadQualityMeasureToArea()
qualityFilter.Update()

plot = k3d.plot()
plot += k3d.vtk_poly_data(qualityFilter.GetOutput(), cell_color_attribute=('Quality', 0.0, 0.83))
plot.display()
In [ ]:
plot.camera = [95.27, 101.43, 224.85,
 53.44, 93.47, 46.74,
 0.0, 1.0, 0.0]
In [ ]:
plot.objects[0].triangles_attribute.shape, plot.objects[0].indices.shape, 
In [ ]: