Serializers

Serializer APIs for exporting IFC geometry and data.

Interfaces

ExportOptions

Defined in: ifcopenshell-js/src/serializers/index.ts:39

Geometry loading, serializer, cancellation, and progress options.

Properties

kernel?

optional kernel?: string

Defined in: ifcopenshell-js/src/serializers/index.ts:41

Previously loaded geometry kernel. Defaults to passthrough.

numThreads?

optional numThreads?: number

Defined in: ifcopenshell-js/src/serializers/index.ts:43

Number of native geometry iterator threads.

signal?

optional signal?: AbortSignal

Defined in: ifcopenshell-js/src/serializers/index.ts:48

Abort the export between geometry elements. Checked between synchronous native calls; it cannot interrupt one native call already in progress.

Methods

onProgress()?

optional onProgress(progress): void

Defined in: ifcopenshell-js/src/serializers/index.ts:50

Receive write and completion progress events.

Parameters
progress

OperationProgress

Returns

void


ExportResult

Defined in: ifcopenshell-js/src/serializers/index.ts:31

Text buffers returned by a serializer; OBJ uses secondary for MTL data.

Properties

primary

primary: string

Defined in: ifcopenshell-js/src/serializers/index.ts:33

Primary serialized content.

secondary

secondary: string

Defined in: ifcopenshell-js/src/serializers/index.ts:35

Secondary content, used for the OBJ material file.


OperationProgress

Defined in: ifcopenshell-js/src/serializers/index.ts:18

Serializer progress in native processing order.

Properties

current?

optional current?: number

Defined in: ifcopenshell-js/src/serializers/index.ts:22

message

message: string

Defined in: ifcopenshell-js/src/serializers/index.ts:20

phase

phase: string

Defined in: ifcopenshell-js/src/serializers/index.ts:19

ratio?

optional ratio?: number

Defined in: ifcopenshell-js/src/serializers/index.ts:21

Type Aliases

SerializerFormat

SerializerFormat = "obj" | "svg" | "ttl"

Defined in: ifcopenshell-js/src/serializers/index.ts:28

Formats supported by exportToBuffer.

Functions

exportToBuffer()

exportToBuffer(file, geomSettings, format, options?): Promise<ExportResult | null>

Defined in: ifcopenshell-js/src/serializers/index.ts:60

Serialize the file into in-memory text buffers. Load kernel, mapping and serializer plugins first.

OBJ returns its material data in secondary; SVG and TTL return an empty secondary buffer. The function returns null when the native iterator cannot initialize and throws when a serializer or geometry element fails.

Parameters

file

File

geomSettings

Settings

format

SerializerFormat

options?

ExportOptions = {}

Returns

Promise<ExportResult | null>