# Screen designer

> How the eaxScada Dev Studio screen designer works, from the layered vector canvas to procedural piping, matrix arrays, faceplates and display versioning.

Product: eaxScada · Type: Explanation · Editions: Starter, Pro, Enterprise
Source: https://eaxware.com/docs/eaxscada/explanation/screen-designer/
Status: migrated page, not yet verified against the current code.

The **Dev Studio screen designer** is eaxScada's web-based, zero-install HMI authoring environment. It combines an HTML5 canvas vector engine with synchronised interactive DOM overlays, procedural geometry for ISA-5.1 smart piping, parameterised User-Defined Type (UDT) faceplates and Git-backed display revisions.

### Edition boundaries

| Capability | Starter | Pro | Enterprise |
|---|---|---|---|
| **Authoring mode** | Manual web designer | Procedural 2D and 3D studio | Procedural 2D and 3D studio |
| **Vector primitives** | Rect, Circle, Line, Text, Path | Same | Same |
| **ISA-5.1 equipment** | Vessels, valves, pumps, heat exchangers | Same | Same |
| **Piping** | Manual multi-segment orthogonal lines | **Procedural filleted piping (R = 20 px)** | Same as Pro |
| **Pipe routing** | Manual waypoints | **ISA-5.1 Manhattan auto-router** | Same as Pro |
| **Mass tag binding** | Manual binding per element | **2D matrix array generator (`{row0:02}`)** | Same as Pro |
| **3D** | 3D digital twin player: view and run scenes with live data | **3D digital twin studio: design and model library** | Same as Pro |
| **Version control** | Screen version history with compare and restore, JSON import / export | Same | Same |
| **AI authoring** | MCP screen tools (see [MCP AI gateway](/docs/eaxscada/explanation/mcp-ai-gateway/)) | Same | Same |

---

## 1. Dev Studio overview
[Image: eaxScada Dev Studio with a tank farm overview screen open in the designer: menu bar, activity bar, project explorer, canvas, inspector and status bar.]
[Image: eaxScada Dev Studio with a tank farm overview screen open in the designer: menu bar, activity bar, project explorer, canvas, inspector and status bar.]

Dev Studio with a synoptic (the docs tank farm overview) open in the screen designer.
The studio runs in any modern browser, with no Java, plugin or client installation. It talks to the server over WebSocket (`/ws`) and REST (`/api/dev/*`).

### 1.1 Phones and tablets

The layout above is the wide one (1200 px and more). On a narrower window the designer keeps the canvas as large as it can:

- **Tablets (640 to 1199 px):** the palette and the inspector fold into their docks and open one at a time over the canvas; selecting an object opens the inspector.
- **Phones (under 640 px):** no side panels and no rulers. A bar under the canvas opens **Displays**, **Palette**, **Assets**, **Layers** or **Properties** as a sheet from the bottom, one at a time, and **Fit** shows the whole screen. One finger pans the empty canvas or drags an object, two fingers pinch and pan, and the selection handles grow to a size a finger can hit.

In the designer a tap never runs an object's command, not even with the animation preview on: commands are tried in the live preview or the runtime, behind the runtime's touch protection and the object's confirmation or e-signature. The other Studio workspaces need at least 900 px; below that the Studio offers to **Edit screens**. Details: [Edit screens on a phone or a tablet](/docs/eaxscada/how-to/edit-screens/#on-a-phone-or-a-tablet).

---

## 2. Layered canvas and DOM overlay

Industrial HMIs need two rendering capabilities that pull in opposite directions:

1. Fast, lightweight vector graphics for thousands of dynamic pipes, tanks, pumps and values, best drawn on a 2D canvas.
2. Rich interactive controls such as sortable data grids, zoomable time-series charts and 3D digital twins, best built as native DOM elements.

eaxScada combines both: **three canvas layers** (grid, shapes, overlay) under **one DOM container** for the rich widgets. The resize and rotate handles belong to the shape layer; the overlay layer holds the other editing aids.

**Diagram: The canvas layers of the screen designer** (layered stack)

