Skip to main content

Module threemf

Module threemf 

Source
Expand description

3MF: the mesh package, written with its own archive.

A 3MF file is a ZIP holding three parts: the content-types declaration, a relationship pointing at the model, and the model itself: an XML document of meshes and the items that place them. The archive is written and read here, with no library behind it.

It writes stored entries (no compression), which the ZIP format allows and every reader accepts: what writing a package needs is the container, not the codec. A file written this way is larger than one deflated.

Reading is the other way round. Every package a slicer or a modelling tool writes is deflated, so read_3mf inflates, with the decoder half of DEFLATE kept in this crate, and reads the archive through its central directory, where the sizes are, since a streamed entry leaves them out of its local header.

Structs§

Object
One mesh in the package, with the name the item carries.
PackageLimits
How much of a package read_package_within may read: how many entries, directories aside, and how many bytes they inflate to in all.
ThreeMfImport
What read_3mf found.
ThreeMfObject
One object of a package, placed as its build item places it.
ThreeMfVolume
One volume of an object: a run of the object’s triangles, and what it is for.

Enums§

ObjectRole
What a volume is for, as the metadata a package’s writer keeps names its role.
ObjectType
What a 3MF object is for, as its type attribute says.

Functions§

read_3mf
Read a 3MF package into placed meshes.
read_package
Read every part of a package: the entry names and their bytes.
read_package_within
read_package, refusing a package past limits before reading any entry.
write_3mf
Write meshes as a 3MF package.