Model > Select

History

Lists the selections made in this model (time, item count, main category) and restores the one you choose. Shift+Click for settings.

Tab and panelModel > Select
KindButton
Live whenA model is open

Status

Untested Never executed inside Navisworks. Passed the headless checks only.

The public ask

No public source is on record for this tool.

Installs with

History sits in a stack, so installing it also installs:

Events it listens to

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

  • selection-changed

Files

Paths are relative to the Playground.extension folder.

  • Model.tab/Select.panel/History.stack/History_List.pushbutton/bundle.yaml
  • Model.tab/Select.panel/History.stack/History_List.pushbutton/config.py
  • Model.tab/Select.panel/History.stack/History_List.pushbutton/icon.dark.png
  • Model.tab/Select.panel/History.stack/History_List.pushbutton/icon.png
  • Model.tab/Select.panel/History.stack/History_List.pushbutton/icon.small.dark.png
  • Model.tab/Select.panel/History.stack/History_List.pushbutton/icon.small.png
  • Model.tab/Select.panel/History.stack/History_List.pushbutton/script.py

Install

  1. Only this tool. In Navisworks, click pyNavis > Playground, search for History, 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. History is on the Model tab, Select 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.

Model.tab/Select.panel/History.stack/History_List.pushbutton/script.py View on GitHub
# -*- coding: utf-8 -*-
"""Lists the selections made in this model and restores the one you choose."""
from pynavis import toast

from namo import sel_history, ui

if not sel_history.settings().get('enabled', True):
    toast.show(*sel_history.OFF)
else:
    history = sel_history.sync()
    if not history['states']:
        toast.show(*sel_history.EMPTY)
    else:
        picked = ui.choose('Selection History', sel_history.list_rows(history),
                           ['#', 'Time', 'Items', 'Mostly', ''], multiselect=False,
                           checked=[history['cursor']], ok='Restore', width=600, height=520,
                           prompt='Newest first. Back (Alt+Left) and Forward (Alt+Right) step through '
                                  'the same list.')
        if picked is not None:
            index = picked[0]
            resolved, missing = sel_history.restore(history, index)
            message, detail = sel_history.describe(history, index, resolved, missing)
            if history['states'][index]['count'] and not resolved:
                toast.warning(message, 'None of its items are in the model any more.')
            else:
                toast.show('warning' if missing else 'success', message, detail)

config.py

The Shift+Click action.

Model.tab/Select.panel/History.stack/History_List.pushbutton/config.py View on GitHub
# -*- coding: utf-8 -*-
"""Options for Selection History: record selections, record clearing, clear the history."""
from pynavis import toast

from namo import sel_history, ui

current = sel_history.settings(refresh=True)
values = ui.form('Selection History', [
    {'kind': 'check', 'key': 'enabled', 'label': 'Record selections as I make them',
     'default': current['enabled']},
    {'kind': 'check', 'key': 'record_empty', 'label': 'Also record clearing the selection',
     'default': current['record_empty']},
    {'kind': 'separator'},
    {'kind': 'check', 'key': 'clear', 'label': "Clear this model's history now", 'default': False},
], ok='Save', width=440)
if values is not None:
    saved = sel_history.save_settings(values)
    dropped = sel_history.clear() if values['clear'] else None
    detail = 'Recording is %s.' % ('on' if saved['enabled'] else 'off')
    if dropped is not None:
        detail += ' Cleared %d recorded %s.' % (dropped, 'selection' if dropped == 1 else 'selections')
    toast.success('Saved', detail)

Library modules this tool uses

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

  • namo.sel_historySelection History: every selection recorded per document, Back / Forward / History.
  • 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.

Model.tab/Select.panel/History.stack/History_List.pushbutton/bundle.yaml View on GitHub
title: History
tooltip: Lists the selections made in this model (time, item count, main category) and restores the one you choose. Shift+Click for settings.
context: doc