Inspiration
Making a CAD model of something you can hold in your hand still means calipers, a notebook and an hour in a CAD tool. Phones now have LiDAR, and AI models can recognise objects, read labels and write code. We wanted to see if a phone scan could replace the calipers and an agent could replace the hour: point your phone at a soda can, a bracket or a whiteboard eraser, and get back a parametric, editable CAD model, not a lumpy mesh.
What it does
You walk slowly around an object with an iPhone, tap it once, and optionally type a note like "model the plastic body, ignore the felt pad". A few minutes later you get a STEP file, an STL, and a Python script (model.py) where every dimension is a named variable with a comment saying where its value came from:
body_diameter = 66.0 # reference (published 12 oz can spec)
body_height = 122.0 # user (typed on the phone)
rim_fillet = 1.5 # estimated
The output is meant to be a starting point you edit, not a metrology-grade scan.
How we built it
Capture. A SwiftUI + ARKit app saves RGB keyframes, LiDAR depth and confidence, camera intrinsics and a camera pose for every keyframe, plus the tap point and the prompt. It zips everything into one capture bundle and uploads it to a Mac. While the app was still being built, a Record3D USB converter wrote the same bundle format, so the server team never waited on the phone.
Perception. Gemini 3.8 Flash names the object, its parts and features, guesses which standard it follows (with typical dimensions), and draws a bounding box around each part in every keyframe. SAM 3 (hosted on fal.ai) turns each box into a pixel mask. If Gemini finds a brand or a named standard, a second Gemini call with Google Search looks up published dimensions.
Geometry. Every frame's high-confidence depth is unprojected through its intrinsics and pose into one world point cloud. We remove the table with a RANSAC plane fit, keep the cluster nearest the tap, and vote with the masks across views: a point stays only if it is seen in at least 3 frames and lands inside the part's mask in at least 60% of them. Each part is then measured in a gravity-aligned object frame in millimetres, and every value carries an uncertainty.
Reconciliation. LiDAR on an iPhone is only good to about $\pm 1$ cm on small objects, so the scan is used as a check, not the final answer. For each dimension with measurement $m \pm \sigma$, a published reference $r$ wins if $|r - m| \le \sigma$, then a class prior, then the measurement itself. A value the user typed on the phone beats all of them. Disagreements are flagged instead of silently picked.
Build. Claude Sonnet 5.5 gets a context file of a few KB plus up to four images. It never sees raw points. Through the Anthropic SDK tool runner it drives build123d-mcp (an OCCT CAD kernel) over MCP: it writes a feature plan, builds the model, measures it, renders it next to the photos and fixes it until every dimension $d$ meets
$$|d - d^{}| \le \max(1\ \text{mm},\ 0.02\, d^{})$$
against its reconciled target $d^{*}$. Turn and time caps keep it from looping, it escalates once to Opus 5.5 if it can't converge, and per-class templates guarantee the run always ends with a STEP file.
Every stage reads and writes files, so any stage can be rerun from cache. That let four people work on the same capture at once.
Challenges we ran into
- Axis bugs. ARKit cameras look down $-Z$ with $+Y$ up, OpenCV looks down $+Z$ with $+Y$ down, and Swift matrices are column-major. We fixed one convention per boundary, wrote it into the spec, and made the loader reject matrices in the wrong layout.
- A half-pixel bug. Our code treated pixel $(u, v)$ as centred at $(u, v)$, while ARKit's intrinsics put the centre at $(u + \tfrac12, v + \tfrac12)$. That shifts every ray by $\Delta = \tfrac{0.5\, z}{f_x}$, about 2.6 mm per metre of depth at LiDAR resolution. It was small enough to hide and large enough to tilt the table plane. Fixing it brought our synthetic can from 120.0 mm to 122.1 mm tall against a true 122.
- Models that can't do what we first planned. Gemini 3 doesn't support segmentation, so it supplies only boxes and SAM 3 does the masks. Our request for the SAM 3 weights on Hugging Face was refused, so we used the hosted version on fal.ai, with SAM 2.1 as an offline fallback.
- Record3D rotates its images relative to its own poses. The converter now tries all four quarter turns and keeps the one where the keyframes' depth maps agree.
- Sensor accuracy. No amount of filtering makes iPhone LiDAR sub-millimetre, which pushed us toward reconciliation instead of trusting the scan.
Accomplishments that we're proud of
- A pipeline where every number in the final model can explain where it came from.
- A synthetic capture generator with exact ground truth, so every stage is tested without a phone. On a synthetic 152 x 51 x 38 mm box with 3 mm depth noise, the geometry stages measure 152.7 x 51.7 x 38.3 mm.
- <!-- update --> Three real objects (a soda can, an eraser and a bracket) run from phone to STEP.
What we learned
- Context quality is the product. Claude builds much better models from a few KB of reconciled, labelled numbers than it would from raw geometry.
- Write the conventions down before writing code. Most of our bugs were coordinate bugs, and the spec caught them.
- Put fallbacks on every risky dependency. Each stage that leans on a hosted model or a young tool has a plain-code path behind it.
What's next
Better small-feature detection (holes, fillets, threads) from the images, comparing the CAD model against the scanned mesh, and capturing on more devices.