# Use the 3D asset library

> Add GLB and glTF equipment models (with their files, or as a .zip) to the 3D studio palette, install, replace and uninstall downloaded model packs, remove the built-in models a project does not use and restore them, manage the library in one grid, export the built-in parametric equipment as files, bind model parts to tags with a bindings sidecar, and edit models in Blender.

Product: eaxScada · Type: How-to guide · Editions: Pro, Enterprise
Source: https://eaxware.com/docs/eaxscada/how-to/3d-asset-library/
Verified against commit 8174396.

The 3D designer's palette ends with the **My models** group. It holds only
the GLB or glTF models you added to the project's library, each with its
picture; with none added yet it says "No models added yet. Drop a GLB or glTF
file here or press Add." The built-in models that ship with eaxScada are in
the kit's groups, next to the kit objects of their category (a heat exchanger
under **Heat transfer**, the cartridge filter under **Vessels and tanks**); a
built-in model of a category the kit has no group for is under **Built-in
models**. A built-in model named like a kit object of the same group is
labelled with "(model)" after its name, for example **Hopper (model)** next
to the kit's **Hopper**. The palette's search also finds a built-in model by
its category.
[Image: The 3D designer palette, Vessels and tanks group: the kit objects (storage tank, batch reactor, silo, hopper, filter vessel and others) followed by the built-in models of that category, such as Filter (cartridge housing), Hopper (model), Silo (model) and Agitated tank (mixer).]
[Image: The 3D designer palette, Vessels and tanks group: the kit objects (storage tank, batch reactor, silo, hopper, filter vessel and others) followed by the built-in models of that category, such as Filter (cartridge housing), Hopper (model), Silo (model) and Agitated tank (mixer).]

Built-in models sit in the kit group of their category.
You place models like built-in equipment (drag them into the scene or click
them), bind their moving parts to tags, and the operator runtime shows them
with the same live behaviour.

Changing the library needs a **Pro** or **Enterprise** licence and the
**engineer** role or higher: adding, replacing and deleting models, saving
bindings, and removing or restoring built-in models. Every signed-in user can
read the library (the operator runtime draws the same models), in every
edition. Each change is recorded in the audit trail under the category
`ASSET3D`, with the file size and SHA-256 of an added model.

## Where the files are

The library is the folder `data/studio/assets/3d/` in the server's work
directory, next to the studio's screens and components. Each model can have
two companion files with the same base name:

| File | What it is |
|---|---|
| `pump_a.glb` or `pump_a.gltf` | The model: glTF 2.0, binary (GLB) or a self-contained `.gltf` with embedded buffers and images. A `.gltf` uploaded with its files, or a `.zip`, is stored as one `.glb` (see below). |
| `pump_a.eax3d.json` | Optional bindings sidecar: which parts move or change colour, and how. |
| `pump_a.thumb.png` | Palette thumbnail. The studio renders it the first time the model is listed and stores it here. |
| `library.eax3dlib.json` | The built-in models removed from each project's palette (one list per project). |

