Types used in the 3MF Library

Simple types

typedef uint8_t Lib3MF_uint8
typedef uint16_t Lib3MF_uint16
typedef uint32_t Lib3MF_uint32
typedef uint64_t Lib3MF_uint64
typedef int8_t Lib3MF_int8
typedef int16_t Lib3MF_int16
typedef int32_t Lib3MF_int32
typedef int64_t Lib3MF_int64
typedef float Lib3MF_single
typedef double Lib3MF_double
using Lib3MF_pvoid = void*
using Lib3MFResult = Lib3MF_int32

Enumerations

enum class ePropertyType : Lib3MF_int32
enumerator NoPropertyType = 0
enumerator BaseMaterial = 1
enumerator TexCoord = 2
enumerator Colors = 3
enumerator Composite = 4
enumerator Multi = 5
enum class eSlicesMeshResolution : Lib3MF_int32
enumerator Fullres = 0
enumerator Lowres = 1
enum class eModelUnit : Lib3MF_int32
enumerator MicroMeter = 0
enumerator MilliMeter = 1
enumerator CentiMeter = 2
enumerator Inch = 3
enumerator Foot = 4
enumerator Meter = 5
enum class eObjectType : Lib3MF_int32
enumerator Other = 0
enumerator Model = 1
enumerator Support = 2
enumerator SolidSupport = 3
enum class eTextureType : Lib3MF_int32
enumerator Unknown = 0
enumerator PNG = 1
enumerator JPEG = 2
enum class eTextureTileStyle : Lib3MF_int32
enumerator Wrap = 0
enumerator Mirror = 1
enumerator Clamp = 2
enumerator NoTileStyle = 3
enum class eTextureFilter : Lib3MF_int32
enumerator Auto = 0
enumerator Linear = 1
enumerator Nearest = 2
enum class eBeamLatticeCapMode : Lib3MF_int32
enumerator Sphere = 0
enumerator HemiSphere = 1
enumerator Butt = 2
enum class eBeamLatticeClipMode : Lib3MF_int32
enumerator NoClipMode = 0
enumerator Inside = 1
enumerator Outside = 2
enum class eBeamLatticeBallMode : Lib3MF_int32
enumerator None = 0
enumerator Mixed = 1
enumerator All = 2
enum class eProgressIdentifier : Lib3MF_int32
enumerator QUERYCANCELED = 0
enumerator DONE = 1
enumerator CLEANUP = 2
enumerator READSTREAM = 3
enumerator EXTRACTOPCPACKAGE = 4
enumerator READNONROOTMODELS = 5
enumerator READROOTMODEL = 6
enumerator READRESOURCES = 7
enumerator READMESH = 8
enumerator READSLICES = 9
enumerator READBUILD = 10
enumerator READCUSTOMATTACHMENT = 11
enumerator READTEXTURETACHMENTS = 12
enumerator CREATEOPCPACKAGE = 13
enumerator WRITEMODELSTOSTREAM = 14
enumerator WRITEROOTMODEL = 15
enumerator WRITENONROOTMODELS = 16
enumerator WRITEATTACHMENTS = 17
enumerator WRITECONTENTTYPES = 18
enumerator WRITENOBJECTS = 19
enumerator WRITENODES = 20
enumerator WRITETRIANGLES = 21
enumerator WRITESLICES = 22
enumerator WRITEKEYSTORE = 23
enum class eBlendMethod : Lib3MF_int32
enumerator NoBlendMethod = 0
enumerator Mix = 1
enumerator Multiply = 2
enum class eEncryptionAlgorithm : Lib3MF_int32
enumerator AES256_GCM = 1
enum class eWrappingAlgorithm : Lib3MF_int32
enumerator RSA_OAEP = 0
enum class eMgfAlgorithm : Lib3MF_int32
enumerator MGF1_SHA1 = 160
enumerator MGF1_SHA224 = 224
enumerator MGF1_SHA256 = 256
enumerator MGF1_SHA384 = 384
enumerator MGF1_SHA512 = 512
enum class eDigestMethod : Lib3MF_int32
enumerator SHA1 = 160
enumerator SHA256 = 256
enum class eCompression : Lib3MF_int32
enumerator NoCompression = 0
enumerator Deflate = 1

Structs

All structs are defined as packed, i.e. with the

#pragma pack (1)
struct sTriangle
Lib3MF_uint32 m_Indices[3]
struct sTriangleProperties
Lib3MF_uint32 m_ResourceID
Lib3MF_uint32 m_PropertyIDs[3]
struct sPosition
Lib3MF_single m_Coordinates[3]
struct sPosition2D
Lib3MF_single m_Coordinates[2]
struct sCompositeConstituent
Lib3MF_uint32 m_PropertyID
Lib3MF_double m_MixingRatio
struct sMultiPropertyLayer
Lib3MF_uint32 m_ResourceID
eBlendMethod m_TheBlendMethod
struct sTex2Coord
Lib3MF_double m_U
Lib3MF_double m_V
struct sTransform
Lib3MF_single m_Fields[4][3]
struct sBox
Lib3MF_single m_MinCoordinate[3]
Lib3MF_single m_MaxCoordinate[3]
struct sColor
Lib3MF_uint8 m_Red
Lib3MF_uint8 m_Green
Lib3MF_uint8 m_Blue
Lib3MF_uint8 m_Alpha
struct sBeam
Lib3MF_uint32 m_Indices[2]
Lib3MF_double m_Radii[2]
eBeamLatticeCapMode m_CapModes[2]
struct sBall
Lib3MF_uint32 m_Index
Lib3MF_double m_Radius

