"""
A demonstration of mesh-plane cross-sections, commonly referred to
as "slicing" in the context of 3D printing.
"""
'\nA demonstration of mesh-plane cross-sections, commonly referred to\nas "slicing" in the context of 3D printing.\n'
import trimesh
import numpy as np
from shapely.geometry import LineString
%pylab inline
%config InlineBackend.figure_format = 'svg'
%pylab is deprecated, use %matplotlib inline and import the required libraries. Populating the interactive namespace from numpy and matplotlib
# load the mesh from filename
# file objects are also supported
mesh = trimesh.load_mesh('../models/featuretype.STL')
# get a single cross section of the mesh
slice = mesh.section(plane_origin=mesh.centroid,
plane_normal=[0,0,1])
# the section will be in the original mesh frame
slice.show()