Crate openbim_ifcx_binding_core

Source
Expand description

Host-independent core of the IFCX language bindings.

The WebAssembly and Python bindings each wrap Document and LayerSet and hand their results to the host as JSON text, which the host parses into plain objects. The operations, the JSON shapes and the error codes live here once, so the hosts cannot drift apart: a fix or a new operation lands in one place and every binding exposes it.

GLB export goes through openbim-ifcx-geometry: the composed layers become a render scene, written by its to_glb.

This crate adds no IFCX behaviour of its own. It is a thin, host-shaped view of openbim-ifcx; if a binding needs more, that crate grows first.

use openbim_ifcx_binding_core::LayerSet;

let layer = br#"{
    "header": {"id": "demo", "ifcxVersion": "ifcx_alpha", "dataVersion": "1.0.0",
               "author": "someone", "timestamp": "2026-10-03"},
    "imports": [], "schemas": {},
    "data": [{"path": "site", "attributes": {"demo::name": "Site"}}]
}"#;
let mut layers = LayerSet::new();
layers.push_layer(layer.to_vec());
let tree: serde_json::Value = serde_json::from_str(&layers.compose_json()?).unwrap();
assert_eq!(tree["children"]["site"]["attributes"]["demo::name"], "Site");

Structs§

Document
One IFCX file held by a host.
GlbSettings
How LayerSet::to_glb places the model; see openbim_ifcx_geometry::glb::GlbOptions.
LayerSet
The layers of one model and, optionally, the files they import.

Enums§

BindingError
Why a binding call failed.