From top to bottom as the engineer sees them: a DOM container above the canvas holds the rich widgets; under it, three canvas layers hold the editing aids, the screen objects, and the grid with the display zone. Each rich widget has a group with a visible backdrop in the shape layer, and its DOM element is placed from that group.

**Parts**

- **DOM widget container** (layer 1): #designer-widgets-container, above the canvas
- **Overlay layer** (layer 2): what the engineer works with
- **Shape layer** (layer 3): the screen objects and their handles
- **Grid layer** (layer 4): drawn only, takes no clicks
- **Rich widgets** (service or process): charts, grids, HTML, video, map, 3D, gauges, dashboards
- **Editing aids** (service or process): rubber band, snap guides, vertex handles, placement ghost, connector hints
- **Screen objects** (service or process): equipment, pipes, text; the resize and rotate handles
- **Widget group** (service or process): a visible backdrop while loading or exported
- **Grid and display zone** (service or process): 20 px dots, a major every 5; outside: scrim

**Connections**

- **Widget group → Rich widgets** (relation): position, size, rotation. After zoom, pan, drag, a transform, a layer change or an undo, each DOM element is placed at its group's absolute position, size and rotation. Removing the group removes the element.

Three canvas layers and one DOM container; a rich widget lives in both, held together by its group in the shape layer.

### 2.1 Grid layer

Implemented in `web/static/js/designer/designer_core.js`:

- Grid dots (a larger dot every 5 cells of 20 px) are drawn directly on the canvas, with no DOM elements; the layer takes no clicks.
- **Virtual fence:** outlines the target monitor resolution (for example `1920x1080`, `1200x800` or `3840x2160`). Space outside the fence is shaded, so engineers see exactly what operators will see in fullscreen kiosk mode.

### 2.2 Synchronised DOM overlay (`designer_widgets.js`)

When an engineer places a rich widget (a chart, a data grid, an HTML block, a video, a map, a 3D view, a gauge, a dashboard or a registered widget) on the canvas:

1. Dev Studio creates a group in the shape layer that holds the widget's coordinates (x, y, w, h), with a backdrop that shows while the widget loads and in an exported picture.
2. A matching DOM element is mounted into `#designer-widgets-container`, which sits above the canvas. Its CSS `left`, `top`, `width` and `height` are taken from the group's absolute transform; the CSS transform holds only a rotation (and a scale for a chart drawn smaller).
3. Zooming, panning, dragging, resizing, a layer change or an undo places the element again, so DOM widgets move with the canvas shapes. Removing the group removes the element.

---

## 3. Procedural geometry and smart piping (Pro)

P&IDs need pipe routing with filleted corners, weld flanges and flow arrows. Drawing them by hand in vector tools is slow and error-prone.

**Pro** and **Enterprise** include a procedural geometry engine (`web/static/js/procedural_2d.js` and `designer/procedural_pid.js`). *In Starter, engineers draw multi-segment orthogonal lines with manual elbows and stroke styling.*

### 3.1 Filleted pipe arcs (`Procedural2D.createFilletedPath`)

Given a polyline of waypoints P0, P1, …, Pn, a corner radius R (default 20 px) and a mode (`fillet` or `chamfer`), the algorithm draws a quadratic Bézier curve around every elbow. The curve leaves the incoming segment at B1, a distance d before the corner P1, and joins the outgoing segment at B2, the same distance after it, with the corner P1 as its control point.

For each interior waypoint P1 between P0 and P2:

1. Unit direction vectors: `u1 = (P0 − P1) / |P0 − P1|` and `u2 = (P2 − P1) / |P2 − P1|`.
2. Distance from the corner: `d = min(R, |P0 − P1| / 2.05, |P2 − P1| / 2.05)`. When d is 0.5 px or less, the corner stays sharp.
3. Curve start and end points: `B1 = P1 + d·u1` and `B2 = P1 + d·u2`.
4. Emitted SVG path command (in `chamfer` mode a straight cut, `L B2.x B2.y`, in place of the curve):
   ```
   L B1.x B1.y Q P1.x P1.y B2.x B2.y
   ```

### 3.2 Pipe cross-section

Pipes are drawn in four tiers:

