#!/usr/bin/env python # coding: utf-8 # In[ ]: import k3d model_matrix = [ 3.5, -2.5, 2.5, 0.0, 0.0, 3.5, 3.5, 0.0, -3.5, -2.5, 2.5, 0.0, 0.0, 0.0, 0.0, 1.0 ] stl = """solid facet normal 0 0 0 outer loop vertex -1.000000 1.000000 -1.000000 vertex -1.000000 -1.000000 -1.000000 vertex -1.000000 -1.000000 1.000000 endloop endfacet facet normal 0 0 0 outer loop vertex -1.000000 -1.000000 1.000000 vertex -1.000000 1.000000 1.000000 vertex -1.000000 1.000000 -1.000000 endloop endfacet facet normal 0 0 0 outer loop vertex 1.000000 -1.000000 1.000000 vertex 1.000000 1.000000 1.000000 vertex -1.000000 1.000000 1.000000 endloop endfacet facet normal 0 0 0 outer loop vertex -1.000000 1.000000 1.000000 vertex -1.000000 -1.000000 1.000000 vertex 1.000000 -1.000000 1.000000 endloop endfacet endsolid""" plot = k3d.plot() plot += k3d.stl(stl, color=0xFF0000, model_matrix=model_matrix) plot.display() # In[ ]: model_matrix = [ 7.0, -5.0, 5.0, -15.0, 0.0, -7.0, -7.0, 0.0, 7.0, 5.0, -5.0, 0.0, 0.0, 0.0, 0.0, 1.0 ] plot += k3d.stl(open('assets/stl.stl').read(), model_matrix=model_matrix) # In[ ]: plot.objects[0].wireframe = True # In[ ]: plot.objects[1].wireframe = True # In[ ]: from k3d.helpers import download filename = download('https://upload.wikimedia.org/wikipedia/commons/a/af/Asad_Al-Lat.stl') plot += k3d.stl(open(filename, 'rb').read()) # In[ ]: plot.objects[2].flat_shading = False # In[ ]: