Views > Capture
Viewpoints to Images
Saves an image of every viewpoint you choose (PNG or JPG, 720p to 4K or a custom size, named by template) into a dated folder with an index.html contact sheet. Your view comes back afterwards.
Status
Launched Ran inside Navisworks at least once with no error logged; nobody checked the result yet.
Related asks to confirm
No quote is on record yet. These threads look related, but a person still has to open and read them.
Events it listens to
None. It runs only when you click it.
Files
Paths are relative to the Playground.extension folder.
Views.tab/Capture.panel/Viewpoints_to_Images.pushbutton/bundle.yamlViews.tab/Capture.panel/Viewpoints_to_Images.pushbutton/icon.dark.pngViews.tab/Capture.panel/Viewpoints_to_Images.pushbutton/icon.pngViews.tab/Capture.panel/Viewpoints_to_Images.pushbutton/icon.small.dark.pngViews.tab/Capture.panel/Viewpoints_to_Images.pushbutton/icon.small.pngViews.tab/Capture.panel/Viewpoints_to_Images.pushbutton/script.py
Install
- Only this tool. In Navisworks, click pyNavis > Playground, search for Viewpoints to Images, tick it and click Install.
- The whole extension. Download
Playground.extension.zip, unzip it, put thePlayground.extensionfolder in%APPDATA%\pyNavis\extensions\, and click pyNavis > Reload. Viewpoints to Images is on the Views tab, Capture panel.
You need pyNavis 1.3.0 or later.
Tried it? Tell us whether it worked or not. That report is what moves a tool up the status ladder.
ReportSource
The tool's own files, word for word as published in pynavis/Playground. Paths are relative to the Playground.extension folder.
script.py
The script that runs on a click.
Views.tab/Capture.panel/Viewpoints_to_Images.pushbutton/script.py View on GitHub"""Saves an image of each chosen saved viewpoint, plus an index.html contact sheet, into a dated folder."""
from namo import capture, progress, reports, ui, vp_common
from pynavis import script, toast
TITLE = 'Viewpoints to Images'
REPORT = 'viewpoint_images'
def run():
document = vp_common.active_doc()
rows = vp_common.view_rows(document) if vp_common.has_models(document) else []
if not rows:
toast.info('No saved viewpoints', 'Save some viewpoints, then run Viewpoints to Images again.')
return
defaults = reports.default_config(REPORT)
defaults['open'] = True
cfg = script.get_config(defaults)
picked = vp_common.choose_views('%s: viewpoints' % TITLE, rows, cfg.get('views'), ok='Next')
if picked is None:
return
chosen, spec = picked
if not chosen:
toast.info('No viewpoints chosen', 'Tick at least one viewpoint, then run Viewpoints to Images again.')
return
fields = capture.image_fields(cfg, vp_common.default_folder(vp_common.doc_path(document)))
fields += [
{'kind': 'check', 'key': 'overlay', 'label': 'Include redlines and on-screen marks',
'default': cfg.get('overlay', False)},
{'kind': 'check', 'key': 'index_html', 'label': 'Write an index.html contact sheet',
'default': cfg.get('index_html', True)},
{'kind': 'check', 'key': 'open', 'label': 'Open it when done', 'default': cfg.get('open', True)},
]
values = ui.form(TITLE, fields, intro='%s chosen. The view comes back where it was afterwards.'
% vp_common.plural(len(chosen), 'viewpoint'), ok='Save images', width=500)
if values is None:
return
cfg = capture.image_values(cfg, values)
cfg.update({'views': spec, 'overlay': values['overlay'], 'index_html': values['index_html'],
'open': values['open']})
script.save_config(cfg)
result = progress.run(TITLE, lambda report: reports.run(REPORT, cfg, doc=document, interactive=True,
progress=report), 'Capturing')
if result is progress.CANCELLED or result.get('cancelled'):
return
toast.show(result['level'], result['message'], result['detail'])
if cfg.get('open') and result['level'] in ('success', 'warning'):
target = result.get('index') or result.get('folder')
if target:
try:
ui.open_path(target)
except Exception:
pass
run()
Library modules this tool uses
From the shared namo library, which installs with every tool. Each name opens the module on GitHub.
namo.captureImages in batches: saved viewpoints, clash results and Playground issues, plus the index.html contact sheet that goes with them.namo.progressGlue between pyNavis' cancellable progress window and Playground's progress callbacks.namo.reportsThe registry of automation-ready reports, and the helpers every report shares.namo.uiWPF building blocks for Playground tools, themed from the pyNavis design system.namo.vp_commonShared helpers for the Views tools (Viewpoints, Capture and Navigate panels).
bundle.yaml
The bundle contract: the keys pyNavis reads for this tool.
Views.tab/Capture.panel/Viewpoints_to_Images.pushbutton/bundle.yaml View on GitHubtitle: Viewpoints\nto Images
tooltip: Saves an image of every viewpoint you choose (PNG or JPG, 720p to 4K or a custom size, named by template) into a dated folder with an index.html contact sheet. Your view comes back afterwards.
context: viewpoints