All guides
Preparing a model
- 04Move, rotate, scale and auto-orient
- 05Check and repair a model
- 06Cut and split a model
- 07Arrange models and use more than one plate
- 08Hollowing and drain holes
- 09Supports: automatic, then by hand
- 10Press a texture into the surface
- 11Write text on a model
- 12Combine models: union, subtract, intersect
- 13Read the layer check before you print
Printing
Help the project
Printing · Guide 20 of 21
A command-line resin slicer
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.
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. 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 has the rest.
Before you start
You need Encrust installed (Install Encrust), a printer chosen as in Your first print, and a resin you made yourself (Printer, resin and 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. 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 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: 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, 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). --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 with an example; the guides on hollowing and supports 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). With a printer named, the command prints the search’s best few poses to choose between, as the window’s Auto-orient does (orientation).
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 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 lists; Open a sliced file 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.
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, 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. 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; 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 · Every subcommand with worked examples, the exit codes and the JSON contract
- Encrust: from the command line · The one-line slice and how to run the binary from a checkout
- Encrust: the --json document · The schema number and when it changes
- Encrust: how a run ends · The exit codes and the Ctrl-C code