Model > Select
Select Similar
Selects every item that shares the property values you tick with the first selected item, in the whole model, its own model or the selection.
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.
Model.tab/Select.panel/Select_Similar.pushbutton/bundle.yamlModel.tab/Select.panel/Select_Similar.pushbutton/icon.dark.pngModel.tab/Select.panel/Select_Similar.pushbutton/icon.pngModel.tab/Select.panel/Select_Similar.pushbutton/icon.small.dark.pngModel.tab/Select.panel/Select_Similar.pushbutton/icon.small.pngModel.tab/Select.panel/Select_Similar.pushbutton/script.py
Install
- Only this tool. In Navisworks, click pyNavis > Playground, search for Select Similar, 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. Select Similar 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/Select_Similar.pushbutton/script.py View on GitHub# -*- coding: utf-8 -*-
"""Selects every item that shares the ticked property values with the first selected item."""
from pynavis import script, toast
from namo import items, selecttools, variants
cfg = script.get_config(selecttools.SIMILAR_DEFAULTS)
selected = items.selected()
if not selected:
toast.info('Nothing selected', 'Select one item, then run Select Similar again.')
else:
element = items.object_of(selected[0])
name = element.DisplayName or element.ClassDisplayName or 'the first selected item'
rows = selecttools.similar_rows(variants.all_of(element))
if not rows:
toast.info('Nothing to match', '%s has no property a search can compare.' % name)
else:
checked = selecttools.default_checked(rows, cfg.get('checked'))
choice = selecttools.similar_dialog(rows, checked, cfg.get('scope'),
cfg.get('show_identity'), name)
if choice is not None:
script.save_config({'checked': choice['keys'], 'scope': choice['scope'],
'show_identity': choice['show_identity']})
chosen = [r for r in rows if r['key'] in choice['keys']]
found, dropped = selecttools.run_similar(element, chosen, choice['scope'])
if found.Count:
items.select(found)
kept = [r for r in chosen if r not in dropped]
level, message, detail = selecttools.similar_summary(found.Count, kept, choice['scope'],
dropped)
toast.show(level, message, detail)
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.variantsProperty values as Python values, the way pynavis.props reads them, minus one trap.
bundle.yaml
The bundle contract: the keys pyNavis reads for this tool.
Model.tab/Select.panel/Select_Similar.pushbutton/bundle.yaml View on GitHubtitle: Select\nSimilar
tooltip: Selects every item that shares the property values you tick with the first selected item, in the whole model, its own model or the selection.
context: selection