1. **Outer casing (14 px stroke):** dark slate border (`#0f172a`) that separates the pipe from equipment behind it.
2. **Pipe wall (8 px stroke):** the metal body (`#334155` or a stainless-steel gradient).
3. **Fluid core (3 px stroke):** coloured by the process medium (for example `#0284c7` for water, `#f59e0b` for steam, `#10b981` for a chemical reagent).
4. **Flange collars:** weld collars at segment ends and evenly spaced along the run (`flangeSpacing = 160px`).

### 3.3 ISA-5.1 Manhattan auto-routing (`ProceduralPID.routeOrthogonal`)

When you connect two pieces of equipment (for example a tank discharge nozzle to a pump suction), the router generates clean 90-degree orthogonal paths from the start point (x1, y1) to the end point (x2, y2): each corner is an elbow, which the fillet generator of 3.1 rounds. Two points on one horizontal or vertical line are joined straight.

The router supports four strategies (`horizontal_first` when none is given):

- `horizontal_first`: horizontal to the target X, then vertical.
- `vertical_first`: vertical to the target Y, then horizontal.
- `mid_horizontal`: horizontal to the midpoint (x1 + x2) / 2, vertical step, then horizontal.
- `mid_vertical`: vertical to the midpoint (y1 + y2) / 2, horizontal step, then vertical.

**Collinear simplification:** redundant collinear points on straight runs are removed, and every remaining corner is tagged `isElbow: true` for the fillet generator.

---

## 4. Matrix array generator (Pro)

Plants often repeat identical equipment: 24 bioreactors in a cell-therapy suite, or 32 valve manifolds on a chemical skid. Drawing and binding each one by hand is error-prone.

In **Pro** and **Enterprise**, the **matrix array generator** (`ProceduralPID.generateMatrixArray`) creates an M × N array of fully bound, interactive equipment from one master shape. *In Starter, duplicate shapes and assign bindings by hand.*

Select the master shape on the canvas, then open the generator. Its dialog has three tabs:

- **Grid Layout**: quick presets (2 × 3 by default), **Rows**, **Columns**, **X Spacing** and **Y Spacing** in pixels.
- **UNS Tags**: the **Tag Path Pattern** and the **Equipment Label Pattern**, with the tokens below (click a token chip to insert it), **Start Row**, **Start Col** and **Start Index**, and a preview of the tag paths.
- **Preview & Build**: a schematic of the grid with its estimated size, and the **Target Canvas Layer**.

For example, with 4 rows and 6 columns, the label pattern `Reactor {row0:02}-{col0:02}` and the tag path pattern `Plant/Line1/Cell{row1}/Reactor{col1}/Temperature`, the first copy is labelled `Reactor 00-00` and reads `Plant/Line1/Cell1/Reactor1/Temperature`, and the last one `Reactor 03-05` with `Plant/Line1/Cell4/Reactor6/Temperature`.

### Token patterns

- `{row0:02}`, `{col0:02}`, `{index0:03}`: zero-padded, 0-based integers (for example `00`, `01`, `002`).
- `{row1}`, `{col1}`, `{index1}`: 1-based integers (for example `1`, `2`, `24`).
- `{r}`, `{c}`, `{i}`: short forms.

The generator walks the master shape and replaces tokens in:

- Coordinates: `props.x`, `props.y`
- Display text: `props.label`, `props.title`
- Tag bindings: `bindings.tagPath`, `bindings.expression`
- Conditioning rules and threshold bands
- Click actions and faceplate targets

---

## 5. Parametric ISA-5.1 equipment

Dev Studio provides procedural, vector-drawn components that follow ISA-5.1 instrumentation and piping symbols (`web/static/js/designer_shapes.js`):
[Image: The 2D screen designer with vessel TK-103 selected and its position, size, colours and vessel properties in the inspector.]
[Image: The 2D screen designer with vessel TK-103 selected and its position, size, colours and vessel properties in the inspector.]

