21  Function Reference

Quick-lookup table for every exported AutoDeskR function. Click the Chapter link to jump to full documentation and worked examples.

21.1 Authentication

Function Required Scopes Key Parameters Returns
getToken(id, secret, scope) id, secret, scope (space-separated string) $content$access_token, $content$expires_in

21.2 Data Management

Function Required Scopes Key Parameters Returns
makeBucket(token, bucket, policy) bucket:create bucket (globally unique key), policy ("transient" / "temporary" / "persistent") $content$bucketKey, $content$policyKey
checkBucket(token, bucket) bucket:read bucket $content$bucketKey, $content$policyKey
deleteBucket(token, bucket) bucket:delete bucket (must be empty) $status_code 200
uploadFile(file, token, bucket) data:write file (local path, ≤ 100 MB), bucket $content$objectId (URN), $content$size
uploadFileSigned(file, token, bucket) data:write file (local path, > 100 MB), bucket $content$objectId (URN)
listBuckets(token, limit, startAt, region) bucket:read limit (default 10), startAt (pagination key), region ("US" / "EMEA") $content$items data frame
listObjects(token, bucket, limit) data:read bucket, limit $content$items data frame
deleteObject(token, bucket, object) data:write bucket, object (filename) $status_code 200
downloadFile(urn, output_urn, token, destfile) data:read urn (encoded source), output_urn (encoded output), destfile $status_code 200

21.3 Model Derivative

Function Required Scopes Key Parameters Returns
translateObj(urn, token) data:read data:write urn (Base-64 encoded) $content$result ("created"), $content$urn
translateStl(urn, token) data:read data:write urn (Base-64 encoded) $content$result, $content$urn
translateSvf(urn, token) data:read data:write urn (Base-64 encoded) $content$result, $content$urn
checkFile(urn, token) data:read urn (Base-64 encoded) $content$status ("pending" / "inprogress" / "success"), $content$progress
getOutputUrn(urn, token) data:read urn (raw, not encoded) $content$derivatives[[1]]$children[[1]]$urn
getMetadata(urn, token) data:read urn (Base-64 encoded) $content$data$metadata[[1]]$guid, $content$data$metadata[[1]]$name
getObjectTree(guid, urn, token) data:read guid, urn (Base-64 encoded) $content$data$objects (nested list)
getData(guid, urn, token) data:read guid, urn (Base-64 encoded) $content$data$collection (list of objects with properties)

21.4 Design Automation

Function Required Scopes Key Parameters Returns
makePdf(source, destination, token) code:all source (public URL to DWG), destination (public URL for output) $content$id (WorkItem ID), $content$status
checkPdf(id, token) code:all id (WorkItem ID from makePdf()) $content$status ("pending" / "inprogress" / "success"), $content$stats

21.5 Reality Capture

Function Required Scopes Key Parameters Returns
createPhotoscene(name, format, token) data:read data:write name (scene label), format ("rcm" / "rcs" / "obj" / "ortho" / "report") $content$photoscene$photosceneid
uploadImages(photoscene_id, files, token) data:read data:write photoscene_id, files (character vector of local JPEG/PNG paths) $content$Files$file (list of uploaded file records)
processPhotoscene(photoscene_id, token) data:read data:write photoscene_id $content$photoscene$progress ("0" on submission)
checkPhotoscene(photoscene_id, token) data:read data:write photoscene_id $content$photoscene$progress (string "0""100"), $content$photoscene$progressmsg
waitForPhotoscene(photoscene_id, token, interval, timeout, verbose) data:read data:write interval (seconds between polls, default 30), timeout (max wait in seconds, default 1800) Final checkPhotoscene response when progress == "100"

21.6 Viewer

Function Required Scopes Key Parameters Returns
viewer3D(urn, token, viewerType) data:read urn (Base-64 encoded), viewerType ("header" / "headless" / "vr") Opens viewer in browser / Shiny
viewerUI(id, urn, token, viewerType) data:read id (Shiny module ID), urn, token, viewerType Shiny UI element for use in fluidPage()

21.7 Scope Quick Reference

Scope Used by
data:read Model Derivative, Viewer, Reality Capture (read)
data:write Data Management (upload/delete), Model Derivative (translate), Reality Capture
bucket:create Data Management (makeBucket)
bucket:read Data Management (checkBucket, listBuckets)
bucket:delete Data Management (deleteBucket)
code:all Design Automation

21.8 Common Patterns

21.8.1 Base-64 encode a URN

The Model Derivative and Viewer APIs require the URN to be Base-64 encoded. Use jsonlite::base64_enc():

myEncodedUrn <- jsonlite::base64_enc(myUrn)

21.8.2 Poll until a job finishes

All async jobs (translateObj, translateSvf, makePdf, processPhotoscene) follow the same pattern:

repeat {
  status <- checkFile(urn = myEncodedUrn, token = myToken)
  if (status$content$status == "success") break
  Sys.sleep(10)
}

Use waitForPhotoscene() as a ready-made equivalent for Reality Capture jobs.


22 Supporting Packages

The chapters outside the Core APIs part rely on the following R packages. This section lists the key functions used in the book and the chapter where each appears.


22.1 httr2

Used for direct Tandem REST API calls in the Digital Twins chapters, and as the underlying HTTP engine for AutoDeskR.

Function Description Chapter
request(url) Create a new HTTP request Tandem Overview, Sensor Streams
req_auth_bearer_token(req, token) Add a Bearer token header Tandem Overview
req_url_query(req, ...) Append query parameters Sensor Streams
req_perform(req) Execute the request Tandem Overview
req_verbose() Enable request/response tracing Troubleshooting
resp_body_json(resp) Parse response body as JSON Sensor Streams

