Skip to content

Command line

Christos Georgiou edited this page Nov 25, 2026 · 4 revisions

Command line

Advanced topic. This page is for technical readers.

The cgeocad program also works in a terminal, without the window. Use it to export, slice or make photos of many models in a script.

Open the window

cgeocad model.scad              # open in the Model tab
cgeocad --optimize model.scad   # open in the Optimize tab
cgeocad --render model.scad     # open in the Render tab

The names before 0.7, --slice and --photo, also work.

Commands without the window

Command Action
cgeocad params FILE.scad List the Customizer parameters. A part list shows the part names of the model definition.
cgeocad sets FILE.scad List the parameter sets of FILE.yml. With --json, write them in the format of the OpenSCAD Customizer, for openscad -p.
cgeocad export FILE.scad -o OUT Build and write OUT. The extension sets the format: .stl, .3mf or .step. STL and 3MF get the print plate, STEP gets the model as built.
cgeocad slice FILE.scad Slice the plate and show the estimates
cgeocad photo FILE.scad -o OUT.png Make a path traced photo from the iso view. It uses all CPU cores, not the GPU.
cgeocad parts-list FILE.scad Write the parts list of a model with the CgeoCAD library: the amounts in the groups buy, cut, print and own, as Markdown. With --csv, as a CSV table. With --mode net or --mode buy, the rows with their prices and the total. A row without a price does not count as 0: the last line gives their number.
cgeocad checks FILE.scad Write the checks of the model, one on each line. The exit code is 1 when a check is a warning.
cgeocad plugin list [FILE.scad] List the builtin and the installed plugins with their versions. With a file: the version of each plugin that the model uses.
cgeocad plugin install PACKAGE|ID --index FOLDER|FILE [--key FILE] Install a plugin package from a local index or folder (installed plugins). It checks the SHA-256, the signature, the contract version and the SCAD library. ID@^0.2 gives a range. Without --key, the key is plugin-key.pub in the settings folder. It changes no model.
cgeocad plugin update [ID] FILE.scad [--back] Use the newest version that CgeoCAD has for this model only, or go one version back. Without ID: all plugins of the model.
cgeocad plugin remove ID [VERSION] Remove an installed version, or all installed versions.
cgeocad plugin dev FOLDER [FILE.scad] [--wasm FILE] Load a plugin from a folder. It tells the changed files since the last call and the warnings of the SCAD check. With a model: run the analysis of the plugin on it once and write the JSON. See Plugin development.
cgeocad run PLUGIN ACTION FILE.scad Build the model and run an action of a plugin that the model includes, for example cut_plan of slotted-angle. Writes the JSON answer. --json writes it on one line. --input JSON gives more input to the action.
cgeocad documents FILE.scad -o DIR Write all documents of the plugins that the model includes to DIR: the beam cut list, the sheet plan, the panel drawings (PDF and DXF) and the shopping list.
cgeocad mcp Serve MCP on stdin and stdout. See MCP reference.
cgeocad gpu-test [-o OUT.png] Draw a test scene without a window with the renderer of the 3D view. It checks that the picture is not empty and names the graphics adapter. The exit code is 3 ("not tested") when the computer has no Vulkan, Metal or DirectX 12 adapter. CGEOCAD_GPU_ADAPTER selects an adapter by a part of its name.
cgeocad --help Show the usage text
cgeocad --version Show the version

export, slice, photo, parts-list, checks, run, documents and mcp stop with an error when the OpenSCAD binary has no Manifold backend. The error shows the install steps. params does not run OpenSCAD.

Examples

cgeocad params model.scad
cgeocad export model.scad -o model.3mf -D width=80 -D 'shape="square"'
cgeocad export model.scad -o big.stl -P big           # saved set 'big' from model.yml
cgeocad sets model.scad --json > sets.json            # the sets for openscad -p sets.json -P big
cgeocad export model.scad -o box.3mf --chamfer --teardrops --bridges=stepped --brim
cgeocad export model.scad -o box.stl --bed 250x210x220
cgeocad export model.scad -o lid.stl --part Lid --orient auto
cgeocad export model.scad -o model.stl --as-built     # the whole model, as before 0.7
cgeocad export badge.scad -o badge.3mf --for orca     # multicolor 3MF for OrcaSlicer
cgeocad slice model.scad --layer-height 0.2 --infill 20 --walls 3
cgeocad parts-list shelf.scad --csv > parts.csv        # the parts list as a table
cgeocad checks shelf.scad || echo "the model has warnings"
cgeocad parts-list rack.scad --mode buy                # the cost of whole packs and beams
cgeocad run slotted-angle cut_plan rack.scad --json    # the beam cut plan as JSON
cgeocad documents cabinet.scad -o out/                 # cut lists, sheet plan, drawings
cgeocad photo model.scad -o model.png --size 1600x1200 --samples 256 --color eb6f40 --finish satin --layer-lines

Parameter values

Option Action
-P SET Apply a saved parameter set
-p FILE Read the sets from FILE: a model definition (.yml) or a .json file of the OpenSCAD Customizer. Without -p, the command uses <model>.yml, else <model>.json.
-D name=value Set one parameter. You can use it more than once. These values apply after the set.

Print options of export and slice

export and slice do the same print preparation as the Optimize tab. They start from the Optimize values that the app stored for the model: the print area, the fixes, the parts, the orientations and the splits. When the app stored no values, they start from the defaults: all parts, the rotation of the model, all fixes off, and the print area of File > Settings > Printer. The options below change these values for this run only.

