> ## Documentation Index
> Fetch the complete documentation index at: https://editor.pascal.app/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Pascal for Blender

> Install the Pascal Blender extension, send a scene from the editor straight into an open Blender, build objects from Blender Python scripts, and understand what the importer rebuilds and how the loopback protocol works.

Pascal exports plain glTF with a small set of documented `extras`. The
[Pascal for Blender](https://github.com/pascalorg/blender-addon) extension reads them so a
scene lands in Blender as something you can work with, not a flat pile of meshes:

* one collection per level with sub-collections per kind (walls, doors, windows, items, zones, slabs, ceilings, …)
* objects named after their Pascal labels, with `pascalId`, `kind` and `label` kept as custom properties
* zones rebuilt as coloured floor polygons (viewport only, excluded from renders)
* metric units, and re-importing the same project replaces the previous import
* optional material polish (real glass, leaf cutouts, a calmer site ground) and lighting presets

![A Pascal house imported into Blender with the outliner and Pascal sidebar tab](https://mintcdn.com/pascal-editor/mlAIf6kqxD_OgVfI/images/developers/blender-import.webp?fit=max\&auto=format\&n=mlAIf6kqxD_OgVfI\&q=85\&s=bb0908ba16ad3438f1e8f291b769c83e)

A Pascal house in Blender: collections per level and kind, the Pascal tab, Daylight preset

> [!NOTE]
>
> The extension is open source under GPL-3.0, as Blender requires for add-ons. Blender 4.2 or
> newer.

## Install

1. Download `pascal-<version>.zip` from the
   [releases page](https://github.com/pascalorg/blender-addon/releases).
2. In Blender: **Edit → Preferences → Get Extensions**, open the **▾** menu top right, choose
   **Install from Disk…** and pick the zip.
3. Press `N` in the 3D viewport and open the **Pascal** tab. It should read
   *Listening on 127.0.0.1:27412*.

## Send a scene from the editor

![The Send to Blender button under Export in the Pascal settings panel](https://mintcdn.com/pascal-editor/mlAIf6kqxD_OgVfI/images/developers/send-to-blender-button.webp?fit=max\&auto=format\&n=mlAIf6kqxD_OgVfI\&q=85\&s=557e6f9ec9f4c6a1f078ed3ce62034ac)

Settings → Export → Send to Blender

With Blender open and the extension enabled:

1. In the Pascal editor open **Settings → Export** and click **Send to Blender**.
2. The first time, Blender has not allowed your site yet. The Pascal tab in Blender lists the
   origin (for example `https://editor.pascal.app`) with an **Allow** button. Click it.
3. Click **Send to Blender** again. The editor exports the live scene, hands it to Blender, and
   reports Blender's own summary when the import is done.

The same "Include in file" choices as **Export GLB** apply. `https://editor.pascal.app` is
allowed by default; local or self-hosted editors go through the Allow step once.

> [!TIP]
>
> No Blender open? The editor tells you so. Blender open but the button says your site is not
> allowed? Look for the Allow button in Blender's Pascal tab.

## Import a downloaded file

**File → Import → Pascal scene (.glb)** works on any file from **Export GLB**, with the same
result as the send flow. Untick *Replace previous import* in the file dialog to keep an earlier
import of the same project.

## Lighting and material polish

Two options, both on by default, in the Pascal tab, the import dialog, and the extension
preferences (which govern scenes sent from the editor):

* **Polish materials** turns see-through surfaces into Principled glass, wires cutout alpha on
  leaf textures, and gives the site ground a calmer albedo.
* **Set up lighting** adds a sky, a sun, a ground disc and a framed camera (`Numpad 0` looks
  through it) and switches the viewport to rendered shading. Presets: *Daylight*, *Golden hour*,
  *Overcast*, *Night* (adds a warm bulb per room and a porch light), *Physical sky*. The refresh
  button next to the preset re-lights the current scene. Your render engine is left alone unless
  you choose otherwise in the preferences.

Everything the extension adds is named (`Pascal sky`, `Pascal sun`, `Pascal camera`, …) and
reused on the next import, so tweak or delete freely.

## Script geometry with Blender

An agent can build a custom object, window, door or column from a Blender Python (`bpy`)
module instead of a three.js one. Blender is the better choice for bevelled and rounded
edges, subdivision-smooth and organic forms, booleans, curves and text, and modifiers
such as solidify, array and screw. The result is a normal Pascal object: you can move
it, paint its surfaces and ask the agent to change its parameters.

Ask for it in plain words:

```text theme={null}
Model a 1.6 m oak dining table with bevelled edges in Blender and place it in the
dining room.
```

The agent calls `add_object` with `language: "bpy"` and a module like this:

```python theme={null}
import bmesh
import bpy

PARAMS = {
    "width": {"default": 1.6, "min": 1.0, "max": 2.4, "step": 0.05, "unit": "m", "label": "Width"},
    "depth": {"default": 0.8, "min": 0.6, "max": 1.2, "step": 0.05, "unit": "m", "label": "Depth"},
}
MOUNT = "floor"


def box(name, size, location, material):
    mesh = bpy.data.meshes.new(name)
    bm = bmesh.new()
    bmesh.ops.create_cube(bm, size=1.0)
    bmesh.ops.scale(bm, vec=size, verts=bm.verts)
    bm.to_mesh(mesh)
    bm.free()
    mesh.materials.append(material)
    obj = bpy.data.objects.new(name, mesh)
    obj.location = location
    bpy.context.scene.collection.objects.link(obj)
    return obj


def build(params):
    w, d, h = params["width"], params["depth"], 0.75
    oak = bpy.data.materials.new("slot_top")
    oak.diffuse_color = (0.62, 0.45, 0.3, 1)
    steel = bpy.data.materials.new("slot_legs")
    steel.diffuse_color = (0.1, 0.1, 0.1, 1)

    top = box("part:top", (w, d, 0.04), (0, 0, h - 0.02), oak)
    bevel = top.modifiers.new("bevel", "BEVEL")
    bevel.width = 0.012
    bevel.segments = 3

    leg_h = h - 0.04
    for i, (x, y) in enumerate([(1, 1), (1, -1), (-1, 1), (-1, -1)]):
        location = (x * (w / 2 - 0.08), y * (d / 2 - 0.08), leg_h / 2)
        box(f"part:leg_{i}", (0.05, 0.05, leg_h), location, steel)
```

The module's shape:

* `PARAMS` declares the values a person or agent can change later, with their ranges.
* `MOUNT` is `floor`, `wall-side` (on a wall face), `wall` (through a wall, like a
  window) or `ceiling`.
* `build(params)` adds objects to an empty scene. Everything in the scene is exported,
  with modifiers applied.

Pascal's naming conventions apply in Blender terms. Work in metres with Z up, and make the
front face −Y (Blender's Front view). Object names carry the meaning: `part:<id>` for a
named part, `light:<id>` for a point or spot light (its `intensity` custom property sets
the brightness, default 2; a spot keeps its cone and blend; `shadows = True` casts shadows;
`glow = {"size": 0.2, "strength": 1}` draws a soft halo around the lamp), `anchor:<id>` for
an empty other things attach to. Material
names `slot_<id>` become paintable surfaces, so the table above has `top` and `legs`
roles for `paint`. An animation is one action named `open`, `close`, `loop` or anything
else, assigned to every object that moves in it. Use the data API and `bmesh`, not
operators that need a 3D viewport. An object can have at most 300k triangles,
32 materials and 60 m per side.

To change the object later, the agent calls `add_object` again with its `nodeId` and
new `params`, or new `code`. `get_source` returns the current module.

### Where Blender runs

* **Hosted Pascal** runs each build in an isolated Blender sandbox with no network
  access. A build takes a few seconds. The object's **Parameters** panel in the editor
  rebuilds it through Blender too.
* **Local MCP** runs `bpy` modules in the Blender binary named by `PASCAL_BLENDER`, set
  in the environment that starts the MCP service. This runs the module on your machine
  without a sandbox, so only use it with code you trust. Without `PASCAL_BLENDER`, a
  `bpy` build is refused. The local editor can't rebuild a Blender object from its
  Parameters panel; ask the agent to rebuild it instead.

## What the file contains

Every Pascal scene node is a glTF node named by its `pascalId` with these `extras`:

| Extra | Meaning |
| - | - |
| `pascalId` | Stable id, also the node name |
| `kind` | `site`, `building`, `level`, `wall`, `door`, `window`, `item`, `zone`, `slab`, `ceiling`, `roof`, … |
| `label` | The user-facing name |
| `openable`, `clips` | Doors and windows that bake an open clip in the published web copy |
| `polygon`, `color` | Zones: `[x, z]` pairs (three.js Y-up) and a hex colour; the fill mesh is left out |

Anything else is ordinary glTF 2.0 that any importer handles. Glass exports with
`KHR_materials_transmission`, so Unity, Unreal and Blender all render it as glass.

## The loopback protocol

The extension listens on `127.0.0.1:27412` (the next few ports if taken). Anyone building
another receiver, or another sender, can speak the same four routes:

| Route | Purpose |
| - | - |
| `OPTIONS *` | CORS preflight, answers `Access-Control-Allow-Private-Network: true` for Chrome |
| `GET /pascal/health` | `{ app, version, addon, port, allowed }`, where `allowed` says whether the calling origin may send |
| `POST /pascal/import` | Body `model/gltf-binary`; optional `X-Pascal-Project-Name` (percent-encoded UTF-8), `X-Pascal-Project-Id`, `X-Pascal-Version`; answers `202 { id, state }`, `403 origin_not_allowed`, `400 not_glb` |
| `GET /pascal/import/<id>` | `{ id, state: queued \| done \| failed, summary?, error? }` |

Browsers are gated by the origin allowlist; requests without an `Origin` header (curl, local
scripts) are accepted, since the allowlist exists to gate the browser's ambient authority. The
editor side lives in the open-source editor package (`lib/send-to-app.ts`), so the same button
could target any app that implements these routes.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.