Polygon geometry: an HGT1 transport, or a kernel3d value (encoded with to_transport, which needs kernel3d).
Required
options.targetUnit'mm' | 'cm' | 'm' | 'in' | 'ft'
The unit the file is written in. Default 'mm'. One of mm, cm, m, in, ft.
options.targetUp'y' | 'z'
The file’s up axis. Default 'z'. One of y, z.
Returns
Ok with the OBJ as bytes and their ref (sha256: of them): one v line per point, one f line per face; no vn, vt, o or g.
Errors
Returned when the geometry is curves or points, or has no P.
The file or value uses something the format reader or writer does not take: an extension, sparse or compressed data, an external buffer not passed, or curves for OBJ. Pass the external buffers as resources, export the file without compression, or convert curves to polygons first.
Returned when the file could pass 2 GiB, from the counts, before it is written.
The file is over an import limit: 256 MiB of bytes, 10^7 triangles or 3·10^7 points, or an export over 2 GiB. Split or decimate the model before importing it, or export a smaller value.
Returned when a coordinate is past the magnitude contract once the unit is applied.
A coordinate is not finite, or is past 1e18 m once the unit is applied. Check sourceUnit: a file in metres read as millimetres is a thousand times smaller, not larger; repair the value named by measured.path.
Returned when geometry names nothing the host holds, or an argument breaks its schema.
A tool argument does not match the tool's input schema. Fix the argument named in paramPath.
Returned when the transport is past kernelio’s decoding limits (any TRANSPORT_* code of a bad transport, at paramPath geometry).
The transport is past a decoding limit: 256 MiB in the browser, 2^28 elements per domain, 1024 attributes, 64 sections, or the decode budget. Split the geometry into smaller values; the message names the limit.
Returned when kernelio is not registered.
The action is not available in the current context. Satisfy measured.requires first (e.g. create a node before editing one), or load the module measured.capability names (e.g. loadGeometryKernel() for kernel3d).
Guarantees
an export in metres with +Y up reads back through importObj to the same topology and P bit for bit
the same geometry and options give the same bytes and ref
The same result on every machine.
Example
TypeScript
const r = FileFormats.exportObj(newUint8Array(0))r.ok || r.diagnostics[0].code // → TRANSPORT_MAGIC for bytes that are no transport once loadKernelIo() has run