Project > Quality
Session Stats
Measures every appended model (file sizes, items, geometry items, primitives, fragments, extent, units, when it arrived and how long it took to load) in a table and a chart, and saves the table as an Excel workbook beside the document.
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
It needs these Navisworks event hooks, so installing it also copies the shared hooks folder:
doc-openedmodel-appended
Files
Paths are relative to the Playground.extension folder.
Project.tab/Quality.panel/Session_Stats.pushbutton/bundle.yamlProject.tab/Quality.panel/Session_Stats.pushbutton/icon.dark.pngProject.tab/Quality.panel/Session_Stats.pushbutton/icon.pngProject.tab/Quality.panel/Session_Stats.pushbutton/icon.small.dark.pngProject.tab/Quality.panel/Session_Stats.pushbutton/icon.small.pngProject.tab/Quality.panel/Session_Stats.pushbutton/script.py
Install
- Only this tool. In Navisworks, click pyNavis > Playground, search for Session Stats, 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. Session Stats 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/Session_Stats.pushbutton/script.py View on GitHub# -*- coding: utf-8 -*-
"""Measures every appended model: file sizes, items, geometry, primitives, fragments, extent and load time."""
from namo import mdl_output, mdl_stats, modelmgmt, progress, reports, rep_session_stats
from pynavis import app, output, toast
def run():
doc = app.get_doc()
if not modelmgmt.has_models(doc):
toast.info('No models to measure', 'Append models first.')
return
config = modelmgmt.report_config(doc, 'Session stats', rep_session_stats.default_config())
result = progress.run('Session Stats', lambda report: reports.run(
'session_stats', config, doc=doc, interactive=True, progress=report), 'Counting')
if result is progress.CANCELLED or result.get('cancelled'):
return
rows = result.get('rows') or []
if rows:
total = result['totals']
html = [mdl_output.heading('Session stats', 2),
mdl_output.kpis([('Models', total['models'], None), ('Items', total['items'], None),
('Geometry items', total['geometry'], None),
('Primitives', total['primitives'], None),
('Loaded files', modelmgmt.format_size(total['cache_bytes']), None)]),
mdl_output.table(mdl_stats.HEADERS, mdl_stats.table_rows(rows), numeric=[5, 6, 7, 8])]
if total['sampled']:
html.append(mdl_output.note('Primitives and fragments of the largest models are estimated from '
'a sample of their geometry items (see Note).'))
output.print_html(''.join(html))
ordered = sorted(rows, key=lambda r: -r['primitives'])[:20]
output.chart_bar([r['name'] for r in ordered], [r['primitives'] for r in ordered],
'Primitives per model' + (' (largest 20)' if len(rows) > 20 else ''))
for path in result.get('paths') or []:
output.print_html(mdl_output.path_line('Workbook:', path))
toast.show(result['level'], result['message'], result['detail'] or None)
run()
Library modules this tool uses
From the shared namo library, which installs with every tool. Each name opens the module on GitHub.
namo.mdl_outputOutput-window HTML for the Models, Quality and Publish tools (pure string building).namo.mdl_statsSession Stats: what each appended model weighs (files, items, geometry, primitives, fragments, extent) and when and how fast it arrived this session.namo.modelmgmtAppended models: listing, identifying, file freshness, batch append and model actions.namo.progressGlue between pyNavis' cancellable progress window and Playground's progress callbacks.namo.rep_session_statsSession Stats: one workbook row per appended model (files, items, geometry, primitives, fragments, extent, arrival and load time).namo.reportsThe registry of automation-ready reports, and the helpers every report shares.
bundle.yaml
The bundle contract: the keys pyNavis reads for this tool.
Project.tab/Quality.panel/Session_Stats.pushbutton/bundle.yaml View on GitHubtitle: Session\nStats
tooltip: Measures every appended model (file sizes, items, geometry items, primitives, fragments, extent, units, when it arrived and how long it took to load) in a table and a chart, and saves the table as an Excel workbook beside the document.
context: doc