Update to text-to-cad
Snapshot Nov 23, 2026 · 12:11 UTC · version 0.11.16
Collection source: downloaded plugin package.
Instructions updated for render
Full description — Now says: Blender - a hero shot, a product or README picture, a turntable, or a film of a model's motion. Use when the person wants a picture or a video for people to...
Observed in instructions or declared skills. Runtime behavior has not been tested.
Up to 3 plugins free · no card required.
All fields and original values.
Full description
Nov 22, 2026 · 12:12 UTC
Blender, for people to look at, such as a hero shot, a README picture, a product post, a turntable or a film of a model's motion or animation. Exports a GLB, loads it with cad.blender, lights and frames it in a bpy script that `cad run` ...
Nov 23, 2026 · 12:11 UTC
Blender - a hero shot, a product or README picture, a turntable, or a film of a model's motion. Use when the person wants a picture or a video for people to look at. Not for checking geometry, which the cad skill's
Skill instructions
Nov 22, 2026 · 12:12 UTC
Blender, for people to look at, such as a hero shot, a README picture, a product post, a turntable or a film of a model's motion or animation. Exports a GLB, loads it with cad.blender, lights and frames it in a bpy script that `cad run` ...
Nov 23, 2026 · 12:11 UTC
Blender - a hero shot, a product or README picture, a turntable, or a film of a model's motion. Use when the person wants a picture or a video for people to look at. Not for checking geometry, which the cad skill's snapshot does. A rende...
Supporting files
Nov 22, 2026 · 12:12 UTC
[{"relative_path":"LICENSE","size_in_bytes":1074},{"relative_path":"agents/openai.yaml","size_in_bytes":254},{"relative_path":"references/scene-script.md","size_in_bytes":6672},{"relative_path":"references/shots.md","size_in_bytes":6563}]
Nov 23, 2026 · 12:11 UTC
[{"relative_path":"LICENSE","size_in_bytes":1074},{"relative_path":"agents/openai.yaml","size_in_bytes":254},{"relative_path":"references/scene-script.md","size_in_bytes":5247},{"relative_path":"references/shots.md","size_in_bytes":5828}]
Compare saved observations
Download comparison JSONSKILL.md text changes
− removed · + added
--- before +++ after @@ -1,6 +1,6 @@ --- name: render -description: Renders photoreal images and videos of a text-to-cad model, a STEP or an xbf with Blender, for people to look at, such as a hero shot, a README picture, a product post, a turntable or a film of a model's motion or animation. Exports a GLB, loads it with cad.blender, lights and frames it in a bpy script that `cad run` runs, drafts in EEVEE and finishes in Cycles on the GPU, and can save a .blend. Not for checking geometry, which a snapshot does. +description: Renders photoreal images and videos of a text-to-cad model, a STEP or an xbf with Blender - a hero shot, a product or README picture, a turntable, or a film of a model's motion. Use when the person wants a picture or a video for people to look at. Not for checking geometry, which the cad skill's snapshot does. license: MIT metadata: repository: earthtojake/text-to-cad @@ -8,30 +8,29 @@ # Renders for people -A render is a picture for a person: a hero image, a README picture, a post, a turntable, a film of -a mechanism. The model goes to Blender as a GLB, loaded by `cad.blender.load`; the scene (camera, -lights, world, engine, output) is an ordinary Python script that imports `bpy`, Blender as a -Python module, and `cad run` runs it. Judge geometry with `cad model snapshot`, never with a -render: a render's lens, light and depth of field make it a poor measure, so never read a -dimension off one. +A render is a picture for a person: a hero image, a README picture, a turntable, a film of a +mechanism. The model goes to Blender as a GLB, loaded by `cad.blender.load`; the scene (camera, lights, +world, engine, output) is an ordinary Python script that imports `bpy`, Blender as a Python module, +and `cad run` runs it. Geometry is judged with `cad model snapshot`, never a render: lens, light and +depth of field make it a poor measure. ## Start with the task | Task | Start with | Reference | | --- | --- | --- | -| **A still of a model** | Export a GLB, write a `render.py` that loads it, `cad run render.py`. | [The script](#the-script), [scene script](references/scene-script.md) | -| **Draft, then a final** | An EEVEE draft at 1080p, looked at, before Cycles. | [Draft then final](references/shots.md#draft-then-final) | -| **A pose of a motion or a frame of an animation** | `model.play(name)` and the frame. | [Clips](#load-the-glb) | -| **A turntable** | The camera on an empty that turns once. | [Turntables](references/shots.md#turntables) | -| **A film of a motion or an animation** | `model.play(name)`, then an mp4. | [Films](references/shots.md#films) | -| **Motion blur, depth of field, a glow** | The scene's and the camera's settings; a keyed emission. | [Shots](references/shots.md) | -| **Choose looks** | `cad.build123d.materials` in the model. | [Looks](#looks) | -| **Give the person a .blend** | `bpy.ops.wm.save_as_mainfile` at the end of the script. | [A .blend](references/shots.md#a-blend-for-a-person) | -| **Use the GPU** | Cycles' device, chosen in the script. | [Engines](references/scene-script.md#engines-and-the-gpu) | +| A still of a model | Export a GLB, write a `render.py` that loads it, `cad run render.py` | [The script](#the-script), [scene script](references/scene-script.md) | +| Draft, then a final | An EEVEE draft at 1080p, looked at, before Cycles | [Draft then final](references/shots.md#draft-then-final) | +| A pose, or a frame of an animation | `model.play(name)` and the frame | [Load the GLB](#load-the-glb) | +| A turntable | The camera on an empty that turns once | [Turntables](references/shots.md#turntables) | +| A film of a motion or an animation | `model.play(name)`, then an mp4 | [Films](references/shots.md#films) | +| Motion blur, depth of field, a glow | The scene's and the camera's settings; a keyed emission | [Shots](references/shots.md) | +| Looks and materials | Set in the model, exported again | [Looks](#looks) | +| A `.blend` for the person | `bpy.ops.wm.save_as_mainfile` at the end of the script | [A .blend](references/shots.md#a-blend-for-a-person) | +| The GPU, or a machine with no graphics driver | Cycles' device, chosen in the script | [Engines](references/scene-script.md#engines-and-the-gpu), [no driver](references/scene-script.md#no-graphics-driver) | ## Setup -Written for `cad==0.11.15`. Before first use in a chat, run `cad --version`. If `cad` is missing or older than +Written for `cad==0.11.16`. Before first use in a chat, run `cad --version`. If `cad` is missing or older than 0.11.12, run `uv tool install cad`, adding `--force` if uv says `cad` already exists. If cad is a major or minor version newer than this skill, tell the person to update the text-to-cad plugin: @@ -39,16 +38,10 @@ A project written for an earlier version may need changes; the migration guides say what: https://github.com/earthtojake/text-to-cad/tree/main/docs/migrations -`cad run render.py` sees `import bpy` and gives the script cad's blender integration: an -environment on Python 3.13, the one Blender is built for, holding bpy 5.2.3 (Blender 5.2 LTS) -beside cad, made the first time and kept. The script imports what it likes of cad and build123d -beside bpy, so one script can build a model, export it and render it. Blender's own preferences, -add-ons and extensions folders are cad's, never the person's, so their Blender settings never load -into a run; every `cad run` shares them, so an extension or a preference one script installs or saves -is there for the next, and a script that needs one sets it up itself. bpy has no build for Intel Macs -or Linux on ARM, where `cad run` refuses such a script by name. A `--python` or a header's -`requires-python` that leaves 3.13 out is refused the same way; one that admits it (`--python 3.13`) -runs on the same environment as none. Nothing here starts the Blender app. +`cad run` sees `import bpy` and makes the script an environment with bpy 5.2.3 (Blender 5.2 LTS) on +Python 3.13 beside cad, once: a download of 260 to 430 MB, so the first run is slow. Nothing starts the +Blender app, and the person's own Blender settings and add-ons never load. bpy has no build for Intel +Macs or Linux on ARM, where `cad run` refuses the script by name. ## Export the model @@ -56,16 +49,12 @@ cad model export "$ID" scene.glb --tolerance 0.02 --angle 5 ``` -`ID` is the model's id (running its script prints it); a STEP or an xbf exports the same way -(`cad step export part.step scene.glb --tolerance 0.02 --angle 5`). The GLB is in metres, Z up once -imported, with the assembly's tree as nested empties, a PBR material per look, and each motion -and `animation()` as a clip. The viewer's mesh shows its facets in a path tracer or a close camera: -`--tolerance` (mm, absolute) and `--angle` (degrees, 1 to 28.5) mesh this file finer, for it alone. -The cost is triangles and seconds: a tenth of the tolerance is about three times the segments round -a curve and ten times the triangles of a doubly curved face. Start at 0.02 mm and 5 degrees for a -close-up of a hand-sized part and coarser for a large assembly seen whole, and export finer when a -draft shows facets. Say the file's size when it is large. Export again after every model change: -the GLB is a copy. +`$ID` is the model's id; a STEP or an xbf exports the same way (`cad step export part.step scene.glb +--tolerance 0.02 --angle 5`). The GLB is in metres, Z up once imported, with the assembly's tree as +nested empties, a PBR material per look, and each motion and `animation()` as a clip. `--tolerance` +(mm) and `--angle` (degrees) mesh it finer than the viewer's, so a close camera shows no facets, at the +cost of triangles: start near 0.02 mm and 5 degrees for a close-up of a hand-sized part, coarser for a +large assembly seen whole. The GLB is a copy: export again after every model change. ## The script @@ -111,97 +100,70 @@ cad run render.py ``` -The script is the scene: a camera, lights and a world are added in Python, every run starts from -an empty scene, and the outputs are wherever the script writes them. Arguments after the script's -name reach it as `sys.argv[1:]` (`cad run render.py --final`). Lights, the world, colour -management and a GPU are in [the scene script](references/scene-script.md). +The script is the scene: every run starts empty and adds its camera, lights and world in Python. +Arguments after the script's name reach it as `sys.argv[1:]`. Lights, the world, colour management and +the GPU are in [the scene script](references/scene-script.md). ## Load the GLB -Always load a GLB with `cad.blender.load`, never `bpy.ops.import_scene.gltf` alone. Blender's -importer poses every part a clip moves at that clip's first frame (a hinge written at 30 degrees -reads at the clip's start, with no error), leaves only the first clip live, and keys from frame 0. -`load` runs that importer, puts every node a clip moves back where the GLB places it, clears what -the import set playing, and plays the clip asked for. It opens any GLB, not only cad's: a node is -found by its place in the file, whatever Blender names its object. +Load with `cad.blender.load`, never `bpy.ops.import_scene.gltf` alone: Blender's importer poses every +part a clip moves at that clip's first frame, with no error, leaves only the first clip live and keys +from frame 0. `load` runs that importer, puts every node back where the GLB places it, and plays the +clip asked for. It opens any GLB, not only cad's. -| Call | What it gives | +| Call | Gives | | --- | --- | -| `load(path, clip=None, fps=24)` | Imports into the current scene and returns the model; `clip` plays one, `fps` keys its seconds (the scene's `render.fps`, with `render.fps_base` 1, set before the import, so a clip is in frames at that rate). | -| `model.root` | The document's root empty, at the origin, scale 0.001 (the parts are in mm below it). `model.roots` is every root's, for another tool's file with several. | -| `model.objects["arm/head"]` | Each node's object by its path below the root, as the GLB names it. A node with no name is under the name Blender gave its object; of two nodes with one name (KiCad names every lens `lens`), the last. | -| `model.nodes[7]` | Each node's object by its index in the file, which tells two of one name apart. A skin's joints are bones of the armature Blender makes for it (the skinned mesh's `parent`), not objects, and `load` never places a bone. | -| `model.clips` | Each clip by name: `kind` (`motion` or `animation`) and `duration` in seconds. | -| `model.box`, `model.center`, `model.size` | The world box of the pose cad wrote, in metres, for framing (the root sits at the document's origin, not the model's middle). | -| `model.play("sweep")` | That clip from frame 0, the scene's range 0 to its duration; `model.play(None)` stands every part where cad placed it. | -| `model.bounds()` | The world box at the current frame. | +| `load(path, clip=None, fps=24)` | Imports into the current scene and returns the model; `clip` plays one, `fps` keys its seconds. Give a film's rate here: `render.fps` set after the import plays every clip at the wrong speed, with no error | +| `model.root` | The document's root empty, at the origin, scale 0.001 (parts are in mm below it); `model.roots` for a file with several | +| `model.objects["arm/head"]` | A node's object by its path below the root, as the GLB names it; of two nodes with one name it is the last (`model.nodes[i]` reaches each) | +| `model.nodes[7]` | A node's object by its index in the file, which tells two of one name apart | +| `model.clips` | Each clip by name: `kind` (`motion` or `animation`) and `duration` in seconds | +| `model.box`, `model.center`, `model.size` | The world box of the pose cad wrote, in metres, for framing | +| `model.play("sweep")` | That clip from frame 0, the scene's range set to its duration; `model.play(None)` stands every part as placed | +| `model.bounds()` | The world box at the current frame | A still of a pose is a clip's frame: `model.play("sweep")`, `scene.frame_set(24)`, render. ## Looks -The parts' looks are the model's: set them in the model, export again. `bd_materials` gives -physics and a look; `cad.build123d.materials` adds named looks Blender draws well (soldermask, -ENIG, anodized, powder coat, LED lenses, ...), each a scalar look with no texture maps -(the cad skill's colour and materials reference lists them). Blender's importer reads these of a look: - -| Drawn | Not drawn | -| --- | --- | -| base colour, metalness, roughness, IOR, opacity, transmission, clear coat, sheen, specular, emission and its strength; iridescence in part | anisotropy (brushed metal draws plain), dispersion, a transmissive part's volume thickness (the light refracts through the real part), texture maps | - -A material in Blender is named by the model's look (`bpy.data.materials["frame_black"]`), so a script -restyles a look by its name wherever it is worn; the physical material it is a look of is its custom -property (`material["cad"]["material"]`: `Alu_G7075_T6`). Two looks of one aluminium are two materials. - -A transmissive look is written opaque, so a lens or a window refracts rather than fades. Its -base colour tints what passes through it, so smoked glass written as a dark colour with a partial -transmission (`color` near black, `transmission=0.35`), which a snapshot draws as a tint, renders -as a black surface: a third of nothing passes. Write the glass in the model as `transmission=1` -with the tint as its colour (a mid grey for smoke), and look at it in a Cycles draft. A -material is changed in the script only for the render's sake (a glow, a backdrop): the model -stays the source of every look. +A part's look is the model's: set it there and export again. `bd_materials` gives physics and a look; +`cad.build123d.materials` adds named looks Blender draws well (solder mask, ENIG, anodized, powder +coat, LED lenses). Blender's importer draws base colour, metalness, roughness, IOR, opacity, +transmission, clear coat, sheen, specular and emission; it does not draw anisotropy (brushed metal +draws plain), dispersion or texture maps. + +A Blender material is named by the model's look (`bpy.data.materials["frame_black"]`), so a script can +restyle a look wherever it is worn, and the physical material it is a look of is its custom property +(`material["cad"]["material"]`). Change one in the script only for the render's sake (a glow, a +backdrop). A transmissive look's base colour tints what passes through, so smoked glass written as a +near-black colour with partial transmission renders black: write glass as `transmission=1` with the +tint as its colour, and judge it in a Cycles draft. ## Engines -EEVEE (`BLENDER_EEVEE`) draws a 1080p frame in about 2 s: drafts, framing, light. Cycles with -OIDN denoising is the final, on the GPU where there is one (Metal, CUDA, OptiX, HIP, oneAPI) and -on the CPU where there is not, at minutes a frame. They disagree on translucent and glass parts -(an LED's glow ghosts through its diffuser in EEVEE), so a draft does not prove a final where glass -matters: draft those in Cycles at a few samples. Device setup is in -[the scene script](references/scene-script.md#engines-and-the-gpu). - -EEVEE needs a graphics driver. On a machine without one (a headless Linux server or container -with no `libEGL`), an EEVEE render prints `Couldn't open libEGL.so.1` and ends the process (exit -134) with no Python exception to catch, and so does the compositor on its default device. There, -draft in Cycles at 8 to 16 samples and set `scene.render.compositor_device = "CPU"` +EEVEE (`BLENDER_EEVEE`) draws a 1080p frame in seconds: drafts, framing, light. Cycles with OIDN +denoising is the final, on the GPU where there is one, at minutes a frame. They disagree on glass and +translucent parts, so draft those in Cycles at a few samples. + +EEVEE needs a graphics driver. On a machine without one (a headless Linux server or container), an +EEVEE render prints `Couldn't open libEGL.so.1` and ends the process with exit 134 and no Python +exception, as does the compositor on its default device: draft in Cycles at 8 to 16 samples and set +`scene.render.compositor_device = "CPU"` ([no graphics driver](references/scene-script.md#no-graphics-driver)). ## Check each change | Change | Check | | --- | --- | -| Camera, framing, lights, world | An EEVEE draft at 1080p, opened and looked at. | -| A pose, a clip's frame | `model.play(...)`, the frame, then a draft; for a moved part, its world position (`model.objects[path].matrix_world.translation`) against the model's. | -| Looks, glass, emission | A small Cycles draft (32 to 64 samples): EEVEE is not the final's evidence for them. | -| A turntable or a film | Three frames (first, middle, last) as EEVEE stills before the whole film. | -| The final | The final's frame against its draft: same framing, nothing missing. | +| Camera, framing, lights, world | An EEVEE draft at 1080p, opened and looked at | +| A pose, a clip's frame | `model.play(...)`, the frame, then a draft; a moved part's world position (`model.objects[path].matrix_world.translation`) against the model's | +| Looks, glass, emission | A small Cycles draft (32 to 64 samples) | +| A turntable or a film | Three frames (first, middle, last) as stills before the whole film | +| The final | Against its draft: same framing, nothing missing | - An empty or black image is the camera inside, behind or too near the model, or no light: print `model.box` and the camera's location. -- A part in the wrong pose is a GLB imported without `load`, or a clip's frame taken before - `model.play`. -- A render proves a picture, not a dimension: geometry is checked with `cad model snapshot`. - -## What to expect - -- The first `cad run` of a script that imports bpy downloads Blender's module once: about 262 MB - on a Mac, 356 MB on Windows, 430 MB on Linux, and a Python 3.13 (65 MB). Later runs and other - projects reuse it, and after an update of text-to-cad it is made again from what was downloaded. -- The first `import bpy` after that takes 11 to 18 s; then about 1.3 s. -- The first EEVEE render compiles its shaders (about 13 s); the first Cycles render on a Mac's GPU - compiles its kernels once, about 3.5 minutes. Run it in the background with a long timeout. -- 1080p of a 537-part assembly on an M1 Max: EEVEE 64 samples 1.3 to 2.1 s; Cycles on the GPU at - 256 samples with OIDN 23 to 26 s, 4.4 GB of memory at peak; Cycles on the CPU 2.5 to 3.5 - minutes. -- Blender keeps a Cycles render's memory until its process ends: render each final in a run of its - own rather than many in one long loop. +- A part in the wrong pose is a GLB imported without `load`, or a frame taken before `model.play`. +- First runs are slow once each: `import bpy` (10 to 20 s), EEVEE's shaders (about 13 s), Cycles' + GPU kernels on a Mac (minutes). Run a final in the background with a long timeout, and each final in + a run of its own, since Blender keeps a Cycles render's memory until its process ends.
Full technical diff · 3 changed fields
changed /description
"Renders photoreal images and videos of a text-to-cad model, a STEP or an xbf with Blender, for people to look at, such as a hero shot, a README picture, a product post, a turntable or a film of a model's motion or animation. Exports a GLB, loads it with cad.blender, lights and frames it in a bpy script that `cad run` runs, drafts in EEVEE and finishes in Cycles on the GPU, and can save a .blend. Not for checking geometry, which a snapshot does."
"Renders photoreal images and videos of a text-to-cad model, a STEP or an xbf with Blender - a hero shot, a product or README picture, a turntable, or a film of a model's motion. Use when the person wants a picture or a video for people to look at. Not for checking geometry, which the cad skill's snapshot does."
changed /included_files
[
{
"relative_path": "LICENSE",
"size_in_bytes": 1074
},
{
"relative_path": "agents/openai.yaml",
"size_in_bytes": 254
},
{
"relative_path": "references/scene-script.md",
"size_in_bytes": 6672
},
{
"relative_path": "references/shots.md",
"size_in_bytes": 6563
}
][
{
"relative_path": "LICENSE",
"size_in_bytes": 1074
},
{
"relative_path": "agents/openai.yaml",
"size_in_bytes": 254
},
{
"relative_path": "references/scene-script.md",
"size_in_bytes": 5247
},
{
"relative_path": "references/shots.md",
"size_in_bytes": 5828
}
]changed /skill_md_contents
"---\nname: render\ndescription: Renders photoreal images and videos of a text-to-cad model, a STEP or an xbf with Blender, for people to look at, such as a hero shot, a README picture, a product post, a turntable or a film of a model's motion or animation. Exports a GLB, loads it with cad.blender, lights and frames it in a bpy script that `cad run` runs, drafts in EEVEE and finishes in Cycles on the GPU, and can save a .blend. Not for checking geometry, which a snapshot does.\nlicense: MIT\nmetadata:\n repository: earthtojake/text-to-cad\n---\n\n# Renders for people\n\nA render is a picture for a person: a hero image, a README picture, a post, a turntable, a film of\na mechanism. The model goes to Blender as a GLB, loaded by `cad.blender.load`; the scene (camera,\nlights, world, engine, output) is an ordinary Python script that imports `bpy`, Blender as a\nPython module, and `cad run` runs it. Judge geometry with `cad model snapshot`, never with a\nrender: a render's lens, light and depth of field make it a poor measure, so never read a\ndimension off one.\n\n## Start with the task\n\n| Task | Start with | Reference |\n| --- | --- | --- |\n| **A still of a model** | Export a GLB, write a `render.py` that loads it, `cad run render.py`. | [The script](#the-script), [scene script](references/scene-script.md) |\n| **Draft, then a final** | An EEVEE draft at 1080p, looked at, before Cycles. | [Draft then final](references/shots.md#draft-then-final) |\n| **A pose of a motion or a frame of an animation** | `model.play(name)` and the frame. | [Clips](#load-the-glb) |\n| **A turntable** | The camera on an empty that turns once. | [Turntables](references/shots.md#turntables) |\n| **A film of a motion or an animation** | `model.play(name)`, then an mp4. | [Films](references/shots.md#films) |\n| **Motion blur, depth of field, a glow** | The scene's and the camera's settings; a keyed emission. | [Shots](references/shots.md) |\n| **Choose looks** | `cad.build123d.materials` in the model. | [Looks](#looks) |\n| **Give the person a .blend** | `bpy.ops.wm.save_as_mainfile` at the end of the script. | [A .blend](references/shots.md#a-blend-for-a-person) |\n| **Use the GPU** | Cycles' device, chosen in the script. | [Engines](references/scene-script.md#engines-and-the-gpu) |\n\n## Setup\n\nWritten for `cad==0.11.15`. Before first use in a chat, run `cad --version`. If `cad` is missing or older than\n0.11.12, run `uv tool install cad`, adding `--force` if uv says `cad` already exists.\n\nIf cad is a major or minor version newer than this skill, tell the person to update the text-to-cad plugin:\nhttps://github.com/earthtojake/text-to-cad\nA project written for an earlier version may need changes; the migration guides say what:\nhttps://github.com/earthtojake/text-to-cad/tree/main/docs/migrations\n\n`cad run render.py` sees `import bpy` and gives the script cad's blender integration: an\nenvironment on Python 3.13, the one Blender is built for, holding bpy 5.2.3 (Blender 5.2 LTS)\nbeside cad, made the first time and kept. The script imports what it likes of cad and build123d\nbeside bpy, so one script can build a model, export it and render it. Blender's own preferences,\nadd-ons and extensions folders are cad's, never the person's, so their Blender settings never load\ninto a run; every `cad run` shares them, so an extension or a preference one script installs or saves\nis there for the next, and a script that needs one sets it up itself. bpy has no build for Intel Macs\nor Linux on ARM, where `cad run` refuses such a script by name. A `--python` or a header's\n`requires-python` that leaves 3.13 out is refused the same way; one that admits it (`--python 3.13`)\nruns on the same environment as none. Nothing here starts the Blender app.\n\n## Export the model\n\n```bash\ncad model export \"$ID\" scene.glb --tolerance 0.02 --angle 5\n```\n\n`ID` is the model's id (running its script prints it); a STEP or an xbf exports the same way\n(`cad step export part.step scene.glb --tolerance 0.02 --angle 5`). The GLB is in metres, Z up once\nimported, with the assembly's tree as nested empties, a PBR material per look, and each motion\nand `animation()` as a clip. The viewer's mesh shows its facets in a path tracer or a close camera:\n`--tolerance` (mm, absolute) and `--angle` (degrees, 1 to 28.5) mesh this file finer, for it alone.\nThe cost is triangles and seconds: a tenth of the tolerance is about three times the segments round\na curve and ten times the triangles of a doubly curved face. Start at 0.02 mm and 5 degrees for a\nclose-up of a hand-sized part and coarser for a large assembly seen whole, and export finer when a\ndraft shows facets. Say the file's size when it is large. Export again after every model change:\nthe GLB is a copy.\n\n## The script\n\n```python\n# render.py: cad run render.py\nimport math\nfrom pathlib import Path\n\nimport bpy\nfrom mathutils import Vector\n\nfrom cad.blender import load\n\nHERE = Path(__file__).resolve().parent\n\nbpy.ops.wm.read_factory_settings(use_empty=True) # no person's startup file, no default cube\nscene = bpy.context.scene\nmodel = load(HERE / \"scene.glb\") # every part where cad placed it\n\nscene.render.resolution_x, scene.render.resolution_y = 1920, 1080\naim = bpy.data.objects.new(\"aim\", None)\naim.location = model.center\ncamera = bpy.data.objects.new(\"camera\", bpy.data.cameras.new(\"camera\"))\ncamera.data.lens = 85\nview = math.tan(camera.data.angle / 2) * min(1, scene.render.resolution_y / scene.render.resolution_x)\ndistance = model.size.length / 2 / view * 1.1 # the whole box in the frame's shorter side\ncamera.location = model.center + distance * Vector((1, -1, 0.6)).normalized()\ncamera.constraints.new(\"TRACK_TO\").target = aim\nsun = bpy.data.objects.new(\"sun\", bpy.data.lights.new(\"sun\", \"SUN\"))\nsun.data.energy, sun.rotation_euler = 3.0, (0.8, 0.2, 0.6)\nfor item in (aim, camera, sun):\n scene.collection.objects.link(item)\nscene.camera = camera\nscene.world = bpy.data.worlds.new(\"world\")\nscene.world.node_tree.nodes[\"Background\"].inputs[\"Strength\"].default_value = 0.4\n\nscene.render.engine = \"BLENDER_EEVEE\" # a draft; \"CYCLES\" for the final\nscene.render.filepath = str(HERE / \"hero.png\")\nbpy.ops.render.render(write_still=True)\n```\n\n```bash\ncad run render.py\n```\n\nThe script is the scene: a camera, lights and a world are added in Python, every run starts from\nan empty scene, and the outputs are wherever the script writes them. Arguments after the script's\nname reach it as `sys.argv[1:]` (`cad run render.py --final`). Lights, the world, colour\nmanagement and a GPU are in [the scene script](references/scene-script.md).\n\n## Load the GLB\n\nAlways load a GLB with `cad.blender.load`, never `bpy.ops.import_scene.gltf` alone. Blender's\nimporter poses every part a clip moves at that clip's first frame (a hinge written at 30 degrees\nreads at the clip's start, with no error), leaves only the first clip live, and keys from frame 0.\n`load` runs that importer, puts every node a clip moves back where the GLB places it, clears what\nthe import set playing, and plays the clip asked for. It opens any GLB, not only cad's: a node is\nfound by its place in the file, whatever Blender names its object.\n\n| Call | What it gives |\n| --- | --- |\n| `load(path, clip=None, fps=24)` | Imports into the current scene and returns the model; `clip` plays one, `fps` keys its seconds (the scene's `render.fps`, with `render.fps_base` 1, set before the import, so a clip is in frames at that rate). |\n| `model.root` | The document's root empty, at the origin, scale 0.001 (the parts are in mm below it). `model.roots` is every root's, for another tool's file with several. |\n| `model.objects[\"arm/head\"]` | Each node's object by its path below the root, as the GLB names it. A node with no name is under the name Blender gave its object; of two nodes with one name (KiCad names every lens `lens`), the last. |\n| `model.nodes[7]` | Each node's object by its index in the file, which tells two of one name apart. A skin's joints are bones of the armature Blender makes for it (the skinned mesh's `parent`), not objects, and `load` never places a bone. |\n| `model.clips` | Each clip by name: `kind` (`motion` or `animation`) and `duration` in seconds. |\n| `model.box`, `model.center`, `model.size` | The world box of the pose cad wrote, in metres, for framing (the root sits at the document's origin, not the model's middle). |\n| `model.play(\"sweep\")` | That clip from frame 0, the scene's range 0 to its duration; `model.play(None)` stands every part where cad placed it. |\n| `model.bounds()` | The world box at the current frame. |\n\nA still of a pose is a clip's frame: `model.play(\"sweep\")`, `scene.frame_set(24)`, render.\n\n## Looks\n\nThe parts' looks are the model's: set them in the model, export again. `bd_materials` gives\nphysics and a look; `cad.build123d.materials` adds named looks Blender draws well (soldermask,\nENIG, anodized, powder coat, LED lenses, ...), each a scalar look with no texture maps\n(the cad skill's colour and materials reference lists them). Blender's importer reads these of a look:\n\n| Drawn | Not drawn |\n| --- | --- |\n| base colour, metalness, roughness, IOR, opacity, transmission, clear coat, sheen, specular, emission and its strength; iridescence in part | anisotropy (brushed metal draws plain), dispersion, a transmissive part's volume thickness (the light refracts through the real part), texture maps |\n\nA material in Blender is named by the model's look (`bpy.data.materials[\"frame_black\"]`), so a script\nrestyles a look by its name wherever it is worn; the physical material it is a look of is its custom\nproperty (`material[\"cad\"][\"material\"]`: `Alu_G7075_T6`). Two looks of one aluminium are two materials.\n\nA transmissive look is written opaque, so a lens or a window refracts rather than fades. Its\nbase colour tints what passes through it, so smoked glass written as a dark colour with a partial\ntransmission (`color` near black, `transmission=0.35`), which a snapshot draws as a tint, renders\nas a black surface: a third of nothing passes. Write the glass in the model as `transmission=1`\nwith the tint as its colour (a mid grey for smoke), and look at it in a Cycles draft. A\nmaterial is changed in the script only for the render's sake (a glow, a backdrop): the model\nstays the source of every look.\n\n## Engines\n\nEEVEE (`BLENDER_EEVEE`) draws a 1080p frame in about 2 s: drafts, framing, light. Cycles with\nOIDN denoising is the final, on the GPU where there is one (Metal, CUDA, OptiX, HIP, oneAPI) and\non the CPU where there is not, at minutes a frame. They disagree on translucent and glass parts\n(an LED's glow ghosts through its diffuser in EEVEE), so a draft does not prove a final where glass\nmatters: draft those in Cycles at a few samples. Device setup is in\n[the scene script](references/scene-script.md#engines-and-the-gpu).\n\nEEVEE needs a graphics driver. On a machine without one (a headless Linux server or container\nwith no `libEGL`), an EEVEE render prints `Couldn't open libEGL.so.1` and ends the process (exit\n134) with no Python exception to catch, and so does the compositor on its default device. There,\ndraft in Cycles at 8 to 16 samples and set `scene.render.compositor_device = \"CPU\"`\n([no graphics driver](references/scene-script.md#no-graphics-driver)).\n\n## Check each change\n\n| Change | Check |\n| --- | --- |\n| Camera, framing, lights, world | An EEVEE draft at 1080p, opened and looked at. |\n| A pose, a clip's frame | `model.play(...)`, the frame, then a draft; for a moved part, its world position (`model.objects[path].matrix_world.translation`) against the model's. |\n| Looks, glass, emission | A small Cycles draft (32 to 64 samples): EEVEE is not the final's evidence for them. |\n| A turntable or a film | Three frames (first, middle, last) as EEVEE stills before the whole film. |\n| The final | The final's frame against its draft: same framing, nothing missing. |\n\n- An empty or black image is the camera inside, behind or too near the model, or no light: print\n `model.box` and the camera's location.\n- A part in the wrong pose is a GLB imported without `load`, or a clip's frame taken before\n `model.play`.\n- A render proves a picture, not a dimension: geometry is checked with `cad model snapshot`.\n\n## What to expect\n\n- The first `cad run` of a script that imports bpy downloads Blender's module once: about 262 MB\n on a Mac, 356 MB on Windows, 430 MB on Linux, and a Python 3.13 (65 MB). Later runs and other\n projects reuse it, and after an update of text-to-cad it is made again from what was downloaded.\n- The first `import bpy` after that takes 11 to 18 s; then about 1.3 s.\n- The first EEVEE render compiles its shaders (about 13 s); the first Cycles render on a Mac's GPU\n compiles its kernels once, about 3.5 minutes. Run it in the background with a long timeout.\n- 1080p of a 537-part assembly on an M1 Max: EEVEE 64 samples 1.3 to 2.1 s; Cycles on the GPU at\n 256 samples with OIDN 23 to 26 s, 4.4 GB of memory at peak; Cycles on the CPU 2.5 to 3.5\n minutes.\n- Blender keeps a Cycles render's memory until its process ends: render each final in a run of its\n own rather than many in one long loop.\n"
"---\nname: render\ndescription: Renders photoreal images and videos of a text-to-cad model, a STEP or an xbf with Blender - a hero shot, a product or README picture, a turntable, or a film of a model's motion. Use when the person wants a picture or a video for people to look at. Not for checking geometry, which the cad skill's snapshot does.\nlicense: MIT\nmetadata:\n repository: earthtojake/text-to-cad\n---\n\n# Renders for people\n\nA render is a picture for a person: a hero image, a README picture, a turntable, a film of a\nmechanism. The model goes to Blender as a GLB, loaded by `cad.blender.load`; the scene (camera, lights,\nworld, engine, output) is an ordinary Python script that imports `bpy`, Blender as a Python module,\nand `cad run` runs it. Geometry is judged with `cad model snapshot`, never a render: lens, light and\ndepth of field make it a poor measure.\n\n## Start with the task\n\n| Task | Start with | Reference |\n| --- | --- | --- |\n| A still of a model | Export a GLB, write a `render.py` that loads it, `cad run render.py` | [The script](#the-script), [scene script](references/scene-script.md) |\n| Draft, then a final | An EEVEE draft at 1080p, looked at, before Cycles | [Draft then final](references/shots.md#draft-then-final) |\n| A pose, or a frame of an animation | `model.play(name)` and the frame | [Load the GLB](#load-the-glb) |\n| A turntable | The camera on an empty that turns once | [Turntables](references/shots.md#turntables) |\n| A film of a motion or an animation | `model.play(name)`, then an mp4 | [Films](references/shots.md#films) |\n| Motion blur, depth of field, a glow | The scene's and the camera's settings; a keyed emission | [Shots](references/shots.md) |\n| Looks and materials | Set in the model, exported again | [Looks](#looks) |\n| A `.blend` for the person | `bpy.ops.wm.save_as_mainfile` at the end of the script | [A .blend](references/shots.md#a-blend-for-a-person) |\n| The GPU, or a machine with no graphics driver | Cycles' device, chosen in the script | [Engines](references/scene-script.md#engines-and-the-gpu), [no driver](references/scene-script.md#no-graphics-driver) |\n\n## Setup\n\nWritten for `cad==0.11.16`. Before first use in a chat, run `cad --version`. If `cad` is missing or older than\n0.11.12, run `uv tool install cad`, adding `--force` if uv says `cad` already exists.\n\nIf cad is a major or minor version newer than this skill, tell the person to update the text-to-cad plugin:\nhttps://github.com/earthtojake/text-to-cad\nA project written for an earlier version may need changes; the migration guides say what:\nhttps://github.com/earthtojake/text-to-cad/tree/main/docs/migrations\n\n`cad run` sees `import bpy` and makes the script an environment with bpy 5.2.3 (Blender 5.2 LTS) on\nPython 3.13 beside cad, once: a download of 260 to 430 MB, so the first run is slow. Nothing starts the\nBlender app, and the person's own Blender settings and add-ons never load. bpy has no build for Intel\nMacs or Linux on ARM, where `cad run` refuses the script by name.\n\n## Export the model\n\n```bash\ncad model export \"$ID\" scene.glb --tolerance 0.02 --angle 5\n```\n\n`$ID` is the model's id; a STEP or an xbf exports the same way (`cad step export part.step scene.glb\n--tolerance 0.02 --angle 5`). The GLB is in metres, Z up once imported, with the assembly's tree as\nnested empties, a PBR material per look, and each motion and `animation()` as a clip. `--tolerance`\n(mm) and `--angle` (degrees) mesh it finer than the viewer's, so a close camera shows no facets, at the\ncost of triangles: start near 0.02 mm and 5 degrees for a close-up of a hand-sized part, coarser for a\nlarge assembly seen whole. The GLB is a copy: export again after every model change.\n\n## The script\n\n```python\n# render.py: cad run render.py\nimport math\nfrom pathlib import Path\n\nimport bpy\nfrom mathutils import Vector\n\nfrom cad.blender import load\n\nHERE = Path(__file__).resolve().parent\n\nbpy.ops.wm.read_factory_settings(use_empty=True) # no person's startup file, no default cube\nscene = bpy.context.scene\nmodel = load(HERE / \"scene.glb\") # every part where cad placed it\n\nscene.render.resolution_x, scene.render.resolution_y = 1920, 1080\naim = bpy.data.objects.new(\"aim\", None)\naim.location = model.center\ncamera = bpy.data.objects.new(\"camera\", bpy.data.cameras.new(\"camera\"))\ncamera.data.lens = 85\nview = math.tan(camera.data.angle / 2) * min(1, scene.render.resolution_y / scene.render.resolution_x)\ndistance = model.size.length / 2 / view * 1.1 # the whole box in the frame's shorter side\ncamera.location = model.center + distance * Vector((1, -1, 0.6)).normalized()\ncamera.constraints.new(\"TRACK_TO\").target = aim\nsun = bpy.data.objects.new(\"sun\", bpy.data.lights.new(\"sun\", \"SUN\"))\nsun.data.energy, sun.rotation_euler = 3.0, (0.8, 0.2, 0.6)\nfor item in (aim, camera, sun):\n scene.collection.objects.link(item)\nscene.camera = camera\nscene.world = bpy.data.worlds.new(\"world\")\nscene.world.node_tree.nodes[\"Background\"].inputs[\"Strength\"].default_value = 0.4\n\nscene.render.engine = \"BLENDER_EEVEE\" # a draft; \"CYCLES\" for the final\nscene.render.filepath = str(HERE / \"hero.png\")\nbpy.ops.render.render(write_still=True)\n```\n\n```bash\ncad run render.py\n```\n\nThe script is the scene: every run starts empty and adds its camera, lights and world in Python.\nArguments after the script's name reach it as `sys.argv[1:]`. Lights, the world, colour management and\nthe GPU are in [the scene script](references/scene-script.md).\n\n## Load the GLB\n\nLoad with `cad.blender.load`, never `bpy.ops.import_scene.gltf` alone: Blender's importer poses every\npart a clip moves at that clip's first frame, with no error, leaves only the first clip live and keys\nfrom frame 0. `load` runs that importer, puts every node back where the GLB places it, and plays the\nclip asked for. It opens any GLB, not only cad's.\n\n| Call | Gives |\n| --- | --- |\n| `load(path, clip=None, fps=24)` | Imports into the current scene and returns the model; `clip` plays one, `fps` keys its seconds. Give a film's rate here: `render.fps` set after the import plays every clip at the wrong speed, with no error |\n| `model.root` | The document's root empty, at the origin, scale 0.001 (parts are in mm below it); `model.roots` for a file with several |\n| `model.objects[\"arm/head\"]` | A node's object by its path below the root, as the GLB names it; of two nodes with one name it is the last (`model.nodes[i]` reaches each) |\n| `model.nodes[7]` | A node's object by its index in the file, which tells two of one name apart |\n| `model.clips` | Each clip by name: `kind` (`motion` or `animation`) and `duration` in seconds |\n| `model.box`, `model.center`, `model.size` | The world box of the pose cad wrote, in metres, for framing |\n| `model.play(\"sweep\")` | That clip from frame 0, the scene's range set to its duration; `model.play(None)` stands every part as placed |\n| `model.bounds()` | The world box at the current frame |\n\nA still of a pose is a clip's frame: `model.play(\"sweep\")`, `scene.frame_set(24)`, render.\n\n## Looks\n\nA part's look is the model's: set it there and export again. `bd_materials` gives physics and a look;\n`cad.build123d.materials` adds named looks Blender draws well (solder mask, ENIG, anodized, powder\ncoat, LED lenses). Blender's importer draws base colour, metalness, roughness, IOR, opacity,\ntransmission, clear coat, sheen, specular and emission; it does not draw anisotropy (brushed metal\ndraws plain), dispersion or texture maps.\n\nA Blender material is named by the model's look (`bpy.data.materials[\"frame_black\"]`), so a script can\nrestyle a look wherever it is worn, and the physical material it is a look of is its custom property\n(`material[\"cad\"][\"material\"]`). Change one in the script only for the render's sake (a glow, a\nbackdrop). A transmissive look's base colour tints what passes through, so smoked glass written as a\nnear-black colour with partial transmission renders black: write glass as `transmission=1` with the\ntint as its colour, and judge it in a Cycles draft.\n\n## Engines\n\nEEVEE (`BLENDER_EEVEE`) draws a 1080p frame in seconds: drafts, framing, light. Cycles with OIDN\ndenoising is the final, on the GPU where there is one, at minutes a frame. They disagree on glass and\ntranslucent parts, so draft those in Cycles at a few samples.\n\nEEVEE needs a graphics driver. On a machine without one (a headless Linux server or container), an\nEEVEE render prints `Couldn't open libEGL.so.1` and ends the process with exit 134 and no Python\nexception, as does the compositor on its default device: draft in Cycles at 8 to 16 samples and set\n`scene.render.compositor_device = \"CPU\"`\n([no graphics driver](references/scene-script.md#no-graphics-driver)).\n\n## Check each change\n\n| Change | Check |\n| --- | --- |\n| Camera, framing, lights, world | An EEVEE draft at 1080p, opened and looked at |\n| A pose, a clip's frame | `model.play(...)`, the frame, then a draft; a moved part's world position (`model.objects[path].matrix_world.translation`) against the model's |\n| Looks, glass, emission | A small Cycles draft (32 to 64 samples) |\n| A turntable or a film | Three frames (first, middle, last) as stills before the whole film |\n| The final | Against its draft: same framing, nothing missing |\n\n- An empty or black image is the camera inside, behind or too near the model, or no light: print\n `model.box` and the camera's location.\n- A part in the wrong pose is a GLB imported without `load`, or a frame taken before `model.play`.\n- First runs are slow once each: `import bpy` (10 to 20 s), EEVEE's shaders (about 13 s), Cycles'\n GPU kernels on a Mac (minutes). Run a final in the background with a long timeout, and each final in\n a run of its own, since Blender keeps a Cycles render's memory until its process ends.\n"
Full snapshot data
{
"description": "Renders photoreal images and videos of a text-to-cad model, a STEP or an xbf with Blender - a hero shot, a product or README picture, a turntable, or a film of a model's motion. Use when the person wants a picture or a video for people to look at. Not for checking geometry, which the cad skill's snapshot does.",
"included_files": [
{
"relative_path": "LICENSE",
"size_in_bytes": 1074
},
{
"relative_path": "agents/openai.yaml",
"size_in_bytes": 254
},
{
"relative_path": "references/scene-script.md",
"size_in_bytes": 5247
},
{
"relative_path": "references/shots.md",
"size_in_bytes": 5828
}
],
"name": "render",
"skill_md_contents": "---\nname: render\ndescription: Renders photoreal images and videos of a text-to-cad model, a STEP or an xbf with Blender - a hero shot, a product or README picture, a turntable, or a film of a model's motion. Use when the person wants a picture or a video for people to look at. Not for checking geometry, which the cad skill's snapshot does.\nlicense: MIT\nmetadata:\n repository: earthtojake/text-to-cad\n---\n\n# Renders for people\n\nA render is a picture for a person: a hero image, a README picture, a turntable, a film of a\nmechanism. The model goes to Blender as a GLB, loaded by `cad.blender.load`; the scene (camera, lights,\nworld, engine, output) is an ordinary Python script that imports `bpy`, Blender as a Python module,\nand `cad run` runs it. Geometry is judged with `cad model snapshot`, never a render: lens, light and\ndepth of field make it a poor measure.\n\n## Start with the task\n\n| Task | Start with | Reference |\n| --- | --- | --- |\n| A still of a model | Export a GLB, write a `render.py` that loads it, `cad run render.py` | [The script](#the-script), [scene script](references/scene-script.md) |\n| Draft, then a final | An EEVEE draft at 1080p, looked at, before Cycles | [Draft then final](references/shots.md#draft-then-final) |\n| A pose, or a frame of an animation | `model.play(name)` and the frame | [Load the GLB](#load-the-glb) |\n| A turntable | The camera on an empty that turns once | [Turntables](references/shots.md#turntables) |\n| A film of a motion or an animation | `model.play(name)`, then an mp4 | [Films](references/shots.md#films) |\n| Motion blur, depth of field, a glow | The scene's and the camera's settings; a keyed emission | [Shots](references/shots.md) |\n| Looks and materials | Set in the model, exported again | [Looks](#looks) |\n| A `.blend` for the person | `bpy.ops.wm.save_as_mainfile` at the end of the script | [A .blend](references/shots.md#a-blend-for-a-person) |\n| The GPU, or a machine with no graphics driver | Cycles' device, chosen in the script | [Engines](references/scene-script.md#engines-and-the-gpu), [no driver](references/scene-script.md#no-graphics-driver) |\n\n## Setup\n\nWritten for `cad==0.11.16`. Before first use in a chat, run `cad --version`. If `cad` is missing or older than\n0.11.12, run `uv tool install cad`, adding `--force` if uv says `cad` already exists.\n\nIf cad is a major or minor version newer than this skill, tell the person to update the text-to-cad plugin:\nhttps://github.com/earthtojake/text-to-cad\nA project written for an earlier version may need changes; the migration guides say what:\nhttps://github.com/earthtojake/text-to-cad/tree/main/docs/migrations\n\n`cad run` sees `import bpy` and makes the script an environment with bpy 5.2.3 (Blender 5.2 LTS) on\nPython 3.13 beside cad, once: a download of 260 to 430 MB, so the first run is slow. Nothing starts the\nBlender app, and the person's own Blender settings and add-ons never load. bpy has no build for Intel\nMacs or Linux on ARM, where `cad run` refuses the script by name.\n\n## Export the model\n\n```bash\ncad model export \"$ID\" scene.glb --tolerance 0.02 --angle 5\n```\n\n`$ID` is the model's id; a STEP or an xbf exports the same way (`cad step export part.step scene.glb\n--tolerance 0.02 --angle 5`). The GLB is in metres, Z up once imported, with the assembly's tree as\nnested empties, a PBR material per look, and each motion and `animation()` as a clip. `--tolerance`\n(mm) and `--angle` (degrees) mesh it finer than the viewer's, so a close camera shows no facets, at the\ncost of triangles: start near 0.02 mm and 5 degrees for a close-up of a hand-sized part, coarser for a\nlarge assembly seen whole. The GLB is a copy: export again after every model change.\n\n## The script\n\n```python\n# render.py: cad run render.py\nimport math\nfrom pathlib import Path\n\nimport bpy\nfrom mathutils import Vector\n\nfrom cad.blender import load\n\nHERE = Path(__file__).resolve().parent\n\nbpy.ops.wm.read_factory_settings(use_empty=True) # no person's startup file, no default cube\nscene = bpy.context.scene\nmodel = load(HERE / \"scene.glb\") # every part where cad placed it\n\nscene.render.resolution_x, scene.render.resolution_y = 1920, 1080\naim = bpy.data.objects.new(\"aim\", None)\naim.location = model.center\ncamera = bpy.data.objects.new(\"camera\", bpy.data.cameras.new(\"camera\"))\ncamera.data.lens = 85\nview = math.tan(camera.data.angle / 2) * min(1, scene.render.resolution_y / scene.render.resolution_x)\ndistance = model.size.length / 2 / view * 1.1 # the whole box in the frame's shorter side\ncamera.location = model.center + distance * Vector((1, -1, 0.6)).normalized()\ncamera.constraints.new(\"TRACK_TO\").target = aim\nsun = bpy.data.objects.new(\"sun\", bpy.data.lights.new(\"sun\", \"SUN\"))\nsun.data.energy, sun.rotation_euler = 3.0, (0.8, 0.2, 0.6)\nfor item in (aim, camera, sun):\n scene.collection.objects.link(item)\nscene.camera = camera\nscene.world = bpy.data.worlds.new(\"world\")\nscene.world.node_tree.nodes[\"Background\"].inputs[\"Strength\"].default_value = 0.4\n\nscene.render.engine = \"BLENDER_EEVEE\" # a draft; \"CYCLES\" for the final\nscene.render.filepath = str(HERE / \"hero.png\")\nbpy.ops.render.render(write_still=True)\n```\n\n```bash\ncad run render.py\n```\n\nThe script is the scene: every run starts empty and adds its camera, lights and world in Python.\nArguments after the script's name reach it as `sys.argv[1:]`. Lights, the world, colour management and\nthe GPU are in [the scene script](references/scene-script.md).\n\n## Load the GLB\n\nLoad with `cad.blender.load`, never `bpy.ops.import_scene.gltf` alone: Blender's importer poses every\npart a clip moves at that clip's first frame, with no error, leaves only the first clip live and keys\nfrom frame 0. `load` runs that importer, puts every node back where the GLB places it, and plays the\nclip asked for. It opens any GLB, not only cad's.\n\n| Call | Gives |\n| --- | --- |\n| `load(path, clip=None, fps=24)` | Imports into the current scene and returns the model; `clip` plays one, `fps` keys its seconds. Give a film's rate here: `render.fps` set after the import plays every clip at the wrong speed, with no error |\n| `model.root` | The document's root empty, at the origin, scale 0.001 (parts are in mm below it); `model.roots` for a file with several |\n| `model.objects[\"arm/head\"]` | A node's object by its path below the root, as the GLB names it; of two nodes with one name it is the last (`model.nodes[i]` reaches each) |\n| `model.nodes[7]` | A node's object by its index in the file, which tells two of one name apart |\n| `model.clips` | Each clip by name: `kind` (`motion` or `animation`) and `duration` in seconds |\n| `model.box`, `model.center`, `model.size` | The world box of the pose cad wrote, in metres, for framing |\n| `model.play(\"sweep\")` | That clip from frame 0, the scene's range set to its duration; `model.play(None)` stands every part as placed |\n| `model.bounds()` | The world box at the current frame |\n\nA still of a pose is a clip's frame: `model.play(\"sweep\")`, `scene.frame_set(24)`, render.\n\n## Looks\n\nA part's look is the model's: set it there and export again. `bd_materials` gives physics and a look;\n`cad.build123d.materials` adds named looks Blender draws well (solder mask, ENIG, anodized, powder\ncoat, LED lenses). Blender's importer draws base colour, metalness, roughness, IOR, opacity,\ntransmission, clear coat, sheen, specular and emission; it does not draw anisotropy (brushed metal\ndraws plain), dispersion or texture maps.\n\nA Blender material is named by the model's look (`bpy.data.materials[\"frame_black\"]`), so a script can\nrestyle a look wherever it is worn, and the physical material it is a look of is its custom property\n(`material[\"cad\"][\"material\"]`). Change one in the script only for the render's sake (a glow, a\nbackdrop). A transmissive look's base colour tints what passes through, so smoked glass written as a\nnear-black colour with partial transmission renders black: write glass as `transmission=1` with the\ntint as its colour, and judge it in a Cycles draft.\n\n## Engines\n\nEEVEE (`BLENDER_EEVEE`) draws a 1080p frame in seconds: drafts, framing, light. Cycles with OIDN\ndenoising is the final, on the GPU where there is one, at minutes a frame. They disagree on glass and\ntranslucent parts, so draft those in Cycles at a few samples.\n\nEEVEE needs a graphics driver. On a machine without one (a headless Linux server or container), an\nEEVEE render prints `Couldn't open libEGL.so.1` and ends the process with exit 134 and no Python\nexception, as does the compositor on its default device: draft in Cycles at 8 to 16 samples and set\n`scene.render.compositor_device = \"CPU\"`\n([no graphics driver](references/scene-script.md#no-graphics-driver)).\n\n## Check each change\n\n| Change | Check |\n| --- | --- |\n| Camera, framing, lights, world | An EEVEE draft at 1080p, opened and looked at |\n| A pose, a clip's frame | `model.play(...)`, the frame, then a draft; a moved part's world position (`model.objects[path].matrix_world.translation`) against the model's |\n| Looks, glass, emission | A small Cycles draft (32 to 64 samples) |\n| A turntable or a film | Three frames (first, middle, last) as stills before the whole film |\n| The final | Against its draft: same framing, nothing missing |\n\n- An empty or black image is the camera inside, behind or too near the model, or no light: print\n `model.box` and the camera's location.\n- A part in the wrong pose is a GLB imported without `load`, or a frame taken before `model.play`.\n- First runs are slow once each: `import bpy` (10 to 20 s), EEVEE's shaders (about 13 s), Cycles'\n GPU kernels on a Mac (minutes). Run a final in the background with a long timeout, and each final in\n a run of its own, since Blender keeps a Cycles render's memory until its process ends.\n"
}SHA-256 of public snapshot: 29faa748d1a3a1b86beb7724a09bbc1cb421da60efb2095add0502066e8be71c