Skip to content

3D modeling in Python, built for LLMs.

12.2 KB
Raw Blame
<!DOCTYPE html>
<html lang="en"><head><meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>sand3d: 3D modeling in Python, built for LLMs</title>
<meta name="description" content="3D modeling in Python, built for LLMs.">
<link rel="icon" href="assets/sandflow-symbol-black.svg">
<link rel="stylesheet" href="assets/site.css">
</head><body><div class="page">
<div class="nav"><a class="titre" href="index.html"><img src="assets/sandflow-symbol-black.svg" alt="">sand3d</a><nav><a href="https://sandflow.ai/sand3d/">Website</a><span class="hfg"><img src="assets/hf-logo.svg" alt="Hugging Face"><a href="https://huggingface.co/collections/Sandflow/sand3d-6aec268fbdcd3bc174236168">Datasets</a><span class="sep">·</span><a href="https://huggingface.co/spaces/Sandflow/sand3d-explorer">Explorer</a></span><a class="gh" href="https://github.com/Sandflow-ai/sand3d"><img src="assets/github.svg" alt="">GitHub</a></nav></div>

<p class="repere">sand3d 1.6.3</p>
<h1>3D modeling in Python, built for LLMs</h1>
<div class="bande"></div>
<p class="chapo">sand3d is a library for writing 3D objects as short programs: profiles, solids, edits,
frames, joints and assemblies, over Blender's <code>bpy</code>. A program says how a shape is made, part by part
and in its own words, so a model writes it in a few hundred tokens and a person can read it.</p>
<div class="actions"><a class="btn plein" href="quickstart.html">Quickstart</a>
<a class="btn" href="gallery.html">Articulated gallery</a><a class="btn" href="api.html">API for LLMs</a></div>
<div class="figure"><img src="assets/hero.png" alt="Objects written in sand3d"></div>

<h2 id="why">Why sand3d</h2>
<div class="cles">
<div class="cle fort"><span class="v">4.0×</span><span class="k">fewer tokens than Blender Python, for the same CAD part (median)</span></div>
<div class="cle"><span class="v">3&#8239;643</span><span class="k">tokens: the whole API, ready for a prompt</span></div>
<div class="cle"><span class="v">70</span><span class="k">public names on one flat <code>s3d.&lt;verb&gt;</code> surface</span></div>
<div class="cle"><span class="v">2</span><span class="k">fresh processes, the same mesh to the bit, for every verb</span></div>
</div>
<div class="fiche"><p class="repere" style="margin-bottom:14px">Fewer tokens for the same object</p><div style="margin:6px 0 16px">
<div style="display:flex;justify-content:space-between;font-size:14.5px"><span><strong>Blender Python</strong> · written by an LLM</span>
<span style="color:var(--gris);font-size:13px">30 CAD parts</span></div>
<div style="display:flex;align-items:center;gap:10px;margin:6px 0 5px"><div style="height:14px;width:57.3%;background:var(--violet);border-radius:0 4px 4px 0"></div><strong>4.0×</strong></div>
<div style="font-size:13px;color:var(--gris)">9 of 30 build the right part</div></div><div style="margin:6px 0 16px">
<div style="display:flex;justify-content:space-between;font-size:14.5px"><span><strong>CadQuery</strong> · the dataset&#x27;s own programs (Zero-To-CAD)</span>
<span style="color:var(--gris);font-size:13px">17 CAD parts</span></div>
<div style="display:flex;align-items:center;gap:10px;margin:6px 0 5px"><div style="height:14px;width:33.0%;background:var(--violet);border-radius:0 4px 4px 0"></div><strong>2.3×</strong></div>
<div style="font-size:13px;color:var(--gris)">synthetic programs, generated for the dataset</div></div><div style="margin:6px 0 16px">
<div style="display:flex;justify-content:space-between;font-size:14.5px"><span><strong>FeatureScript (Onshape)</strong> · the dataset&#x27;s own programs (CADFS)</span>
<span style="color:var(--gris);font-size:13px">13 CAD parts</span></div>
<div style="display:flex;align-items:center;gap:10px;margin:6px 0 5px"><div style="height:14px;width:86.0%;background:var(--violet);border-radius:0 4px 4px 0"></div><strong>6.0×</strong></div>
<div style="font-size:13px;color:var(--gris)">real designs from public Onshape documents</div></div><div style="margin:6px 0 16px">
<div style="display:flex;justify-content:space-between;font-size:14.5px"><span><strong>Articraft&#x27;s Python SDK</strong> · the dataset&#x27;s own programs</span>
<span style="color:var(--gris);font-size:13px">12 articulated objects</span></div>
<div style="display:flex;align-items:center;gap:10px;margin:6px 0 5px"><div style="height:14px;width:28.7%;background:var(--violet);border-radius:0 4px 4px 0"></div><strong>2.0×</strong></div>
<div style="font-size:13px;color:var(--gris)">5 of 12 also use CadQuery; they also declare masses and inertias</div></div><p class="counts">median of the other program's tokens over sand3d's · o200k_base, code only · per part: <a href="tokens.html">the table</a></p></div>
<p>The same part or object, written in sand3d and in another language: the Blender Python an LLM writes for 30 parts
from public CAD models (9 of 30 build the right part; all 30 in sand3d), the CAD datasets' own CadQuery and FeatureScript programs,
and Articraft's own programs for 12 articulated objects. The sand3d programs are written for this repo, each matching
its reference mesh. Objects that come as meshes are not compared: no program exists to set beside sand3d's.</p>

