--export-stls
Export one binary STL per loaded object into a caller-supplied directory (created single-level if needed), merging all instances of each object into one mesh per file and naming output files by per-model 1-based index and object name, without slicing.
Details
The flag accepts a directory path as its string value (not a boolean switch). When invoked, the CLI ensures any object lacking a placed instance gets one at the default origin, then iterates every model object in each loaded model and writes one .stl file per object into the specified directory, creating that directory first if it does not exist. No slicing takes place; this is a pure geometry-export action. Note that the directory is created with a single-level directory-creation call, so intermediate parent directories must already exist or the write will fail.
The per-object mesh that is exported is the fully-instance-merged result: all non-modifier volumes for the object are merged with their per-volume transforms applied, then every instance of the object is transformed and merged into a single mesh. Objects with multiple instances therefore produce one STL containing all copies fused together. Modifier volumes (such as support enforcers or paint-on regions) are excluded because only volumes classified as geometry parts contribute to the exported mesh. The STL is written in binary format.
Each output file is named obj_<N>_<objectname>.stl, where <N> is a 1-based counter that resets to 1 for each loaded model. When multiple input files are supplied, each file's objects are numbered independently starting from 1; the counter does not carry across input files. <objectname> is taken from the object's recorded name, falling back to the original input_file string if the name is empty. If the name string already ends in .stl the extension is not duplicated.
When a non-empty directory path is supplied, --outputdir is ignored. The --outputdir fallback (which appends a stl/ subdirectory under the outputdir value) is reached only if the resolved string value of this flag is empty. Because the compiled-in default is the literal string stl_path rather than an empty string, a command line invocation that omits an explicit value will write into a directory named stl_path in the working directory, not into the --outputdir path.
Watch out for
- ▲ Multiple instances of the same object collapse into one merged STL, not one file per instance. If your workflow requires one file per placed copy, split instances into separate objects before export.
- ▲ The sibling flag `--export-stl` (no trailing `s`) is a boolean flag that accepts no directory path argument. It also exports one STL per object rather than a single merged file; the distinction from `--export-stls` is that output paths are determined by the default path logic (writing under a `stl/` subdirectory relative to `--outputdir` or the working directory) rather than an explicit caller-supplied directory.
- ▲ The default value recorded in the config definition is the literal string `stl_path`, which will be used as the output directory name if no value is explicitly passed on the command line. Always supply an explicit path to avoid writing into a directory named `stl_path` in the working directory.
Sign up for free today
No credit card required. Connect unlimited printers and get production automation running in minutes.