feat(viewer): Open button reclaims IFC-merge engine + new BCF export module - #676
Open
red1oon wants to merge 2 commits into
Open
feat(viewer): Open button reclaims IFC-merge engine + new BCF export module#676red1oon wants to merge 2 commits into
red1oon wants to merge 2 commits into
Conversation
…e landing drop-zone Open now accepts native .db AND raw IFC (single or multi — 2+ auto-merge into one building), reusing import_own.js's engine verbatim instead of reinventing it. The landing page's #m-import-zone drop-box is removed — it read as an upload/privacy prompt; Open is now the single entry point for any input. - viewer/scene.js: A.openModelDb widens its picker (.db/.sqlite/.ifc, multi-select); A._routeOpenPicks branches by extension into the existing native-open path or handleImportFiles (sameTab mode). - import_own.js: loaded a second time from viewer/viewer.html. Added _fromViewerHost/_viewerAssetPrefix so its viewer/-relative asset paths (sql.js, web-ifc.wasm, workers) collapse correctly when hosted from inside viewer/. openProject() gained opts.sameTab to location.assign in place instead of window.open when triggered from the Open button, so a merge loads into the current tab rather than spawning a second one. - viewer/viewer.html: loads import_own.js; hidden status/progress nodes (styled as a top overlay, since the reused code toggles their display) mirror merge progress into the Viewer's own status line. - index.html: removes the drop-zone markup/CSS and the now-dead wireImportZone(). - viewer/tests/poc_open_button_ifc_merge.js: new live witness, drives the real production entry point with real ARC+MEP IFC files end to end (merge → same-tab nav → reload → rendered scene), 10/10 PASS. - viewer/tests/morpheus_import_live.js: retired to a regression guard that the drop-zone removal stuck, 4/4 PASS. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…hes + notes) Viewer had no BCF export at all (unlike Modeller's modeller/bcf_export.js). Ported rather than invented: the zip/XML engine is a verbatim port of Modeller's already-shipped BCF 2.1 writer; the domain mapping (topic shape, status→BCF-status, discipline/severity→BCF-priority) is ported from the real Federation/IfcOpenShell Python BCF generator (~/IfcOpenShell/src/bonsai/ bonsai/bim/module/federation/bcf/bcf_generator.py + viewpoint_manager.py, user-cited "old IfcOpenShell/Federation python"). Re-sourced onto the Viewer's own real data instead of that module's SQLite clash_status schema: - status ← A._clashStatuses[A._clashPairKey(...)] (viewer/measure.js's real lifecycle: ''/Reviewed/Resolved/Accepted) → Open/Open/Resolved/Closed - priority ← the issue's own stored `severity` label (Hard clash/Soft clash/ Clearance violation, viewer/clash_rules.json) → Critical/Major/Minor - viewpoint← the issue's own real captured camera_pos/camera_target (viewer/clash_snag.js already stores these); falls back to the Python module's isometric-from-bbox-center math only when none was stored - snapshot ← the issue's own real stored PNG blob; omitted (not synthesized) when an issue has none One BCF Topic per viewer/issues.js Issue record — clashes (TopicType=Clash) AND freeform site notes (TopicType=Comment) both export, not just clashes. - viewer/bcf_export.js: new module, setupBcfExport(A) convention (matches every other viewer/ module). Exposes A.exportBcf(opts) + A._bcf (pure builders, for unit checks). - viewer/main.js: wired into the _mods boot list + window.exportIssuesBcf. - viewer/viewer.html: script tag + "Export BCF" button in the existing Issues panel toolbar, next to the existing Export Excel button. - viewer/locales/en_US.js: ui_export_bcf key (other locales fall back to the hardcoded English label per locale_loader.js's existing missing-key behavior — no crash, just untranslated). - viewer/tests/poc_bcf_export.js: new live witness — seeds real Issue records (one clash w/ real PNG snapshot, one note) into the real IndexedDB, drives the real APP.exportBcf() entry point, then validates the produced .bcfzip with the INDEPENDENT `unzip` CLI (archive integrity, file contents, per-topic XML fields) rather than self-checking. 20/20 PASS. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Both halves of
bim-compiler prompts/OPEN_BUTTON_IFC_BCF_MERGE.md— Open-button item done first, BCF-export item added as a follow-up commit on this same branch/PR since it continues the same backlog entry.1. Open button reclaims the drop-IFC multi-merge engine
.dbAND raw IFC (single or multi — 2+ auto-merge into one building), reusingimport_own.js's existing multi-IFC-merge engine verbatim rather than reinventing it.#m-import-zonedrop-box is retired — flagged by the user as reading like an upload/privacy prompt. Open is now the single, normal-convention entry point for any supported input.import_own.jsis loaded a second time, fromviewer/viewer.html. Itsviewer/-relative asset paths now collapse correctly via_fromViewerHost/_viewerAssetPrefix.openProject()gainedopts.sameTabso a merge triggered from Open navigates the CURRENT tab instead of spawning a second one.2. New BCF 2.1 export module (Viewer had none)
modeller/bcf_export.js; the domain mapping (topic shape, status→BCF-status, severity→BCF-priority) is ported from the real Federation/IfcOpenShell Python BCF generator (~/IfcOpenShell/src/bonsai/bonsai/bim/module/federation/bcf/bcf_generator.py+viewpoint_manager.py) — re-sourced onto the Viewer's own real fields (clash status lifecycle, severity labels, stored camera/snapshot per issue) instead of that module's SQLite schema.viewer/issues.jsIssue — both clashes (TopicType=Clash) and freeform site notes (TopicType=Comment).Test plan
viewer/tests/poc_open_button_ifc_merge.js— real ARC+MEP reference IFCs through the real Open-button entry point, full round trip. 10/10 PASS.viewer/tests/morpheus_import_live.js— retired to a regression guard confirming the drop-zone removal stuck. 4/4 PASS.viewer/tests/poc_bcf_export.js— seeds real Issue records (one clash w/ real PNG snapshot, one note) into the real IndexedDB, drives the realAPP.exportBcf(), then validates the produced.bcfzipwith the independentunzipCLI (archive integrity + per-topic XML content), not self-checking. 20/20 PASS. Snapshot separately confirmed a genuinely valid PNG viafile.index.htmlhub post-removal — catalog cards render normally, 0 console errors.Generated with Claude Code.