Project > Models

Stale Files

Compares every model's loaded file (the NWC) with its source file and lists the models whose source was saved later, whose file is missing, or whose source is not on this computer. Shift+Click to check automatically whenever a model opens.

Tab and panelProject > Models
KindButton
Live whenA model is open

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.

Recorded on 2026-10-09. The evidence is a pynavis run transcript.

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

It needs these Navisworks event hooks, so installing it also copies the shared hooks folder:

  • doc-opened

Files

Paths are relative to the Playground.extension folder.

  • Project.tab/Models.panel/Stale_File_Alert.pushbutton/bundle.yaml
  • Project.tab/Models.panel/Stale_File_Alert.pushbutton/config.py
  • Project.tab/Models.panel/Stale_File_Alert.pushbutton/icon.dark.png
  • Project.tab/Models.panel/Stale_File_Alert.pushbutton/icon.png
  • Project.tab/Models.panel/Stale_File_Alert.pushbutton/icon.small.dark.png
  • Project.tab/Models.panel/Stale_File_Alert.pushbutton/icon.small.png
  • Project.tab/Models.panel/Stale_File_Alert.pushbutton/script.py

Install

  1. Only this tool. In Navisworks, click pyNavis > Playground, search for Stale Files, tick it and click Install.
  2. The whole extension. Download Playground.extension.zip, unzip it, put the Playground.extension folder in %APPDATA%\pyNavis\extensions\, and click pyNavis > Reload. Stale Files is on the Project tab, Models 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.

Report

Source

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/Models.panel/Stale_File_Alert.pushbutton/script.py View on GitHub
# -*- coding: utf-8 -*-
"""Compares every model's loaded file with its source file and lists what is out of date or missing."""
from namo import hk_stalecheck, mdl_output, modelmgmt, rep_stale_files

from pynavis import app, output, toast


def run():
    doc = app.get_doc()
    if not modelmgmt.has_models(doc):
        toast.info('No models to check', 'Append models first.')
        return
    config = hk_stalecheck.load_config()
    rows = modelmgmt.stale_rows(doc, tolerance=config['tolerance_seconds'])
    level, message, detail = modelmgmt.stale_summary(rows)
    late = sum(1 for r in rows if r['status'] == modelmgmt.OUT_OF_DATE)
    lost = sum(1 for r in rows if r['status'] in (modelmgmt.CACHE_NOT_FOUND, modelmgmt.CACHE_OFFLINE))
    elsewhere = sum(1 for r in rows if modelmgmt.STATUS_LEVEL.get(r['status']) == 'info')
    table = rep_stale_files.table_rows(rows)
    shown = [[mdl_output.chip(r['level'], r['status']), t[0], t[2], t[4], t[5], t[7]]
             for r, t in zip(rows, table)]
    html = [mdl_output.heading('Stale files', 2),
            mdl_output.kpis([('Models', len(rows), None), ('Out of date', late, 'warn' if late else None),
                             ('Not found', lost, 'fail' if lost else None),
                             ('No source here', elsewhere, None)]),
            mdl_output.table(['Status', 'Model', 'File time', 'Source time', 'Source newer by', 'Detail'],
                             shown, raw=set([0]), numeric=[])]
    if late:
        html.append(mdl_output.note('Refresh (Home > Refresh, or Refresh changed in Source Files) '
                                    'loads the newer source files.'))
    output.print_html(''.join(html))
    toast.show(level, message, detail)


run()

config.py

The Shift+Click action.

Project.tab/Models.panel/Stale_File_Alert.pushbutton/config.py View on GitHub
# -*- coding: utf-8 -*-
"""Options for Stale File Alert: check whenever a model opens, and how much clock difference to ignore."""
from namo import hk_stalecheck, ui

from pynavis import settings, toast


def run():
    values = hk_stalecheck.load_config()
    fields = [
        {'kind': 'check', 'key': 'check_on_open', 'default': values['check_on_open'],
         'label': 'Check the files whenever a model opens, and warn only when something is out of date'},
        {'kind': 'number', 'key': 'tolerance_seconds', 'label': 'Ignore differences up to',
         'default': values['tolerance_seconds'], 'min': 0.0, 'max': 86400.0, 'suffix': 's',
         'hint': 'File servers round times; 2 s covers that. Raise it when clocks between servers drift.'},
    ]
    answer = ui.form('Stale File Alert', fields, ok='Save')
    if answer is None:
        return
    values.update(answer)
    if values['tolerance_seconds'] is None:
        values['tolerance_seconds'] = 2.0
    try:
        settings.save(hk_stalecheck.TOOL, values)
    except (IOError, OSError) as error:
        toast.error('Could not save the options', str(error))
        return
    toast.success('Stale File Alert options saved',
                  'Checks every model that opens.' if values['check_on_open'] else 'Checks only when you click.')


run()

Library modules this tool uses

From the shared namo library, which installs with every tool. Each name opens the module on GitHub.

  • namo.hk_stalecheckStale File Alert handler: when a document opens and 'Check when a model opens' is on (Stale File Alert's Shift+Click, off by default), compares every model's loaded file with its source and toasts only when something is out of date or missing.
  • namo.mdl_outputOutput-window HTML for the Models, Quality and Publish tools (pure string building).
  • namo.modelmgmtAppended models: listing, identifying, file freshness, batch append and model actions.
  • namo.rep_stale_filesStale File Alert: every appended model's loaded file against its source file, as a workbook (model, file times, age difference, status).
  • 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/Models.panel/Stale_File_Alert.pushbutton/bundle.yaml View on GitHub
title: Stale\nFiles
tooltip: Compares every model's loaded file (the NWC) with its source file and lists the models whose source was saved later, whose file is missing, or whose source is not on this computer. Shift+Click to check automatically whenever a model opens.
context: doc