CLI & command-line options
PreFormServer is a command-line application. It serves the PreForm API on the port you pass, and --help lists its options.
Options#
PreForm Server accepts the following options:
| Option | Effect |
|---|---|
-p, --port <port> | The port to serve the PreForm API on. Required. |
--scene-cache-size <size> | The maximum number of scenes the server keeps. When the limit is exceeded, the server deletes the least recently used scene. The default is 30, and the maximum is 10000. |
--export-support-bundle | Bundle the structured diagnostic logs and text logs into one archive for Formlabs support, then exit. |
-v, --version | Print the version. |
-h, --help | Print the options. |
Start the server#
Start the server on port 44388:
/Applications/PreFormServer.app/Contents/MacOS/PreFormServer --port 44388C:\PreFormServer\PreFormServer.exe --port 44388docker run --rm -it -p 127.0.0.1:44388:44388 formlabs/preform-server:release-latest --port 44388In the container image, every argument after the image name goes to PreForm Server. For more information, see PreForm Server in Docker.
The server prints READY FOR INPUT when it accepts requests. The SDK's launch() method passes --port and waits for that line.
Environment variables#
PreForm Server reads the following variables:
| Variable | Effect |
|---|---|
DISABLE_PREFORMSERVER_TELEMETRY | Set to 1 to turn off telemetry. The server reports the telemetry state on its first line of output. |
PREFORM_ENV_DATA_DIRECTORY | The folder for the server's data, such as print settings, presets, and crash reports. The default is the user's local application data folder. |
To pass variables to a server the SDK starts, use the extra_env argument of launch(): the server gets your script's environment plus those variables. The env argument gives the server only the variables you pass, and the data_dir argument sets PREFORM_ENV_DATA_DIRECTORY. To pass variables to a server in a container, use the -e option of docker run or podman run.