pub struct IfcAPI { /* private fields */ }Expand description
Main IFC-Lite API
Implementations§
Source§impl IfcAPI
impl IfcAPI
Sourcepub fn parse_streaming(&self, content: String, callback: Function) -> Promise
pub fn parse_streaming(&self, content: String, callback: Function) -> Promise
Parse IFC file with streaming events Calls the callback function for each parse event
Example:
const api = new IfcAPI();
await api.parseStreaming(ifcData, (event) => {
console.log('Event:', event);
});Sourcepub fn parse(&self, content: String) -> Promise
pub fn parse(&self, content: String) -> Promise
Parse IFC file (traditional - waits for completion)
Example:
const api = new IfcAPI();
const result = await api.parse(ifcData);
console.log('Entities:', result.entityCount);Sourcepub fn parse_zero_copy(&self, content: String) -> ZeroCopyMesh
pub fn parse_zero_copy(&self, content: String) -> ZeroCopyMesh
Parse IFC file with zero-copy mesh data Maximum performance - returns mesh with direct memory access
Example:
const api = new IfcAPI();
const mesh = await api.parseZeroCopy(ifcData);
// Create TypedArray views (NO COPYING!)
const memory = await api.getMemory();
const positions = new Float32Array(
memory.buffer,
mesh.positions_ptr,
mesh.positions_len
);
// Upload directly to GPU
gl.bufferData(gl.ARRAY_BUFFER, positions, gl.STATIC_DRAW);Sourcepub fn parse_meshes(&self, content: String) -> MeshCollection
pub fn parse_meshes(&self, content: String) -> MeshCollection
Parse IFC file and return individual meshes with express IDs and colors This matches the MeshData[] format expected by the viewer
Example:
const api = new IfcAPI();
const collection = api.parseMeshes(ifcData);
for (let i = 0; i < collection.length; i++) {
const mesh = collection.get(i);
console.log('Express ID:', mesh.expressId);
console.log('Positions:', mesh.positions);
console.log('Color:', mesh.color);
}Sourcepub fn parse_meshes_instanced(&self, content: String) -> InstancedMeshCollection
pub fn parse_meshes_instanced(&self, content: String) -> InstancedMeshCollection
Parse IFC file and return instanced geometry grouped by geometry hash This reduces draw calls by grouping identical geometries with different transforms
Example:
const api = new IfcAPI();
const collection = api.parseMeshesInstanced(ifcData);
for (let i = 0; i < collection.length; i++) {
const geometry = collection.get(i);
console.log('Geometry ID:', geometry.geometryId);
console.log('Instances:', geometry.instanceCount);
for (let j = 0; j < geometry.instanceCount; j++) {
const inst = geometry.getInstance(j);
console.log(' Express ID:', inst.expressId);
console.log(' Transform:', inst.transform);
}
}Sourcepub fn parse_meshes_instanced_async(
&self,
content: String,
options: JsValue,
) -> Promise
pub fn parse_meshes_instanced_async( &self, content: String, options: JsValue, ) -> Promise
Parse IFC file with streaming instanced geometry batches for progressive rendering Groups identical geometries and yields batches of InstancedGeometry Uses fast-first-frame streaming: simple geometry (walls, slabs) first
Example:
const api = new IfcAPI();
await api.parseMeshesInstancedAsync(ifcData, {
batchSize: 25, // Number of unique geometries per batch
onBatch: (geometries, progress) => {
for (const geom of geometries) {
renderer.addInstancedGeometry(geom);
}
},
onComplete: (stats) => {
console.log(`Done! ${stats.totalGeometries} unique geometries, ${stats.totalInstances} instances`);
}
});Sourcepub fn parse_meshes_async(&self, content: String, options: JsValue) -> Promise
pub fn parse_meshes_async(&self, content: String, options: JsValue) -> Promise
Parse IFC file with streaming mesh batches for progressive rendering Calls the callback with batches of meshes, yielding to browser between batches
Example:
const api = new IfcAPI();
await api.parseMeshesAsync(ifcData, {
batchSize: 100,
onBatch: (meshes, progress) => {
// Add meshes to scene
for (const mesh of meshes) {
scene.add(createThreeMesh(mesh));
}
console.log(`Progress: ${progress.percent}%`);
},
onComplete: (stats) => {
console.log(`Done! ${stats.totalMeshes} meshes`);
}
});Sourcepub fn get_memory(&self) -> JsValue
pub fn get_memory(&self) -> JsValue
Get WASM memory for zero-copy access
Sourcepub fn get_geo_reference(&self, content: String) -> Option<GeoReferenceJs>
pub fn get_geo_reference(&self, content: String) -> Option<GeoReferenceJs>
Extract georeferencing information from IFC content Returns null if no georeferencing is present
Example:
const api = new IfcAPI();
const georef = api.getGeoReference(ifcData);
if (georef) {
console.log('CRS:', georef.crsName);
const [e, n, h] = georef.localToMap(10, 20, 5);
}Sourcepub fn parse_meshes_with_rtc(&self, content: String) -> MeshCollectionWithRtc
pub fn parse_meshes_with_rtc(&self, content: String) -> MeshCollectionWithRtc
Parse IFC file and return mesh with RTC offset for large coordinates This handles georeferenced models by shifting to centroid
Example:
const api = new IfcAPI();
const result = api.parseMeshesWithRtc(ifcData);
const rtcOffset = result.rtcOffset;
const meshes = result.meshes;
// Convert local coords back to world:
if (rtcOffset.isSignificant()) {
const [wx, wy, wz] = rtcOffset.toWorld(localX, localY, localZ);
}Sourcepub fn debug_process_entity_953(&self, content: String) -> String
pub fn debug_process_entity_953(&self, content: String) -> String
Debug: Test processing entity #953 (FacetedBrep wall)
Sourcepub fn debug_process_first_wall(&self, content: String) -> String
pub fn debug_process_first_wall(&self, content: String) -> String
Debug: Test processing a single wall
Trait Implementations§
Source§impl FromWasmAbi for IfcAPI
impl FromWasmAbi for IfcAPI
Source§impl IntoWasmAbi for IfcAPI
impl IntoWasmAbi for IfcAPI
Source§impl LongRefFromWasmAbi for IfcAPI
impl LongRefFromWasmAbi for IfcAPI
Source§impl OptionFromWasmAbi for IfcAPI
impl OptionFromWasmAbi for IfcAPI
Source§impl OptionIntoWasmAbi for IfcAPI
impl OptionIntoWasmAbi for IfcAPI
Source§impl RefFromWasmAbi for IfcAPI
impl RefFromWasmAbi for IfcAPI
Source§impl RefMutFromWasmAbi for IfcAPI
impl RefMutFromWasmAbi for IfcAPI
Source§impl TryFromJsValue for IfcAPI
impl TryFromJsValue for IfcAPI
Source§impl VectorFromWasmAbi for IfcAPI
impl VectorFromWasmAbi for IfcAPI
Source§impl VectorIntoWasmAbi for IfcAPI
impl VectorIntoWasmAbi for IfcAPI
impl SupportsConstructor for IfcAPI
impl SupportsInstanceProperty for IfcAPI
impl SupportsStaticProperty for IfcAPI
Auto Trait Implementations§
impl Freeze for IfcAPI
impl RefUnwindSafe for IfcAPI
impl Send for IfcAPI
impl Sync for IfcAPI
impl Unpin for IfcAPI
impl UnwindSafe for IfcAPI
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
Source§type Abi = <T as IntoWasmAbi>::Abi
type Abi = <T as IntoWasmAbi>::Abi
IntoWasmAbi::AbiSource§fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
IntoWasmAbi::into_abi, except that it may throw and never
return in the case of Err.Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.