The wrapper class CWrapper

class Lib3MF::CWrapper

All types of the 3MF Library reside in the namespace Lib3MF and all functionality of the 3MF Library resides in Lib3MF::CWrapper.

A suitable way to use Lib3MF::CWrapper is as a singleton.

void GetLibraryVersion(Lib3MF_uint32 &nMajor, Lib3MF_uint32 &nMinor, Lib3MF_uint32 &nMicro)

retrieves the binary version of this library.

Parameters:
  • nMajor – returns the major version of this library

  • nMinor – returns the minor version of this library

  • nMicro – returns the micro version of this library

bool GetPrereleaseInformation(std::string &sPrereleaseInfo)

retrieves prerelease information of this library.

Returns:

Does the library provide prerelease version?

Parameters:

sPrereleaseInfo – retrieves prerelease information of this library.

bool GetBuildInformation(std::string &sBuildInformation)

retrieves build information of this library.

Returns:

Does the library provide build version?

Parameters:

sBuildInformation – retrieves build information of this library.

void GetSpecificationVersion(const std::string &sSpecificationURL, bool &bIsSupported, Lib3MF_uint32 &nMajor, Lib3MF_uint32 &nMinor, Lib3MF_uint32 &nMicro)

retrieves whether a specification is supported, and if so, which version.

Parameters:
  • sSpecificationURL – URL of extension to check

  • bIsSupported – returns whether this specification is supported

  • nMajor – returns the major version of the extension (if IsSupported)

  • nMinor – returns the minor version of the extension (if IsSupported)

  • nMicro – returns the micro version of the extension (if IsSupported)

PModel CreateModel()

creates an empty model instance.

Returns:

returns an empty model instance

void Release(CBase *pInstance)

releases shared ownership of an object instance

Parameters:

pInstance – the object instance to release

void Acquire(CBase *pInstance)

acquires shared ownership of an object instance

Parameters:

pInstance – the object instance to acquire

void SetJournal(const std::string &sJournalPath)

Sets the journal file path

Parameters:

sJournalPath – File name of the journal file

bool GetLastError(CBase *pInstance, std::string &sLastErrorString)

Retrieves the last error string of an instance

Parameters:
  • pInstance – Object where the error occured.

  • sLastErrorString – Last Error String

Returns:

Returns if the instance has a last error.

void RetrieveProgressMessage(const eProgressIdentifier eTheProgressIdentifier, std::string &sProgressMessage)

Return an English text for a progress identifier.|Note: this is the only function you can call from your callback function.

Parameters:
  • eTheProgressIdentifier – the progress identifier that is passed to the callback function

  • sProgressMessage – English text for the progress identifier

sColor RGBAToColor(const Lib3MF_uint8 nRed, const Lib3MF_uint8 nGreen, const Lib3MF_uint8 nBlue, const Lib3MF_uint8 nAlpha)

Creates a Color from uint8 RGBA values

Parameters:
  • nRed – Red value of color (0-255)

  • nGreen – Green value of color (0-255)

  • nBlue – Blue value of color (0-255)

  • nAlpha – Alpha value of color (0-255)

Returns:

Assembled color

sColor FloatRGBAToColor(const Lib3MF_single fRed, const Lib3MF_single fGreen, const Lib3MF_single fBlue, const Lib3MF_single fAlpha)

Creates a Color from uint8 RGBA values

Parameters:
  • fRed – Red value of color (0-1)

  • fGreen – Green value of color (0-1)

  • fBlue – Blue value of color (0-1)

  • fAlpha – Alpha value of color (0-1)

Returns:

Assembled color

void ColorToRGBA(const sColor &TheColor, Lib3MF_uint8 &nRed, Lib3MF_uint8 &nGreen, Lib3MF_uint8 &nBlue, Lib3MF_uint8 &nAlpha)

Calculates uint8-RGBA-values from a Color

Parameters:
  • TheColor – Color to handle

  • nRed – Red value of color (0-255)

  • nGreen – Green value of color (0-255)

  • nBlue – Blue value of color (0-255)

  • nAlpha – Alpha value of color (0-255)

void ColorToFloatRGBA(const sColor &TheColor, Lib3MF_single &fRed, Lib3MF_single &fGreen, Lib3MF_single &fBlue, Lib3MF_single &fAlpha)

Calculates float-RGBA-values from a Color

Parameters:
  • TheColor – Color to handle

  • fRed – Red value of color (0-1)

  • fGreen – Green value of color (0-1)

  • fBlue – Blue value of color (0-1)

  • fAlpha – Alpha value of color (0-1)

sTransform GetIdentityTransform()

Creates an identity transform

Returns:

Transformation matrix.

sTransform GetUniformScaleTransform(const Lib3MF_single fFactor)

Creates a uniform scale transform

Parameters:

fFactor – Factor in X, Y and Z

Returns:

Transformation matrix.

sTransform GetScaleTransform(const Lib3MF_single fFactorX, const Lib3MF_single fFactorY, const Lib3MF_single fFactorZ)

Creates a scale transform

Parameters:
  • fFactorX – Factor in X

  • fFactorY – Factor in Y

  • fFactorZ – Factor in Z

Returns:

Transformation matrix.

sTransform GetTranslationTransform(const Lib3MF_single fVectorX, const Lib3MF_single fVectorY, const Lib3MF_single fVectorZ)

Creates an translation transform

Parameters:
  • fVectorX – Translation in X

  • fVectorY – Translation in Y

  • fVectorZ – Translation in Z

Returns:

Transformation matrix.

typedef std::shared_ptr<CWrapper> Lib3MF::PWrapper