CWriter

class Lib3MF::CWriter : public CBase
void WriteToFile(const std::string &sFilename)

Writes out the model as file. The file type is specified by the Model Writer class.

Parameters:

sFilename – Filename to write into

Lib3MF_uint64 GetStreamSize()

Retrieves the size of the full 3MF file stream.

Returns:

the stream size

void WriteToBuffer(std::vector<Lib3MF_uint8> &BufferBuffer)

Writes out the 3MF file into a memory buffer

Parameters:

BufferBuffer – buffer to write into

void WriteToCallback(const WriteCallback pTheWriteCallback, const SeekCallback pTheSeekCallback, const Lib3MF_pvoid pUserData)

Writes out the model and passes the data to a provided callback function. The file type is specified by the Model Writer class.

Parameters:
  • pTheWriteCallback – Callback to call for writing a data chunk

  • pTheSeekCallback – Callback to call for seeking in the stream

  • pUserData – Userdata that is passed to the callback function

void SetProgressCallback(const ProgressCallback pProgressCallback, const Lib3MF_pvoid pUserData)

Set the progress callback for calls to this writer

Parameters:
  • pProgressCallback – pointer to the callback function.

  • pUserData – pointer to arbitrary user data that is passed without modification to the callback.

Lib3MF_uint32 GetDecimalPrecision()

Returns the number of digits after the decimal point to be written in each vertex coordinate-value.

Returns:

The number of digits to be written in each vertex coordinate-value after the decimal point.

void SetDecimalPrecision(const Lib3MF_uint32 nDecimalPrecision)

Sets the number of digits after the decimal point to be written in each vertex coordinate-value.

Parameters:

nDecimalPrecision – The number of digits to be written in each vertex coordinate-value after the decimal point.

void SetStrictModeActive(const bool bStrictModeActive)

Activates (deactivates) the strict mode of the reader.

Parameters:

bStrictModeActive – flag whether strict mode is active or not.

bool GetStrictModeActive()

Queries whether the strict mode of the reader is active or not

Returns:

returns flag whether strict mode is active or not.

std::string GetWarning(const Lib3MF_uint32 nIndex, Lib3MF_uint32 &nErrorCode)

Returns Warning and Error Information of the read process

Parameters:
  • nIndex – Index of the Warning. Valid values are 0 to WarningCount - 1

  • nErrorCode – filled with the error code of the warning

Returns:

the message of the warning

Lib3MF_uint32 GetWarningCount()

Returns Warning and Error Count of the read process

Returns:

filled with the count of the occurred warnings.

void AddKeyWrappingCallback(const std::string &sConsumerID, const KeyWrappingCallback pTheCallback, const Lib3MF_pvoid pUserData)

Registers a callback to deal with data key encryption/decryption from keystore

Parameters:
  • sConsumerID – The ConsumerID to register for

  • pTheCallback – The callback to be callede for wrapping and encryption key

  • pUserData – Userdata that is passed to the callback function

void SetContentEncryptionCallback(const ContentEncryptionCallback pTheCallback, const Lib3MF_pvoid pUserData)

Registers a callback to deal with encryption of content

Parameters:
  • pTheCallback – The callback used to encrypt content

  • pUserData – Userdata that is passed to the callback function

typedef std::shared_ptr<CWriter> Lib3MF::PWriter

Shared pointer to CWriter to easily allow reference counting.