← API Guide / CLI and GUI execution

CLI and GUI execution

Export-only, headless native SolidCraft and authenticated live GUI batches.

Export without starting SolidCraft

python -m scpc examples/plate/model.py --out output/plate.json

This creates only the command JSON. It does not change any open GUI document and does not test SolidCraft's geometry engine.

Run the native command-line engine

python -m scpc examples/plate/model.py --run --save output/plate.sc
python -m scpc output/plate.json --run --save output/plate-replay.sc

--run requires the installed solidcraft-cli. Use --cli PATH if the CLI is not on PATH. --save is valid only with --run. SCPC executes the command list through SolidCraft with native strict parameter checking and propagates errors.

Apply commands to the open desktop GUI

python -m scpc examples/plate/model.py --connect
python -m scpc output/plate.json --connect

This sends the ordered commands as one authenticated engine.batch request to an already running SolidCraft desktop process, operating on its current design. Enable Preferences → Assistant → Let AI agents connect in SolidCraft. SCPC does not launch the app, create or clear a document, or save the active file automatically.

SCPC requests param_check=strict and rollback=true for the batch. If a step fails, the native error and reported rollback result are shown. If a request times out, the GUI operation may still be running: check the open document before attempting the same batch again.

Call the same functions directly from Python

from scpc import run_cli, send_batch

run_cli(script, save="output/plate.sc")
send_batch(script.commands)
Different execution modes: --out is offline serialisation; --run is a separate native headless session; --connect changes the currently open GUI document. Choose the mode intentionally.