Crate ifc_lite_processing

Crate ifc_lite_processing 

Source
Expand description

Shared IFC processing pipeline and types.

This crate extracts the core processing logic so it can be used by both the HTTP server and the native FFI library.

Re-exports§

pub use geometry_export::build_geometry_data_export;
pub use geometry_export::build_colored_geometry_data_export;
pub use geometry_export::ColoredGeometryDataExport;
pub use geometry_export::ExportedElement;
pub use geometry_export::GeometryDataExport;
pub use analytic_export::check_swept_disk;
pub use analytic_export::extract_analytic_quantity_sources;
pub use analytic_export::AnalyticQuantitySources;
pub use analytic_export::extract_swept_disk_definitions;
pub use analytic_export::extract_swept_disk_descriptions;
pub use analytic_export::extract_swept_disk_views;
pub use analytic_export::extract_extrusion_definitions;
pub use analytic_export::extrusion_nominal_quantities;
pub use analytic_export::DirectrixMetrics;
pub use analytic_export::DirectrixSegmentMetrics;
pub use analytic_export::ExtrusionNominalQuantities;
pub use analytic_export::SweptDiskCheckError;
pub use analytic_export::SweptDiskCheckFinding;
pub use analytic_export::SweptDiskCheckOptions;
pub use analytic_export::SweptDiskCheckReport;
pub use analytic_export::SweptDiskDefinition;
pub use analytic_export::SweptDiskDefinitions;
pub use analytic_export::SweptDiskDescriptions;
pub use analytic_export::SweptDiskFindingCode;
pub use analytic_export::SweptDiskInstance;
pub use analytic_export::SweptDiskNominalQuantities;
pub use analytic_export::SweptDiskOccurrence;
pub use analytic_export::SweptDiskSourceContext;
pub use analytic_export::SweptDiskSourceKey;
pub use analytic_export::AnalyticSourceContext;
pub use analytic_export::AnalyticSourceKey;
pub use analytic_export::ExtrusionDefinition;
pub use analytic_export::ExtrusionDefinitions;
pub use analytic_export::ExtrusionInstance;
pub use pipeline_diagnostics::PipelineDiagnostics;
pub use pipeline_diagnostics::PipelineDiagnosticsReport;
pub use pipeline_diagnostics::PipelinePhaseTimings;
pub use pipeline_diagnostics::PIPELINE_DIAGNOSTICS_SCHEMA_VERSION;
pub use simplify_session::simplify_element;
pub use simplify_session::SimplifiedElement;
pub use simplify_session::SimplifyRecordInput;
pub use simplify_session::SimplifySkip;
pub use style::default_color_for_type;
pub use style::Rgba;
pub use style::TRANSPARENCY_ALPHA_THRESHOLD;

Modules§

