In [ ]:
from k3d import K3D

plot = K3D()
view_matrix = (
    (1.0, 0.0, 1.0, 0.0),
    (0.0, 1.0, 1.0, 0.0),
    (0.0, 0.0, 1.0, 20.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.stl(view_matrix, stl, color=0xFF0000)
plot.display()
In [ ]:
view_matrix = [
    7.07, -5.0, 5.0, -10,
    0.0, -7.07, -7.07, 0.0,
    7.07, 5.0, -5.0, 0.0,
    0.0, 0.0, 0.0, 1.0
]

plot += K3D.stl_load('assets/stl.stl', view_matrix)