print_export
Exports a structure as aligned, watertight STL files, one per colour group, for multi-colour 3D printing.
Instructions
Exports a structure as watertight STL files ready for multi-colour 3D printing.
Each colour group becomes one STL file. PyMOL's exporters write the whole visible scene, so each group is isolated on its own before export, then rebuilt into a watertight solid. Every STL is written in PyMOL model coordinates (Å, the numbers get_coords reports) whatever the camera view, so groups from one call, or from separate calls, line up; the camera is left as it was. A slicer can load them as aligned multi-material parts (e.g. add the second STL as a "part" of the first in Bambu Studio).
representation="displayed" prints what PyMOL shows, sticks and spheres included; "cartoon" keeps to cartoon and surface triangles and names what it left out. A group keeps every separate piece (two chains that do not touch print as two pieces) unless bodies="largest". The voxel method's growth of about 0.62 voxel per surface is undone unless undo_voxel_growth=False, but gaps narrower than about 2.5 voxels fuse while voxelising and cannot be reopened: a clearance needs voxel_pitch <= gap / 2.5.
STL has no units and slicers read it as millimetres, so mm_per_angstrom
sets the print size. The result gives each part's size in mm and warns about
any part small enough for a slicer to take for inches and enlarge 25.4x.
Requires the optional print extra (trimesh, pymeshlab, manifold3d); see
the install hint returned if the libraries are missing.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| bodies | No | "all" (default) keeps every separate piece of a group, e.g. both dimers of 4hhb's ribbon or all four hemes, and the result says it prints as N pieces. "largest" keeps only the biggest piece and reports what it dropped, with a WARNING when that is over 1% of the volume. Either way enclosed cavities are filled and stray fragments under 8 faces removed. | all |
| groups | Yes | Semicolon-separated ``label=selection`` pairs, one per colour. Example: "protein=polymer.protein; nucleic=polymer.nucleic". In cartoon and displayed modes each group names whole objects, e.g. "barrel=(barrel or barrel_spine)". | |
| method | No | "auto" (light cleanup if the export is already watertight apart from stray fragments, else poisson with voxel fallback), "poisson" (keeps detail, best for bulky surfaces; cannot merge sticks and spheres), or "voxel" (robust for thin cartoons, tubes and nucleic acids). | auto |
| out_dir | No | Directory for the STL files (default: current directory). | . |
| obj_name | Yes | PyMOL object the groups are taken from (e.g. "1abc"); the STL files are named after it. | |
| voxel_pitch | No | Voxel size in Ångström for the voxel method; it stays in Å whatever mm_per_angstrom is. Use about one third of the thinnest feature you need to keep: 0.7 keeps a ~10 Å helix, print_ribbon_view ribbons want 0.2, thin rods 0.1. The result warns when a displayed cartoon feature is under 3 voxels across. Halving it costs about 5x the time. | |
| poisson_depth | No | Screened-Poisson octree depth; higher = more detail. | |
| representation | No | What geometry to export. "surface" (default) isolates each group as its own temporary object and exports its molecular surface. "cartoon" exports the cartoon and surface triangles the group's objects *display*, keeping per-residue rep flags and per-object cartoon type (e.g. a `cartoon tube` spine from print_ribbon_view); it leaves out sticks, spheres, lines and dashes and names what it left out. "displayed" exports everything PyMOL draws for the group's objects: those triangles plus sticks, spheres, lines, ribbon and distance dashes (as solid rods), merged exactly. In cartoon and displayed modes groups are isolated by object visibility, so each group names whole object(s), one colour per object (e.g. "1abc or 1abc_spine"); name measurement and CGO objects in the group too. | surface |
| mm_per_angstrom | No | Print scale in millimetres per Ångström. 1.0 (default) prints 1 Å as 1 mm; 3.0 makes a 40 Å protein 120 mm across. Applied after repair to every group about the same origin, so the parts stay aligned; voxel_pitch stays in Å. Raise it when the result warns that a part is small enough for a slicer to mistake it for inches. | |
| undo_voxel_growth | No | Voxel method only: move every surface back in by 0.62 x voxel_pitch, the amount voxelising grows it (a 0.33 Å rod came out 0.38 Å at 0.1 Å pitch). Default true. Gaps narrower than about 2.5 x voxel_pitch fuse while voxelising and cannot be reopened, so where a clearance matters use voxel_pitch <= gap / 2.5. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |