stl#
- k3d.factory.stl(stl, color=255, wireframe=False, flat_shading=True, name=None, group=None, custom_data=None, compression_level=0, **kwargs)[source]#
Create an STL drawable for data in STereoLitograpy format.
- Parameters
stl (str or bytes) – STL data in either ASCII STL (str) or Binary STL (bytes).
color (int, optional) – Hex color of the mesh, by default _default_color.
wireframe (bool, optional) – Display the mesh as wireframe, by default False.
flat_shading (bool, optional) – Display the mesh with flat shading, by default True.
name (str, optional) – Object name, by default None.
group (str, optional) – Name of a group, by default None.
custom_data (dict) – A object with custom data attached to object.
compression_level (int, optional) – Level of data compression [-1, 9], by default 0.
**kwargs – For other keyword-only arguments, see process_transform_arguments.
- Returns
STL Drawable.
- Return type
STL
See also
Examples#
# Model from https://www.thingiverse.com/thing:819046/
import k3d
with open('skull_w_jaw.stl', 'rb') as stl:
data = stl.read()
plt_skull = k3d.stl(data, color=0xe3dac9)
plot = k3d.plot()
plot += plt_skull
plot.display()