---
title: "SLA resin slicer CLI: slice and batch from the command line"
description: "The encrust CLI slices SLA and MSLA resin models with no window into .ctb, .goo and 20+ other printer formats, with JSON output and exit codes for scripts."
url: "https://encrust.app/guides/slice-resin-files-command-line-batch/"
lang: "en"
updated: "2026-11-17"
---

Printing · Guide 20 of 21

# A command-line resin slicer

[By Vladimir Varvorkin](https://encrust.app/about/) Updated November 17, 2026 10 min read

The encrust command is a resin slicer for the terminal. It slices a model, a project's plates or a whole folder into a printer file such as .ctb or .goo with no window, and runs a printer on your network. With --json it prints one JSON document per run, and its exit code tells a script how it went.

## On this page

1. [Before you start](https://encrust.app/guides/slice-resin-files-command-line-batch/#before-you-start)
2. [Find the printer and resin ids](https://encrust.app/guides/slice-resin-files-command-line-batch/#find-the-printer-and-resin-ids)
3. [Slice one model](https://encrust.app/guides/slice-resin-files-command-line-batch/#slice-one-model)
4. [Check before you slice](https://encrust.app/guides/slice-resin-files-command-line-batch/#check-before-you-slice)
5. [Slice a folder](https://encrust.app/guides/slice-resin-files-command-line-batch/#slice-a-folder)
6. [Use it from a script](https://encrust.app/guides/slice-resin-files-command-line-batch/#use-it-from-a-script)
7. [Other subcommands](https://encrust.app/guides/slice-resin-files-command-line-batch/#other-subcommands)
8. [Run a printer on your network](https://encrust.app/guides/slice-resin-files-command-line-batch/#run-a-printer-on-your-network)
9. [What it refuses and what it only warns of](https://encrust.app/guides/slice-resin-files-command-line-batch/#what-it-refuses-and-what-it-only-warns-of)
10. [If something goes wrong](https://encrust.app/guides/slice-resin-files-command-line-batch/#if-something-goes-wrong)

A slice that fails the check does not leave a half-good file behind. With `--strict`, a model with defects, or one that does not fit the plate, ends the run with exit code 3, and the file or PNG folder it just wrote is [taken off the disk again](https://github.com/vvvlladimir/Encrust/blob/v0.9.0/docs/cli.md#output-exit-codes-and-ctrl-c). The exit code and what is on the disk say the same thing, so a script can trust either.

The window and the command reach the same code, through `core-engine`. This guide covers the commands you reach for first. [The reference](https://github.com/vvvlladimir/Encrust/blob/v0.9.0/docs/cli.md) has the rest.

## Before you start

You need Encrust installed ( [Install Encrust](https://encrust.app/guides/install-encrust/)), a printer chosen as in [Your first print](https://encrust.app/guides/first-resin-print/), and a resin you made yourself ( [Printer, resin and support profiles](https://encrust.app/guides/printer-resin-support-profiles/)). A model as STL, OBJ or 3MF is the input.

The command is a second program called `encrust`, next to the window. The portable `encrust-*.tar.gz` and `.zip` archives hold both in a folder named `Encrust`, [as the release workflow packs them](https://github.com/vvvlladimir/Encrust/blob/v0.9.0/.github/workflows/release.yml). Run `encrust --version` in a terminal to see whether the command is on your PATH, and from the extracted folder if it is not found. In a source checkout, [the README](https://github.com/vvvlladimir/Encrust/blob/v0.9.0/README.md#from-the-command-line) runs it as `cargo run --release -p encrust-cli --bin encrust --`. Below, `encrust` stands for either.

## Find the printer and resin ids

Run `encrust profiles list`. It prints three blocks: printers, resins and support profiles. Your own profiles are marked. The resin block holds only what you made, because [the catalogue ships no resin](https://github.com/vvvlladimir/Encrust/blob/v0.9.0/docs/cli.md): an exposure is measured on your own machine.

A machine named without a resin is refused, not given stock numbers. If the resin block is empty, make one in the Machine and resin window first, or write a TOML file and bring it in with `encrust profiles import grey.toml --kind resin --printer elegoo-mars-4-ultra`. `encrust profiles show <id>` prints any profile as the TOML it is kept in; add `-o file.toml` to write it, edit it, and pass it back with `--profile` (a printer) or `--material` (a resin). A path wins over a catalogue id.

## Slice one model

```
encrust slice model.stl \
  --printer elegoo-mars-4-ultra --resin my-grey --center -o model.goo
```

The extension of `-o` picks the format: `.goo`, `.prz`, `.ctb`, `.cbddlp`, `.photon`, `.sl1`, `.zip`, `.crmaslice`, `.cxdlp`, `.cxdlpv4`, `.fdg`, `.phz`, `.photons`, `.cxline` and the rest of [the list](https://github.com/vvvlladimir/Encrust/blob/v0.9.0/docs/cli.md#output-exit-codes-and-ctrl-c), the Anycubic extensions and the `.pwsz` family among them. A name with no extension writes a folder of PNG layers. A `.ctb` is written at the revision the printer’s profile names: version 5, or the encrypted container for a panel past 4095 pixels a side; `--ctb-version 4`, `5` or `encrypted` overrides it. A `.goo` is written at revision 5.1 where the profile names it, else 3.0\. A format file needs `--printer` (or `--profile`), because the printer’s panel is what the layers are drawn on; without one the command fails rather than reports success.

On a terminal you see a progress bar over the layers. It goes away under `--quiet`, `--no-progress` and `--json`.

Hollowing, supports, relief and the other tools of the window are flags of `slice` too: `--hollow 2 --drain 4 --drain-at 30,30,60`, `--supports medium`, `--relief 0.4`. `--infill hive --infill-cell 6 --infill-density 0.3` fills the cavity, `--keep-solid X,Y,Z` keeps the wall solid at a point (`--keep-solid-size` reaches that many millimetres past it), `--keep-solid-under 6` keeps it solid wherever the model is thinner than 6 mm, so fingers and blades survive hollowing, and `--drain-walled` and `--drain-support-at X,Y,Z` drill a recess in the wall or a hole in the supports. Instead of choosing a point, `--drain-at auto` drills a drain and a vent for every pocket that still traps resin, keeping a hole only once a scan finds its pocket empty; `--no-drain-vent` leaves the vents out ( [the reference](https://github.com/vvvlladimir/Encrust/blob/v0.9.0/docs/cli.md)). `--supports auto` sizes each support by what it holds, as the window’s **Auto** does, and `--support-cavity` holds up the cavity of a hollowed model too, as **Support the cavity** does. Each is in [the reference](https://github.com/vvvlladimir/Encrust/blob/v0.9.0/docs/cli.md) with an example; the guides on [hollowing](https://encrust.app/guides/hollow-resin-model-drain-holes/) and [supports](https://encrust.app/guides/supports-resin-print/) explain what the numbers do.

These numbers are examples for one printer and resin, not recommendations: your resin maker’s and printer’s instructions come first.

### Let it orient the model

`--orient` turns the model before anything else and reports the `--rotate` that repeats the turn. `--orient-goal` picks what to search for: `fewest-supports` (the default), `least-peel`, `shortest-print` or `auto`, which balances the three. `--max-tilt 30` keeps the turn within 30 degrees of how the file stands. `--clean-surface` holds any goal to the fewest contacts where the model shows, read off its shape ( [the reference](https://github.com/vvvlladimir/Encrust/blob/v0.9.0/docs/cli.md)). With a printer named, the command prints the search’s best few poses to choose between, as the window’s Auto-orient does ( [orientation](https://github.com/vvvlladimir/Encrust/blob/v0.9.0/docs/design/orientation.md)).

### Let it prepare the model

`--prepare` runs the steps in order with nothing tuned: orient (`--orient-goal auto`), repair if import found a defect, hollow if that saves at least 10 ml and 40 %, drain, support. It stops and says so where resin stays trapped or the model on its supports does not fit. It does not imply `--strict`. `--recipe ID|PATH` on `slice`, `estimate` and `batch` runs a recipe instead, a built-in one by id (`encrust recipes list` shows them) or your own file. A project carries its own steps and refuses both.

```
encrust slice figure.stl --printer elegoo-mars-4-ultra --resin my-grey --prepare -o figure.goo
```

### Repair a model

`--repair` stitches seams, drops specks, patches holes and drops doubled faces, as the **Repair** tool does, and keeps the model as it came if that would leave more wrong. `--repair=close-holes`, `=close-small-holes` or `=turn` runs part of it; `=wrap` wraps every shell in one outer surface, and `=deep` repairs, wraps and repairs again. `--seam-tolerance MM` (0.01) and `--smallest-shell MM2` (1) set how far a vertex may stand off an open edge to be stitched, and the least area an open shell keeps.

By hand, as the **Faces** mode and the **Shells** list do it: `--flip-faces 3,4` turns faces, `--drop-faces` drops them, `--drop-shells 2` drops shells numbered from 1 as `inspect --shells` lists them, and `--bridge A-B:C-D` lays faces between two open edges. Every number is of the model as import leaves it. See [repair](https://encrust.app/guides/check-repair-model-on-import/) for what each method does.

```
encrust inspect broken.stl --repair
encrust slice parts.stl --drop-shells 2,3 -o out
```

### Shade the edges

A mask is shaded as the resin’s `[edges]` say, and anti-aliased when it says nothing. `--anti-alias` or `--no-anti-alias` shades edges by coverage or lights each pixel fully or not at all, `--grey-levels N` rounds the edges to N greys, `--blur PX` fades every edge, and `--grey-range MIN..MAX` spreads edge greys over that range in place of the printer profile’s. A printer whose masks carry no grey ignores these, with a warning.

## Check before you slice

`encrust inspect model.stl --printer elegoo-mars-4-ultra` reads a model and reports its size, defects and whether it fits, without slicing. Add `--center` to see the bounds after placement, `--shells` to list every shell numbered from 1, and `--intersections` to count the pairs of faces that cross. A model standing in the band a maker keeps clear along the plate’s edges still fits, and the report says how far it reaches in. A solid model that hollowing to a 2 mm wall would save at least 10 ml and 40 % of gets a `solid` line saying how much.

`encrust estimate model.stl --printer elegoo-mars-4-ultra --resin my-grey` takes what `slice` takes, writes nothing, and prints layers, print time, resin volume and weight, and the layers likely to fail. It is the dry run: there is no `--dry-run` flag. `inspect` also takes `--strict`, so it can gate a model without writing a file.

The report answers the way Check’s **On the plate** does: once `--supports` has stood the supports, the `fits` line answers again for the model with its supports and raft where they were put down, and two models standing into each other, or the supports of one reaching into another, are named once as `meeting a.stl and b.stl`. Touching counts, a gap does not. `--strict` fails on both, and each `batch` model lists the others it meets in `meets`.

`encrust info plate.ctb` goes the other way and opens a sliced file in any format [the reference](https://github.com/vvvlladimir/Encrust/blob/v0.9.0/docs/cli.md) lists; [Open a sliced file](https://encrust.app/guides/open-sliced-file-goo-ctb-pwmx/) walks through what it reports. `--thumbnail out.png` saves the largest preview the file carries as a PNG.

## Slice a folder

```
encrust batch models/ \
  --printer elegoo-mars-4-ultra --resin my-grey --center --orient --supports light -o out/
encrust batch models/ --printer elegoo-mars-4-ultra --resin my-grey \
  --name "{model}_{resin}_{layer}um_{date}" -o out/
```

Every `.stl`, `.obj` and `.3mf` in the folder is cut with the same flags. Other files in it are left alone. Each model gets its own printer file and a `<name>.json` report, and the run adds a `batch.json` over the lot. `-o` defaults to `out`. `--name` names each file by a template, as the **File name** setting does for the window: `{model}`, `{ext}` (the model’s own extension), `{printer}`, `{resin}`, `{layer}` in µm, `{plate}`, `{date}` and `{time}`, and the printer’s extension follows.

`--jobs N` cuts that many models at once; the default is 1\. A model that fails does not stop the others: the run ends with exit code 4 instead. One file a part is what you want here. To pack several models on a single plate, give `slice` several files and `--arrange`, as in [Arrange models](https://encrust.app/guides/arrange-models-build-plate/).

## Use it from a script

Two things are promised. The first is `--json`, which prints exactly one JSON document to stdout with `"schema": 1` beside the report’s fields. Logs and progress stay on stderr, so `encrust inspect model.stl --json | jq` parses. A failed run prints `{"schema": 1, "error": {"message", "chain", "cancelled"}}` in the same place. The schema number goes up when a field is removed or changes meaning; [adding a field does not raise it](https://github.com/vvvlladimir/Encrust/blob/v0.9.0/crates/encrust-cli/src/json.rs), so read the fields you need by name and ignore the rest. Findings come with a place: `cured.risks` lists each risk with its layer and `at_mm` point, `slicing.trapped` each trapped pocket, and `supports.no_room_why` says why a contact found no room (`head-blocked`, `faces-up` or `no-ground`). The points are in the frame `--drain-at` takes, so a script can feed one back.

The second is the exit code:

| Code | Meaning                                                                     |
| ---- | --------------------------------------------------------------------------- |
| 0    | Done                                                                        |
| 1    | The run failed                                                              |
| 2    | The arguments were wrong                                                    |
| 3    | \--strict, and a model has defects or does not fit; nothing is left on disk |
| 4    | A batch in which at least one model failed                                  |
| 130  | Stopped by Ctrl-C                                                           |

Source: [the exit codes](https://github.com/vvvlladimir/Encrust/blob/v0.9.0/docs/cli.md#output-exit-codes-and-ctrl-c). The first Ctrl-C stops between layers, or between the models of a batch, and removes the file being written. A second one exits at once.

A number after a flag may be negative: `--rotate -90,0,0` works as typed.

### Write the flags down

`--config FILE` reads flags from a TOML file: a key is a flag’s long name, and a table names a subcommand.

```
[slice]
printer = "elegoo-mars-4-ultra"
resin = "my-grey"
center = true
```

A flag you type wins over the file. A key the command does not take is an error with exit code 2.

### Plate files and projects

`encrust slice plate.toml -o plate.goo` reads a plate file that lists models with their own `rotate`, `scale`, `position`, `supports` and `hollow`. A project saved from the window slices its models as saved: `encrust slice plate.encrust --resin my-grey -o plate.goo`. A project names its printer and resin by id only, so one that is not among your profiles needs a flag. Flags that shape a model, such as `--hollow` or `--supports`, are refused for a project.

A project keeps no print settings: they are the printer’s and resin’s. `--layer-height`, `--adaptive`, `--samples-per-layer`, `--exposure-at` and the mask flags apply to it as they do to a model.

### Pick a plate

A project of several plates slices the plate it was saved on and says so. `--plate N` picks another, counted from one as the plate bar shows them, for `slice` and `estimate`. `slice --all-plates` writes every plate holding a model into a file of its own named after it, `plate-small-parts.goo` beside `plate.goo`, as **File** \> **Slice all N plates to .goo** does. Its `--json` is one document with a report per plate under `plates`.

```
encrust slice plate.encrust --plate 2 -o small.goo
encrust slice plate.encrust --all-plates -o plate.goo
```

## Other subcommands

`encrust convert plate.ctb --printer elegoo-mars-4-ultra -o plate.goo` rewrites a sliced file in another container without resampling its layers, so the printer’s panel must be the size the file was drawn for. `encrust completions zsh` prints shell completions for bash, zsh, fish, elvish or PowerShell.

`encrust profiles reset-unreadable` throws away the copies of shipped profiles that no longer read, so the shipped ones are used again; `--with-own` deletes your own unreadable files too, as the window’s **Delete** does.

## Run a printer on your network

`encrust printer discover`, `status` and `send` talk to a printer over your local network: `discover` broadcasts to find ELEGOO boards, and `status` and `send` take a board’s IP address. `send --start` starts the file once the board has checked it. Start a print only when you are at the printer and the vat and plate are ready; follow the printer’s manual. Encrust does not find a Prusa machine by broadcast and sends it only `.sl1` and `.sl1s`; name it by host with `--prusalink`, and pass its key or password as `ENCRUST_PRUSALINK_KEY` or `ENCRUST_PRUSALINK_PASSWORD` so they stay out of your shell history.

Once a print is under way, the printer card’s buttons have commands:

| Command               | What it does                                                                                                            |
| --------------------- | ----------------------------------------------------------------------------------------------------------------------- |
| pause, resume         | Pauses the print, or continues it                                                                                       |
| stop                  | Stops it; a stopped print cannot be resumed, and the command asks nothing first                                         |
| history               | Lists the last prints an ELEGOO board remembers, 10 unless \--count says; Encrust reads no history from a Prusa machine |
| camera on, camera off | Prints the RTSP address an ELEGOO board streams to, for a video player, or turns the stream off                         |
| picture -o FILE       | Saves the picture of the plate the printer keeps for the print under way                                                |

```
encrust printer pause 192.168.1.42
encrust printer history 192.168.1.42 --count 5
```

These are [the reference’s printer commands](https://github.com/vvvlladimir/Encrust/blob/v0.9.0/docs/cli.md#printers-on-the-network); under `--json` each prints its own fields.

## What it refuses and what it only warns of

Encrust refuses what it cannot do as asked, and says so; it does not write a different file under your name. It refuses a machine without a resin, a container name without a printer, a shaping flag on a project, an infill number given without `--infill`, a drain point off an edge or corner of the model, and an exposure band or adaptive layers for an `.sl1`.

It warns, and still writes the file, when a resin setting is past what the printer takes or its maker advises (`slice` and `convert` name each one), and when you give mask flags to a printer whose masks carry no grey.

## If something goes wrong

It exits with code 2: an argument was wrong: a flag the subcommand does not take, a conflicting pair, or a key in a `--config` file the command does not know. The message on stderr names it. `encrust slice --help` is authoritative for the flags.

It refuses the machine: you named a printer and no resin. Name one with `--resin`, or `--material` with a TOML path. Check `encrust profiles list`.

It exits with code 3 and there is no file. That is `--strict` doing its job. The report still names each defect or the overflow. Fix the model, move it with `--center`, or drop `--strict` if you accept the defect.

A batch ends with code 4\. At least one model failed and the others were cut. Read `batch.json` and the `<model>.json` beside each part to find which.

## Sources

- [Encrust: the command line](https://github.com/vvvlladimir/Encrust/blob/v0.9.0/docs/cli.md)  · Every subcommand with worked examples, the exit codes and the JSON contract
- [Encrust: from the command line](https://github.com/vvvlladimir/Encrust/blob/v0.9.0/README.md#from-the-command-line)  · The one-line slice and how to run the binary from a checkout
- [Encrust: the --json document](https://github.com/vvvlladimir/Encrust/blob/v0.9.0/crates/encrust-cli/src/json.rs)  · The schema number and when it changes
- [Encrust: how a run ends](https://github.com/vvvlladimir/Encrust/blob/v0.9.0/crates/encrust-cli/src/exit.rs)  · The exit codes and the Ctrl-C code

[  Previous Convert a sliced file to another format](https://encrust.app/guides/convert-sliced-file-ctb-goo/) [ Next Confirm your printer with one test print](https://encrust.app/guides/confirm-resin-printer-profile/)

## Read next

- [Your first print ](https://encrust.app/guides/first-resin-print/)
- [Printer, resin and support profiles ](https://encrust.app/guides/printer-resin-support-profiles/)
- [Open a sliced file and check its layers ](https://encrust.app/guides/open-sliced-file-goo-ctb-pwmx/)
- [All guides ](https://encrust.app/guides/)

---

[ Encrust](https://encrust.app/)

Free and open source under AGPL-3.0, written in Rust. Your files stay on your computer.

## Product

[Download](https://encrust.app/download/) [Printers](https://encrust.app/printers/) [Web app](https://encrust.app/app/)

## Learn

[Guides](https://encrust.app/guides/) [Blog](https://encrust.app/blog/) [FAQ](https://encrust.app/faq/) [Changelog](https://github.com/vvvlladimir/Encrust/blob/main/CHANGELOG.md)

## Project

[About](https://encrust.app/about/) [Source code](https://github.com/vvvlladimir/Encrust) [Discussions](https://github.com/vvvlladimir/Encrust/discussions) [Report a bug](https://github.com/vvvlladimir/Encrust/issues)

Encrust prepares files for machines that cure resin with UV light. It can’t know whether your settings suit your resin, printer or model, so check its output before a long print. Provided without warranty, as the licence says.

[Privacy](https://encrust.app/privacy/) [Impressum](https://encrust.app/impressum/) [Datenschutzerklärung](https://encrust.app/datenschutz/)
