Repository navigation
Command Line and Headless
Marius Stanciu edited this page Oct 29, 2026
·
1 revision
FlatCAM Evo starts from a terminal with options and file names. The headless mode runs Tcl scripts with no window, for automation on a server or in a build step.
- Start the program from a terminal:
python flatcam.py [OPTION]... [FILE]... - On Windows, the packaged program is
FlatCAM.exe. It takes the same options. - The man page is
flatcam-evo.1in the program folder. On Linux, install it to amanfolder to read it withman flatcam-evo. - Help text:
flatcam.py -h.
- Open a terminal in the program folder.
- Start a script without a window:
python flatcam.py --headless --shellfile=my_job.tcl - Check the exit code.
0means done. Runecho $?on Linux orecho %ERRORLEVEL%on Windows.
| Option | Description | Default |
|---|---|---|
FILE |
Opens the file at startup. A .FlatPrj file opens as a project. A script runs. A Gerber, Excellon or G-code file opens by its extension. The file name must exist, or the program stops with an error. Quote a name that has spaces. |
— |
--shellfile=SCRIPT |
Runs the Tcl script file after the program starts. The file must exist and be readable, or the program stops with exit code 2. | — |
--shellvar=VALUE1,VALUE2,... |
Sets the Tcl variables shellvar_0, shellvar_1, and so on, with these values. Each value is read as a Python literal when possible, for example a number or a list. Other values stay as text. Backslashes in Windows paths become forward slashes. |
— |
--command=COMMANDS |
Runs the Tcl commands. Separate the commands with semicolons. Quote the commands to protect them from the system shell. | — |
--headless |
Runs without a window or an OpenGL canvas. Without --shellfile or --command, the Tcl commands are read from standard input. |
Off |
-h |
Prints the help text and exits. | — |
Without --headless, the options open the program with a window. The script or the commands run after the window opens. The Tcl shell dock opens for --command.
| Variable | Description | Default |
|---|---|---|
FLATCAM_DATA_PATH |
The folder for the application data: the preferences, the Tools Database, the recent files lists, the log file, and the user preprocessors. |
~/.FlatCAM on Linux and macOS. On Windows, %APPDATA%\FlatCAM. |
| Code | Meaning |
|---|---|
| 0 | The run is done. |
| 1 | A Tcl command failed. |
| 2 | The command line is not valid, or the --shellfile is not readable. |
| N | The Tcl command exit N sets the code to N. |
-
Headless mode. Headless mode runs no window, no tray icon, and no update check. The order of the work is:
--shellvar, then--shellfile, then--command. Without--shellfileand--command, the Tcl commands are read from standard input one line at a time. -
Files in headless mode. The
FILEarguments do not open in headless mode. Use--shellfileor--commandto open files with Tcl commands. -
Error messages. In headless mode, a Tcl error writes an
ERROR Reportwith the script name and the Tcl error details to standard error. - Machine safety. On a critical error in headless mode, the program stops the connected machines before it ends. See GCode Sender.
-
Multiprocessing. The program starts worker processes. The option
--multiprocessing-forkis used by these workers. Do not use it by hand. - Tcl commands. The Tcl commands of the scripts are described in Tcl Command Reference. The Tcl scripting guide is Tcl Scripting.
- Tcl Scripting: writing the scripts that run in headless mode.
- Tcl Command Reference: the commands that a script can run.
-
Projects: opening and saving a
.FlatPrjfile. - Importing Files: the file types that open at startup.
- FAQ and Troubleshooting: startup problems.
FlatCAM Evo Manual · Source code · Report a problem · MIT license
Start here
- Installation
- Getting Started
- Tutorial: Single-Sided PCB
- Tutorial: Double-Sided PCB
- User Interface
- Keyboard Shortcuts
- Glossary
- FAQ and Troubleshooting
Files and projects
Objects
Editors
PCB operations
- Isolation Routing
- Non-Copper Clearing
- Paint
- Cutout
- Drilling
- Milling
- Follow
- Double-Sided
- Solder Paste
- Film
- Panelize
- Copper Thieving
- Fiducials
- Markers
- Punch Gerber
- Invert Gerber
- Etch Compensation
- Extract
- Rules Check
- QR Code
Utility plugins
- Align Objects
- Calculators
- Distance · Object Distance
- Optimal
- Move · Transform
- Subtract
- Image Import · PDF Import
- PCB Wizard
- Report
- Tcl Shell
Machine control (in development)
Advanced
- Tools Database
- Preprocessors
- Path Optimization
- Tcl Scripting
- Tcl Command Reference
- Developer Guide
- Translating
Preferences