Dev > Tools
Unit Converter
Converts lengths, areas, volumes and masses as you type, like 12' 6" to mm or 250 sqft in m2. Enter copies the result.
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.
Dev.tab/Tools.panel/Unit_Converter.pushbutton/bundle.yamlDev.tab/Tools.panel/Unit_Converter.pushbutton/icon.dark.pngDev.tab/Tools.panel/Unit_Converter.pushbutton/icon.pngDev.tab/Tools.panel/Unit_Converter.pushbutton/icon.small.dark.pngDev.tab/Tools.panel/Unit_Converter.pushbutton/icon.small.pngDev.tab/Tools.panel/Unit_Converter.pushbutton/script.py
Install
- Only this tool. In Navisworks, click pyNavis > Playground, search for Unit Converter, 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. Unit Converter is on the Dev tab, Tools 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/Tools.panel/Unit_Converter.pushbutton/script.py View on GitHub# -*- coding: utf-8 -*-
"""Opens the unit converter: lengths, areas, volumes and masses as you type."""
from pynavis import toast
from pynavis._api import Application
from namo import converter
if globals().get('__runner__'):
toast.info('The Unit Converter needs the Navisworks window', 'It cannot open under pynavis run.')
else:
document = Application.ActiveDocument
doc_units = None
if document is not None and document.Models.Count:
doc_units = str(document.Units)
converter.show(doc_units)
Library modules this tool uses
From the shared namo library, which installs with every tool. Each name opens the module on GitHub.
namo.converterUnit Converter: a small calculator window that converts as you type.
bundle.yaml
The bundle contract: the keys pyNavis reads for this tool.
Dev.tab/Tools.panel/Unit_Converter.pushbutton/bundle.yaml View on GitHubtitle: Unit\nConverter
tooltip: Converts lengths, areas, volumes and masses as you type, like 12' 6" to mm or 250 sqft in m2. Enter copies the result.