Project > Quality
Preflight
Checks the document is ready to share against a profile: saved, models current, clash tests run after the newest models, no stray hidden items, overrides or section. Shift+Click to edit the profiles.
Status
Launched Ran inside Navisworks at least once with no error logged; nobody checked the result yet.
Ran headless under pynavis run against a sample model; no selection: ran to the end (wrote output); result not checked by a person.
The public ask
No public source is on record for this tool.
Events it listens to
None. It runs only when you click it.
Files
Paths are relative to the Playground.extension folder.
Project.tab/Quality.panel/Preflight.pushbutton/bundle.yamlProject.tab/Quality.panel/Preflight.pushbutton/config.pyProject.tab/Quality.panel/Preflight.pushbutton/icon.dark.pngProject.tab/Quality.panel/Preflight.pushbutton/icon.pngProject.tab/Quality.panel/Preflight.pushbutton/icon.small.dark.pngProject.tab/Quality.panel/Preflight.pushbutton/icon.small.pngProject.tab/Quality.panel/Preflight.pushbutton/script.py
Install
- Only this tool. In Navisworks, click pyNavis > Playground, search for Preflight, 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. Preflight is on the Project tab, Quality 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.
Project.tab/Quality.panel/Preflight.pushbutton/script.py View on GitHub# -*- coding: utf-8 -*-
"""Checks the document against a preflight profile and lists every check as pass, warning or fail."""
from pynavis import forms, output, script, toast
from namo import preflight, progress
def run():
config = script.get_config({'profile': preflight.DEFAULT_NAME})
names = preflight.profile_names()
name = names[0]
if len(names) > 1:
last = config.get('profile') if config.get('profile') in names else names[0]
name = forms.select_from_list(names, title='Preflight',
prompt='Check the document against which profile?',
checked=[last])
if name is None:
return
profile = preflight.load_profile(name)
if profile is None:
toast.error('Profile %s is gone' % name, 'Pick another profile, or save one with Shift+Click.')
return
checks = progress.run('Preflight', lambda report: preflight.run_profile(profile, progress=report),
'Reading the models')
if checks is progress.CANCELLED:
return
script.save_config({'profile': name})
output.print_html(preflight.output_html(checks, profile['name'], preflight.document_name()))
level, message, detail = preflight.toast_text(checks)
toast.show(level, message, detail)
run()
config.py
The Shift+Click action.
Project.tab/Quality.panel/Preflight.pushbutton/config.py View on GitHub# -*- coding: utf-8 -*-
"""Edits, creates and deletes preflight profiles (shared with the team when Playground uses a shared folder)."""
from pynavis import forms, toast
from namo import preflight, ui
NEW = '__new_profile__'
def run():
items = []
for name in preflight.profile_names():
built_in = name == preflight.DEFAULT_NAME and not preflight.is_saved(name)
items.append(('%s (built in)' % name if built_in else name, name))
items.append(('New profile', NEW))
picked = forms.select_from_list(items, title='Preflight profiles',
prompt='Pick a profile to edit, or start a new one.')
if picked is None:
return
if picked == NEW:
base = preflight.normalize_profile(preflight.DEFAULT_PROFILE)
base['name'] = 'New profile'
existing = False
else:
base = preflight.load_profile(picked) or preflight.normalize_profile(preflight.DEFAULT_PROFILE)
existing = preflight.is_saved(picked)
label = ('Go back to the built-in Standard profile' if picked == preflight.DEFAULT_NAME
else 'Delete this profile')
values = ui.form('Preflight profile', preflight.profile_form_fields(base, existing, label),
ok='Save', width=520)
if values is None:
return
if values.get('delete'):
preflight.delete_profile(picked)
if picked == preflight.DEFAULT_NAME:
toast.success('Standard is back to the built-in checks')
else:
toast.success('Deleted profile %s' % picked)
return
profile = preflight.profile_from_form(values, base)
try:
stored = preflight.save_profile(profile)
except (IOError, OSError, ValueError) as error:
toast.error('Could not save the profile', str(error))
return
detail = '%s.' % preflight.describe_profile(profile)
if existing and stored.lower() != str(picked).lower():
detail += ' %s is still there under its old name.' % picked
toast.success('Saved profile %s' % stored, detail)
run()
Library modules this tool uses
From the shared namo library, which installs with every tool. Each name opens the module on GitHub.
namo.preflightPreflight: is this document ready to share? A profile of checks, each pass, warn or fail.namo.progressGlue between pyNavis' cancellable progress window and Playground's progress callbacks.namo.uiWPF building blocks for Playground tools, themed from the pyNavis design system.
bundle.yaml
The bundle contract: the keys pyNavis reads for this tool.
Project.tab/Quality.panel/Preflight.pushbutton/bundle.yaml View on GitHubtitle: Preflight
tooltip: Checks the document is ready to share against a profile: saved, models current, clash tests run after the newest models, no stray hidden items, overrides or section. Shift+Click to edit the profiles.
context: doc