Model > Inspect
Selection HUD
Shows a small readout in the bottom-left corner of the Navisworks window: how many items and objects are selected, from which models, the top categories, and a summed property when you set one. Shift+Click for settings.
Status
Untested Never executed inside Navisworks. Passed the headless checks only.
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.
Model.tab/Inspect.panel/Selection_HUD.toggle/bundle.yamlModel.tab/Inspect.panel/Selection_HUD.toggle/config.pyModel.tab/Inspect.panel/Selection_HUD.toggle/icon.dark.pngModel.tab/Inspect.panel/Selection_HUD.toggle/icon.off.dark.pngModel.tab/Inspect.panel/Selection_HUD.toggle/icon.off.pngModel.tab/Inspect.panel/Selection_HUD.toggle/icon.on.dark.pngModel.tab/Inspect.panel/Selection_HUD.toggle/icon.on.pngModel.tab/Inspect.panel/Selection_HUD.toggle/icon.pngModel.tab/Inspect.panel/Selection_HUD.toggle/icon.small.dark.pngModel.tab/Inspect.panel/Selection_HUD.toggle/icon.small.pngModel.tab/Inspect.panel/Selection_HUD.toggle/script.py
Install
- Only this tool. In Navisworks, click pyNavis > Playground, search for Selection HUD, 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. Selection HUD is on the Model tab, Inspect 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.
Model.tab/Inspect.panel/Selection_HUD.toggle/script.py View on GitHub# -*- coding: utf-8 -*-
"""Turns the Selection HUD on and off: a live readout of the selection in the corner of the window."""
from pynavis import script, toast
from namo import hud, ui
DEFAULTS = {'sum_property': ''}
def run():
if ui.is_runner():
toast.info('The Selection HUD needs the Navisworks window', 'It cannot open under pynavis run.')
return
# The window decides, not the button's own on/off state, so the two can never
# disagree (after a Reload the button forgets while the HUD is still showing).
if hud.is_running():
hud.stop()
script.set_toggle_state(False)
toast.info('Selection HUD off')
return
config = script.get_config(DEFAULTS)
try:
hud.start(config, ui.pinned_logger())
except Exception as error:
hud.stop()
script.set_toggle_state(False)
toast.error('Could not show the Selection HUD', str(error))
return
script.set_toggle_state(True)
detail = 'Bottom left of the Navisworks window. Click again to hide it.'
if config.get('sum_property'):
detail = 'It also sums %s. Click again to hide it.' % config['sum_property']
toast.info('Selection HUD on', detail)
run()
config.py
The Shift+Click action.
Model.tab/Inspect.panel/Selection_HUD.toggle/config.py View on GitHub# -*- coding: utf-8 -*-
"""Chooses the property the Selection HUD sums over the selected objects."""
from pynavis import script, toast
from namo import data_common, hud, propindex, ui
DEFAULTS = {'sum_property': ''}
NOTHING = '(nothing)'
def run():
if ui.is_runner():
toast.info('Settings need the Navisworks window', 'They cannot open under pynavis run.')
return
values = script.get_config(DEFAULTS)
rows = [{'cells': ['Sum nothing', '', ''], 'value': NOTHING}]
if data_common.has_models():
has_selection = data_common.selected_count() > 0
for category, prop, count in propindex.property_choices(scope='selection' if has_selection else 'model'):
rows.append({'cells': [category, prop, count], 'value': propindex.pair_text(category, prop)})
current = values.get('sum_property') or NOTHING
picked = ui.choose('Selection HUD', rows, ['Tab', 'Property', 'Items'], multiselect=False, checked=[current],
prompt='Sum which property over the selected objects? Lengths, areas and volumes show in '
'Playground report units.', ok='Use')
if picked is None:
return
choice = '' if picked[0] == NOTHING else picked[0]
values['sum_property'] = choice
script.save_config(values)
hud.update_config({'sum_property': choice})
if choice:
toast.success('Selection HUD sums %s' % choice)
else:
toast.success('Selection HUD sums nothing')
run()
Library modules this tool uses
From the shared namo library, which installs with every tool. Each name opens the module on GitHub.
namo.data_commonShared plumbing for the Inspect and Data panel tools: progress stages, where files go by default, the scope dialog fields, and the small checks every button starts with.namo.hudSelection HUD: a small, non-activating readout of the current selection anchored to the bottom-left corner of the Navisworks window.namo.propindexProperty scanning shared by Property Explorer, Count by Property, Data Validator and the Write Data tools: scopes, fast value reading, the category > property > value index.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/Inspect.panel/Selection_HUD.toggle/bundle.yaml View on GitHubtitle: Selection\nHUD
tooltip: Shows a small readout in the bottom-left corner of the Navisworks window: how many items and objects are selected, from which models, the top categories, and a summed property when you set one. Shift+Click for settings.
tooltip_on: Hides the Selection HUD. Shift+Click for settings.