Writes a stereolithography (STL) file that can be used in 3D printing.

save_3dprint(filename, maxwidth = 125, unit = "mm", rotate = FALSE)

Arguments

filename

String with the filename. If `.stl` is not at the end of the string, it will be appended automatically.

maxwidth

Default `125`. Desired maximum width of the 3D print in millimeters. Uses the units set in `unit` argument. Can also pass in a string, "125mm" or "5in".

unit

Default `mm`. Units of the `maxwidth` argument. Can also be set to inches with `in`.

rotate

Default `TRUE`. If `FALSE`, the map will be printing on its side. This may improve resolution for some 3D printing types.

Value

Writes an STL file to `filename`. Regardless of the unit displayed, the output STL is in millimeters.

Examples

filename_stl = tempfile()

#Save the STL file into `filename_stl`
if(run_documentation()) {
volcano %>%
 sphere_shade() %>%
 plot_3d(volcano,zscale=3)
render_snapshot()
save_3dprint(filename_stl)
}

#> Dimensions of model are: 125.0 mm x 58.7 mm x 87.2 mm

#Save the STL file into `filename_stl`, setting maximum width to 100 mm
if(run_documentation()) {
volcano %>%
 sphere_shade() %>%
 plot_3d(volcano,zscale=3)
render_snapshot()
save_3dprint(filename_stl, maxwidth = 100)
}

#> Dimensions of model are: 100.0 mm x 47.0 mm x 69.8 mm

#'#Save the STL file into `filename_stl`, setting maximum width to 4 inches
if(run_documentation()) {
volcano %>%
 sphere_shade() %>%
 plot_3d(volcano,zscale=3)
render_snapshot()
save_3dprint(filename_stl, maxwidth = 4, unit = "in")
}

#> Dimensions of model are: 4.00 in x 1.88 in x 2.79 in
#'#'#Save the STL file into `filename_stl`, setting maximum width (character) to 120mm
if(run_documentation()) {
volcano %>%
 sphere_shade() %>%
 plot_3d(volcano,zscale=3)
render_snapshot()
save_3dprint(filename_stl, maxwidth = "120mm")
}

#> Dimensions of model are: 120.0 mm x 56.4 mm x 83.7 mm