Model > Select
Number Picked
Writes Playground > Sequence = 1, 2, 3... onto the picked items in pick order, keeping their other Playground properties. One undo step.
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/Select.panel/Pick_Order_Actions.pulldown/Number_Picked.pushbutton/bundle.yamlModel.tab/Select.panel/Pick_Order_Actions.pulldown/Number_Picked.pushbutton/icon.dark.pngModel.tab/Select.panel/Pick_Order_Actions.pulldown/Number_Picked.pushbutton/icon.pngModel.tab/Select.panel/Pick_Order_Actions.pulldown/Number_Picked.pushbutton/icon.small.dark.pngModel.tab/Select.panel/Pick_Order_Actions.pulldown/Number_Picked.pushbutton/icon.small.pngModel.tab/Select.panel/Pick_Order_Actions.pulldown/Number_Picked.pushbutton/script.py
Install
- Only this tool. In Navisworks, click pyNavis > Playground, search for Number Picked, 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. Number Picked 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/Pick_Order_Actions.pulldown/Number_Picked.pushbutton/script.py View on GitHub# -*- coding: utf-8 -*-
"""Writes Playground > Sequence = 1, 2, 3... onto the picked items in pick order."""
from pynavis import script, toast
from namo import progress, sel_pickorder, ui
cfg = script.get_config(sel_pickorder.NUMBER_DEFAULTS)
picks = sel_pickorder.load()
if not picks:
toast.info('No picked items', 'Turn on Pick Order and click items in order first.')
else:
found, missing = sel_pickorder.resolve()
if not found:
toast.warning('None of the picked items are in the model',
'They may have been removed or re-exported. Clear Picked starts a new list.')
else:
values = ui.form('Number Picked', [
{'kind': 'label', 'text': 'Numbers the %d picked items in pick order on the Playground tab.'
% len(found)},
{'kind': 'text', 'key': 'property', 'label': 'Property name', 'default': cfg['property'],
'required': True},
{'kind': 'int', 'key': 'start', 'label': 'First number', 'default': cfg['start'],
'required': True},
{'kind': 'int', 'key': 'step', 'label': 'Step', 'default': cfg['step'], 'min': 1,
'required': True},
{'kind': 'text', 'key': 'prefix', 'label': 'Prefix', 'default': cfg['prefix'],
'hint': 'Optional, for example P- gives P-1, P-2...'},
{'kind': 'int', 'key': 'digits', 'label': 'Zero padding (digits)', 'default': cfg['digits'],
'min': 0, 'max': 8,
'hint': '3 gives 001, 002...; with padding or a prefix the values are text.'},
], ok='Number', width=440)
if values is not None:
for key in ('property', 'start', 'step', 'prefix', 'digits'):
cfg[key] = values[key]
cfg['property'] = cfg['property'].strip()
cfg['digits'] = cfg['digits'] or 0
script.save_config(cfg)
numbers = sel_pickorder.sequence_values(len(found), cfg['start'], cfg['step'],
cfg['prefix'], cfg['digits'])
if len(found) > 100:
outcome = progress.run('Numbering picked items', lambda report: sel_pickorder.number(
found, numbers, cfg['property'], report))
else:
outcome = sel_pickorder.number(found, numbers, cfg['property'])
if outcome is not progress.CANCELLED:
written, errors = outcome
detail = 'Playground > %s = %s to %s' % (cfg['property'], numbers[0], numbers[-1])
if missing:
detail += '; %d picked items are no longer in the model' % missing
if errors:
toast.warning('Numbered %d of %d items' % (written, len(found)), errors[0])
else:
toast.success('Numbered %d %s' % (written, 'item' if written == 1 else 'items'),
detail)
Library modules this tool uses
From the shared namo library, which installs with every tool. Each name opens the module on GitHub.
namo.progressGlue between pyNavis' cancellable progress window and Playground's progress callbacks.namo.sel_pickorderPick Order: an ordered list of items the user clicks, and what to do with it.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/Pick_Order_Actions.pulldown/Number_Picked.pushbutton/bundle.yaml View on GitHubtitle: Number Picked
tooltip: Writes Playground > Sequence = 1, 2, 3... onto the picked items in pick order, keeping their other Playground properties. One undo step.
context: doc