22.2 jsonlite

Function Description Chapter
base64_enc(x) Base-64 encode a string (required for APS URNs) Model Derivative, Case Study
fromJSON(txt) Parse a JSON string into an R list General

22.3 Rvcg

Mesh processing — surface area, volume, smoothing, and surface distance. (Schlager 2024)

Function Description Chapter
vcgImport(file) Import OBJ, STL, or PLY mesh as tmesh3d Reading Meshes
vcgArea(mesh) Compute total surface area Mesh Metrics
vcgVolume(mesh) Compute volume (watertight meshes only) Mesh Metrics
vcgSmooth(mesh, iteration, lambda) Laplacian smoothing Mesh Comparison
vcgDist(mesh1, mesh2) Per-vertex surface distance Mesh Comparison

22.4 rgl

Interactive 3D visualisation. (Adler, Murdoch, et al. 2024)

Function Description Chapter
open3d() Open a new 3D graphics device Mesh Visualisation
shade3d(mesh, col) Render a mesh with per-vertex colours Mesh Visualisation, Mesh Comparison
rglwidget() Embed interactive 3D widget in HTML Mesh Visualisation
readOBJ(file) Alternative OBJ reader Troubleshooting
options(rgl.useNULL = TRUE) Suppress OpenGL window (headless/server use) Troubleshooting

22.5 geometry

Computational geometry for open (non-watertight) meshes. (Roussel, Sterratt, et al. 2024)

Function Description Chapter
convhulln(pts, options) Convex hull with area and volume (options = "FA") Mesh Metrics

22.6 rayshader

High-quality 3D rendered images. (Morgan-Wall 2024)

Function Description Chapter
render_snapshot(filename) Save a ray-traced render to file Mesh Visualisation

22.7 lidR

Point cloud analysis from LAS/LAZ files. (Roussel et al. 2020)

Function Description Chapter
readLAS(file) Read a LAS or LAZ point cloud Point Cloud Analysis
normalize_height(pc, algorithm) Normalise Z to ground level Point Cloud Analysis
rasterize_canopy(pc, res, algorithm) Maximum-Z raster (canopy/roof height model) Point Cloud Analysis
grid_density(pc, res) Point density raster Point Cloud Analysis
voxelize_points(pc, res) Voxelise point cloud for volume estimation Point Cloud Analysis
npoints(pc) Total point count Point Cloud Analysis
area(pc) Survey footprint area Point Cloud Analysis

22.8 dplyr

Data manipulation — filtering, grouping, joining. Used throughout the DWG Analytics and Digital Twins chapters.

Function Description Chapter
group_by(...) Group rows for summarisation Layer Analysis
summarise(...) Aggregate within groups Layer Analysis
filter(...) Keep rows matching a condition Attribute Extraction
select(...) Choose columns Sensor Streams
mutate(...) Add or transform columns Attribute Extraction
inner_join(x, y, by) Join keeping rows in both tables Sensor Streams
left_join(x, y, by) Join keeping all rows from left table Sensor Streams

22.9 tidyr

Function Description Chapter
pivot_wider(data, names_from, values_from) Reshape long data to wide format Attribute Extraction

22.10 ggplot2

Data visualisation. Used in DWG Analytics, Digital Twins, and the Case Study.

Function Description Chapter
ggplot(data, aes(...)) Initialise a plot Multiple
geom_col() Bar chart (pre-counted values) Layer Analysis
geom_line() Line chart Sensor Streams
geom_histogram() Histogram Point Cloud Analysis, Mesh Comparison
geom_ribbon() Shaded confidence band Sensor Streams
geom_tile() Heatmap tiles Cross-Drawing Comparison
facet_wrap(~ var) Small multiples Sensor Streams
coord_flip() Swap x and y axes Layer Analysis
theme_minimal() Clean theme Multiple

22.11 gt

Publication-quality tables for automated reports.(Iannone et al. 2024)

Function Description Chapter
gt(data) Create a gt table from a data frame Drawing Reports
tab_header(title, subtitle) Add a title and subtitle Drawing Reports
fmt_number(columns, decimals) Format numeric columns Drawing Reports
cols_label(...) Rename column headers Drawing Reports
tab_source_note(note) Add a footnote Drawing Reports

22.12 shiny

Interactive web applications and dashboards.

Function Description Chapter
fluidPage(...) Standard responsive page layout Viewer, Live Dashboards
tabsetPanel(...) / tabPanel(...) Tabbed layout Case Study
renderPlot({}) Reactive ggplot2 output Case Study
plotOutput(id) Placeholder for a plot Case Study
reactiveTimer(ms) Trigger reactive updates on a schedule Live Dashboards
shinyApp(ui, server) Launch the app Case Study
deployApp() Deploy to shinyapps.io Live Dashboards

22.13 dygraphs

Interactive time-series plots for Shiny dashboards. (Vanderkam et al. 2018)

Function Description Chapter
dygraph(data, main) Create an interactive time-series chart Live Dashboards
dyOptions(...) Customise colours, fill, axes Live Dashboards
dygraphOutput(id) Shiny UI placeholder Live Dashboards
renderDygraph({}) Shiny server renderer Live Dashboards

22.14 xts

Time-series objects required by dygraphs.

Function Description Chapter
xts(data, order.by) Create an extensible time-series object Live Dashboards

22.15 quarto

Programmatic report rendering.

Function Description Chapter
quarto_render(input, execute_params) Render a .qmd file with injected parameters Drawing Reports