<h2 id="object">A whole object, part by part</h2>
<div class="figure"><img src="assets/washer.png" alt="A washing machine: its part tree, its joints, its three export files"></div>
<p>A front-loading washing machine: the cabinet, the drum, the door with its glass and handle, the drawer and the
dial, each a named part, and four joints that say how they move.</p>
<div class="fiche"><pre class="code">door = s3d.group(<span class="s">&quot;door&quot;</span>, ring, glass, handle)                      <span class="c"># the handle and the glass move with it</span>
s3d.joint(<span class="s">&quot;door_hinge&quot;</span>, door, hinge, axis=<span class="s">&quot;-Z&quot;</span>, range=(<span class="n">0</span>, <span class="n">143</span>))
s3d.joint(<span class="s">&quot;drum_spin&quot;</span>, drum, front.move(<span class="n">0</span>, <span class="n">400</span>), kind=<span class="s">&quot;continuous&quot;</span>)
s3d.joint(<span class="s">&quot;drawer_slide&quot;</span>, drawer, top_band.move(<span class="n">150</span>), kind=<span class="s">&quot;prismatic&quot;</span>, axis=<span class="s">&quot;+X&quot;</span>, range=(<span class="n">0</span>, <span class="n">200</span>))
s3d.joint(<span class="s">&quot;dial_turn&quot;</span>, dial, top_band.move(-<span class="n">150</span>), kind=<span class="s">&quot;continuous&quot;</span>)
<span class="k">return</span> s3d.assembly(<span class="s">&quot;washing_machine&quot;</span>, cab, drum, door, drawer, dial, front=front)</pre><p class="counts">6 lines · 153 tokens (o200k_base)</p></div>
<p>Twelve articulated objects, a lamp, a refrigerator, a gate, a tripod head, binoculars and more, each one program,
to turn in 3D and play joint by joint: <a href="gallery.html">the gallery</a>.</p>
<div class="actions"><a class="btn plein" href="gallery.html">Play the articulated gallery</a></div>

<h2 id="export">Export: GLB, URDF, USD, OBJ, STL</h2>
<p>One call; the file's extension names the format; lengths in metres.</p>
<div class="tablo"><table><tr><th>format</th><th>what it carries</th><th>for</th></tr>
<tr><td><strong>GLB</strong></td><td>meshes, materials, the joints in each node's extras, at the current pose</td><td>the web, viewers, game engines</td></tr>
<tr><td><strong>URDF</strong></td><td>a link per moving part, its joints and their limits, at rest; OBJ meshes beside it</td><td>ROS, PyBullet, MuJoCo, Isaac</td></tr>
<tr><td><strong>USDA</strong></td><td>the same tree in OpenUSD (UsdGeom, UsdPhysics), with the materials</td><td>Omniverse, Isaac Sim, USD pipelines</td></tr>
<tr><td><strong>OBJ</strong>, <strong>STL</strong></td><td>the meshes alone, at the current pose: OBJ Y up, binary STL Z up</td><td>any 3D tool, slicers</td></tr></table></div>
<p><code>.usd</code>, <code>.usdc</code> and <code>.usdz</code> come from the <code>.usda</code> through USD's own tools.</p>

<h2 id="start">Install, and a first program</h2>
<p>Python 3.13 (recommended) or 3.11. Blender comes with it, as the <code>bpy</code> module: 5.2 LTS on Python 3.13,
4.5 LTS on Python 3.11; CI runs bpy 5.2.</p>
<div class="fiche"><pre class="code">pip install sand3d        # or, in a uv project: uv add sand3d</pre></div>
<div class="cote"><div class="fiche"><pre class="code"><span class="k">import</span> sand3d <span class="k">as</span> s3d


