This IJulia notebook is to demonstrate how to slice an STL file.
STL file is courtesy of Jordan Miller, and can be found here.
In [1]:
using MeshSlicer
using PyPlot
In [2]:
mesh = PolygonMesh("jmil_2012_GeneratedVasculature.stl");
rotate!(mesh, 45.0, [1.0,0.0,0.0],[0.0,0.0,0.0])
In [3]:
layers = 100;
# find slice heights
step = (mesh.bounds.zmax - mesh.bounds.zmin)/layers
heights = [mesh.bounds.zmin:step:mesh.bounds.zmax]
# create an array of slices
slices = PolygonSlice(mesh,heights)
# plot slices
for slice in slices
for seg in slice.segments
plot3D([seg.start[1],seg.finish[1]], [seg.start[2],seg.finish[2]], slice.layer)
end
end