Vessel TK-103 selected: its geometry, colours and vessel properties in the inspector.
| Component | Constructor | Capabilities |
|---|---|---|
| **ISAVessel** | `createISAVessel` | Cylindrical tanks with dished or ellipsoidal heads, conical bottoms, heating coils, liquid level with meniscus, and an animated agitator shaft. |
| **ISAValve** | `createISAValve` | Gate, globe, ball, butterfly and check valves. Actuator heads: manual lever, pneumatic diaphragm, electric motor or solenoid. Status colour binding (`Closed` = green, `Open` = red/cyan, `Fault` = yellow blink). |
| **ISAPump** | `createISAPump` | Centrifugal pumps, positive displacement pumps and rotary compressors, with impeller rotation linked to running status or drive frequency. |
| **ISAInstrumentBubble** | `createISAInstrumentBubble` | Circular instrument tag. Letter codes (`FT` flow transmitter, `PT` pressure, `LT` level, `TT` temperature, `FCV` flow control valve). Mounting line styles: field, main control room panel or auxiliary console. |
| **HeatExchanger** | `createHeatExchanger` | Shell-and-tube, plate-and-frame and fin-fan coolers with inlet/outlet ports and baffle indicators. |
| **Conveyor** | `createConveyor` | Belt conveyors, roller tables and bucket elevators with chevron flow animation. |

The generated widget and symbol reference will list every type with its properties.

---

## 6. Composite faceplates and UDT instantiation

### 6.1 What is a faceplate?

A faceplate is a reusable composite component for a whole machine or User Defined Type (UDT). A **reactor faceplate**, for example, contains a vessel, an agitator motor, inlet and outlet valves, temperature and pressure transmitters, and operator buttons.

Faceplate definitions are parameterised JSON documents in `data/studio/components/` (for example `cmp_reactor_udt_faceplate.json`).

### 6.2 Parameterised bindings

Inside a faceplate definition, bindings reference parameters instead of fixed tag paths:

```json
{
  "type": "Tank",
  "props": {
    "label": "{DeviceName} Vessel"
  },
  "bindings": {
    "level": {
      "type": "tag",
      "tagPath": "{TagRoot}/Level",
      "transform": { "type": "format", "units": "%" }
    },
    "temperature": {
      "type": "tag",
      "tagPath": "{TagRoot}/Temperature",
      "transform": { "type": "format", "units": "°C" }
    }
  }
}
```

### 6.3 Instantiation

When an engineer drags a faceplate onto a screen, the studio asks for the parameters:

- `TagRoot`: `Plant/Processing/Reactors/Reactor1`
- `DeviceName`: `Rx-101`

Dev Studio posts to `/api/dev/udts/instantiate`. The server substitutes the tokens and inserts the instantiated shape group into the screen, with no manual re-wiring.

### 6.4 UDT definitions

