Model > Data

Find and Replace

Finds text or a regular expression in property values (all properties or one) and replaces it after a preview. Native values are read-only, so corrections go to a Playground Corrected tab; values in custom tabs are edited in place.

Tab and panelModel > Data
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.

Events it listens to

None. It runs only when you click it.

Files

Paths are relative to the Playground.extension folder.

  • Model.tab/Data.panel/Write_Data.pulldown/Find_and_Replace.pushbutton/bundle.yaml
  • Model.tab/Data.panel/Write_Data.pulldown/Find_and_Replace.pushbutton/icon.dark.png
  • Model.tab/Data.panel/Write_Data.pulldown/Find_and_Replace.pushbutton/icon.png
  • Model.tab/Data.panel/Write_Data.pulldown/Find_and_Replace.pushbutton/icon.small.dark.png
  • Model.tab/Data.panel/Write_Data.pulldown/Find_and_Replace.pushbutton/icon.small.png
  • Model.tab/Data.panel/Write_Data.pulldown/Find_and_Replace.pushbutton/script.py

Install

  1. Only this tool. In Navisworks, click pyNavis > Playground, search for Find and Replace, 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. Find and Replace is on the Model tab, Data 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.

Model.tab/Data.panel/Write_Data.pulldown/Find_and_Replace.pushbutton/script.py View on GitHub
# -*- coding: utf-8 -*-
"""Finds and replaces text in property values, writing corrections to custom tabs."""
from pynavis import script, toast

from namo import data_common, data_write, ui


def run():
    if ui.is_runner():
        toast.info('Find and Replace needs the Navisworks window', 'It cannot open under pynavis run.')
        return
    doc = data_common.active_doc()
    if not data_common.has_models(doc):
        data_common.no_model_toast()
        return
    data_write.find_flow(script.bind(), doc)


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.data_writeThe Write Data pulldown's dialogs and flows: Bulk Property Writer, Find and Replace, Property Mapper and External Data Link. The logic they rest on (planning, matching, mapping, writing inside one transaction) is namo.propwrite; this module asks, previews and reports. Every flow takes the BoundScript `me` (settings) and the document, returns nothing and toasts every outcome; cancelling any dialog is silent.
  • 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/Data.panel/Write_Data.pulldown/Find_and_Replace.pushbutton/bundle.yaml View on GitHub
title: Find and Replace
tooltip: Finds text or a regular expression in property values (all properties or one) and replaces it after a preview. Native values are read-only, so corrections go to a Playground Corrected tab; values in custom tabs are edited in place.
context: doc