<span class="k">def</span> <span class="f">bracket</span>(w=<span class="n">80</span>, d=<span class="n">40</span>, t=<span class="n">6</span>, hole_d=<span class="n">6.6</span>, pitch=<span class="n">50</span>):
    plate = s3d.extrude(<span class="s">&quot;plate&quot;</span>, s3d.rect(w, d, r=<span class="n">4</span>), t)
    s3d.hole(plate, hole_d, on=s3d.grid(<span class="n">2</span>, <span class="n">1</span>, pitch, <span class="n">0</span>))
    s3d.fillet(plate, <span class="n">1</span>, edges=<span class="s">&quot;top&quot;</span>)
    <span class="k">return</span> plate

s3d.export(bracket(), <span class="s">&quot;bracket.glb&quot;</span>)</pre><p class="counts">10 lines · 121 tokens (o200k_base)</p></div><img src="assets/bracket.png" alt="The bracket"></div>
<p>Every verb, with code that runs and its render: <a href="quickstart.html">the quickstart</a>.</p>

<h2 id="llm">Give it to your LLM</h2>
<p>Put the API in the system prompt: the rules of the vocabulary, every signature, and worked examples, in
3&#8239;643 tokens. It is served raw at <a href="api.md"><code>api.md</code></a>, and
<a href="llms.txt"><code>llms.txt</code></a> points a model at it. For objects of several parts, <a href="guidelines.html">the guidelines</a> give the
eight rules of an assembly program: the plan first, then the details, then the parts.</p>
<div class="actions"><a class="btn plein" href="api.html">Read the API</a><a class="btn" href="api.md">api.md, raw</a></div>

<h2 id="datasets">Datasets</h2>
<p>sand3d programs for five sources of 3D objects, on Hugging Face under CC BY 4.0. The programs come from
Sandflow's iterative agentic reconstruction pipeline, which will be described in upcoming releases.</p>
<div class="datasets"><a class="ds" href="https://huggingface.co/datasets/Sandflow/sand3d-objaverse">
<img src="assets/datasets/sand3d-objaverse.jpg" alt="sand3d-objaverse"><span><strong>sand3d-objaverse</strong> · Objaverse</span>
<em>Everyday objects from Objaverse, each rebuilt as a program.</em></a><a class="ds" href="https://huggingface.co/datasets/Sandflow/sand3d-cad">
<img src="assets/datasets/sand3d-cad.jpg" alt="sand3d-cad"><span><strong>sand3d-cad</strong> · CAD</span>
<em>Mechanical parts from public CAD models.</em></a><a class="ds" href="https://huggingface.co/datasets/Sandflow/sand3d-articraft">
<img src="assets/datasets/sand3d-articraft.jpg" alt="sand3d-articraft"><span><strong>sand3d-articraft</strong> · Articraft</span>
<em>Articulated objects from Articraft, their joints declared.</em></a><a class="ds" href="https://huggingface.co/datasets/Sandflow/sand3d-simready">
<img src="assets/datasets/sand3d-simready.jpg" alt="sand3d-simready"><span><strong>sand3d-simready</strong> · SimReady</span>
<em>Simulation-ready assets from NVIDIA SimReady.</em></a><a class="ds" href="https://huggingface.co/datasets/Sandflow/sand3d-automate">
<img src="assets/datasets/sand3d-automate.jpg" alt="sand3d-automate"><span><strong>sand3d-automate</strong> · AutoMate</span>
<em>Mechanical assemblies from AutoMate, each part a function of its program.</em></a></div>

<h2 id="citation">Citation</h2>
<div class="fiche"><button class="copie" data-copy="bib">Copy</button><pre class="code" id="bib">@misc{sand3d2026,
  author = {Neveu, Thibault and Loy, Andr{\&#x27;e}a},
  title  = {sand3d},
  year   = {2026},
  note   = {Version 1.6.3},
  url    = {https://github.com/Sandflow-ai/sand3d}
}</pre></div>

<div class="fin"><span>sand3d 1.6.3 · Apache-2.0 · <a href="https://github.com/Sandflow-ai/sand3d">source</a></span>
<img src="assets/sandflow-signature.svg" alt="Sandflow"></div>
</div><script>
document.querySelectorAll("[data-copy]").forEach(b => b.addEventListener("click", () => {
  const text = document.getElementById(b.dataset.copy).textContent;
  navigator.clipboard.writeText(text).then(() => { const t = b.textContent; b.textContent = "Copied";
    setTimeout(() => b.textContent = t, 1400); });
}));
</script></body></html>