R for the Built Environment
Preface

The built environment generates an enormous amount of data. Architectural drawings, structural models, survey point clouds, energy performance figures, sensor readings from every floor of every building. Most of it sits inside proprietary formats that R has historically had no good way to reach. R for the Built Environment changes that.
This book uses the AutoDeskR R package (Govan 2024) and the AutoDesk Platform Services (APS) cloud API as the primary bridge to that data, translating design files, extracting geometry, connecting live sensor streams, and embedding interactive 3D models in Shiny dashboards. AutoDesk is the dominant platform in the AEC industry, so it’s a practical place to start. But the analytical techniques here, mesh analysis, layer analytics, digital twin patterns, MCP tool exposure, apply to any BIM or CAD data, wherever it comes from.
Whether you’re a data scientist who just inherited a folder of DWG files, or a BIM manager who wants to automate something that currently takes three software packages and a prayer, this book is for you.
Why R?
Fair question. Most AEC professionals use Python, .NET, or whatever scripting language AutoCAD yells at you in. So why drag R into this?
Because the audience isn’t architects, it’s analysts. The real use case here is the data scientist who gets handed a folder of DWG files and told to “make a dashboard out of this.” That person lives in R. They know dplyr, they know ggplot2, they know Shiny. AutoDeskR gives them a bridge to the CAD world without forcing them to learn a whole new stack.
Because the Python SDK is for building applications. It’s great if you’re writing production software. But if you want to pull geometry data, run some summary statistics, and produce a polished report with a table and a plot, R’s ecosystem (ggplot2, gt, Quarto) is still unmatched. The wrapper isn’t competing with the Python SDK; it’s serving a different job.
Because thin wrappers encode real expertise. Yes, a sophisticated user could call the APS REST API directly with httr2. But do they know that the object URN needs to be Base64-encoded before passing it to the Model Derivative API? That tokens expire after exactly 3600 seconds? That bucket names are globally unique across all APS applications? AutoDeskR quietly handles all of that so you can focus on the analysis, not the plumbing.
Because API drift is a fact of life, not a dealbreaker. AutoDesk updates its APIs. So do Google, AWS, and everyone else. Staying close to the API surface means fewer moving parts to break, and direct httr2 calls would have exactly the same maintenance problem with more boilerplate.
Because the free tier is for experimenting, and that’s the whole point. Once you’ve prototyped something worth running in production, you’re almost certainly inside an organisation that’s already paying for AutoDesk products, and API access comes with the subscription.
What You’ll Learn
Each chapter covers a different piece of the BIM and CAD analytics ecosystem:
- Authentication — grab an OAuth token in one line and never think about it again
- Data Management — upload files to the cloud, wrangle buckets, and pull objects back down
- Model Derivative — translate design files into OBJ, STL, and SVF; extract geometry and metadata
- Design Automation — run DWG-to-PDF conversion in the cloud, no AutoCAD required
- Reality Capture — turn a set of overlapping photos into a 3D mesh
- Viewer — embed a live 3D model viewer in a Shiny app with two lines of code
- 3D Geometry & Meshes — import, measure, and visualise translated mesh files
- DWG & DXF Analytics — parse layer structure, extract attributes, compare drawing revisions
- Digital Twins — link live sensor data to BIM elements via AutoDesk Tandem
- MCP Server — expose AutoDeskR as an AI agent tool so LLMs can query BIM models directly
How This Book is Structured
The book is organised into eight parts. You don’t have to read them in order, each chapter is reasonably self-contained, but the parts do build on each other if you want the full picture.
| Part | Chapters | What you’ll do |
|---|---|---|
| Front Matter | Motivation, Acknowledgements | Understand the why |
| Getting Started | Getting Started | Install the package and make your first API call |
| AutoDesk Platform Services | Authentication → Viewer | The six main APS APIs, start to finish |
| 3D Geometry & Meshes | Reading → Visualisation → Point Clouds → Comparison | Import, measure, and compare translated mesh files |
| DWG & DXF Analytics | Layer Analysis → Attributes → Comparison → Reports | Extract meaning from drawing data |
| Digital Twins | Tandem Overview → Sensor Streams → Live Dashboards | Join live sensor readings to BIM elements |
| AI Integration | MCP Server | Expose AutoDeskR as a tool for AI agents |
| Reference | Case Study, Function Reference, Troubleshooting | Worked example, lookup tables, and help |
Prerequisites
To follow along you’ll need:
- R (version 4.0 or later) and, optionally, RStudio
- A free AutoDesk account with an APS application registered at aps.autodesk.com.The Getting Started chapter walks you through it step by step
- An internet connection (all the action happens in AutoDesk’s cloud)
No prior CAD or BIM experience assumed. If you’re comfortable running an R script, you’re ready.
Installation
Install the stable release from CRAN:
install.packages("AutoDeskR")Or grab the development version from GitHub if you like living on the edge:
devtools::install_github("paulgovan/AutoDeskR")How to Use This Book
New to APS? Start with Getting Started and work through the chapters in order, each one builds on the previous. Already know the APS basics? Jump straight to whatever chapter covers your use case. The Troubleshooting chapter is always there when something goes sideways.
All code examples are copy-paste ready and work with #| eval: false so they won’t execute during book rendering but will run just fine in your R session.
Where This is Headed
This book covers a lot of ground, but the APS API catalogue is bigger than any one book. Here’s what’s on the horizon.
Near-term package additions — AutoDeskR currently wraps the six core APS APIs. The next wave of functions will cover the richer ACC project hierarchy (Hubs → Projects → Folders → Items → Versions), which is required for working with BIM 360 and ACC projects where files live in managed folder trees rather than flat OSS buckets. Alongside that: Webhooks (so your pipelines can react to events instead of polling), Construction Issues (live project health data in R), and Account Admin (bulk user and project management via script instead of clicking through a web interface a hundred times).
Advanced Design Automation — makePdf() is just the beginning. APS Design Automation also supports Revit, 3ds Max, Inventor, and Fusion, meaning you can run custom scripts against any of those engines from R without installing the software locally. Generalised submitWorkItem() and listEngines() functions are planned to unlock that.
Longer-term — Model Coordination (clash detection and model sets, once the ACC hierarchy is in place), Forma (AutoDesk’s AEC industry cloud), and Cost Management (budget and financial data for project dashboards) are all on the radar. And as IFC, Speckle, and other open BIM platforms mature, they belong here too. The guiding rule: if it takes built environment data as its primary input, it belongs in this book.
Track progress and file requests at github.com/paulgovan/AutoDeskR.