Function types

using ProgressCallback = void (*)(bool*, Lib3MF_double, Lib3MF::eProgressIdentifier, Lib3MF_pvoid)

A callback function

Return:

Returns whether the calculation should be aborted

Param dProgressValue:

The value of the progress function: values in the interval [0,1] are progress; < mean no progress update

Param eProgressIdentifier:

An identifier of progress

Param pUserData:

Userdata that is passed to the callback function

using WriteCallback = void (*)(Lib3MF_uint64, Lib3MF_uint64, Lib3MF_pvoid)

Callback to call for writing a data chunk

Param nByteData:

Pointer to the data to be written

Param nNumBytes:

Number of bytes to write

Param pUserData:

Userdata that is passed to the callback function

using ReadCallback = void (*)(Lib3MF_uint64, Lib3MF_uint64, Lib3MF_pvoid)

Callback to call for reading a data chunk

Param nByteData:

Pointer to a buffer to read data into

Param nNumBytes:

Number of bytes to read

Param pUserData:

Userdata that is passed to the callback function

using SeekCallback = void (*)(Lib3MF_uint64, Lib3MF_pvoid)

Callback to call for seeking in the stream

Param nPosition:

Position in the stream to move to

Param pUserData:

Userdata that is passed to the callback function

using RandomNumberCallback = void (*)(Lib3MF_uint64, Lib3MF_uint64, Lib3MF_pvoid, Lib3MF_uint64*)

Callback to generate random numbers

Param nByteData:

Pointer to a buffer to read data into

Param nNumBytes:

Size of available bytes in the buffer

Param pUserData:

Userdata that is passed to the callback function

Return:

Number of bytes generated when succeed. 0 or less if failed.

using KeyWrappingCallback = void (*)(Lib3MF_AccessRight, Lib3MF_uint8*, Lib3MF_uint8**, Lib3MF_pvoid, Lib3MF_uint64*)

A callback used to wrap (encrypt) the content key available in keystore resource group

Param pKEKParams:

The information about the parameters used used to wrap the key to the contents

Param nInBufferBufferSize:

Buffer to the input value. When encrypting, this should be the plain key. When decrypting, this should be the key cipher.

Param nInBufferBufferSize:

buffer of Buffer to the input value. When encrypting, this should be the plain key. When decrypting, this should be the key cipher.

Param nOutBufferBufferSize:

Number of elements in buffer

Param pOutBufferNeededCount:

will be filled with the count of the written elements, or needed buffer size.

Param pOutBufferBuffer:

buffer of Buffer where the data will be placed. When encrypting, this will be the key cipher. When decrypting, this will be the plain key. When buffer is null, neededBytes contains the required bytes to run.

Param pUserData:

Userdata that is passed to the callback function

Return:

The needed/encrypted/decrypted bytes when succeed or zero when error.

using ContentEncryptionCallback = void (*)(Lib3MF_ContentEncryptionParams, Lib3MF_uint8*, Lib3MF_uint8**, Lib3MF_pvoid, Lib3MF_uint64*)

A callback to encrypt/decrypt content called on each resource encrypted. This might be called several times depending on content size. If Input is not available(either null or size is 0), clients must return the result of authenticated tag generation/validation.

Param pCEKParams:

The params of the encryption process. Client must set/check AuthenticationTag when closing the encryption/decryption process.

Param nInputBufferSize:

Buffer to the original data. In encrypting, this will be the plain data. If decrypting, this will be the cipher data

Param nInputBufferSize:

buffer of Buffer to the original data. In encrypting, this will be the plain data. If decrypting, this will be the cipher data

Param nOutputBufferSize:

Number of elements in buffer

Param pOutputNeededCount:

will be filled with the count of the written elements, or needed buffer size.

Param pOutputBuffer:

buffer of Buffer to hold the transformed data. When encrypting, this will be the cipher data. When decrypting, this shall be the plain data. If buffer is null, neededBytes return the necessary amount of bytes.

Param pUserData:

Userdata that is passed to the callback function

Return:

The needed/encrypted/decrypted/verified bytes when succeed or zero when error.

ELib3MFException: The standard exception class of the 3MF Library

Errors in the 3MF Library are reported as Exceptions. It is recommended to not throw these exceptions in your client code.

class Lib3MF::ELib3MFException
void ELib3MFException::what() const noexcept

Returns error message

Returns:

the error message of this exception

Lib3MFResult ELib3MFException::getErrorCode() const noexcept

Returns error code

Returns:

the error code of this exception

CInputVector: Adapter for passing arrays as input for functions

Several functions of the 3MF Library expect arrays of integral types or structs as input parameters. To not restrict the interface to, say, std::vector<type>, and to have a more abstract interface than a location in memory and the number of elements to input to a function the 3MF Library provides a templated adapter class to pass arrays as input for functions.

Usually, instances of CInputVector are generated anonymously (or even implicitly) in the call to a function that expects an input array.

template<typename T>
class Lib3MF::CInputVector
CInputVector(const std::vector<T> &vec)

Constructs of a CInputVector from a std::vector<T>

CInputVector(const T *in_data, size_t in_size)

Constructs of a CInputVector from a memory address and a given number of elements

const T *CInputVector::data() const

returns the start address of the data captured by this CInputVector

size_t CInputVector::size() const

returns the number of elements captured by this CInputVector