Coordinate > Clash Results

Show from Revit

Selects and zooms to the elements sent from Revit with the Playground Link button for pyRevit.

Tab and panelCoordinate > Clash Results
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

Show from Revit 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.

  • Coordinate.tab/Clash_Results.panel/Revit_Link.stack/Show_from_Revit.pushbutton/bundle.yaml
  • Coordinate.tab/Clash_Results.panel/Revit_Link.stack/Show_from_Revit.pushbutton/icon.dark.png
  • Coordinate.tab/Clash_Results.panel/Revit_Link.stack/Show_from_Revit.pushbutton/icon.png
  • Coordinate.tab/Clash_Results.panel/Revit_Link.stack/Show_from_Revit.pushbutton/icon.small.dark.png
  • Coordinate.tab/Clash_Results.panel/Revit_Link.stack/Show_from_Revit.pushbutton/icon.small.png
  • Coordinate.tab/Clash_Results.panel/Revit_Link.stack/Show_from_Revit.pushbutton/script.py

Install

  1. Only this tool. In Navisworks, click pyNavis > Playground, search for Show from Revit, 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. Show from Revit is on the Coordinate tab, Clash Results 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.

Coordinate.tab/Clash_Results.panel/Revit_Link.stack/Show_from_Revit.pushbutton/script.py View on GitHub
"""Selects and zooms to the elements Revit sent with the Playground Link button for pyRevit."""
import os

from pynavis import toast

from namo import items, progress, revitlink
from namo import clashset_common as common


def run():
    elements, sent, source, problem = revitlink.read_from_revit()
    if problem:
        toast.error('Could not use the link file', problem)
        return
    if not elements:
        toast.info('Nothing has been sent from Revit yet',
                   'In Revit, select elements and click Playground > Send to Navisworks.')
        return
    user = os.environ.get('USERNAME')
    found = progress.run('Finding elements from Revit', lambda report_to: revitlink.find_elements(
        elements, progress=report_to, user=user))
    if found is progress.CANCELLED:
        return
    hits, missing, notes = found
    age = revitlink.age_text(sent)
    origin = 'Sent %s from %s.' % (age, source or 'Revit') if age else ''
    if not hits:
        toast.warning('None of the %s from Revit are in this model' % common.plural(len(elements), 'element'),
                      ' '.join(p for p in (origin, notes[0] if notes else '') if p) or None)
        return
    items.select(hits, zoom=True)
    parts = [origin] if origin else []
    if missing:
        parts.append('Not found: %s.' % revitlink.short_list(missing))
    if notes:
        parts.append(notes[0])
    headline = 'Selected %s from Revit' % common.plural(len(hits), 'element')
    if missing:
        toast.warning(headline, ' '.join(parts))
    else:
        toast.success(headline, ' '.join(parts) or None)


run()

Library modules this tool uses

From the shared namo library, which installs with every tool. Each name opens the module on GitHub.

  • namo.clashset_commonSmall things every Clash Setup and Clash Results tool shares.
  • namo.itemsModel items: walking, collecting, identifying, measuring and showing them.
  • namo.progressGlue between pyNavis' cancellable progress window and Playground's progress callbacks.
  • namo.revitlinkRevit Link: hand elements between Navisworks and Revit through two small JSON files.

bundle.yaml

The bundle contract: the keys pyNavis reads for this tool.

Coordinate.tab/Clash_Results.panel/Revit_Link.stack/Show_from_Revit.pushbutton/bundle.yaml View on GitHub
title: Show from Revit
tooltip: Selects and zooms to the elements sent from Revit with the Playground Link button for pyRevit.
context: doc