Model > Inspect
Copy IDs
Copies one row per selected element (name, Element ID, UniqueId, IFC GlobalId, InstanceGuid, source file, tree path) as tab-separated text with a header, ready to paste into Excel. 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; 17 parts selected: ran to the end: 'Copied 1 row'; result not checked by a person (stubbed: namo.ui.copy).
The public ask
No public source is on record for this tool.
Installs with
Copy IDs 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/Inspect.panel/Inspect_Tools.stack/Copy_IDs.pushbutton/bundle.yamlModel.tab/Inspect.panel/Inspect_Tools.stack/Copy_IDs.pushbutton/config.pyModel.tab/Inspect.panel/Inspect_Tools.stack/Copy_IDs.pushbutton/icon.dark.pngModel.tab/Inspect.panel/Inspect_Tools.stack/Copy_IDs.pushbutton/icon.pngModel.tab/Inspect.panel/Inspect_Tools.stack/Copy_IDs.pushbutton/icon.small.dark.pngModel.tab/Inspect.panel/Inspect_Tools.stack/Copy_IDs.pushbutton/icon.small.pngModel.tab/Inspect.panel/Inspect_Tools.stack/Copy_IDs.pushbutton/script.py
Install
- Only this tool. In Navisworks, click pyNavis > Playground, search for Copy IDs, 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. Copy IDs 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/Inspect_Tools.stack/Copy_IDs.pushbutton/script.py View on GitHub# -*- coding: utf-8 -*-
"""Copies the identifiers of every selected element to the clipboard as a tab-separated table."""
from pynavis import script, toast
from namo import data_common, inspect, items, progress, propindex, ui
DEFAULTS = {'columns': list(inspect.ID_KEYS)}
PROGRESS_FROM = 2000 # selections larger than this get a progress window
def run():
doc = data_common.active_doc()
selected = items.selected(doc) if data_common.has_models(doc) else []
if not selected:
toast.info('Nothing selected', 'Select the elements whose IDs you want, then run Copy IDs again.')
return
columns = script.get_config(DEFAULTS).get('columns') or list(inspect.ID_KEYS)
if len(selected) > PROGRESS_FROM and not ui.is_runner():
records = progress.run('Copy IDs', lambda report: inspect.id_records(
selected, doc, tick=data_common.stage(report, 0.0, 1.0, 'Reading %s')))
if records is progress.CANCELLED:
return
else:
records = inspect.id_records(selected, doc)
headers, rows = inspect.id_table(records, columns)
if not ui.copy(propindex.tsv(rows, headers)):
toast.error('Could not copy', 'Another program is holding the clipboard; try again.')
return
toast.success('Copied %s %s' % ('{:,}'.format(len(rows)), 'row' if len(rows) == 1 else 'rows'),
', '.join(headers))
run()
config.py
The Shift+Click action.
Model.tab/Inspect.panel/Inspect_Tools.stack/Copy_IDs.pushbutton/config.py View on GitHub# -*- coding: utf-8 -*-
"""Chooses which identifier columns Copy IDs puts on the clipboard."""
from pynavis import script, toast
from namo import inspect, ui
DEFAULTS = {'columns': list(inspect.ID_KEYS)}
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': [label], 'value': key} for key, label in inspect.ID_COLUMNS]
picked = ui.choose('Copy IDs columns', rows, ['Column'], multiselect=True,
checked=values.get('columns') or list(inspect.ID_KEYS),
prompt='Tick the columns Copy IDs puts on the clipboard, in this order.', ok='Save',
width=420, height=420)
if picked is None:
return
values['columns'] = picked
script.save_config(values)
toast.success('Copy IDs copies %d %s' % (len(picked), 'column' if len(picked) == 1 else 'columns'),
', '.join(inspect.ID_LABELS[key] for key in picked))
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.inspectInspecting single items: What Is It, Copy IDs, Open in Explorer, Properties Plus.namo.itemsModel items: walking, collecting, identifying, measuring and showing them.namo.progressGlue between pyNavis' cancellable progress window and Playground's progress callbacks.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/Inspect_Tools.stack/Copy_IDs.pushbutton/bundle.yaml View on GitHubtitle: Copy IDs
tooltip: Copies one row per selected element (name, Element ID, UniqueId, IFC GlobalId, InstanceGuid, source file, tree path) as tab-separated text with a header, ready to paste into Excel. Shift+Click for settings.
context: selection