Skip to content

[Bug] IElement3D.hasMesh / hasGeometry always false after vim.load() #90

@SamuelAB-VIM

Description

@SamuelAB-VIM

Environment

  • vim-web 1.0.0-alpha.0, IIFE build (dist/vim-web.iife.js) loaded via <script>
  • API: VIM.Core.Webgl.createViewer() (headless, custom UI)
  • Chromium / desktop, devicePixelRatio 1.75
  • Model: 2,547 elements (2,264 with geometry), 12 Revit categories, structural

Summary. After loading a model and building geometry, every element reports
hasMesh === false and hasGeometry === false, even though the geometry renders correctly
and el.instances.length > 0. This makes it impossible to use the documented flags to tell
geometric elements apart from non-geometric ones.

Repro.

const viewer = VIM.Core.Webgl.createViewer();
viewer.viewport.reparent(container);
const vim = await viewer.load({ url: 'model.vim' }).getVim();
await vim.load();                       // geometry is built; the model is visible
const els = vim.getAllElements();
els.filter(e => e.hasMesh).length;      // 0   ❌ (expected: thousands)
els.filter(e => e.hasGeometry).length;  // 0   ❌
els.filter(e => e.instances?.length).length; // 2264 ✅ (the real signal)

Expected. After vim.load(), hasMesh is true for elements whose meshes were built,
and hasGeometry is true for elements that have instance definitions.

Actual. Both are false for all elements; only instances.length is reliable.

Impact. The docs point consumers at hasMesh/hasGeometry for filtering; downstream code
that trusts them silently treats every element as non-geometric. instances?.length > 0 is a
leaky fallback — e.g. the 9 OST_Cameras (saved-3D-view cameras, family "3D View") each
report instances: 2 yet getBoundingBox() returns null (no resolvable mesh). A working
hasMesh/hasGeometry would correctly return false for those and serve as the real
"has renderable/measurable geometry" filter (see also #8). Today the only reliable per-element
geometry test is await el.getBoundingBox() != null, which is async and doesn't scale (see #5).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions