/** * IFC STEP file exporter * * Exports IFC data store to ISO 10303-21 STEP format. * Supports applying property and root attribute mutations before export. */ import type { IfcDataStore } from '@ifc-lite/parser'; import { type MapConversion, type ProjectedCRS } from '@ifc-lite/parser'; import type { MutablePropertyView } from '@ifc-lite/mutations'; /** * Options for STEP export */ export interface StepExportOptions { /** IFC schema version for the output file (any version, will convert if needed) */ schema: 'IFC2X3' | 'IFC4' | 'IFC4X3' | 'IFC5'; /** File description */ description?: string; /** Author name */ author?: string; /** Organization name */ organization?: string; /** Application name (defaults to 'ifc-lite') */ application?: string; /** Output filename */ filename?: string; /** Include original geometry entities (default: true) */ includeGeometry?: boolean; /** Include property sets (default: true) */ includeProperties?: boolean; /** Include quantity sets (default: true) */ includeQuantities?: boolean; /** Include relationships (default: true) */ includeRelationships?: boolean; /** Apply mutations from MutablePropertyView (default: true if provided) */ applyMutations?: boolean; /** Only export entities with mutations (delta export) */ deltaOnly?: boolean; /** Only export entities currently visible in the viewer */ visibleOnly?: boolean; /** Hidden entity IDs (local expressIds) — required when visibleOnly is true */ hiddenEntityIds?: Set; /** Isolated entity IDs (local expressIds, null = no isolation active) */ isolatedEntityIds?: Set | null; /** Georeferencing mutations to apply (IfcProjectedCRS / IfcMapConversion edits) */ georefMutations?: { projectedCRS?: Partial; mapConversion?: Partial; }; /** Progress callback for async export */ onProgress?: (progress: StepExportProgress) => void; } /** * Progress information during STEP export */ export interface StepExportProgress { /** Current phase of export */ phase: 'preparing' | 'entities' | 'assembling'; /** Progress 0-1 */ percent: number; /** Number of entities processed so far */ entitiesProcessed: number; /** Total entities to process */ entitiesTotal: number; } /** * Result of STEP export */ export interface StepExportResult { /** STEP file content as bytes (avoids V8 string length limit for large files) */ content: Uint8Array; /** Statistics about the export */ stats: { /** Total entities exported */ entityCount: number; /** New entities created for mutations */ newEntityCount: number; /** Entities modified by mutations */ modifiedEntityCount: number; /** File size in bytes */ fileSize: number; }; } /** * IFC STEP file exporter */ export declare class StepExporter { private dataStore; private mutationView; private nextExpressId; private entityExtractor; constructor(dataStore: IfcDataStore, mutationView?: MutablePropertyView); /** * Export to STEP format */ export(options: StepExportOptions): StepExportResult; /** * Async export that yields to the event loop periodically, keeping the * UI responsive during large exports. Calls onProgress with live stats. */ exportAsync(options: StepExportOptions): Promise; /** * Export only property/quantity changes (lightweight export) */ exportPropertiesOnly(options: Omit): StepExportResult; /** * Generate STEP entities for property sets */ private generatePropertySetEntities; /** * Generate STEP entities for quantity sets (IfcElementQuantity) */ private generateQuantitySetEntities; /** * Rewrite root IFC attributes directly on the original STEP entity line. */ private applyAttributeMutations; /** * Apply positional STEP argument overrides to an entity line. * Used for non-IfcRoot edits (e.g. profile dimensions) where attributes * have no symbolic names. Indexes that fall outside the existing arg list * are silently ignored. */ private applyPositionalMutations; private resolveMapUnitReference; private normalizeMapUnitName; private findLengthUnitReference; private findPreferredGeometricRepresentationContextId; /** * Generate a new IFC GlobalId (22 character base64) */ private generateGlobalId; /** * Find the maximum EXPRESS ID in the data store */ private findMaxExpressId; /** * Find a unit entity ID by name (simplified - returns null for now) */ private findUnitId; /** * Check if an entity type is a geometry-related type */ private isGeometryEntity; /** * Build a one-shot reverse index of every IfcRelDefinesByProperties in * the source: for each related entity, list the rels and property/quantity * sets that reference it. Used by the export pre-pass so the per-entity * "find owning rels" step is O(K) rather than O(N) per modified entity. */ private buildRelDefinesByPropertiesIndex; /** * Get entity IDs related by IfcRelDefinesByProperties (the related objects) */ private getRelatedEntities; /** * Get the property set ID from IfcRelDefinesByProperties */ private getRelatedPropertySet; /** * Get the name of a property set by parsing the entity */ private getPropertySetName; /** * Get the name of an element quantity set by parsing the entity */ private getElementQuantityName; /** * Get IDs of properties in a property set */ private getPropertyIdsInSet; /** * Check whether an entity is an IFC type object (e.g. IfcWallType). */ private isTypeEntity; /** * Get the full HasPropertySets ID list from a type entity. * This preserves both property and quantity definitions already assigned there. */ private getTypeOwnedHasPropertySetIds; /** * Rewrite a type entity so its HasPropertySets attribute points to replacement psets. */ private rewriteTypeEntityHasPropertySets; /** * Replace a single top-level STEP attribute in an entity line. */ private replaceEntityAttribute; } /** * Quick export function for simple use cases. * Returns content as a string (may fail for very large files due to V8 string limit). * For large files, use StepExporter directly and work with the Uint8Array content. */ export declare function exportToStep(dataStore: IfcDataStore, options?: Partial): string; //# sourceMappingURL=step-exporter.d.ts.map