A UDT definition is kept on the server (`udts/<id>.json` in the Studio's data folder, and in the HA cluster when there is one). `GET /api/dev/udts` lists them for any signed-in user; saving (`POST`) and deleting (`DELETE /api/dev/udts?id=<id>`) need the engineer role or above. Each save and each delete is recorded in the audit trail before it is made (`UDT` `SAVE`, `DELETE`): without the record nothing changes.

**Members and their defaults.** A member has a name, a type (`Float64`, `Int32`, `Bool` or `String`), an engineering unit, a description and a default (`default_val`). The default is checked against the type when the UDT is saved:

| Type | Default |
|---|---|
| `Bool` | `true` or `false` (`0` and `1`, as earlier versions stored them, are taken too) |
| `String` | a text (a number, as earlier versions stored it, is taken too) |
| `Int32` | a whole number from -2147483648 to 2147483647 |
| `Float64` | a number |

A default that does not suit its type is refused with `400`, naming the member, and nothing is saved. Before, a UDT with a `Bool` or `String` member could not be saved at all (`400`), because every default had to be a number. UDT files saved earlier load unchanged, and saving one again without changes writes the same values. In the Studio, a member's description and deadband, and a type, protocol or default you did not edit, keep their stored values when you save.

**Times.** `created_at` is set by the first save and kept by every later one, whatever the save sends; `updated_at` is the time of the last save (Unix nanoseconds). A file saved before `updated_at` existed has none until it is saved again.

**Delete.** **Delete** in the UDT list asks first, naming the UDT's id, then deletes it on the server and reads the list again. Before, the UDT was removed from the Studio's list only and came back on the next reload. Tags already made from the UDT stay. The server answers:

| Answer | When |
|---|---|
| `200` `{"status": "ok", "deleted": "<id>"}` | Deleted and recorded. |
| `409` | A component template is built on the UDT (a UDT-mode faceplate): the message names the templates. Delete them, or build them on another UDT, first. Nothing changed and nothing is recorded. |
| `404` | No UDT with that id. |
| `400` | No id, or an id that is not valid. |
| `500` | The delete could not be written (disk, cluster): the UDT stays. Before, every failure was answered `404`. |
| `503 AUDIT_NOT_WRITTEN` | The audit record could not be written: nothing changed. |

A refusal shows its reason in the Studio and changes nothing. A UDT that was never saved is only dropped from the list.

---

## 7. Display version history

Regulations such as 21 CFR Part 11 and ISO 9001 require that every change to a supervisory screen is tracked with its author, a timestamp and a way to roll back.

eaxScada commits each saved screen to a Git repository in the screens folder `data/studio/pages` (`internal/devstudio/page_versioner.go`), after the save is recorded in the audit trail and the screen file is written. The server needs the `git` program for this: without it the screen is saved and no history is kept. The screen file and its audit record are the save; the Git commit is its history copy. A commit that fails does not fail the save, but it is never hidden: the answer carries a `"warning"` ("saved, but not in its version history"), which the studio shows. A screen file that cannot be written fails the save, with a `PAGE UPDATE_FAILED` (or `CREATE_FAILED`) record after the first one; a new screen is then linked nowhere. A save is checked (the screen's parameters, shapes, report and 3D rules, the revision, the screen script right) but not against a JSON schema. A save does not reach the operators by itself: they get it with Deploy, or at the next load when the project has live editing on. Open it with **File → Revision History...**: each revision can be restored, and two versions can be put side by side with [Compare two versions of a screen](/docs/eaxscada/how-to/compare-screen-versions/). JSON export and import remain available to move screens between servers.

**Diagram: Saving a screen, and restoring an earlier version** (data flow)

An engineer saves a screen. The server checks it, records the change in the audit trail first, then stores it and writes the screen file; a Git commit follows. Operators get the change with Deploy, or at the next load when live editing is on. A rollback restores an earlier version through the same save path: recorded first, then the file, then the commit.

**Parts**

- **Engineer** (person or role): engineer level
- **Save checks** (check or decision): valid screen, revision not stale, 3D, report, script right, replace guard
- **Refused** (outcome): nothing changes
- **Rollback** (service or process): a 7-40 hex hash; 3D and script checks
- **Audit trail** (data store): PAGE CREATE or UPDATE, first
- **Screen file** (data store): store, then pages/\<id>.json
- **Git history** (data store): a commit after the save
- **Operators get it** (outcome): with Deploy, or at the next load (live editing)

**Connections**

- **Engineer → Save checks** (data or telemetry): save. POST or PUT /api/dev/screens, engineer level.
- **Engineer → Rollback** (data or telemetry): restore. POST /api/dev/screens/{id}/rollback with a commit, after a plain confirmation in the Studio; no signature is asked.
- **Save checks → Refused** (refusal): no. An invalid screen (400), a stale revision (409), a 3D design or report rule, the external-delivery right, a changed script without screens.script (403) or the replace guard (409, recorded) refuses the save.
- **Save checks → Audit trail** (next step)
- **Audit trail → Refused** (refusal): not written. When the record cannot be written the save is refused with 503 and nothing changes.
- **Audit trail → Screen file** (next step)
- **Screen file → Git history** (data or telemetry): then. The Git commit runs after the save, in the pages folder. A Git error does not fail the save: it comes back as a warning. A screen file that cannot be written fails the save, recorded as \_FAILED. Without git the file is written and no history is kept.
- **Screen file → Operators get it** (next step). With live editing off a save changes the Studio copy only; operators get it with Deploy. With live editing on, the manifest is redeployed at its next load after the same checks as Deploy.
- **Rollback → Refused** (refusal): no. A commit that is not a 7 to 40 character hexadecimal hash (400), a version that does not exist (404) or is not a screen (422), a 3D design rule, or a changed script without screens.script refuses the rollback before anything changes.
- **Rollback → Save checks** (next step): a save. The earlier version is restored as a screen save: the save checks, its PAGE UPDATE record first (503 AUDIT_NOT_WRITTEN with the audit trail down, nothing changes), the file, then the commit.

A save, a rollback included, is recorded before it changes anything; a Git error leaves the save standing and comes back as a warning.

### 7.1 Revision history API

| Endpoint | Method | Description |
|---|---|---|
| `/api/dev/screens/:id/versions` | `GET` | The last 20 commits of the screen: hash, author, timestamp and message. Without a version store, an empty list and the reason. |
| `/api/dev/screens/:id/versions/:commit` | `GET` | The screen as it was at a commit. |
| `/api/dev/screens/:id/diff` | `GET` | The difference between two commits (`?commitA=...&commitB=...`, or `from` and `to`). |
| `/api/dev/screens/:id/rollback` | `POST` | Restores the screen to a commit (`{"commit_hash": "...", "reason": "..."}`). The commit must be a hash of 7 to 40 hexadecimal characters (`400` otherwise). The restore is a screen save: its audit record is written first, and with the audit trail down it is refused (`503 AUDIT_NOT_WRITTEN`) and nothing changes; then the screen file, then the Git commit (a Git error comes back as `"warning"`). A refused restore is answered with its refusal, never `"ok"`. Operators get it as any save: with Deploy, or at the next load with live editing on. |

---

## 8. Display JSON format

Each screen is saved as a declarative JSON document. The MCP gateway publishes its JSON Schema as a resource (see [MCP AI gateway](/docs/eaxscada/explanation/mcp-ai-gateway/)):

```json
{
  "id": "dsp_reactor_overview",
  "name": "Reactor Unit 101 Synoptic",
  "width": 1920,
  "height": 1080,
  "background": "#090d16",
  "version": 3,
  "layers": [
    {
      "id": "layer_background",
      "name": "Piping & Vessels",
      "visible": true,
      "locked": false,
      "shapes": [
        {
          "id": "shp_pipe_feed",
          "type": "ProceduralPipe",
          "points": [
            { "x": 100, "y": 250 },
            { "x": 400, "y": 250, "isElbow": true },
            { "x": 400, "y": 450 }
          ],
          "props": {
            "radius": 20,
            "stroke": "#0284c7",
            "strokeWidth": 8,
            "outerCasing": true
          }
        },
        {
          "id": "shp_rx101_vessel",
          "type": "ISAVessel",
          "props": {
            "x": 350,
            "y": 450,
            "width": 180,
            "height": 320,
            "agitator": true,
            "fillColor": "#1e293b"
          },
          "bindings": {
            "level": {
              "type": "tag",
              "tagPath": "Plant/Processing/Reactors/Reactor1/Level"
            }
          }
        }
      ]
    }
  ]
}
```

---

## 9. See also

- [Build your first 2D screen](/docs/eaxscada/tutorials/build-your-first-2d-screen/): a tutorial from an empty project to a live screen.
- [Choose an editor: 2D, 3D or isometric](/docs/eaxscada/explanation/choose-an-editor/).
- [Expression language](/docs/eaxscada/reference/expression-language/): tag bindings, expressions and alarm blinking on these shapes.
- [Operator runtime](/docs/eaxscada/explanation/operator-runtime/): run these screens in kiosk mode.
- [3D digital twin](/docs/eaxscada/explanation/digital-twin-3d/): build 3D scenes of a plant area, driven by the same tags.
- [MCP AI gateway](/docs/eaxscada/explanation/mcp-ai-gateway/): let an AI assistant propose screens.
- [Edit screens: groups, clipboard, paste special and undo](/docs/eaxscada/how-to/edit-screens/), [Find and replace across screens](/docs/eaxscada/how-to/find-and-replace/), [Check screens before deploying](/docs/eaxscada/how-to/check-screens-before-deploy/).
- [How texts, fonts, states and languages are resolved](/docs/eaxscada/explanation/text-and-states/).
