Coordinate > BCF
BCF Import
Reads a BCF 2.0, 2.1 or 3.0 file into the issue register, merging topics with the same GUID, saving their viewpoints under BCF in Saved Viewpoints and finding their components by IFC GUID or Revit Element ID.
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.
Coordinate.tab/BCF.panel/BCF_Import.pushbutton/bundle.yamlCoordinate.tab/BCF.panel/BCF_Import.pushbutton/icon.dark.pngCoordinate.tab/BCF.panel/BCF_Import.pushbutton/icon.pngCoordinate.tab/BCF.panel/BCF_Import.pushbutton/icon.small.dark.pngCoordinate.tab/BCF.panel/BCF_Import.pushbutton/icon.small.pngCoordinate.tab/BCF.panel/BCF_Import.pushbutton/script.py
Install
- Only this tool. In Navisworks, click pyNavis > Playground, search for BCF Import, 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. BCF Import is on the Coordinate tab, BCF 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/BCF.panel/BCF_Import.pushbutton/script.py View on GitHub# -*- coding: utf-8 -*-
"""Reads a BCF file into the issue register, with saved viewpoints and found elements."""
import os
from pynavis import forms, script, toast
from namo import bcf, bcf_exchange, issueapi, issuestore, progress, ui
DEFAULTS = {'viewpoints': True, 'elements': True}
def run():
doc = issuestore.active_doc()
if doc is None or not issueapi.has_model(doc):
toast.info('No model open', 'Open the model the BCF file belongs to, then import it.')
return
store = issuestore.for_doc(doc)
if not store.saved:
toast.info('Save the model first', issuestore.NOT_SAVED)
return
path = forms.open_file(filter='BCF files (*.bcfzip;*.bcf)|*.bcfzip;*.bcf|All files (*.*)|*.*',
title='Import BCF')
if path is None:
return
try:
data = bcf.read(path)
except bcf.BcfError as error:
toast.error('Could not read %s' % os.path.basename(path), str(error))
return
except (IOError, OSError) as error:
toast.error('Could not open %s' % os.path.basename(path), str(error))
return
if not data['topics']:
toast.info('No topics in %s' % os.path.basename(path),
data['notes'][0] if data['notes'] else 'The file holds no issues.')
return
preview = bcf_exchange.preview(data, store)
me = script.bind()
values = me.get_config(dict(DEFAULTS))
intro = ('%s: BCF %s, %d topic%s (%d new, %d already in this register), %d viewpoint%s, '
'%d component%s.' % (os.path.basename(path), preview['version'], preview['topics'],
'' if preview['topics'] == 1 else 's', preview['new'],
preview['matching'], preview['viewpoints'],
'' if preview['viewpoints'] == 1 else 's', preview['components'],
'' if preview['components'] == 1 else 's'))
fields = [
{'kind': 'check', 'key': 'viewpoints', 'label': 'Save the viewpoints under BCF in Saved Viewpoints',
'default': bool(values['viewpoints'])},
{'kind': 'check', 'key': 'elements', 'label': 'Find the components in the model',
'default': bool(values['elements']),
'hint': 'By IFC GUID, then Revit Element ID. Each lookup searches the model; large '
'models take longer (stops after 3 minutes).'},
{'kind': 'label', 'muted': True,
'text': 'Topics already in the register take the BCF fields when the BCF is newer; new '
'comments are added either way, never duplicated.'},
]
answers = ui.form('BCF Import', fields, intro=intro, ok='Import', width=560)
if answers is None:
return
values.update(answers)
me.save_config(values)
name = os.path.basename(path)
try:
outcome = progress.run('BCF import', lambda report: bcf_exchange.import_topics(
data, name, answers, doc, report))
except (IOError, OSError) as error:
toast.error('Could not save the imported issues', '%s Check the data folder, then try again.'
% error)
return
if outcome is progress.CANCELLED:
return
detail = bcf_exchange.detail_line(outcome)
level = 'warning' if (outcome['missing'] or outcome['not_searched'] or outcome['notes']) else 'success'
toast.show(level, 'Imported %s' % bcf_exchange.summary_line(outcome), detail)
run()
Library modules this tool uses
From the shared namo library, which installs with every tool. Each name opens the module on GitHub.
namo.bcfBCF (BIM Collaboration Format) files: write 2.1 and 3.0, read 2.0, 2.1 and 3.0.namo.bcf_exchangeBCF Export and BCF Import: issues (or clash results) to a .bcfzip and back.namo.issueapiThe Navisworks half of the issue tools: capture a view as issue material, go back to it, draw issue pins, pick stamp points, and find BCF components in the model.namo.issuestoreWhere Playground issues live: one record per issue, per model file, in the data mode namo.config chooses, plus the session events every issue view listens to.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/BCF.panel/BCF_Import.pushbutton/bundle.yaml View on GitHubtitle: BCF\nImport
tooltip: Reads a BCF 2.0, 2.1 or 3.0 file into the issue register, merging topics with the same GUID, saving their viewpoints under BCF in Saved Viewpoints and finding their components by IFC GUID or Revit Element ID.
context: doc