The built-in models themselves ship with the server and are not in this
folder; they are never changed or deleted. Installed model packs (see
[Install a model pack](#install-a-model-pack)) are kept next to it, in
`data/studio/assets/3d-packs/<pack>/`.

## Add a model

1. Open the 3D designer and the **Palette** tab.
2. Drag the model's files from the desktop onto the palette, or click **Add**
   in the **My models** header and choose them (the refresh button next to it
   reloads the list). You can add:
   - a `.glb` file;
   - a `.gltf` file together with the files it refers to: its `.bin`
     buffers and its `.png`, `.jpg` or `.webp` textures (select them all);
   - a `.zip` of the model's folder, holding exactly one `.gltf` or `.glb`.

   To add bindings at the same time, drop the `<name>.eax3d.json` file
   together with the model.
3. A model with the same name asks before it is replaced; every placement of
   it in the open scene is updated.

A `.gltf` with its files and a `.zip` are packed on the server into one GLB,
stored as `<name>.glb`; nothing is unpacked to disk. If a file the `.gltf`
names is missing, the studio says which one before anything is sent. Dropping
a model file directly on the scene adds it to the library first and then
places it where you dropped it.

The server refuses:

- a model larger than 50 MB, counted with its files (and a `.zip` that
  unpacks to more than that);
- anything but `.glb`, `.gltf` and `.zip`, and files whose content is not glTF
  2.0 (the content is checked, not only the extension);
- a reference to anything outside the upload: an internet or file link
  (`http:`, `https:`, `file:`, a drive), an absolute path, a backslash or a
  `..` segment, also when written with `%` escapes; the same for the names of
  the entries of a `.zip`;
- a file the `.gltf` refers to that is not in the upload, and embedded data
  other than buffers and PNG, JPEG or WebP images;
- models that require a mesh or texture compression extension, which the
  studio cannot decode without fetching a decoder from the internet: export
  the model without compression; and extensions that would run behaviour or
  play media in the viewer;
- names that contain a path (`../`, `/`, `\`). Spaces and other characters
  in a name become `_`, and the extension is lowercased: `My Pump.GLB` is
  stored as `My_Pump.glb`.

## Remove and restore built-in models

The built-in models a project does not use can be taken out of its palette:

- In the palette, hover a built-in model (in its kit group) and click its eye
  icon (**Remove from this project's library**), then confirm.
- Or open the library manager (below) and click **Remove** on its row.

Removing hides the model from this project's palette only. Nothing is deleted,
the other projects keep it, and **a scene that already places the model keeps
drawing it**, in the designer and in the runtime. The setting is kept with the
project's library: it survives restarts and upgrades, is replicated to the
standby server of a high availability pair and is part of checkpoints.

**My models** then starts with "1 built-in model removed from this project.
**Restore built-ins**": click it to offer every removed model again. A
built-in model that a later version adds is shown until someone removes it.

Models you added are not removed but deleted (the trash icon): the file, its
bindings and its thumbnail.

## Manage the library

The list icon in the **My models** header (**Manage the model library**) opens
the **3D model library**: every model of the project in one grid, built-in
and added, offered or removed.
[Image: The 3D model library dialog for project default: a grid of 50 models with the columns Model, Palette, Source, Category, File, Size and Bindings; the Beacon built-in shows Removed with a Restore button, the others In palette with Remove; Restore built-ins (1) and Export CSV above the grid.]
[Image: The 3D model library dialog for project default: a grid of 50 models with the columns Model, Palette, Source, Category, File, Size and Bindings; the Beacon built-in shows Removed with a Restore button, the others In palette with Remove; Restore built-ins (1) and Export CSV above the grid.]

Removed built-ins are marked in the Palette column.
| Column | Shows |
|---|---|
| **Model** | The model's name. |
| **Palette** | **In palette**, or **Removed** for a built-in taken out of this project's palette. |
| **Source** | **Built-in** or **Added**. |
| **Category**, **File**, **Size (KB)** | The palette category, the file name and its size. |
| **Bindings** | Whether the model has a bindings sidecar. |

Each column filters and sorts; **Export CSV** saves the list. The row actions
are **Remove** and **Restore** for a built-in model, **Delete** for one you
added (both ask first). **Restore built-ins (n)** offers every removed model
again. The rows update while the dialog is open.

## Install a model pack

Ready-made equipment models (logistics, utilities and safety, data centre,
robots) come as a **model pack**: one `.zip` archive downloaded from
eaxware.com. The eaxScada server ships no pack, which keeps it lean: you
install a pack on the server that needs it (in a high availability pair, on
the active server: the standby gets it automatically). Installing, replacing and
uninstalling a pack needs a **Pro** or **Enterprise** licence and the
**engineer** role or higher.

1. Download the pack from [eaxware.com/3d-models](https://eaxware.com/3d-models)
   (the file is named like `eaxscada-3d-pack-industry-1.0.0.zip`). **Get model
   packs** in the library opens that page.
2. Check the file against the SHA-256 shown on the download page:

   ```sh
   # Windows (PowerShell)
   Get-FileHash .\eaxscada-3d-pack-industry-1.0.0.zip -Algorithm SHA256
   # Linux
   sha256sum eaxscada-3d-pack-industry-1.0.0.zip
   ```

   Install the archive only if the two values are identical.
3. In the 3D designer, open the **3D model library** (the list icon in the
   **My models** header). Under **Installed model packs**, click **Install
   model pack…** and choose the archive.
4. The server checks every model of the archive before it writes anything,
   then installs the pack as a whole or not at all. The models appear in their
   palette groups, ready to place and bind.

The **Installed model packs** grid lists each pack with its version, number
of models, size, and when and by whom it was installed.

### Replace, upgrade and uninstall

- **Same pack, newer or same version:** the studio asks **Replace model
  pack** ("… is installed. Replace it with version … from this archive?").
  Nothing changes until you confirm.
- **Older version:** refused. To go back to an older version, uninstall the
  installed pack first, then install the older archive.
- **Uninstall:** click **Uninstall** on the pack's row and confirm. Its models
  leave the palette.

A scene that places a model of a pack that is not installed (uninstalled, or
a project copied to another server) keeps the model's placement and its
bindings and shows a marked **placeholder** instead: "Model pack not
installed: … install it from the 3D model library". Install the pack and the
placeholders turn back into the models (at once in the studio that installed
it; within a minute elsewhere).

Pack models behave like the built-in models: you can remove them from a
project's palette and restore them, and you cannot edit or delete them one by
one. Every signed-in user can read them (the operator runtime draws them).

### What the server refuses

An archive is refused as a whole when:

- it is larger than 64 MB, holds more than 200 entries, or unpacks to more
  than 256 MB;
- it is not flat (folders or paths), or holds a file that its `pack.json` does
  not list, a duplicate, or anything other than the manifest, `.glb` models,
  `.thumb.webp` thumbnails and `.txt` notice and licence texts;
- a file `pack.json` names is missing, or a model fails the checks an added
  model goes through (see [Add a model](#add-a-model));
- one of its models is already installed by another pack (a model belongs to
  one pack);
- another pack is being installed at the same moment (try again when it has
  finished).

Each install, replacement, uninstall and refusal is recorded in the audit
trail under `ASSET3D` (`PACK_*` actions).

## Export built-in equipment as a model

Every built-in equipment type (tank, reactor, silo, pump, motor, conveyor,
pipe, valves, heat exchanger, transmitter) is generated from its parameters.
To keep a variant as a file:

1. Place the equipment and set its parameters in **Properties**.
2. Click **Export as asset** under the parameters.
3. Enter a file name and click **Export**.

The library gets a GLB of the model as currently configured, plus a bindings
sidecar that reproduces what the built-in model animates: the liquid level of
vessels, shafts and agitators that turn, valve stems that travel, the status
lamp. Place it from the palette, share the file, or refine it in a 3D
modelling tool.

To export the whole catalog at once, for example to prepare a library for a
customer, run from the `eaxScada` folder:

```sh
node tools/3d/export_builtin.mjs --out ./my-3d-library
```

It writes `<id>.glb` and `<id>.eax3d.json` for every built-in type, built by
the studio's own code in a headless Chrome, and checks each file. Options:
`--types Tank3D,Pump3D` limits the types, `--params '{"Tank3D":{"height":6}}'`
changes parameters, `--chrome <path>` names the browser. Copy the result into
a project's `data/studio/assets/3d/` folder, or add the files through the
palette.

## Place and bind a model

1. Drag the model from **My models** into the scene (or click it).
2. Select it. The **Live data** section of **Properties** lists the model's
   channels, one tag field each, laid out like the built-in equipment's tags.
3. Enter the tag path for each channel you want to drive.

A channel whose tag is unbound, has no value yet or has bad quality moves
nothing: the liquid is hidden, shafts stand still, stems stay at rest. The
label above the model shows the primary channel's value; the tooltip lists
every bound channel. An active alarm on any of the model's tags makes it glow
and puts the alarm ring around it, as for built-in equipment.

A model without a sidecar can still be placed and bound as a whole: the
**Live tag** drives its label and tooltip and its alarm glow and
ring, and **Property Bindings** (visibility, colour, glow, alarm) work as for
any object. A library model keeps the materials of its file unless you
choose a **Finish** for a placement in Properties; **Default** gives it its
file's materials back.

**Edit bindings file** in Properties opens the sidecar as JSON. Saving it
checks the file on the server and reloads every placement of the model.

## The bindings sidecar

`<name>.eax3d.json` is a JSON object:

```json
{
  "format": "eax3d-asset",
  "version": 1,
  "label": "Transfer pump",
  "category": "Pumps",
  "label_offset": [0, 1.6, 0],
  "footprint": [1.8, 0.9],
  "channels": [
    { "id": "running", "label": "Running", "kind": "rotate", "nodes": ["shaft"],
      "axis": "z", "mode": "run", "rate": 3.2, "primary": true },
    { "id": "lamp", "label": "Status lamp", "kind": "emissive", "nodes": ["lamp"],
      "states": [{ "op": "!=", "value": 0, "color": "#22c55e", "intensity": 3 }] }
  ]
}
```

| Field | Meaning |
|---|---|
| `format`, `version` | Always `"eax3d-asset"` and `1`. |
| `label`, `category` | Shown in the bindings editor; optional. |
| `label_offset` | Where the floating value label is anchored, in the model's coordinates. Default: above the model. |
| `footprint` | Width and depth of the alarm ring, in metres. Default: from the model's size. |
| `channels` | Up to 64 channels. |

Every channel has an `id` (letters, digits, `_`, `-`; unique), a `label`, a
`kind`, and except for `value` a list of `nodes`: the names of the parts it
acts on, as they are named in the file. A part's sub-parts move with it.
Optional: `unit` (shown with the value) and `primary: true` (the value the
label shows).

| Kind | What the tag does | Fields |
|---|---|---|
| `rotate` | Turns the parts about `axis`. | `mode: "run"`: any non-zero value turns at `rate` revolutions per second. `mode: "speed"`: value × `revs_per_unit` revolutions per second (`1/60` for an rpm tag). `mode: "angle"`: the value from `min` to `max` maps to `angle: [from, to]` in degrees (a butterfly valve disc). |
| `translate` | Moves the parts along `axis`. | The value from `min` to `max` maps to `distance: [from, to]` in metres (a valve stem). |
| `level` | Fill level of a liquid or bulk solid, from `min` (empty) to `max` (full). | `mode: "clip"` with `range: [bottom, top]`: everything above the level is cut away; `range` is the height of empty and full in the model's coordinates. `mode: "scale"`: each node is scaled along `axis` from 0 to its modelled size; a node may be `{ "name": "...", "from": 0.2, "to": 1 }` to fill only over part of the range. With no value the parts are hidden. |
| `color` | Base colour of the parts. | `states`: a list of `{ "op": ">", "value": 50, "color": "#ef4444" }`; the first that matches wins. `else`: colour when none matches (otherwise the modelled colour). `alarm: true`: the alarm severity colour while the model's tags are in alarm. |
| `emissive` | Glow of the parts (lamps, beacons). | As `color`, plus `intensity` per state. |
| `visible` | Shows the parts while the condition is true. | `op` and `value`. With no value the parts keep their modelled visibility. |
| `value` | Nothing moves: the value is shown in the label, tooltip and faceplate. | `unit`. |

`op` is one of `>`, `<`, `>=`, `<=`, `==`, `!=`. A boolean tag counts as 1
and 0. `axis` is `"x"`, `"y"`, `"z"` (or `"-x"` and so on), or a vector
`[x, y, z]`, in the part's own coordinates: rotations turn about the part's
origin, and translations follow the part's own orientation.

Instead of a sidecar, the same object can be stored inside the model under
`asset.extras.eax3d`. A sidecar file, when present, takes precedence. The
models exported by the studio carry both.

## Edit a model in Blender

Blender reads and writes GLB directly. To refine an exported model or to
prepare your own:

1. **File > Import > glTF 2.0** and open the `.glb`.
2. Edit the geometry and materials. Keep the names of the parts the sidecar
   uses (a moving part such as `body:rotor` or a liquid such as
   `body:fluidBody`): bindings find parts by name, exactly first and then
   ignoring case. Blender adds `.001` to duplicated names; rename them back.
3. Moving parts turn about their origin. Set it with **Object > Set Origin**
   on the shaft axis, the hinge, or the bottom of a liquid you scale.
4. **File > Export > glTF 2.0**, format **glTF Binary (.glb)**, with **+Y Up**
   on (the default).
5. Add the `.glb` and its `.eax3d.json` to the library together (drop both on
   the palette) and confirm the replacement.

Coordinates in the sidecar are those of the file: Y is up. In Blender, the
file's Y axis is Blender's Z axis and the file's Z axis is Blender's −Y, so a
part that spins about Blender's vertical axis uses `"axis": "y"`, and a
`level` range is the height above the model's origin as Blender shows it in
Z. Do not rely on the bindings stored inside the GLB surviving a round trip
through a modelling tool: keep the sidecar file next to the model.

Animations inside the file are not played: motion comes from the bindings.

## Library API

| Method and path | Role | What it does |
|---|---|---|
| `GET /api/dev/assets3d` | any | Lists the added models with size, version, sidecar and thumbnail URL, the project (`?project=`, default the active one) and its `hidden_builtins`. |
| `POST /api/dev/assets3d` | engineer | Multipart upload: `file` (the model: `.glb`, `.gltf` or `.zip`), optional `sidecar`, `thumb` and `name`, and for a `.gltf` one `resource` part per file it refers to, named by its path relative to the `.gltf`. `?overwrite=1` replaces an existing model. A packed upload answers `"packed": true`. |
| `POST /api/dev/assets3d?builtins=remove` or `?builtins=restore` | engineer | Body `{"names": ["isoblock_beacon.glb"]}`. A restore with no names (or `{"all": true}`) restores every removed built-in. `&project=` names the project. |
| `DELETE /api/dev/assets3d?name=<file>` | engineer | Deletes the model with its sidecar and thumbnail. |
| `POST /api/dev/assets3d/sidecar?name=<file>` | engineer | Replaces the sidecar (body: the JSON). |
| `POST /api/dev/assets3d/thumb?name=<file>` | engineer | Stores the thumbnail (body: PNG, at most 1024 × 1024). |
| `GET /api/dev/assets3d/file/<file>` | any | Serves a model, sidecar or thumbnail. |
| `GET /api/dev/assets3d/packs` | any | Lists the installed model packs with their models. |
| `POST /api/dev/assets3d/packs` | engineer | Installs a model pack: multipart upload with one `file` part (the `.zip`). `?replace=1` replaces an installed pack of the same id with a newer or the same version; without it the answer is `409`. An older version is always refused (`409`). |
| `DELETE /api/dev/assets3d/packs?id=<pack>` | engineer | Uninstalls the pack. |
| `GET /api/dev/assets3d/pack/<pack>/<file>` | any | Serves a file of an installed pack (read only). |

## Limits

- In a high availability pair, a change to the library made on the active
  server (a model added, replaced or deleted, bindings saved, built-ins
  removed or restored) is replicated to the standby. A file copied into the
  folder by hand is not: add models through the palette. Model packs are
  replicated too: install, replace and uninstall a pack on the active server
  (the standby refuses with a link to it). The standby installs the pack only
  once every file has been checked against its SHA-256, and a server that was
  offline catches up when it rejoins (its previous copy is kept under
  `data/ha-config-backup`). Packs are not part of project checkpoints.
- Selecting a placed model gives it its own copy of its meshes (as for the
  built-in equipment); unselected copies of a model share one GPU geometry
  and are drawn as instances.
- Pipe flow arrows and the conveyor belt's moving texture of the built-in
  models are not exported; their exported versions animate the parts listed
  in their sidecar.
