Skip to main content

Overview

OpenGeometry can export B-Reps to binary STL. You can export a single B-Rep payload or export a whole scene through OGSceneManager.
STL export is experimental. Output, config fields, and file-writing helpers may change. If you hit an exporter limitation or confusing output, reach out on Discord.
The WebAssembly build returns STL as bytes (Uint8Array). You are responsible for downloading or persisting those bytes. Some file-writing convenience methods exist only in native builds.

Initialization

Initialize the WASM module once before using OGSceneManager:

Export APIs

exportBrepToStl

Export a single serialized B-Rep JSON string to STL bytes.

exportSceneToStl / exportCurrentSceneToStl

Export a stored scene (or the current scene) to STL bytes.

Result type

export*ToStl(...) returns an OGStlExportResult:
Uint8Array
The binary STL bytes.
string
A JSON string containing export statistics (triangle counts, skipped faces, topology errors).

Config JSON

All STL exports accept an optional config_json string. If it is null, undefined, or an empty string, OpenGeometry uses defaults. If you provide config_json, it must deserialize into the full StlExportConfig shape. Default configuration (Rust):
Example JSON payload:

Examples

Export a wrapper shape to STL

OGSceneManager expects a serialized B-Rep string. Wrapper shapes expose one of getBrep(), getBrepData(), or getBrepSerialized() depending on the type.

Download STL in the browser

Write STL in Node.js

Native-only file export

Native-only builds also expose exportSceneToStlFile(...) (not available in browser/WASM builds).
Last modified on March 14, 2026