Option Action
--part NAME or --part all Only this print part, or all print parts. A part that you turned off in the app is printed when you name it.
--bed WxDxH The print area in mm, for example --bed 250x210x220
--orient model or --orient auto The orientation of all parts: the rotation of the model, or the best face
--chamfer or --chamfer=MM Bed chamfer. 0.4 mm by default. --chamfer=0 turns it off.
--teardrops Teardrop holes
--bridges or --bridges=sacrificial or --bridges=stepped Bridge fixes, with the fix for a hole above a bridge
--brim Brim on small bed islands
--ears Mouse ears on the sharp bed corners of large parts
--holes or --holes=MM Hole size: vertical round holes get their diameter plus MM. 0.2 mm by default.
--no-fixes All stored fixes off. The fix options above still turn a fix on.
--as-built The model as built, without the print preparation, as before 0.7. With --part NAME, only that part, in its place in the model.

All print parts go on one plate, in one file. The print area sets the fit of each part and the splits. When the parts need more room than the bed and each part fits, the report shows a note. Your slicer arranges the parts on its plates. Version 0.7 had more plates and a --plate option. This option now gives an error.

The command line cannot split a part. It uses the splits that you made in the app. A part that is too large for the print area is on the plate, but your printer cannot print it. The report tells you to split it in the Optimize tab.

export and slice write a report on stderr: the parts, the print parts with their sizes, the copies on the plate, the fixes and the problems of the check.

Options of export

Option Action
-o OUT The output file
--for prusa or --for orca Write a multicolor 3MF for that slicer. See Multicolor prints. The print options do nothing with --for.

STEP always gets the model as built. With --part NAME, the STEP file has only that part. The print options do nothing for STEP.

A 3MF plate has one object for each print part and one build item for each copy.

Options of slice

Option Action
--layer-height MM Layer height in mm
--first-layer MM First layer height in mm
--line-width MM Line width in mm
--infill PCT Infill in percent
--walls N Number of walls
--solid-layers N Number of solid layers at the top and the bottom
--speed MM_S Print speed in mm/s

slice slices all parts on the plate as one job. The layer heights also set the steps of the bed chamfer, the brim and the sacrificial layers, for export too.

Options of photo

Option Default Action
-o OUT.png The output file
--size WxH 1600x1200 Image size in pixels
--samples N 128 Samples per pixel
--color RRGGBB ff9300 Plastic color
--finish matte|satin|gloss satin Finish
--studio dark|light dark Backdrop
--layer-lines off Show print layer lines

photo shows the model as built, not the print plate.

Projects

A project is a .cgeocad file with many objects. See Projects and Project file. The window cannot open a project yet: cgeocad FILE.cgeocad shows a message.

cgeocad project new room.cgeocad --title "Storage room"
cgeocad project add room.cgeocad models/rack.scad --at 0,0,0 -D bays=2
cgeocad project add room.cgeocad box:400x300x250 --id crate --at 1500,50,0
cgeocad project check room.cgeocad
cgeocad parts-list room.cgeocad --include-plugins
cgeocad checks room.cgeocad --scene room --include-plugins
cgeocad export room.cgeocad -o room.glb --include-plugins
cgeocad export room.cgeocad -o room.zip
Command Action
project new FILE.cgeocad [--title T] Writes a new empty project with one scene main. The file must not exist.
project add FILE.cgeocad SOURCE Adds an object and shows it in the first scene. SOURCE is a .scad, .stl or .3mf file, or box:WxDxH in mm. The path in the project file is relative to the project file.
project check FILE.cgeocad Reads the project, finds the files of the objects and checks the plugins and the lock file. It builds nothing. The exit code is 1 when a file does not read, a file of an object is missing, a plugin is not available or the lock file does not fit.
parts-list FILE.cgeocad The parts list of the visible objects of the scene: equal rows of all objects are joined. Markdown, or CSV with --csv.
checks FILE.cgeocad The checks of all visible objects, the findings of the plugins, and a warning when two scenes show one object with different parts. The exit code is 1 when a check is a warning.
export FILE.cgeocad -o OUT.glb The visible scene as a GLB file with the materials. Each different part is in the file one time, each copy is a node.
export FILE.cgeocad -o OUT.zip The package: the project folder as one zip with the SCAD libraries that the models use.

Options of project add:

Option Action
--id ID The object id. Default: from the name or the file name.
--name N The name that CgeoCAD shows.
--at x,y,z The place in mm.
--turn x,y,z The turn in degrees about x, then y, then z.
--set NAME A parameter set of the model definition.
--material M A material of the project.
-D name=value A parameter value of a .scad object. CgeoCAD checks it against the parameter.

Options of parts-list, checks and export for a project:

Option Action
--scene ID The scene. Default: the first scene.
--include-plugins Includes the plugins that the project lists. Without it, a model that uses a plugin library does not build.

A project file can come from another person, and plugins run code. Thus CgeoCAD includes the plugins of a project only with --include-plugins. The lock file does not include them: it can come in a package from another person too. Use the option only for files that you trust.

Environment

Variable Action
OPENSCAD The OpenSCAD binary. It overrides the saved setting.
OPENSCAD_ARGS Extra OpenSCAD arguments. It overrides the saved setting.

The commands use the settings of the app. See OpenSCAD engine and files.

Notes

  • The commands params, export, slice and photo send no analytics and no error reports. See Privacy.
  • On Windows, a release build opens no console window. The commands write to the console that started them.

Clone this wiki locally