analytic_export
Optional analytic descriptions of authored geometry, keyed by product occurrence. This walks the same body-representation selection as the mesh router, but does not produce meshes. Source operands of booleans are identified as such.
appearance
Opt-in appearance authoring over an effective IFC snapshot. No load-time geometry changes. Plans are applied atomically by the host mutation editor.
data_model
Data model extraction service - extracts properties, relationships, and spatial hierarchy.
determinism
Mesh-output determinism manifest - the pipeline-level companion to the kernel’s predicate sign manifest (ifc_lite_geometry::kernel::manifest).
discovery
Shared record discovery; native metadata and geometry-job decoration remain consumers.
element
Canonical per-element mesh production — THE single decision tree that turns one IFC product (or type-product RepresentationMap) into renderable meshes.
execution
Shared scheduler boundaries around the owned element transaction. Worker caches, batch source ownership and output encoding remain with the callers.
geometry_export
Analysis-ready geometry-data export.
pdf_vector
Bounded graphics-state preparation for the pinned PDF.js adapter, producing the convertible path subset and a page-level fidelity report. This does not authorize geometry. The explicit annotation planner separately composes qualified fills and bounded solid straight stroke outlines.
pipeline_diagnostics
Structured per-load pipeline diagnostics — the cross-target contract.
prepass
Canonical prepass resolution — the single post-scan step that turns the entity spans a scan collected into the style / material / void context the per-element producer (crate::element) consumes.
result_cache
Native warm-load cache of complete results; off unless a caller opts in. Native warm-load cache of complete processing results (phase 1).
retained_geometry
Explicit admission of canonical processing output into a geometry document.
retained_requests
Opt-in retained authored-source requests for a model.
scan
ScanClass: the one table of STEP keywords a scan loop reacts to.
scan_proposals
Scan-to-BIM element proposals (#6894): planes and cylinders from scan_segmentation become proposed walls, slabs, columns and pipes in the IFC model frame, each with a confidence, its source detections and their fit statistics. Nothing is created here; the viewer reviews the proposals and creates the accepted ones through its modelling commands.
scan_segmentation
Plane and cylinder detection in point clouds (#6870): scan-to-BIM groundwork.
simplify_session
Demesher session core: simplify already-produced element meshes and hand back BOTH a render-ready replacement mesh and the same vertices in the element’s IFC object-placement frame (file units) for tessellated IFC re-export.
stream_meta
Shared streaming pre-pass meta resolution.
style
Canonical IFC styling — the single source of truth for mesh colors, shared between the HTTP server, the native pipeline, and the browser-side WASM bindings (issue #913).

Structs§

Batching
How the meshing loop chunks its jobs, and in what order.
CoordinateInfo
Coordinate system information.
Features
The optional phases of a pass. All on except the bootstrap and the finishes, as before.
FrameEvent
The frame a pass bakes its vertices in (#5407).
Georeferencing
Georeferencing metadata (IfcMapConversion + IfcProjectedCRS).
InstanceRecord
#1623 Phase 2: one resolved occurrence of a shared template geometry, emitted in crate::ProcessingResult::instances instead of a full materialized mesh when StreamingOptions.enable_instancing is set. The consumer uploads the template MeshData (template_express_id, still in meshes) once and draws this occurrence by applying transform to the template’s baked world geometry. Purely in-memory, like MeshData::instance — recomputed fresh each load, never round-trips a cache.
MeshData
Individual mesh data with geometry and metadata.
MeshPresentationProvenance
Provenance of one produced mesh’s presentation channels.
MeshTextureData
A surface texture attached to a mesh (issues #961, #1781). Exactly one of rgba / url is set:
ModelMetadata
Model metadata extracted from the IFC file.
OnBatch
A sink that listens to batches only: OnBatch::new(|meshes, processed, total| ..).
ParseResponse
Full parse response with all meshes.
ProcessingRequest
One pass over one file: the input of process.
ProcessingResult
Result of processing an IFC file.
ProcessingStats
Processing statistics.
ProductGeometryAudit
Per-product processing receipts for consumers that cannot accept partial geometry. No entry means NOT proven: skipped/undecodable jobs never become a clean receipt. Ok certifies only the diagnostic checks below, not source referential integrity or shared-cache provenance. Strict consumers must check those independently.
QuickMetadataBootstrap
QuickMetadataEntitySummary
QuickMetadataPrunedEdge
A spatial child edge left out of QuickMetadataBootstrap::spatial_tree. Each node is placed where the depth-first walk from the root first reaches it; every later IfcRelAggregates edge to it is recorded here, as is every child edge the walk would follow out of a node at the depth limit. A spatial element an IfcRelContainedInSpatialStructure promotes to a child is not an aggregate edge: skipping it because the node is already placed, or because the node is settled (see QuickMetadataPrunedEdgeKind::DepthLimit), is not recorded (#4689).
QuickMetadataSpatialNode
RawInstanceOccurrence
#1623 Phase 2 “don’t-bake”: a non-template occurrence of a shared IfcRepresentationMap that skipped the per-occurrence vertex materialize. The router emits an instance-only placeholder (empty geometry carrying InstanceMeta); [crate::element::emit_sub_meshes] turns it into one of these, and the streaming finalize resolves it against the template MeshData into an InstanceRecord. Purely in-memory (recomputed each load), never serialized.
ShardScan
A speculative shard; diagnostics are attributed only after the handoff stitch.
StreamingOptions
Controls the tradeoff between first-frame latency and richer upfront metadata.
SymbolicCircle
A single 2D circle / arc for symbolic representations.
SymbolicData
Server-friendly summary of the IFC’s 2D symbol data.
SymbolicDataWithProvenance
Canonical symbol data plus extraction-bound direct fill identities. Private fields preserve freedom to extend this result without breaking callers constructing the legacy SymbolicData / SymbolicFillArea structs.
SymbolicFillArea
A 2D filled region (IfcAnnotationFillArea).
SymbolicGridAxis
A single IfcGridAxis tag + axis curve (server-friendly endpoint-pair representation; the wasm pipeline emits the same data via SymbolicPolyline axis lines and SymbolicText bubbles, both of which are also populated below).
SymbolicPolyline
A single 2D polyline for symbolic representations.
SymbolicText
A 2D text annotation (IfcTextLiteral / IfcTextLiteralWithExtent).
SymbolicTruncation
What stopped an extraction early, when something did.
TextureBinding
Binding of a mesh’s texture coordinates to the source texture map.

Enums§

MeshCoordinateSpace
Which frame serialized mesh vertices are expressed in.
MeshFrame
The frame a pipeline meshes into: the translation it subtracts and, in the site tier, the rotation it removes.
NormalProvenance
Who wrote the normals this mesh ships.
OpeningFilterMode
Controls how IfcWindow / IfcDoor openings are exported.
PaletteAbsence
Why a body that reached a palette carries no binding.
PaletteBinding
Binding of a mesh’s colour to an IfcIndexedColourMap palette entry.
QuickMetadataPrunedEdgeKind
Why a QuickMetadataPrunedEdge was left out.
SymbolicTruncationReason
Which bound stopped an extraction early.
TessellationQuality
Re-exported so the server can name the quality level without a direct ifc-lite-geometry dependency edge for one enum. Detail level for geometry tessellation, selectable by consumers.
UvAuthority
How far the shipped UVs are the source’s.

Constants§

GEOMETRY_STACK_BYTES
Stack size for every rayon worker that runs geometry (256 MiB).
PREPASS_CLASS_CODE_MASK
Mask extracting the named-arm code from a class byte (drops the flag bits).
PREPASS_CLASS_FLAG_GEOMETRY_JOB
FLAG bit: geometry-bearing entity (has_geometry_by_name) — a pre-pass geometry job. Composes with the named codes’ nibble range (2..=13) and with PREPASS_CLASS_FLAG_TYPE_CANDIDATE.
PREPASS_CLASS_FLAG_TYPE_CANDIDATE
FLAG bit: IfcTypeProduct subtype candidate (name ends TYPE/STYLE) for the #957 orphan type-geometry pass.
PREPASS_CLASS_INDEXED_COLOUR_MAP
IFCINDEXEDCOLOURMAP (#663/#858).
PREPASS_CLASS_MAPPED_ITEM
IFCMAPPEDITEM (#957/#1623 repmap plans).
PREPASS_CLASS_MATERIAL_DEF_REPR
IFCMATERIALDEFINITIONREPRESENTATION (#407).
PREPASS_CLASS_MATERIAL_LAYER_SET
IFCMATERIALLAYERSET / IFCMATERIALLAYERSETUSAGE (arms the layer index).
PREPASS_CLASS_NONE
Per-record prepass class emitted by scan_shard_classified.
PREPASS_CLASS_PROJECT
IFCPROJECT.
PREPASS_CLASS_REL_AGGREGATES
IFCRELAGGREGATES.
PREPASS_CLASS_REL_ASSOCIATES_MATERIAL
IFCRELASSOCIATESMATERIAL (#407).
PREPASS_CLASS_REL_DEFINES_BY_TYPE
IFCRELDEFINESBYTYPE (#957 instantiated-type ids).
PREPASS_CLASS_REL_FILLS
IFCRELFILLSELEMENT.
PREPASS_CLASS_REL_VOIDS
IFCRELVOIDSELEMENT.
PREPASS_CLASS_SITE
IFCSITE (also a geometry job — the pre-pass buffers it like one).
PREPASS_CLASS_STYLED_ITEM
IFCSTYLEDITEM — the styled-item spans the pre-pass resolver classifies into orphan (material appearance) vs geometry-attached styles.

Traits§

ProcessingSink
Events of one process pass. See the module docs.

Functions§

build_entity_index_parallel
Build the entity index (expressId -> byte span) across all available cores.
classify_type_name
Classify a scanned STEP keyword into the prepass class byte: a named-arm code for the exact keywords the serial pre-pass matches, plus the geometry-job / type-candidate FLAG bits from the same helpers it calls (has_geometry_by_name, IfcType::is_subtype_of). Byte-identical span collection and job discovery follow from using the identical predicates at scan time.
convert_mesh_to_site_local
Rotate a mesh into the site-local axis frame. Only runs for the site_local coordinate-space tier; translation alignment happens upstream via the router’s RTC subtraction.
detect_schema_version
The IFC schema a STEP file declares: "IFC2X3", "IFC4", "IFC4X3" or "IFC5". THE detector for every schema_version this workspace reports, the native pipeline’s ModelMetadata and the server’s /parse/metadata alike (PROCESSING-5 / SERVER-18, #7691: the server kept a second, case-sensitive copy, and processing searched the whole file, so ifc4 inside a GUID reported an IFC2X3 model as IFC4).
extract_georeferencing
Extract georeferencing from an IFC file, returning None when the model carries no IfcMapConversion, IfcRigidOperation, declared CRS, ePSet_MapConversion or IfcSite lat/long data.
extract_georeferencing_with_index
extract_georeferencing, reusing an index the caller already holds.
extract_symbolic_data
Scan an IFC file for IfcGrid and any product carrying a Plan / Annotation / FootPrint / Axis representation, and return the full symbolic primitive collection. Pure-Rust (no wasm_bindgen), so it works inside the HTTP server.
extract_symbolic_data_with_provenance
Extract symbols with ordinal-bound direct fill provenance, preserving the legacy data shape.
extract_symbolic_data_with_provenance_in_frame
Extract symbols in a frame the caller already chose: the native pipeline’s crate::ProcessingResult::frame.
flat_styles_rgba8_from_geometry_columns
crate::prepass::flat_styles_rgba8 with the (dominant) geometry-style source supplied as PRE-MERGED columns instead of a map — the sharded finalize path. geom_ids are unique (the host merged shard results first-wins) with geom_colors as rgba f32 quads; resolved carries the support resolution (indexed colours, materials, element colours) and MUST have an empty geometry_style_index. Output is byte-identical to the serial flatten: same precedence (geometry > indexed colour > material > element material), same id-ascending wire order, same rgba8 conversion — without ever building the 4M-entry geometry hashmap.
geometry_pool
The process-wide large-stack pool, built on first use.
geometry_pool_builder
A [ThreadPoolBuilder] whose workers have GEOMETRY_STACK_BYTES stacks. Callers may add num_threads and then build or build_global.
group_occurrences_by_rep
The don’t-bake occurrence grouping, template selection and occurrence → flat MeshData recovery, shared with the browser batch (rust/wasm-bindings/src/api/gpu_meshes/instancing.rs) so each has one home rather than two clones. See their doc comments. Group don’t-bake occurrences by shared-template key (rep_identity, the IfcRepresentationMap id). Groups come back in ascending rep order so the output is deterministic; each group keeps its occurrences in arrival order.
index_templates_by_rep
The don’t-bake occurrence grouping, template selection and occurrence → flat MeshData recovery, shared with the browser batch (rust/wasm-bindings/src/api/gpu_meshes/instancing.rs) so each has one home rather than two clones. See their doc comments. Index the template meshes a set of occurrences can be placed against, by rep_identity. A template is a non-empty mesh whose instance metadata is instanceable; the FIRST such mesh per rep wins. info maps the winner’s position in meshes and the mesh itself to what the caller records: the native finalize keeps the index, the browser batch its shard eligibility. The caller decides the scope meshes covers (the whole model natively, one batch in the browser).
is_quick_spatial_type_ci
Is this STEP keyword a node of the quick-metadata spatial tree?
native_to_baked
The row-major 4x4 mapping a NATIVE-frame point (IFC Z-up, pre-RTC — the frame InstanceMeta.transform and every captured local_to_world describe) onto the BAKED point this pipeline actually writes into MeshData, for the given coordinate-space tier.
process
The native pipeline: scan, resolve, mesh, finalise. The one body behind every entry point; see ProcessingRequest for the inputs and ProcessingSink for the events it raises while it runs.
process_geometry
Process IFC content with parallel geometry extraction (default opening filter).
process_geometry_filteredDeprecated
Process IFC content with parallel geometry extraction and a configurable opening filter.
process_geometry_filtered_with_qualityDeprecated
Like process_geometry_filtered with a consumer-selected tessellation detail level (#976), exposed to the browser and server too.
process_geometry_filtered_with_quality_and_idsDeprecated
Like process_geometry_filtered_with_quality, but restricts tessellation to the supplied IFC express ids. None preserves the unfiltered behaviour; Some(empty) is an active filter that produces no meshes.
process_geometry_streamingDeprecated
Process IFC content with parallel geometry extraction and emit batches as they complete.
process_geometry_streaming_filteredDeprecated
Process IFC content with parallel geometry extraction and a configurable streaming batch size.
process_geometry_streaming_filtered_with_baked_basisDeprecated
process_geometry_streaming_filtered_with_options, plus: baked_basis_out receives native_to_baked for the frame this pass bakes vertices in. It is set once, after frame selection and BEFORE the first batch is emitted, so a streaming consumer can collate each batch in the baked frame as it arrives. It equals native_to_baked of the returned result’s mesh_coordinate_space, site_transform and metadata.coordinate_info.origin_shift.
process_geometry_streaming_filtered_with_optionsDeprecated
Process IFC content with parallel geometry extraction and configurable streaming behavior.
process_geometry_streaming_with_optionsDeprecated
Process IFC content with parallel geometry extraction and configurable streaming behavior.
process_geometry_streaming_with_options_and_bootstrapDeprecated
Process IFC content with parallel geometry extraction and emit a quick metadata bootstrap once the scan phase completes.
process_geometry_with_indexDeprecated
Like process_geometry but reuses a pre-built entity index instead of scanning content for one. For a caller that also runs a second pass over the same bytes (e.g. pairing GLB export with attribute extraction): build the index once with ifc_lite_core::build_entity_index and share it across both, skipping the duplicate scan. index MUST be built from the same content. Output is identical to process_geometry(content).
recover_occurrences_flat
The don’t-bake occurrence grouping, template selection and occurrence → flat MeshData recovery, shared with the browser batch (rust/wasm-bindings/src/api/gpu_meshes/instancing.rs) so each has one home rather than two clones. See their doc comments. Rebuild each don’t-bake occurrence of rep as a standalone flat MeshData, baked from the shared mapped-source registry at the occurrence’s world transform (post-RTC) — geometrically identical to the occurrence the flat path would have produced. No instancing benefit, but correct and never a silent loss.
result_fingerprint
Lowercase hex SHA-256 over the whole result (see the module docs for the two excluded field kinds).
run_on_geometry_pool
Run work on geometry_pool, so it and every rayon job it starts run on large-stack workers. Blocks the calling thread until work returns.
scan_shardDeprecated
scan_shard_with_refusals without the refusal offsets.
scan_shard_classifiedDeprecated
[scan_shard] plus a parallel per-record class column (see the PREPASS_CLASS_* codes). Same records, same handoff; the class byte lets the browser host extract pre-pass span lists (today: styled items) from the stitched shard columns WITHOUT waiting for the serial pre-pass scan.
scan_shard_classified_with_refusalsDeprecated
scan_shard_classified plus the byte offset of every record this shard refused because its instance name does not fit u32 (#3395).
scan_shard_result
Scan one shard, optionally classifying it without making index-only callers pay for keyword classification. Preserve file order and speculative diagnostics.
scan_shard_with_diagnosticsDeprecated
One shard’s speculative scan over [range_start, range_end), plus the byte offset of every record this shard refused and, if any, the byte offset of the record that made the scan stop early (#3695’s malformed-record stop).
scan_shard_with_refusalsDeprecated
scan_shard_with_diagnostics without the malformed-record offset.

Type Aliases§

ShardRecords
One shard’s records: (id, start, end) per entity, strictly increasing in start.
ShardRefusals
One shard’s refusals: the start byte of each record the scan dropped for an instance name above u32::MAX (#3395), strictly increasing.