Model > Select

Select by File

Selects every item of the appended files you tick, remembering your last choice. 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

Select by File 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/Select_by_File.pushbutton/bundle.yaml
  • Model.tab/Select.panel/Quick.stack/Select_by_File.pushbutton/config.py
  • Model.tab/Select.panel/Quick.stack/Select_by_File.pushbutton/icon.dark.png
  • Model.tab/Select.panel/Quick.stack/Select_by_File.pushbutton/icon.png
  • Model.tab/Select.panel/Quick.stack/Select_by_File.pushbutton/icon.small.dark.png
  • Model.tab/Select.panel/Quick.stack/Select_by_File.pushbutton/icon.small.png
  • Model.tab/Select.panel/Quick.stack/Select_by_File.pushbutton/script.py

Install

  1. Only this tool. In Navisworks, click pyNavis > Playground, search for Select by File, 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. Select by File 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/Quick.stack/Select_by_File.pushbutton/script.py View on GitHub
# -*- coding: utf-8 -*-
"""Selects every item of the appended files you tick."""
from pynavis import script, toast

from namo import items, selecttools, ui

cfg = script.get_config(selecttools.FILE_DEFAULTS)
models = items.models()

if not models:
    toast.info('No models', 'Open or append a model first.')
else:
    counted = selecttools.count_models([m['root'] for m in models])
    counts = dict((m['index'], counted.get(position)) for position, m in enumerate(models))
    rows = selecttools.file_rows(models, counts)
    picked = ui.choose('Select by File', rows, ['File', 'Type', 'Units', 'Items'], multiselect=True,
                       checked=selecttools.checked_files(models, cfg['files']),
                       prompt='Tick the files whose items you want selected.', ok='Select',
                       width=640, height=480)
    if picked is not None:
        chosen = [m for m in models if m['index'] in picked]
        items.select([m['root'] for m in chosen], zoom=cfg['zoom'])
        names = [m['name'] for m in chosen]
        script.save_config({'files': names, 'zoom': cfg['zoom']})
        noun = 'file' if len(names) == 1 else 'files'
        toast.success('Selected %d %s' % (len(names), noun),
                      ', '.join(names) if len(names) <= 4 else '%s and %d more' % (
                          ', '.join(names[:3]), len(names) - 3))

config.py

The Shift+Click action.

Model.tab/Select.panel/Quick.stack/Select_by_File.pushbutton/config.py View on GitHub
# -*- coding: utf-8 -*-
"""Options for Select by File: zoom to the files after selecting them."""
from pynavis import script, toast

from namo import selecttools, ui

cfg = script.get_config(selecttools.FILE_DEFAULTS)
values = ui.form('Select by File', [
    {'kind': 'check', 'key': 'zoom', 'label': 'Zoom to the files after selecting them',
     'default': cfg['zoom']},
], ok='Save')
if values is not None:
    cfg['zoom'] = values['zoom']
    script.save_config(cfg)
    toast.success('Saved', 'Select by File %s.' % ('zooms to the files' if cfg['zoom']
                                                    else 'leaves the view where it is'))

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.
  • 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/Quick.stack/Select_by_File.pushbutton/bundle.yaml View on GitHub
title: Select by File
tooltip: Selects every item of the appended files you tick, remembering your last choice. Shift+Click for settings.
context: doc