Coordinate > Clash Results
Clash Namer
Renames clashes and result groups from a template like {test} {n:000} {grid} {level}, with a live before and after preview. Pick the tests, type the template, check the preview, then Rename. Shift+Click for settings.
Status
Untested Never executed inside Navisworks. Passed the headless checks only.
Related asks to confirm
No quote is on record yet. These threads look related, but a person still has to open and read them.
- https://www.revitforum.org/forum/revit-all-flavors/coordination-tools/23325-navisworks-retain-clash-names-in-exported-jpg-files
- https://forums.autodesk.com/t5/navisworks-forum/design-request-for-clash-detective/td-p/13166238
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/Clash_Namer.pushbutton/bundle.yamlCoordinate.tab/Clash_Results.panel/Clash_Namer.pushbutton/config.pyCoordinate.tab/Clash_Results.panel/Clash_Namer.pushbutton/icon.dark.pngCoordinate.tab/Clash_Results.panel/Clash_Namer.pushbutton/icon.pngCoordinate.tab/Clash_Results.panel/Clash_Namer.pushbutton/icon.small.dark.pngCoordinate.tab/Clash_Results.panel/Clash_Namer.pushbutton/icon.small.pngCoordinate.tab/Clash_Results.panel/Clash_Namer.pushbutton/script.py
Install
- Only this tool. In Navisworks, click pyNavis > Playground, search for Clash Namer, 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. Clash Namer 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.
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.
Coordinate.tab/Clash_Results.panel/Clash_Namer.pushbutton/script.py View on GitHub"""Renames clash results and result groups from a name template, with a live preview."""
from pynavis import script, toast
from namo import clashname, naming, progress, ui
from namo import clashset_common as common
from namo import clashset_tests as defs
DEFAULTS = {'clash_template': clashname.DEFAULT_CLASH, 'group_template': clashname.DEFAULT_GROUP,
'scope': 'clashes', 'tests': [], 'threshold': clashname.DEFAULT_THRESHOLD}
TITLE = 'Clash Namer'
def run():
from pynavis import doc as pdoc
doc = pdoc.get_doc()
problem = common.clash_problem(doc, need_results=True)
if problem:
toast.show(*problem)
return
values = script.get_config(DEFAULTS)
tests = common.choose_tests(TITLE, 'Tick the tests whose clashes you want to rename.',
values['tests'], doc=doc)
if tests is None:
return
if not tests:
toast.info('No clash results yet', 'Run your clash tests in Clash Detective first.')
return
try:
entries = common.read_entries(tests, doc)
except RuntimeError as error:
toast.error('Could not read the clashes', str(error))
return
if entries is progress.CANCELLED:
return
units = defs.doc_units(doc)
standard = naming.standard_values(doc)
readers = [clashname.category_reader(entry) for entry in entries]
def preview(clash_template, group_template, scope):
return clashname.preview(entries, clash_template, group_template, scope, units, readers,
standard)
win = clashname.build_window(preview, values, TITLE)
ui.show_modal(win)
state = win.Tag
if not state.accepted:
return
choice = state.result
values.update(choice)
values['tests'] = [t.DisplayName for t in tests]
script.save_config(values)
plans = progress.run('Planning names', lambda report_to: clashname.plan_all(
entries, choice['clash_template'], choice['group_template'], choice['scope'], units,
readers, standard, report_to))
if plans is progress.CANCELLED:
return
if not any(p['clashes'] or p['groups'] for p in plans):
toast.info('Every name already matches this template')
return
try:
result = common.write_progress('Renaming clashes', lambda report_to: clashname.apply(
entries, plans, clashname.threshold_of(values), doc, report_to))
except ValueError as error:
toast.error('Could not rename the clashes', str(error))
return
detail = None
if result['mode'] == 'rebuild':
detail = 'Each test was rebuilt once with the new names. One undo step.'
toast.success(clashname.result_text(result['clashes'], result['groups'], result['tests']), detail)
if globals().get('__runner__'):
toast.warning(*common.RUNNER_MESSAGE)
else:
run()
config.py
The Shift+Click action.
Coordinate.tab/Clash_Results.panel/Clash_Namer.pushbutton/config.py View on GitHub"""Options for Clash Namer: when to rebuild tests instead of renaming one by one."""
from pynavis import script, toast
from namo import clashname, ui
DEFAULTS = {'clash_template': clashname.DEFAULT_CLASH, 'group_template': clashname.DEFAULT_GROUP,
'scope': 'clashes', 'tests': [], 'threshold': clashname.DEFAULT_THRESHOLD}
values = script.get_config(DEFAULTS)
fields = [
{'kind': 'int', 'key': 'threshold', 'label': 'Rename one by one up to',
'default': clashname.threshold_of(values),
'min': 1, 'max': 1000000, 'suffix': 'names', 'required': True,
'hint': 'Above this, each test is rebuilt once with the new names, which stays fast on '
'big tests. One by one takes longer the larger the model is.'},
{'kind': 'text', 'key': 'clash_template', 'label': 'Starting clash template',
'default': values['clash_template']},
{'kind': 'text', 'key': 'group_template', 'label': 'Starting group template',
'default': values['group_template']},
]
answers = ui.form('Clash Namer options', fields, ok='Save')
if answers is not None:
values.update(answers)
script.save_config(values)
toast.success('Saved Clash Namer options',
'One by one up to {:,} names, then a rebuild.'.format(values['threshold']))
Library modules this tool uses
From the shared namo library, which installs with every tool. Each name opens the module on GitHub.
namo.clashnameClash Namer: rename clash results and result groups from a name template.namo.clashset_commonSmall things every Clash Setup and Clash Results tool shares.namo.clashset_testsClash test definitions as plain data, and the one place Playground builds tests from them.namo.namingName templates: '{test} - {n:000}', '{date:%Y%m%d} {project}', '{{literal braces}}'.namo.progressGlue between pyNavis' cancellable progress window and Playground's progress callbacks.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.
Coordinate.tab/Clash_Results.panel/Clash_Namer.pushbutton/bundle.yaml View on GitHubtitle: Clash\nNamer
tooltip: Renames clashes and result groups from a template like {test} {n:000} {grid} {level}, with a live before and after preview. Pick the tests, type the template, check the preview, then Rename. Shift+Click for settings.
context: clash-results