pyboxbuilder.run

pyboxbuilder.run(project: Project, out_dir: str | Path = 'output/', *, show_lids: bool = False, lids_only: bool = False, remove_layers: int = 0, only: str | collections.abc.Sequence[str] | None = None, argv: collections.abc.Sequence[str] | None = None) → None[source]

Preview a project, or export it when asked for files.

Put this under an example’s if __name__ == "__main__": and the same file does the right thing in the PythonSCAD GUI, in a notebook, under make, and on the command line:

if __name__ == "__main__":
    run(project)
Parameters:
project: Project

The project to preview or export.

out_dir: str | Path = 'output/'

Where an export writes; files land under {out_dir}/{project name}/. --out overrides it.

show_lids: bool = False

Show lids by default in a preview. Off by default, since a lid covers the compartments a packing preview exists to show; --lids turns it on for one run.

lids_only: bool = False

Show the lids without their bodies.

remove_layers: int = 0

Omit the top N layers in the preview to see underneath.

only: str | collections.abc.Sequence[str] | None = None

Only preview/export this box label (or list of labels).

argv: collections.abc.Sequence[str] | None = None

Command-line arguments; None reads sys.argv.

Raises:

SystemExit – If the arguments are malformed, as argparse does.