Class AbstractThreeMfSerializer<T, O>Abstract
Type Parameters
- T
- O extends IThreeMfSerializerBaseOptions
Hierarchy (View Summary)
- AbstractThreeMfSerializer
Implements
Constructors
constructor
-
new AbstractThreeMfSerializer<T, O extends IThreeMfSerializerBaseOptions>(
opts: O,
): AbstractThreeMfSerializer<T, O>Type Parameters
- T
- O extends IThreeMfSerializerBaseOptions
Parameters
- opts: O
user-provided options overriding defaults.
Returns AbstractThreeMfSerializer<T, O>
Accessors
options
-
Expose the resolved options (defaults + overrides) as readonly.
Returns Readonly<O>
Methods
Abstractensure Zip Lib Ready Async
-
Provide a zip implementation for the current host/runtime.
This might be provided by the framework implementation, but it could differ depending on the host (native, Node.js, browser, etc.).
Expected shape (fflate-like):
- return [ Zip, ZipDeflate ] at minimum.
Notes:
- In a browser, this might require bundler configuration or dynamic import.
- In Node.js, this might be a direct import of "fflate" or another compatible implementation.
Returns Promise<any>
serialize Async
-
serializeAsync(
sink: (err: any, chunk: Uint8Array, final: boolean) => void,
...meshes: T[],
): Promise<void>Generic 3MF binary serializer. Pipeline overview:
- ensureZipLibReadyAsync provides a zip implementation (host-dependent).
- Convert meshes into an I3mfDocument (OPC parts + model).
- Create a zip target that streams through the provided sink.
- Serialize XML parts into zip entries.
- End the zip stream.
Parameters
- sink: (err: any, chunk: Uint8Array, final: boolean) => void
a callback receiving byte chunks; enables streaming without buffering the full archive in memory.
- ...meshes: T[]
the meshes to serialize.
Returns Promise<void>
to Document
-
Build a full 3MF OPC document from meshes.
The default behavior uses ThreeMfDocumentBuilder with the model produced by toModel(). Override if you need custom parts (textures, thumbnails, print ticket, etc.).
Parameters
- ...meshes: T[]
Returns I3mfDocument | undefined
Abstractto Model
-
Convert input meshes into a 3MF model.
Implementations typically:
- Create resources and objects.
- Define build items (instances) when exportInstances is enabled.
- Encode geometry and properties required by your pipeline.
Parameters
- builder: ThreeMfModelBuilder
- ...meshes: T[]
Returns I3mfModel
Base class for 3MF serialization.
Responsibilities:
Non-responsibilities: