Dev > Automate
Manage Macros
Rename, reorder, add pauses, questions or Navisworks commands to, export or import your macros.
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
It needs these Navisworks event hooks, so installing it also copies the shared hooks folder:
after-command
Files
Paths are relative to the Playground.extension folder.
Dev.tab/Automate.panel/Macros.pulldown/Manage_Macros.pushbutton/bundle.yamlDev.tab/Automate.panel/Macros.pulldown/Manage_Macros.pushbutton/icon.dark.pngDev.tab/Automate.panel/Macros.pulldown/Manage_Macros.pushbutton/icon.pngDev.tab/Automate.panel/Macros.pulldown/Manage_Macros.pushbutton/icon.small.dark.pngDev.tab/Automate.panel/Macros.pulldown/Manage_Macros.pushbutton/icon.small.pngDev.tab/Automate.panel/Macros.pulldown/Manage_Macros.pushbutton/script.py
Install
- Only this tool. In Navisworks, click pyNavis > Playground, search for Manage Macros, 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. Manage Macros is on the Dev tab, Automate 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.
Dev.tab/Automate.panel/Macros.pulldown/Manage_Macros.pushbutton/script.py View on GitHub# -*- coding: utf-8 -*-
"""Edits, renames, deletes, exports and imports macros."""
from pynavis import toast
from pynavis._api import Application
from namo import macros, palette
document = Application.ActiveDocument
def commands():
return palette.gather(document)[0]
if globals().get('__runner__'):
toast.info('Manage Macros needs the Navisworks window', 'It cannot open under pynavis run.')
else:
name = macros.manage(commands)
if name is not None:
config = macros.load(name)
if macros.playing() is not None:
# A second player would replace the first in the session, leaving it running
# where Play Macro can no longer stop it.
toast.info('A macro is already playing', 'Click Play Macro to stop it first.')
elif config is not None and config['steps']:
toast.info('Playing macro %s' % name, '%s. Click Play Macro again to stop it.' % macros.describe(config))
macros.play(name, config)
Library modules this tool uses
From the shared namo library, which installs with every tool. Each name opens the module on GitHub.
namo.macrosMacros: record pyNavis commands, play them back in order, manage them.namo.paletteCommand Palette: type a few letters, press Enter, the command runs.
bundle.yaml
The bundle contract: the keys pyNavis reads for this tool.
Dev.tab/Automate.panel/Macros.pulldown/Manage_Macros.pushbutton/bundle.yaml View on GitHubtitle: Manage Macros
tooltip: Rename, reorder, add pauses, questions or Navisworks commands to, export or import your macros.