Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

save_3dprint

Save 3D Print


Description

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

Usage

save_3dprint(
  filename,
  maxwidth = 125,
  unit = "mm",
  rotate = TRUE,
  remove_extras = TRUE,
  clear = 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.

remove_extras

Default 'TRUE'. Removes non-topographic features from base: lines, water, labels, and the shadow.

clear

Default 'FALSE'. If 'TRUE', the current 'rgl' device will be cleared.

Value

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

Examples

if(interactive()) {
filename_stl = tempfile()

#Save the STL file into `filename_stl`

volcano %>%
 sphere_shade() %>%
 plot_3d(volcano,zscale=3)
render_snapshot()
save_3dprint(filename_stl, clear=TRUE)


#Save the STL file into `filename_stl`, setting maximum width to 100 mm

volcano %>%
 sphere_shade() %>%
 plot_3d(volcano,zscale=3)
render_snapshot()
save_3dprint(filename_stl, maxwidth = 100, clear=TRUE)


#'#Save the STL file into `filename_stl`, setting maximum width to 4 inches

volcano %>%
 sphere_shade() %>%
 plot_3d(volcano,zscale=3)
render_snapshot()
save_3dprint(filename_stl, maxwidth = 4, unit = "in", clear=TRUE)

#'#'#Save the STL file into `filename_stl`, setting maximum width (character) to 120mm

volcano %>%
 sphere_shade() %>%
 plot_3d(volcano,zscale=3)
render_snapshot()
save_3dprint(filename_stl, maxwidth = "120mm", clear=TRUE)

}

rayshader

Create Maps and Visualize Data in 2D and 3D

v0.24.10
GPL-3
Authors
Tyler Morgan-Wall
Initial release
2021-04-25

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.