Model > Inspect
Open in Explorer
Shows the selected item's model file in Windows Explorer: the source file it was appended from, or its Navisworks cache file (asks when both exist). With nothing selected, shows this document's own file.
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: 'Opened in Explorer'; result not checked by a person (stubbed: namo.ui.show_in_explorer; stubbed: namo.ui.show_in_explorer).
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
Open in Explorer 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/Open_in_Explorer.pushbutton/bundle.yamlModel.tab/Inspect.panel/Inspect_Tools.stack/Open_in_Explorer.pushbutton/icon.dark.pngModel.tab/Inspect.panel/Inspect_Tools.stack/Open_in_Explorer.pushbutton/icon.pngModel.tab/Inspect.panel/Inspect_Tools.stack/Open_in_Explorer.pushbutton/icon.small.dark.pngModel.tab/Inspect.panel/Inspect_Tools.stack/Open_in_Explorer.pushbutton/icon.small.pngModel.tab/Inspect.panel/Inspect_Tools.stack/Open_in_Explorer.pushbutton/script.py
Install
- Only this tool. In Navisworks, click pyNavis > Playground, search for Open in Explorer, 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. Open in Explorer 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/Open_in_Explorer.pushbutton/script.py View on GitHub# -*- coding: utf-8 -*-
"""Shows the selected item's model file, or this document's file, in Windows Explorer."""
import os
from pynavis import forms, toast
from namo import data_common, inspect, items, ui
def show(path):
ui.show_in_explorer(path)
toast.success('Opened in Explorer', path)
def document_file(doc):
path = str(doc.FileName or '')
if not path:
toast.info('This document is not saved yet', 'Save it, or select an item to find its model file.')
return
if not os.path.exists(path):
toast.warning('The document file is gone', path)
return
show(path)
def run():
doc = data_common.active_doc()
selected = items.selected(doc) if data_common.has_models(doc) else []
if not selected:
document_file(doc)
return
model = items.model_of(selected[0])
if model is None:
toast.info('No model file for this item', 'Select an item inside an appended model.')
return
targets = inspect.explorer_targets(model.FileName, model.SourceFileName, os.path.exists)
if not targets:
toast.info('No model file for this item', 'Its model carries no file name.')
return
present = [t for t in targets if t[2]]
if not present:
toast.warning('The model file is gone', targets[0][1])
return
if len(present) == 1:
gone = [t for t in targets if not t[2]]
ui.show_in_explorer(present[0][1])
if gone:
toast.warning('Opened the %s' % present[0][0].lower(), '%s is gone: %s' % (gone[0][0], gone[0][1]))
else:
toast.success('Opened in Explorer', present[0][1])
return
if ui.is_runner():
show(present[0][1])
return
labels = ['%s: %s' % (label, os.path.basename(path)) for label, path, _present in present]
choice = forms.ask_options('Show which file in Explorer?', labels, title='Open in Explorer')
if choice is None:
return
show(present[labels.index(choice)][1])
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.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/Open_in_Explorer.pushbutton/bundle.yaml View on GitHubtitle: Open in Explorer
tooltip: Shows the selected item's model file in Windows Explorer: the source file it was appended from, or its Navisworks cache file (asks when both exist). With nothing selected, shows this document's own file.
context: doc