print_export
Exports molecular structures as 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 OBJ exporter writes the whole visible scene, so each group is isolated on its own before export, then rebuilt into a single watertight, manifold solid. All groups share the same coordinate frame, so 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).
Requires the optional print extra (trimesh, pymeshlab); see the install
hint returned if the libraries are missing.
Args:
obj_name: PyMOL object to export (e.g. "1abc").
groups: Semicolon-separated label=selection pairs, one per colour.
Example: "protein=polymer.protein; nucleic=polymer.nucleic".
out_dir: Directory for the STL files (default: current directory).
method: "auto" (light cleanup if the export is already watertight,
else poisson with voxel fallback), "poisson" (keeps detail,
best for bulky chains), or "voxel" (robust for thin nucleic
acids).
voxel_pitch: Voxel size in Angstrom for the voxel method. Smaller keeps
more detail; 0.7 keeps a ~10 A helix intact.
poisson_depth: Screened-Poisson octree depth; higher = more detail.
representation: What geometry to export. "surface" (default,
unchanged) isolates each group as its own temp
object and exports its molecular surface. "cartoon"
exports the currently displayed cartoon geometry of
the real objects, preserving per-residue rep flags
and per-object cartoon type (e.g. a cartoon tube
spine from :func:print_ribbon_view). In cartoon
mode each group must name whole object(s) — one
colour per object (e.g. "1abc or 1abc_spine") — and
groups are isolated by toggling object visibility, no
temp objects.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| groups | Yes | ||
| method | No | auto | |
| out_dir | No | . | |
| obj_name | Yes | ||
| voxel_pitch | No | ||
| poisson_depth | No | ||
| representation | No | surface |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |