Model > Select
Invert
Selects everything the current selection leaves out, leaving hidden items out. With nothing selected it selects everything visible. Shift+Click for settings.
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: 'Selected everything visible'; result not checked by a person.
Related asks to confirm
No quote is on record yet. These threads look related, but a person still has to open and read them.
Installs with
Invert sits in a stack, so installing it also installs:
Events it listens to
None. It runs only when you click it.
Files
Paths are relative to the Playground.extension folder.
Model.tab/Select.panel/Quick.stack/Invert.pushbutton/bundle.yamlModel.tab/Select.panel/Quick.stack/Invert.pushbutton/config.pyModel.tab/Select.panel/Quick.stack/Invert.pushbutton/icon.dark.pngModel.tab/Select.panel/Quick.stack/Invert.pushbutton/icon.pngModel.tab/Select.panel/Quick.stack/Invert.pushbutton/icon.small.dark.pngModel.tab/Select.panel/Quick.stack/Invert.pushbutton/icon.small.pngModel.tab/Select.panel/Quick.stack/Invert.pushbutton/script.py
Install
- Only this tool. In Navisworks, click pyNavis > Playground, search for Invert, 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. Invert 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.
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/Select.panel/Quick.stack/Invert.pushbutton/script.py View on GitHub# -*- coding: utf-8 -*-
"""Selects everything the current selection leaves out, leaving hidden items out."""
from pynavis import script, toast
from namo import items, selecttools
cfg = script.get_config(selecttools.INVERT_DEFAULTS)
had_selection = bool(items.selected())
kept, note = selecttools.invert(include_hidden=cfg['include_hidden'])
if not kept:
if had_selection:
toast.info('Nothing left to select', 'Everything visible is already selected.')
else:
toast.info('Nothing to select', 'The model has no visible items.')
else:
items.select(kept)
message = 'Inverted the selection' if had_selection else 'Selected everything visible'
detail = '%s %s in the selection tree; hidden items %s.' % (
'{:,}'.format(len(kept)), 'item' if len(kept) == 1 else 'items',
'included' if cfg['include_hidden'] else 'left out')
if note:
toast.warning(message, '%s %s' % (detail, note))
else:
toast.success(message, detail)
config.py
The Shift+Click action.
Model.tab/Select.panel/Quick.stack/Invert.pushbutton/config.py View on GitHub# -*- coding: utf-8 -*-
"""Options for Invert: leave hidden items out of the inverted selection, or include them."""
from pynavis import forms, script, toast
from namo import selecttools
cfg = script.get_config(selecttools.INVERT_DEFAULTS)
current = 'Include hidden items' if cfg['include_hidden'] else 'Leave hidden items out'
choice = forms.ask_options('When inverting the selection (now: %s):' % current.lower(),
['Leave hidden items out', 'Include hidden items'], title='Invert')
if choice is not None:
cfg['include_hidden'] = choice == 'Include hidden items'
script.save_config(cfg)
toast.success('Saved', 'Invert now %s.' % ('includes hidden items' if cfg['include_hidden']
else 'leaves hidden items out'))
Library modules this tool uses
From the shared namo library, which installs with every tool. Each name opens the module on GitHub.
namo.itemsModel items: walking, collecting, identifying, measuring and showing them.namo.selecttoolsSelect panel logic: Select Similar, Filter Selection, Invert, Select by File, Save as Set.
bundle.yaml
The bundle contract: the keys pyNavis reads for this tool.
Model.tab/Select.panel/Quick.stack/Invert.pushbutton/bundle.yaml View on GitHubtitle: Invert
tooltip: Selects everything the current selection leaves out, leaving hidden items out. With nothing selected it selects everything visible. Shift+Click for settings.
context: doc