stl#
- k3d.factory.stl(stl: str | bytes, color: int = 255, wireframe: bool = False, flat_shading: bool = True, shininess: float = 50.0, name: str | None = None, group: str | None = None, custom_data: Dict[str, Any] | None = None, compression_level: int = 0, **kwargs: Any) STL[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.
shininess (float.) – Shininess of object material.
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()