Dev > Build

Hotkey Manager

Gives any pyNavis button or Navisworks ribbon command a keyboard shortcut, or takes one away, and warns when two commands want the same keys. Click a command, click the shortcut field, then press the keys.

Tab and panelDev > Build
KindButton

Status

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

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.

  • Dev.tab/Build.panel/Hotkey_Manager.pushbutton/bundle.yaml
  • Dev.tab/Build.panel/Hotkey_Manager.pushbutton/icon.dark.png
  • Dev.tab/Build.panel/Hotkey_Manager.pushbutton/icon.png
  • Dev.tab/Build.panel/Hotkey_Manager.pushbutton/icon.small.dark.png
  • Dev.tab/Build.panel/Hotkey_Manager.pushbutton/icon.small.png
  • Dev.tab/Build.panel/Hotkey_Manager.pushbutton/script.py

Install

  1. Only this tool. In Navisworks, click pyNavis > Playground, search for Hotkey Manager, 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. Hotkey Manager is on the Dev tab, Build 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.

Dev.tab/Build.panel/Hotkey_Manager.pushbutton/script.py View on GitHub
# -*- coding: utf-8 -*-
"""Assigns and clears keyboard shortcuts for pyNavis buttons and Navisworks commands."""
from pynavis import toast

from namo import hotkeys, ribbon

if globals().get('__runner__'):
    toast.info('The Hotkey Manager needs the Navisworks window', 'It cannot open under pynavis run.')
else:
    state = hotkeys.load()
    if state['error']:
        toast.error('config.json cannot be read', state['error'])
    elif hotkeys.show(state):
        try:
            count, (added, changed, removed) = hotkeys.save(state)
        except (IOError, OSError, ValueError) as error:
            toast.error('The shortcuts were not saved', str(error))
        else:
            ribbon.reload()
            parts = []
            if count:
                parts.append('%d pyNavis button%s' % (count, '' if count == 1 else 's'))
            natives = added + changed + removed
            if natives:
                parts.append('%d Navisworks command%s' % (natives, '' if natives == 1 else 's'))
            toast.success('Shortcuts saved', 'Changed for %s. pyNavis reloaded.' % ' and '.join(parts))

Library modules this tool uses

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

  • namo.hotkeysHotkey Manager: one list of every command, with chords you can assign or clear.
  • namo.ribbonThe ribbon as data: every pyNavis button and every native Navisworks command, and safe ways to run them from code. Shared by the Command Palette, macros, the Hotkey Manager, usage analytics and the Environment Doctor.

bundle.yaml

The bundle contract: the keys pyNavis reads for this tool.

Dev.tab/Build.panel/Hotkey_Manager.pushbutton/bundle.yaml View on GitHub
title: Hotkey\nManager
tooltip: Gives any pyNavis button or Navisworks ribbon command a keyboard shortcut, or takes one away, and warns when two commands want the same keys. Click a command, click the shortcut field, then press the keys.