Advanced Export Views
An automated state-machine exporter that cycles through GH Canvas States and Named Views.
Overview
An automated state-machine exporter that cycles through GH Canvas States and Named Views.
Inputs (17)
- Run (Boolean): Set to true to start the batch export.
- Views (Text): Names of the views to export. If empty, exports ALL named views.
- GH States (Text): Optional. List of GH Canvas State names to cycle through. Wire the 'Current GH State' output to your Canvas State Manager.
- Display Style (Text): Optional. Name of the Display Mode (e.g., 'Rendered').
- Layer State (Text): Optional. Name of the saved Layer State to restore.
- Directory (Text): Folder path to save the images.
- Prefix (Text): Prefix for the output filenames.
- Suffix (Text): Suffix for the output filenames.
- Format (Text): Image format: png, jpg, bmp, tiff.
- Width (Integer): Image width in pixels.
- Height (Integer): Image height in pixels.
- DPI (Integer): Print DPI metadata embedded into the image.
- Grid (Boolean): Show Grid.
- World Axes (Boolean): Show World Axes.
- CPlane Axes (Boolean): Show CPlane Axes.
- Transparent (Boolean): Transparent background (PNG only).
- Scale Items (Boolean): Scale line thicknesses and text sizes when capturing at high resolutions.
Outputs (3)
- Saved Files (Text): Paths to the exported image files.
- Current GH State (Text): Wire this into the 'Load Name' of the Canvas State Manager component.
- Info (Text): Component information.
Method, assumptions and simplifications
The same notes appear in the component's Info output.
Method
- On a rising edge of Run it stores all settings and starts a state machine. For each name in GH States (or once, if empty) it sets Current GH State (which holds the state being captured while a capture is pending and keeps the last exported state after the export ends), waits 500 ms, then captures every view in Views (all Named Views if empty; when Views is connected but empty a warning says so) from the active viewport with Rhino ViewCapture at Width × Height.
- Before capturing it optionally switches the active viewport to Display Style and restores the Layer State; afterwards it restores the original camera, display mode and layers.
- Files are named Prefix_State_View_Suffix.ext in Directory (Desktop if empty; created if missing); the DPI value is written as image metadata only.
Assumptions
- The 500 ms delay is long enough for the Canvas State Manager and the downstream definition to finish recomputing.
- Named views, display modes and layer states are matched by name (case-insensitive for display modes and layer states, Rhino lookup for views).
Simplifications and limits
- Unknown view names are skipped silently. DPI does not change pixel size; Transparent applies to PNG only.
- Output aspect is Width × Height; if it differs from the viewport aspect, ViewCapture shows more or less of the scene than the named view framed.
Workflow
- Create Named Views -> Views. GH States list -> GH States; Current GH State -> Load Name of a Canvas State Manager.
- Paper Size To Pixels (Add Default Controls menu) -> Width, Height, DPI. Saved Files -> GIF Compiler or Report Metrics Maps.