From b817e32da4294bb5394a5a0e29bbe7348068122a Mon Sep 17 00:00:00 2001 From: Alexander Oster Date: Wed, 21 Feb 2024 18:50:19 +0100 Subject: [PATCH] Added Compression control on binary stream writer --- Autogenerated/Bindings/C/lib3mf.h | 37 ++++- Autogenerated/Bindings/C/lib3mf_types.h | 10 ++ .../Bindings/CDynamic/lib3mf_dynamic.cc | 40 +++++ .../Bindings/CDynamic/lib3mf_dynamic.h | 41 ++++- .../Bindings/CDynamic/lib3mf_types.h | 10 ++ Autogenerated/Bindings/CSharp/Lib3MF.cs | 42 +++++ Autogenerated/Bindings/Cpp/lib3mf_abi.hpp | 37 ++++- .../Bindings/Cpp/lib3mf_implicit.hpp | 41 ++++- Autogenerated/Bindings/Cpp/lib3mf_types.hpp | 6 + .../Bindings/CppDynamic/lib3mf_dynamic.h | 41 ++++- .../Bindings/CppDynamic/lib3mf_dynamic.hpp | 97 ++++++++++- .../Bindings/CppDynamic/lib3mf_types.hpp | 6 + Autogenerated/Bindings/Go/lib3mf.go | 82 +++++++++- Autogenerated/Bindings/Go/lib3mf_dynamic.cc | 40 +++++ Autogenerated/Bindings/Go/lib3mf_dynamic.h | 41 ++++- Autogenerated/Bindings/Go/lib3mf_types.h | 10 ++ .../Bindings/NodeJS/lib3mf_dynamic.cc | 40 +++++ .../Bindings/NodeJS/lib3mf_dynamic.h | 41 ++++- .../Bindings/NodeJS/lib3mf_nodewrapper.cc | 98 +++++++++++ .../Bindings/NodeJS/lib3mf_nodewrapper.h | 4 + Autogenerated/Bindings/NodeJS/lib3mf_types.h | 10 ++ Autogenerated/Bindings/Pascal/Unit_Lib3MF.pas | 113 ++++++++++++- Autogenerated/Bindings/Python/Lib3MF.py | 63 +++++++ Autogenerated/Source/lib3mf_abi.hpp | 37 ++++- Autogenerated/Source/lib3mf_interfaces.hpp | 25 ++- .../Source/lib3mf_interfacewrapper.cpp | 135 +++++++++++++++ Autogenerated/Source/lib3mf_types.hpp | 6 + AutomaticComponentToolkit/lib3mf.xml | 26 ++- Include/API/lib3mf_binarystream.hpp | 6 + .../NMR_ChunkedBinaryStreamTypes.h | 8 +- .../NMR_ChunkedBinaryStreamWriter.h | 17 ++ Source/API/lib3mf_binarystream.cpp | 32 ++++ Source/API/lib3mf_toolpath.cpp | 2 +- .../NMR_ChunkedBinaryStreamWriter.cpp | 154 ++++++++++++++---- .../v100/NMR_ModelWriterNode100_Mesh.cpp | 23 ++- 35 files changed, 1368 insertions(+), 53 deletions(-) diff --git a/Autogenerated/Bindings/C/lib3mf.h b/Autogenerated/Bindings/C/lib3mf.h index cb32f4ca3..3589b1924 100644 --- a/Autogenerated/Bindings/C/lib3mf.h +++ b/Autogenerated/Bindings/C/lib3mf.h @@ -92,6 +92,41 @@ LIB3MF_DECLSPEC Lib3MFResult lib3mf_binarystream_getpath(Lib3MF_BinaryStream pBi */ LIB3MF_DECLSPEC Lib3MFResult lib3mf_binarystream_getuuid(Lib3MF_BinaryStream pBinaryStream, const Lib3MF_uint32 nUUIDBufferSize, Lib3MF_uint32* pUUIDNeededChars, char * pUUIDBuffer); +/** +* Sets the float compression mode to raw. All subsequent writes will adhere to this mode. +* +* @param[in] pBinaryStream - BinaryStream instance. +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_binarystream_disablediscretizedarraycompression(Lib3MF_BinaryStream pBinaryStream); + +/** +* Sets the compression mode to a quantized array. All subsequent writes will adhere to this mode. +* +* @param[in] pBinaryStream - BinaryStream instance. +* @param[in] dUnits - Unit factor to use for quantization. +* @param[in] ePredictionType - Prediction type to use for arrays. +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_binarystream_enablediscretizedarraycompression(Lib3MF_BinaryStream pBinaryStream, Lib3MF_double dUnits, eLib3MFBinaryStreamPredictionType ePredictionType); + +/** +* Enables LZMA mode. +* +* @param[in] pBinaryStream - BinaryStream instance. +* @param[in] nLZMALevel - LZMA Level (0-9) +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_binarystream_enablelzma(Lib3MF_BinaryStream pBinaryStream, Lib3MF_uint32 nLZMALevel); + +/** +* Disables LZMA mode. +* +* @param[in] pBinaryStream - BinaryStream instance. +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_binarystream_disablelzma(Lib3MF_BinaryStream pBinaryStream); + /************************************************************************************************************************* Class definition for Writer **************************************************************************************************************************/ @@ -236,7 +271,7 @@ LIB3MF_DECLSPEC Lib3MFResult lib3mf_writer_setcontentencryptioncallback(Lib3MF_W LIB3MF_DECLSPEC Lib3MFResult lib3mf_writer_createbinarystream(Lib3MF_Writer pWriter, const char * pPath, Lib3MF_BinaryStream * pBinaryStream); /** -* Sets a binary stream for a mesh object. Currently supported objects are Meshes and Toolpath layers. +* Sets a binary stream for an object. Currently supported objects are Meshes and Toolpath layers. * * @param[in] pWriter - Writer instance. * @param[in] pInstance - Object instance to assign Binary stream to. diff --git a/Autogenerated/Bindings/C/lib3mf_types.h b/Autogenerated/Bindings/C/lib3mf_types.h index b5fbad4c7..9730f77e5 100644 --- a/Autogenerated/Bindings/C/lib3mf_types.h +++ b/Autogenerated/Bindings/C/lib3mf_types.h @@ -356,6 +356,11 @@ typedef enum eLib3MFBeamLatticeBallMode { eBeamLatticeBallModeAll = 2 } eLib3MFBeamLatticeBallMode; +typedef enum eLib3MFBinaryStreamPredictionType { + eBinaryStreamPredictionTypeNoPrediction = 0, + eBinaryStreamPredictionTypeDeltaPrediction = 1 +} eLib3MFBinaryStreamPredictionType; + typedef enum eLib3MFProgressIdentifier { eProgressIdentifierQUERYCANCELED = 0, eProgressIdentifierDONE = 1, @@ -487,6 +492,11 @@ typedef union { int m_code; } structEnumLib3MFBeamLatticeBallMode; +typedef union { + eLib3MFBinaryStreamPredictionType m_enum; + int m_code; +} structEnumLib3MFBinaryStreamPredictionType; + typedef union { eLib3MFProgressIdentifier m_enum; int m_code; diff --git a/Autogenerated/Bindings/CDynamic/lib3mf_dynamic.cc b/Autogenerated/Bindings/CDynamic/lib3mf_dynamic.cc index 54b017fce..b84749fc3 100644 --- a/Autogenerated/Bindings/CDynamic/lib3mf_dynamic.cc +++ b/Autogenerated/Bindings/CDynamic/lib3mf_dynamic.cc @@ -51,6 +51,10 @@ Lib3MFResult InitLib3MFWrapperTable(sLib3MFDynamicWrapperTable * pWrapperTable) pWrapperTable->m_Base_ClassTypeId = NULL; pWrapperTable->m_BinaryStream_GetPath = NULL; pWrapperTable->m_BinaryStream_GetUUID = NULL; + pWrapperTable->m_BinaryStream_DisableDiscretizedArrayCompression = NULL; + pWrapperTable->m_BinaryStream_EnableDiscretizedArrayCompression = NULL; + pWrapperTable->m_BinaryStream_EnableLZMA = NULL; + pWrapperTable->m_BinaryStream_DisableLZMA = NULL; pWrapperTable->m_Writer_WriteToFile = NULL; pWrapperTable->m_Writer_GetStreamSize = NULL; pWrapperTable->m_Writer_WriteToBuffer = NULL; @@ -617,6 +621,42 @@ Lib3MFResult LoadLib3MFWrapperTable(sLib3MFDynamicWrapperTable * pWrapperTable, if (pWrapperTable->m_BinaryStream_GetUUID == NULL) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + #ifdef _WIN32 + pWrapperTable->m_BinaryStream_DisableDiscretizedArrayCompression = (PLib3MFBinaryStream_DisableDiscretizedArrayCompressionPtr) GetProcAddress(hLibrary, "lib3mf_binarystream_disablediscretizedarraycompression"); + #else // _WIN32 + pWrapperTable->m_BinaryStream_DisableDiscretizedArrayCompression = (PLib3MFBinaryStream_DisableDiscretizedArrayCompressionPtr) dlsym(hLibrary, "lib3mf_binarystream_disablediscretizedarraycompression"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_BinaryStream_DisableDiscretizedArrayCompression == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_BinaryStream_EnableDiscretizedArrayCompression = (PLib3MFBinaryStream_EnableDiscretizedArrayCompressionPtr) GetProcAddress(hLibrary, "lib3mf_binarystream_enablediscretizedarraycompression"); + #else // _WIN32 + pWrapperTable->m_BinaryStream_EnableDiscretizedArrayCompression = (PLib3MFBinaryStream_EnableDiscretizedArrayCompressionPtr) dlsym(hLibrary, "lib3mf_binarystream_enablediscretizedarraycompression"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_BinaryStream_EnableDiscretizedArrayCompression == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_BinaryStream_EnableLZMA = (PLib3MFBinaryStream_EnableLZMAPtr) GetProcAddress(hLibrary, "lib3mf_binarystream_enablelzma"); + #else // _WIN32 + pWrapperTable->m_BinaryStream_EnableLZMA = (PLib3MFBinaryStream_EnableLZMAPtr) dlsym(hLibrary, "lib3mf_binarystream_enablelzma"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_BinaryStream_EnableLZMA == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_BinaryStream_DisableLZMA = (PLib3MFBinaryStream_DisableLZMAPtr) GetProcAddress(hLibrary, "lib3mf_binarystream_disablelzma"); + #else // _WIN32 + pWrapperTable->m_BinaryStream_DisableLZMA = (PLib3MFBinaryStream_DisableLZMAPtr) dlsym(hLibrary, "lib3mf_binarystream_disablelzma"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_BinaryStream_DisableLZMA == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + #ifdef _WIN32 pWrapperTable->m_Writer_WriteToFile = (PLib3MFWriter_WriteToFilePtr) GetProcAddress(hLibrary, "lib3mf_writer_writetofile"); #else // _WIN32 diff --git a/Autogenerated/Bindings/CDynamic/lib3mf_dynamic.h b/Autogenerated/Bindings/CDynamic/lib3mf_dynamic.h index 80cae6777..a37b58a86 100644 --- a/Autogenerated/Bindings/CDynamic/lib3mf_dynamic.h +++ b/Autogenerated/Bindings/CDynamic/lib3mf_dynamic.h @@ -79,6 +79,41 @@ typedef Lib3MFResult (*PLib3MFBinaryStream_GetPathPtr) (Lib3MF_BinaryStream pBin */ typedef Lib3MFResult (*PLib3MFBinaryStream_GetUUIDPtr) (Lib3MF_BinaryStream pBinaryStream, const Lib3MF_uint32 nUUIDBufferSize, Lib3MF_uint32* pUUIDNeededChars, char * pUUIDBuffer); +/** +* Sets the float compression mode to raw. All subsequent writes will adhere to this mode. +* +* @param[in] pBinaryStream - BinaryStream instance. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFBinaryStream_DisableDiscretizedArrayCompressionPtr) (Lib3MF_BinaryStream pBinaryStream); + +/** +* Sets the compression mode to a quantized array. All subsequent writes will adhere to this mode. +* +* @param[in] pBinaryStream - BinaryStream instance. +* @param[in] dUnits - Unit factor to use for quantization. +* @param[in] ePredictionType - Prediction type to use for arrays. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFBinaryStream_EnableDiscretizedArrayCompressionPtr) (Lib3MF_BinaryStream pBinaryStream, Lib3MF_double dUnits, eLib3MFBinaryStreamPredictionType ePredictionType); + +/** +* Enables LZMA mode. +* +* @param[in] pBinaryStream - BinaryStream instance. +* @param[in] nLZMALevel - LZMA Level (0-9) +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFBinaryStream_EnableLZMAPtr) (Lib3MF_BinaryStream pBinaryStream, Lib3MF_uint32 nLZMALevel); + +/** +* Disables LZMA mode. +* +* @param[in] pBinaryStream - BinaryStream instance. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFBinaryStream_DisableLZMAPtr) (Lib3MF_BinaryStream pBinaryStream); + /************************************************************************************************************************* Class definition for Writer **************************************************************************************************************************/ @@ -223,7 +258,7 @@ typedef Lib3MFResult (*PLib3MFWriter_SetContentEncryptionCallbackPtr) (Lib3MF_Wr typedef Lib3MFResult (*PLib3MFWriter_CreateBinaryStreamPtr) (Lib3MF_Writer pWriter, const char * pPath, Lib3MF_BinaryStream * pBinaryStream); /** -* Sets a binary stream for a mesh object. Currently supported objects are Meshes and Toolpath layers. +* Sets a binary stream for an object. Currently supported objects are Meshes and Toolpath layers. * * @param[in] pWriter - Writer instance. * @param[in] pInstance - Object instance to assign Binary stream to. @@ -5113,6 +5148,10 @@ typedef struct { PLib3MFBase_ClassTypeIdPtr m_Base_ClassTypeId; PLib3MFBinaryStream_GetPathPtr m_BinaryStream_GetPath; PLib3MFBinaryStream_GetUUIDPtr m_BinaryStream_GetUUID; + PLib3MFBinaryStream_DisableDiscretizedArrayCompressionPtr m_BinaryStream_DisableDiscretizedArrayCompression; + PLib3MFBinaryStream_EnableDiscretizedArrayCompressionPtr m_BinaryStream_EnableDiscretizedArrayCompression; + PLib3MFBinaryStream_EnableLZMAPtr m_BinaryStream_EnableLZMA; + PLib3MFBinaryStream_DisableLZMAPtr m_BinaryStream_DisableLZMA; PLib3MFWriter_WriteToFilePtr m_Writer_WriteToFile; PLib3MFWriter_GetStreamSizePtr m_Writer_GetStreamSize; PLib3MFWriter_WriteToBufferPtr m_Writer_WriteToBuffer; diff --git a/Autogenerated/Bindings/CDynamic/lib3mf_types.h b/Autogenerated/Bindings/CDynamic/lib3mf_types.h index b5fbad4c7..9730f77e5 100644 --- a/Autogenerated/Bindings/CDynamic/lib3mf_types.h +++ b/Autogenerated/Bindings/CDynamic/lib3mf_types.h @@ -356,6 +356,11 @@ typedef enum eLib3MFBeamLatticeBallMode { eBeamLatticeBallModeAll = 2 } eLib3MFBeamLatticeBallMode; +typedef enum eLib3MFBinaryStreamPredictionType { + eBinaryStreamPredictionTypeNoPrediction = 0, + eBinaryStreamPredictionTypeDeltaPrediction = 1 +} eLib3MFBinaryStreamPredictionType; + typedef enum eLib3MFProgressIdentifier { eProgressIdentifierQUERYCANCELED = 0, eProgressIdentifierDONE = 1, @@ -487,6 +492,11 @@ typedef union { int m_code; } structEnumLib3MFBeamLatticeBallMode; +typedef union { + eLib3MFBinaryStreamPredictionType m_enum; + int m_code; +} structEnumLib3MFBinaryStreamPredictionType; + typedef union { eLib3MFProgressIdentifier m_enum; int m_code; diff --git a/Autogenerated/Bindings/CSharp/Lib3MF.cs b/Autogenerated/Bindings/CSharp/Lib3MF.cs index 4321b72d1..50e7cd69f 100644 --- a/Autogenerated/Bindings/CSharp/Lib3MF.cs +++ b/Autogenerated/Bindings/CSharp/Lib3MF.cs @@ -113,6 +113,11 @@ public enum eBeamLatticeBallMode { All = 2 }; + public enum eBinaryStreamPredictionType { + NoPrediction = 0, + DeltaPrediction = 1 + }; + public enum eProgressIdentifier { QUERYCANCELED = 0, DONE = 1, @@ -354,6 +359,18 @@ public class Lib3MFWrapper [DllImport("lib3mf.dll", EntryPoint = "lib3mf_binarystream_getuuid", CallingConvention=CallingConvention.Cdecl)] public unsafe extern static Int32 BinaryStream_GetUUID (IntPtr Handle, UInt32 sizeUUID, out UInt32 neededUUID, IntPtr dataUUID); + [DllImport("lib3mf.dll", EntryPoint = "lib3mf_binarystream_disablediscretizedarraycompression", CallingConvention=CallingConvention.Cdecl)] + public unsafe extern static Int32 BinaryStream_DisableDiscretizedArrayCompression (IntPtr Handle); + + [DllImport("lib3mf.dll", EntryPoint = "lib3mf_binarystream_enablediscretizedarraycompression", CallingConvention=CallingConvention.Cdecl)] + public unsafe extern static Int32 BinaryStream_EnableDiscretizedArrayCompression (IntPtr Handle, Double AUnits, Int32 APredictionType); + + [DllImport("lib3mf.dll", EntryPoint = "lib3mf_binarystream_enablelzma", CallingConvention=CallingConvention.Cdecl)] + public unsafe extern static Int32 BinaryStream_EnableLZMA (IntPtr Handle, UInt32 ALZMALevel); + + [DllImport("lib3mf.dll", EntryPoint = "lib3mf_binarystream_disablelzma", CallingConvention=CallingConvention.Cdecl)] + public unsafe extern static Int32 BinaryStream_DisableLZMA (IntPtr Handle); + [DllImport("lib3mf.dll", EntryPoint = "lib3mf_writer_writetofile", CallingConvention=CallingConvention.Cdecl)] public unsafe extern static Int32 Writer_WriteToFile (IntPtr Handle, byte[] AFilename); @@ -2266,6 +2283,31 @@ public String GetUUID () return Encoding.UTF8.GetString(bytesUUID).TrimEnd(char.MinValue); } + public void DisableDiscretizedArrayCompression () + { + + CheckError(Internal.Lib3MFWrapper.BinaryStream_DisableDiscretizedArrayCompression (Handle)); + } + + public void EnableDiscretizedArrayCompression (Double AUnits, eBinaryStreamPredictionType APredictionType) + { + Int32 enumPredictionType = (Int32) APredictionType; + + CheckError(Internal.Lib3MFWrapper.BinaryStream_EnableDiscretizedArrayCompression (Handle, AUnits, enumPredictionType)); + } + + public void EnableLZMA (UInt32 ALZMALevel) + { + + CheckError(Internal.Lib3MFWrapper.BinaryStream_EnableLZMA (Handle, ALZMALevel)); + } + + public void DisableLZMA () + { + + CheckError(Internal.Lib3MFWrapper.BinaryStream_DisableLZMA (Handle)); + } + } public class CWriter : CBase diff --git a/Autogenerated/Bindings/Cpp/lib3mf_abi.hpp b/Autogenerated/Bindings/Cpp/lib3mf_abi.hpp index d83d8d969..9027344b1 100644 --- a/Autogenerated/Bindings/Cpp/lib3mf_abi.hpp +++ b/Autogenerated/Bindings/Cpp/lib3mf_abi.hpp @@ -92,6 +92,41 @@ LIB3MF_DECLSPEC Lib3MFResult lib3mf_binarystream_getpath(Lib3MF_BinaryStream pBi */ LIB3MF_DECLSPEC Lib3MFResult lib3mf_binarystream_getuuid(Lib3MF_BinaryStream pBinaryStream, const Lib3MF_uint32 nUUIDBufferSize, Lib3MF_uint32* pUUIDNeededChars, char * pUUIDBuffer); +/** +* Sets the float compression mode to raw. All subsequent writes will adhere to this mode. +* +* @param[in] pBinaryStream - BinaryStream instance. +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_binarystream_disablediscretizedarraycompression(Lib3MF_BinaryStream pBinaryStream); + +/** +* Sets the compression mode to a quantized array. All subsequent writes will adhere to this mode. +* +* @param[in] pBinaryStream - BinaryStream instance. +* @param[in] dUnits - Unit factor to use for quantization. +* @param[in] ePredictionType - Prediction type to use for arrays. +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_binarystream_enablediscretizedarraycompression(Lib3MF_BinaryStream pBinaryStream, Lib3MF_double dUnits, Lib3MF::eBinaryStreamPredictionType ePredictionType); + +/** +* Enables LZMA mode. +* +* @param[in] pBinaryStream - BinaryStream instance. +* @param[in] nLZMALevel - LZMA Level (0-9) +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_binarystream_enablelzma(Lib3MF_BinaryStream pBinaryStream, Lib3MF_uint32 nLZMALevel); + +/** +* Disables LZMA mode. +* +* @param[in] pBinaryStream - BinaryStream instance. +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_binarystream_disablelzma(Lib3MF_BinaryStream pBinaryStream); + /************************************************************************************************************************* Class definition for Writer **************************************************************************************************************************/ @@ -236,7 +271,7 @@ LIB3MF_DECLSPEC Lib3MFResult lib3mf_writer_setcontentencryptioncallback(Lib3MF_W LIB3MF_DECLSPEC Lib3MFResult lib3mf_writer_createbinarystream(Lib3MF_Writer pWriter, const char * pPath, Lib3MF_BinaryStream * pBinaryStream); /** -* Sets a binary stream for a mesh object. Currently supported objects are Meshes and Toolpath layers. +* Sets a binary stream for an object. Currently supported objects are Meshes and Toolpath layers. * * @param[in] pWriter - Writer instance. * @param[in] pInstance - Object instance to assign Binary stream to. diff --git a/Autogenerated/Bindings/Cpp/lib3mf_implicit.hpp b/Autogenerated/Bindings/Cpp/lib3mf_implicit.hpp index 58c8d02e7..e5d5e9218 100644 --- a/Autogenerated/Bindings/Cpp/lib3mf_implicit.hpp +++ b/Autogenerated/Bindings/Cpp/lib3mf_implicit.hpp @@ -723,6 +723,10 @@ class CBinaryStream : public CBase { inline std::string GetPath(); inline std::string GetUUID(); + inline void DisableDiscretizedArrayCompression(); + inline void EnableDiscretizedArrayCompression(const Lib3MF_double dUnits, const eBinaryStreamPredictionType ePredictionType); + inline void EnableLZMA(const Lib3MF_uint32 nLZMALevel); + inline void DisableLZMA(); }; /************************************************************************************************************************* @@ -2407,6 +2411,41 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle) return std::string(&bufferUUID[0]); } + /** + * CBinaryStream::DisableDiscretizedArrayCompression - Sets the float compression mode to raw. All subsequent writes will adhere to this mode. + */ + void CBinaryStream::DisableDiscretizedArrayCompression() + { + CheckError(lib3mf_binarystream_disablediscretizedarraycompression(m_pHandle)); + } + + /** + * CBinaryStream::EnableDiscretizedArrayCompression - Sets the compression mode to a quantized array. All subsequent writes will adhere to this mode. + * @param[in] dUnits - Unit factor to use for quantization. + * @param[in] ePredictionType - Prediction type to use for arrays. + */ + void CBinaryStream::EnableDiscretizedArrayCompression(const Lib3MF_double dUnits, const eBinaryStreamPredictionType ePredictionType) + { + CheckError(lib3mf_binarystream_enablediscretizedarraycompression(m_pHandle, dUnits, ePredictionType)); + } + + /** + * CBinaryStream::EnableLZMA - Enables LZMA mode. + * @param[in] nLZMALevel - LZMA Level (0-9) + */ + void CBinaryStream::EnableLZMA(const Lib3MF_uint32 nLZMALevel) + { + CheckError(lib3mf_binarystream_enablelzma(m_pHandle, nLZMALevel)); + } + + /** + * CBinaryStream::DisableLZMA - Disables LZMA mode. + */ + void CBinaryStream::DisableLZMA() + { + CheckError(lib3mf_binarystream_disablelzma(m_pHandle)); + } + /** * Method definitions for class CWriter */ @@ -2575,7 +2614,7 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle) } /** - * CWriter::AssignBinaryStream - Sets a binary stream for a mesh object. Currently supported objects are Meshes and Toolpath layers. + * CWriter::AssignBinaryStream - Sets a binary stream for an object. Currently supported objects are Meshes and Toolpath layers. * @param[in] pInstance - Object instance to assign Binary stream to. * @param[in] pBinaryStream - Binary stream object to use for this layer. */ diff --git a/Autogenerated/Bindings/Cpp/lib3mf_types.hpp b/Autogenerated/Bindings/Cpp/lib3mf_types.hpp index 96033c1b3..5bbee6bba 100644 --- a/Autogenerated/Bindings/Cpp/lib3mf_types.hpp +++ b/Autogenerated/Bindings/Cpp/lib3mf_types.hpp @@ -357,6 +357,11 @@ namespace Lib3MF { All = 2 }; + enum class eBinaryStreamPredictionType : Lib3MF_int32 { + NoPrediction = 0, + DeltaPrediction = 1 + }; + enum class eProgressIdentifier : Lib3MF_int32 { QUERYCANCELED = 0, DONE = 1, @@ -588,6 +593,7 @@ typedef Lib3MF::eTextureFilter eLib3MFTextureFilter; typedef Lib3MF::eBeamLatticeCapMode eLib3MFBeamLatticeCapMode; typedef Lib3MF::eBeamLatticeClipMode eLib3MFBeamLatticeClipMode; typedef Lib3MF::eBeamLatticeBallMode eLib3MFBeamLatticeBallMode; +typedef Lib3MF::eBinaryStreamPredictionType eLib3MFBinaryStreamPredictionType; typedef Lib3MF::eProgressIdentifier eLib3MFProgressIdentifier; typedef Lib3MF::eBlendMethod eLib3MFBlendMethod; typedef Lib3MF::eToolpathSegmentType eLib3MFToolpathSegmentType; diff --git a/Autogenerated/Bindings/CppDynamic/lib3mf_dynamic.h b/Autogenerated/Bindings/CppDynamic/lib3mf_dynamic.h index 7304dca38..4628ac90b 100644 --- a/Autogenerated/Bindings/CppDynamic/lib3mf_dynamic.h +++ b/Autogenerated/Bindings/CppDynamic/lib3mf_dynamic.h @@ -79,6 +79,41 @@ typedef Lib3MFResult (*PLib3MFBinaryStream_GetPathPtr) (Lib3MF_BinaryStream pBin */ typedef Lib3MFResult (*PLib3MFBinaryStream_GetUUIDPtr) (Lib3MF_BinaryStream pBinaryStream, const Lib3MF_uint32 nUUIDBufferSize, Lib3MF_uint32* pUUIDNeededChars, char * pUUIDBuffer); +/** +* Sets the float compression mode to raw. All subsequent writes will adhere to this mode. +* +* @param[in] pBinaryStream - BinaryStream instance. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFBinaryStream_DisableDiscretizedArrayCompressionPtr) (Lib3MF_BinaryStream pBinaryStream); + +/** +* Sets the compression mode to a quantized array. All subsequent writes will adhere to this mode. +* +* @param[in] pBinaryStream - BinaryStream instance. +* @param[in] dUnits - Unit factor to use for quantization. +* @param[in] ePredictionType - Prediction type to use for arrays. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFBinaryStream_EnableDiscretizedArrayCompressionPtr) (Lib3MF_BinaryStream pBinaryStream, Lib3MF_double dUnits, Lib3MF::eBinaryStreamPredictionType ePredictionType); + +/** +* Enables LZMA mode. +* +* @param[in] pBinaryStream - BinaryStream instance. +* @param[in] nLZMALevel - LZMA Level (0-9) +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFBinaryStream_EnableLZMAPtr) (Lib3MF_BinaryStream pBinaryStream, Lib3MF_uint32 nLZMALevel); + +/** +* Disables LZMA mode. +* +* @param[in] pBinaryStream - BinaryStream instance. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFBinaryStream_DisableLZMAPtr) (Lib3MF_BinaryStream pBinaryStream); + /************************************************************************************************************************* Class definition for Writer **************************************************************************************************************************/ @@ -223,7 +258,7 @@ typedef Lib3MFResult (*PLib3MFWriter_SetContentEncryptionCallbackPtr) (Lib3MF_Wr typedef Lib3MFResult (*PLib3MFWriter_CreateBinaryStreamPtr) (Lib3MF_Writer pWriter, const char * pPath, Lib3MF_BinaryStream * pBinaryStream); /** -* Sets a binary stream for a mesh object. Currently supported objects are Meshes and Toolpath layers. +* Sets a binary stream for an object. Currently supported objects are Meshes and Toolpath layers. * * @param[in] pWriter - Writer instance. * @param[in] pInstance - Object instance to assign Binary stream to. @@ -5113,6 +5148,10 @@ typedef struct { PLib3MFBase_ClassTypeIdPtr m_Base_ClassTypeId; PLib3MFBinaryStream_GetPathPtr m_BinaryStream_GetPath; PLib3MFBinaryStream_GetUUIDPtr m_BinaryStream_GetUUID; + PLib3MFBinaryStream_DisableDiscretizedArrayCompressionPtr m_BinaryStream_DisableDiscretizedArrayCompression; + PLib3MFBinaryStream_EnableDiscretizedArrayCompressionPtr m_BinaryStream_EnableDiscretizedArrayCompression; + PLib3MFBinaryStream_EnableLZMAPtr m_BinaryStream_EnableLZMA; + PLib3MFBinaryStream_DisableLZMAPtr m_BinaryStream_DisableLZMA; PLib3MFWriter_WriteToFilePtr m_Writer_WriteToFile; PLib3MFWriter_GetStreamSizePtr m_Writer_GetStreamSize; PLib3MFWriter_WriteToBufferPtr m_Writer_WriteToBuffer; diff --git a/Autogenerated/Bindings/CppDynamic/lib3mf_dynamic.hpp b/Autogenerated/Bindings/CppDynamic/lib3mf_dynamic.hpp index 5305eb4ba..da37c6218 100644 --- a/Autogenerated/Bindings/CppDynamic/lib3mf_dynamic.hpp +++ b/Autogenerated/Bindings/CppDynamic/lib3mf_dynamic.hpp @@ -747,6 +747,10 @@ class CBinaryStream : public CBase { inline std::string GetPath(); inline std::string GetUUID(); + inline void DisableDiscretizedArrayCompression(); + inline void EnableDiscretizedArrayCompression(const Lib3MF_double dUnits, const eBinaryStreamPredictionType ePredictionType); + inline void EnableLZMA(const Lib3MF_uint32 nLZMALevel); + inline void DisableLZMA(); }; /************************************************************************************************************************* @@ -2389,6 +2393,10 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle) pWrapperTable->m_Base_ClassTypeId = nullptr; pWrapperTable->m_BinaryStream_GetPath = nullptr; pWrapperTable->m_BinaryStream_GetUUID = nullptr; + pWrapperTable->m_BinaryStream_DisableDiscretizedArrayCompression = nullptr; + pWrapperTable->m_BinaryStream_EnableDiscretizedArrayCompression = nullptr; + pWrapperTable->m_BinaryStream_EnableLZMA = nullptr; + pWrapperTable->m_BinaryStream_DisableLZMA = nullptr; pWrapperTable->m_Writer_WriteToFile = nullptr; pWrapperTable->m_Writer_GetStreamSize = nullptr; pWrapperTable->m_Writer_WriteToBuffer = nullptr; @@ -2951,6 +2959,42 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle) if (pWrapperTable->m_BinaryStream_GetUUID == nullptr) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + #ifdef _WIN32 + pWrapperTable->m_BinaryStream_DisableDiscretizedArrayCompression = (PLib3MFBinaryStream_DisableDiscretizedArrayCompressionPtr) GetProcAddress(hLibrary, "lib3mf_binarystream_disablediscretizedarraycompression"); + #else // _WIN32 + pWrapperTable->m_BinaryStream_DisableDiscretizedArrayCompression = (PLib3MFBinaryStream_DisableDiscretizedArrayCompressionPtr) dlsym(hLibrary, "lib3mf_binarystream_disablediscretizedarraycompression"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_BinaryStream_DisableDiscretizedArrayCompression == nullptr) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_BinaryStream_EnableDiscretizedArrayCompression = (PLib3MFBinaryStream_EnableDiscretizedArrayCompressionPtr) GetProcAddress(hLibrary, "lib3mf_binarystream_enablediscretizedarraycompression"); + #else // _WIN32 + pWrapperTable->m_BinaryStream_EnableDiscretizedArrayCompression = (PLib3MFBinaryStream_EnableDiscretizedArrayCompressionPtr) dlsym(hLibrary, "lib3mf_binarystream_enablediscretizedarraycompression"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_BinaryStream_EnableDiscretizedArrayCompression == nullptr) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_BinaryStream_EnableLZMA = (PLib3MFBinaryStream_EnableLZMAPtr) GetProcAddress(hLibrary, "lib3mf_binarystream_enablelzma"); + #else // _WIN32 + pWrapperTable->m_BinaryStream_EnableLZMA = (PLib3MFBinaryStream_EnableLZMAPtr) dlsym(hLibrary, "lib3mf_binarystream_enablelzma"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_BinaryStream_EnableLZMA == nullptr) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_BinaryStream_DisableLZMA = (PLib3MFBinaryStream_DisableLZMAPtr) GetProcAddress(hLibrary, "lib3mf_binarystream_disablelzma"); + #else // _WIN32 + pWrapperTable->m_BinaryStream_DisableLZMA = (PLib3MFBinaryStream_DisableLZMAPtr) dlsym(hLibrary, "lib3mf_binarystream_disablelzma"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_BinaryStream_DisableLZMA == nullptr) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + #ifdef _WIN32 pWrapperTable->m_Writer_WriteToFile = (PLib3MFWriter_WriteToFilePtr) GetProcAddress(hLibrary, "lib3mf_writer_writetofile"); #else // _WIN32 @@ -7344,6 +7388,22 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle) if ( (eLookupError != 0) || (pWrapperTable->m_BinaryStream_GetUUID == nullptr) ) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + eLookupError = (*pLookup)("lib3mf_binarystream_disablediscretizedarraycompression", (void**)&(pWrapperTable->m_BinaryStream_DisableDiscretizedArrayCompression)); + if ( (eLookupError != 0) || (pWrapperTable->m_BinaryStream_DisableDiscretizedArrayCompression == nullptr) ) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + eLookupError = (*pLookup)("lib3mf_binarystream_enablediscretizedarraycompression", (void**)&(pWrapperTable->m_BinaryStream_EnableDiscretizedArrayCompression)); + if ( (eLookupError != 0) || (pWrapperTable->m_BinaryStream_EnableDiscretizedArrayCompression == nullptr) ) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + eLookupError = (*pLookup)("lib3mf_binarystream_enablelzma", (void**)&(pWrapperTable->m_BinaryStream_EnableLZMA)); + if ( (eLookupError != 0) || (pWrapperTable->m_BinaryStream_EnableLZMA == nullptr) ) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + eLookupError = (*pLookup)("lib3mf_binarystream_disablelzma", (void**)&(pWrapperTable->m_BinaryStream_DisableLZMA)); + if ( (eLookupError != 0) || (pWrapperTable->m_BinaryStream_DisableLZMA == nullptr) ) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + eLookupError = (*pLookup)("lib3mf_writer_writetofile", (void**)&(pWrapperTable->m_Writer_WriteToFile)); if ( (eLookupError != 0) || (pWrapperTable->m_Writer_WriteToFile == nullptr) ) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; @@ -9339,6 +9399,41 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle) return std::string(&bufferUUID[0]); } + /** + * CBinaryStream::DisableDiscretizedArrayCompression - Sets the float compression mode to raw. All subsequent writes will adhere to this mode. + */ + void CBinaryStream::DisableDiscretizedArrayCompression() + { + CheckError(m_pWrapper->m_WrapperTable.m_BinaryStream_DisableDiscretizedArrayCompression(m_pHandle)); + } + + /** + * CBinaryStream::EnableDiscretizedArrayCompression - Sets the compression mode to a quantized array. All subsequent writes will adhere to this mode. + * @param[in] dUnits - Unit factor to use for quantization. + * @param[in] ePredictionType - Prediction type to use for arrays. + */ + void CBinaryStream::EnableDiscretizedArrayCompression(const Lib3MF_double dUnits, const eBinaryStreamPredictionType ePredictionType) + { + CheckError(m_pWrapper->m_WrapperTable.m_BinaryStream_EnableDiscretizedArrayCompression(m_pHandle, dUnits, ePredictionType)); + } + + /** + * CBinaryStream::EnableLZMA - Enables LZMA mode. + * @param[in] nLZMALevel - LZMA Level (0-9) + */ + void CBinaryStream::EnableLZMA(const Lib3MF_uint32 nLZMALevel) + { + CheckError(m_pWrapper->m_WrapperTable.m_BinaryStream_EnableLZMA(m_pHandle, nLZMALevel)); + } + + /** + * CBinaryStream::DisableLZMA - Disables LZMA mode. + */ + void CBinaryStream::DisableLZMA() + { + CheckError(m_pWrapper->m_WrapperTable.m_BinaryStream_DisableLZMA(m_pHandle)); + } + /** * Method definitions for class CWriter */ @@ -9507,7 +9602,7 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle) } /** - * CWriter::AssignBinaryStream - Sets a binary stream for a mesh object. Currently supported objects are Meshes and Toolpath layers. + * CWriter::AssignBinaryStream - Sets a binary stream for an object. Currently supported objects are Meshes and Toolpath layers. * @param[in] pInstance - Object instance to assign Binary stream to. * @param[in] pBinaryStream - Binary stream object to use for this layer. */ diff --git a/Autogenerated/Bindings/CppDynamic/lib3mf_types.hpp b/Autogenerated/Bindings/CppDynamic/lib3mf_types.hpp index 96033c1b3..5bbee6bba 100644 --- a/Autogenerated/Bindings/CppDynamic/lib3mf_types.hpp +++ b/Autogenerated/Bindings/CppDynamic/lib3mf_types.hpp @@ -357,6 +357,11 @@ namespace Lib3MF { All = 2 }; + enum class eBinaryStreamPredictionType : Lib3MF_int32 { + NoPrediction = 0, + DeltaPrediction = 1 + }; + enum class eProgressIdentifier : Lib3MF_int32 { QUERYCANCELED = 0, DONE = 1, @@ -588,6 +593,7 @@ typedef Lib3MF::eTextureFilter eLib3MFTextureFilter; typedef Lib3MF::eBeamLatticeCapMode eLib3MFBeamLatticeCapMode; typedef Lib3MF::eBeamLatticeClipMode eLib3MFBeamLatticeClipMode; typedef Lib3MF::eBeamLatticeBallMode eLib3MFBeamLatticeBallMode; +typedef Lib3MF::eBinaryStreamPredictionType eLib3MFBinaryStreamPredictionType; typedef Lib3MF::eProgressIdentifier eLib3MFProgressIdentifier; typedef Lib3MF::eBlendMethod eLib3MFBlendMethod; typedef Lib3MF::eToolpathSegmentType eLib3MFToolpathSegmentType; diff --git a/Autogenerated/Bindings/Go/lib3mf.go b/Autogenerated/Bindings/Go/lib3mf.go index 8ab5d784e..b3bd5ecd8 100644 --- a/Autogenerated/Bindings/Go/lib3mf.go +++ b/Autogenerated/Bindings/Go/lib3mf.go @@ -99,6 +99,42 @@ Lib3MFResult CCall_lib3mf_binarystream_getuuid(Lib3MFHandle libraryHandle, Lib3M } +Lib3MFResult CCall_lib3mf_binarystream_disablediscretizedarraycompression(Lib3MFHandle libraryHandle, Lib3MF_BinaryStream pBinaryStream) +{ + if (libraryHandle == 0) + return LIB3MF_ERROR_INVALIDCAST; + sLib3MFDynamicWrapperTable * wrapperTable = (sLib3MFDynamicWrapperTable *) libraryHandle; + return wrapperTable->m_BinaryStream_DisableDiscretizedArrayCompression (pBinaryStream); +} + + +Lib3MFResult CCall_lib3mf_binarystream_enablediscretizedarraycompression(Lib3MFHandle libraryHandle, Lib3MF_BinaryStream pBinaryStream, Lib3MF_double dUnits, eLib3MFBinaryStreamPredictionType ePredictionType) +{ + if (libraryHandle == 0) + return LIB3MF_ERROR_INVALIDCAST; + sLib3MFDynamicWrapperTable * wrapperTable = (sLib3MFDynamicWrapperTable *) libraryHandle; + return wrapperTable->m_BinaryStream_EnableDiscretizedArrayCompression (pBinaryStream, dUnits, ePredictionType); +} + + +Lib3MFResult CCall_lib3mf_binarystream_enablelzma(Lib3MFHandle libraryHandle, Lib3MF_BinaryStream pBinaryStream, Lib3MF_uint32 nLZMALevel) +{ + if (libraryHandle == 0) + return LIB3MF_ERROR_INVALIDCAST; + sLib3MFDynamicWrapperTable * wrapperTable = (sLib3MFDynamicWrapperTable *) libraryHandle; + return wrapperTable->m_BinaryStream_EnableLZMA (pBinaryStream, nLZMALevel); +} + + +Lib3MFResult CCall_lib3mf_binarystream_disablelzma(Lib3MFHandle libraryHandle, Lib3MF_BinaryStream pBinaryStream) +{ + if (libraryHandle == 0) + return LIB3MF_ERROR_INVALIDCAST; + sLib3MFDynamicWrapperTable * wrapperTable = (sLib3MFDynamicWrapperTable *) libraryHandle; + return wrapperTable->m_BinaryStream_DisableLZMA (pBinaryStream); +} + + Lib3MFResult CCall_lib3mf_writer_writetofile(Lib3MFHandle libraryHandle, Lib3MF_Writer pWriter, const char * pFilename) { if (libraryHandle == 0) @@ -4582,6 +4618,14 @@ const ( BeamLatticeBallMode_All = 2 ) +// BinaryStreamPredictionType represents a Lib3MF enum. +type BinaryStreamPredictionType int + +const ( + BinaryStreamPredictionType_NoPrediction = 0 + BinaryStreamPredictionType_DeltaPrediction = 1 +) + // ProgressIdentifier represents a Lib3MF enum. type ProgressIdentifier int @@ -5126,6 +5170,42 @@ func (inst BinaryStream) GetUUID() (string, error) { return string(bufferuUID[:(filledinuUID-1)]), nil } +// DisableDiscretizedArrayCompression sets the float compression mode to raw. All subsequent writes will adhere to this mode. +func (inst BinaryStream) DisableDiscretizedArrayCompression() error { + ret := C.CCall_lib3mf_binarystream_disablediscretizedarraycompression(inst.wrapperRef.LibraryHandle, inst.Ref) + if ret != 0 { + return makeError(uint32(ret)) + } + return nil +} + +// EnableDiscretizedArrayCompression sets the compression mode to a quantized array. All subsequent writes will adhere to this mode. +func (inst BinaryStream) EnableDiscretizedArrayCompression(units float64, predictionType BinaryStreamPredictionType) error { + ret := C.CCall_lib3mf_binarystream_enablediscretizedarraycompression(inst.wrapperRef.LibraryHandle, inst.Ref, C.double(units), C.eLib3MFBinaryStreamPredictionType(predictionType)) + if ret != 0 { + return makeError(uint32(ret)) + } + return nil +} + +// EnableLZMA enables LZMA mode. +func (inst BinaryStream) EnableLZMA(lZMALevel uint32) error { + ret := C.CCall_lib3mf_binarystream_enablelzma(inst.wrapperRef.LibraryHandle, inst.Ref, C.uint32_t(lZMALevel)) + if ret != 0 { + return makeError(uint32(ret)) + } + return nil +} + +// DisableLZMA disables LZMA mode. +func (inst BinaryStream) DisableLZMA() error { + ret := C.CCall_lib3mf_binarystream_disablelzma(inst.wrapperRef.LibraryHandle, inst.Ref) + if ret != 0 { + return makeError(uint32(ret)) + } + return nil +} + // Writer represents a Lib3MF class. type Writer struct { @@ -5289,7 +5369,7 @@ func (inst Writer) CreateBinaryStream(path string) (BinaryStream, error) { return inst.wrapperRef.NewBinaryStream(binaryStream), nil } -// AssignBinaryStream sets a binary stream for a mesh object. Currently supported objects are Meshes and Toolpath layers. +// AssignBinaryStream sets a binary stream for an object. Currently supported objects are Meshes and Toolpath layers. func (inst Writer) AssignBinaryStream(instance Base, binaryStream BinaryStream) error { ret := C.CCall_lib3mf_writer_assignbinarystream(inst.wrapperRef.LibraryHandle, inst.Ref, instance.Ref, binaryStream.Ref) if ret != 0 { diff --git a/Autogenerated/Bindings/Go/lib3mf_dynamic.cc b/Autogenerated/Bindings/Go/lib3mf_dynamic.cc index 54b017fce..b84749fc3 100644 --- a/Autogenerated/Bindings/Go/lib3mf_dynamic.cc +++ b/Autogenerated/Bindings/Go/lib3mf_dynamic.cc @@ -51,6 +51,10 @@ Lib3MFResult InitLib3MFWrapperTable(sLib3MFDynamicWrapperTable * pWrapperTable) pWrapperTable->m_Base_ClassTypeId = NULL; pWrapperTable->m_BinaryStream_GetPath = NULL; pWrapperTable->m_BinaryStream_GetUUID = NULL; + pWrapperTable->m_BinaryStream_DisableDiscretizedArrayCompression = NULL; + pWrapperTable->m_BinaryStream_EnableDiscretizedArrayCompression = NULL; + pWrapperTable->m_BinaryStream_EnableLZMA = NULL; + pWrapperTable->m_BinaryStream_DisableLZMA = NULL; pWrapperTable->m_Writer_WriteToFile = NULL; pWrapperTable->m_Writer_GetStreamSize = NULL; pWrapperTable->m_Writer_WriteToBuffer = NULL; @@ -617,6 +621,42 @@ Lib3MFResult LoadLib3MFWrapperTable(sLib3MFDynamicWrapperTable * pWrapperTable, if (pWrapperTable->m_BinaryStream_GetUUID == NULL) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + #ifdef _WIN32 + pWrapperTable->m_BinaryStream_DisableDiscretizedArrayCompression = (PLib3MFBinaryStream_DisableDiscretizedArrayCompressionPtr) GetProcAddress(hLibrary, "lib3mf_binarystream_disablediscretizedarraycompression"); + #else // _WIN32 + pWrapperTable->m_BinaryStream_DisableDiscretizedArrayCompression = (PLib3MFBinaryStream_DisableDiscretizedArrayCompressionPtr) dlsym(hLibrary, "lib3mf_binarystream_disablediscretizedarraycompression"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_BinaryStream_DisableDiscretizedArrayCompression == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_BinaryStream_EnableDiscretizedArrayCompression = (PLib3MFBinaryStream_EnableDiscretizedArrayCompressionPtr) GetProcAddress(hLibrary, "lib3mf_binarystream_enablediscretizedarraycompression"); + #else // _WIN32 + pWrapperTable->m_BinaryStream_EnableDiscretizedArrayCompression = (PLib3MFBinaryStream_EnableDiscretizedArrayCompressionPtr) dlsym(hLibrary, "lib3mf_binarystream_enablediscretizedarraycompression"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_BinaryStream_EnableDiscretizedArrayCompression == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_BinaryStream_EnableLZMA = (PLib3MFBinaryStream_EnableLZMAPtr) GetProcAddress(hLibrary, "lib3mf_binarystream_enablelzma"); + #else // _WIN32 + pWrapperTable->m_BinaryStream_EnableLZMA = (PLib3MFBinaryStream_EnableLZMAPtr) dlsym(hLibrary, "lib3mf_binarystream_enablelzma"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_BinaryStream_EnableLZMA == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_BinaryStream_DisableLZMA = (PLib3MFBinaryStream_DisableLZMAPtr) GetProcAddress(hLibrary, "lib3mf_binarystream_disablelzma"); + #else // _WIN32 + pWrapperTable->m_BinaryStream_DisableLZMA = (PLib3MFBinaryStream_DisableLZMAPtr) dlsym(hLibrary, "lib3mf_binarystream_disablelzma"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_BinaryStream_DisableLZMA == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + #ifdef _WIN32 pWrapperTable->m_Writer_WriteToFile = (PLib3MFWriter_WriteToFilePtr) GetProcAddress(hLibrary, "lib3mf_writer_writetofile"); #else // _WIN32 diff --git a/Autogenerated/Bindings/Go/lib3mf_dynamic.h b/Autogenerated/Bindings/Go/lib3mf_dynamic.h index 80cae6777..a37b58a86 100644 --- a/Autogenerated/Bindings/Go/lib3mf_dynamic.h +++ b/Autogenerated/Bindings/Go/lib3mf_dynamic.h @@ -79,6 +79,41 @@ typedef Lib3MFResult (*PLib3MFBinaryStream_GetPathPtr) (Lib3MF_BinaryStream pBin */ typedef Lib3MFResult (*PLib3MFBinaryStream_GetUUIDPtr) (Lib3MF_BinaryStream pBinaryStream, const Lib3MF_uint32 nUUIDBufferSize, Lib3MF_uint32* pUUIDNeededChars, char * pUUIDBuffer); +/** +* Sets the float compression mode to raw. All subsequent writes will adhere to this mode. +* +* @param[in] pBinaryStream - BinaryStream instance. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFBinaryStream_DisableDiscretizedArrayCompressionPtr) (Lib3MF_BinaryStream pBinaryStream); + +/** +* Sets the compression mode to a quantized array. All subsequent writes will adhere to this mode. +* +* @param[in] pBinaryStream - BinaryStream instance. +* @param[in] dUnits - Unit factor to use for quantization. +* @param[in] ePredictionType - Prediction type to use for arrays. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFBinaryStream_EnableDiscretizedArrayCompressionPtr) (Lib3MF_BinaryStream pBinaryStream, Lib3MF_double dUnits, eLib3MFBinaryStreamPredictionType ePredictionType); + +/** +* Enables LZMA mode. +* +* @param[in] pBinaryStream - BinaryStream instance. +* @param[in] nLZMALevel - LZMA Level (0-9) +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFBinaryStream_EnableLZMAPtr) (Lib3MF_BinaryStream pBinaryStream, Lib3MF_uint32 nLZMALevel); + +/** +* Disables LZMA mode. +* +* @param[in] pBinaryStream - BinaryStream instance. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFBinaryStream_DisableLZMAPtr) (Lib3MF_BinaryStream pBinaryStream); + /************************************************************************************************************************* Class definition for Writer **************************************************************************************************************************/ @@ -223,7 +258,7 @@ typedef Lib3MFResult (*PLib3MFWriter_SetContentEncryptionCallbackPtr) (Lib3MF_Wr typedef Lib3MFResult (*PLib3MFWriter_CreateBinaryStreamPtr) (Lib3MF_Writer pWriter, const char * pPath, Lib3MF_BinaryStream * pBinaryStream); /** -* Sets a binary stream for a mesh object. Currently supported objects are Meshes and Toolpath layers. +* Sets a binary stream for an object. Currently supported objects are Meshes and Toolpath layers. * * @param[in] pWriter - Writer instance. * @param[in] pInstance - Object instance to assign Binary stream to. @@ -5113,6 +5148,10 @@ typedef struct { PLib3MFBase_ClassTypeIdPtr m_Base_ClassTypeId; PLib3MFBinaryStream_GetPathPtr m_BinaryStream_GetPath; PLib3MFBinaryStream_GetUUIDPtr m_BinaryStream_GetUUID; + PLib3MFBinaryStream_DisableDiscretizedArrayCompressionPtr m_BinaryStream_DisableDiscretizedArrayCompression; + PLib3MFBinaryStream_EnableDiscretizedArrayCompressionPtr m_BinaryStream_EnableDiscretizedArrayCompression; + PLib3MFBinaryStream_EnableLZMAPtr m_BinaryStream_EnableLZMA; + PLib3MFBinaryStream_DisableLZMAPtr m_BinaryStream_DisableLZMA; PLib3MFWriter_WriteToFilePtr m_Writer_WriteToFile; PLib3MFWriter_GetStreamSizePtr m_Writer_GetStreamSize; PLib3MFWriter_WriteToBufferPtr m_Writer_WriteToBuffer; diff --git a/Autogenerated/Bindings/Go/lib3mf_types.h b/Autogenerated/Bindings/Go/lib3mf_types.h index b5fbad4c7..9730f77e5 100644 --- a/Autogenerated/Bindings/Go/lib3mf_types.h +++ b/Autogenerated/Bindings/Go/lib3mf_types.h @@ -356,6 +356,11 @@ typedef enum eLib3MFBeamLatticeBallMode { eBeamLatticeBallModeAll = 2 } eLib3MFBeamLatticeBallMode; +typedef enum eLib3MFBinaryStreamPredictionType { + eBinaryStreamPredictionTypeNoPrediction = 0, + eBinaryStreamPredictionTypeDeltaPrediction = 1 +} eLib3MFBinaryStreamPredictionType; + typedef enum eLib3MFProgressIdentifier { eProgressIdentifierQUERYCANCELED = 0, eProgressIdentifierDONE = 1, @@ -487,6 +492,11 @@ typedef union { int m_code; } structEnumLib3MFBeamLatticeBallMode; +typedef union { + eLib3MFBinaryStreamPredictionType m_enum; + int m_code; +} structEnumLib3MFBinaryStreamPredictionType; + typedef union { eLib3MFProgressIdentifier m_enum; int m_code; diff --git a/Autogenerated/Bindings/NodeJS/lib3mf_dynamic.cc b/Autogenerated/Bindings/NodeJS/lib3mf_dynamic.cc index 54b017fce..b84749fc3 100644 --- a/Autogenerated/Bindings/NodeJS/lib3mf_dynamic.cc +++ b/Autogenerated/Bindings/NodeJS/lib3mf_dynamic.cc @@ -51,6 +51,10 @@ Lib3MFResult InitLib3MFWrapperTable(sLib3MFDynamicWrapperTable * pWrapperTable) pWrapperTable->m_Base_ClassTypeId = NULL; pWrapperTable->m_BinaryStream_GetPath = NULL; pWrapperTable->m_BinaryStream_GetUUID = NULL; + pWrapperTable->m_BinaryStream_DisableDiscretizedArrayCompression = NULL; + pWrapperTable->m_BinaryStream_EnableDiscretizedArrayCompression = NULL; + pWrapperTable->m_BinaryStream_EnableLZMA = NULL; + pWrapperTable->m_BinaryStream_DisableLZMA = NULL; pWrapperTable->m_Writer_WriteToFile = NULL; pWrapperTable->m_Writer_GetStreamSize = NULL; pWrapperTable->m_Writer_WriteToBuffer = NULL; @@ -617,6 +621,42 @@ Lib3MFResult LoadLib3MFWrapperTable(sLib3MFDynamicWrapperTable * pWrapperTable, if (pWrapperTable->m_BinaryStream_GetUUID == NULL) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + #ifdef _WIN32 + pWrapperTable->m_BinaryStream_DisableDiscretizedArrayCompression = (PLib3MFBinaryStream_DisableDiscretizedArrayCompressionPtr) GetProcAddress(hLibrary, "lib3mf_binarystream_disablediscretizedarraycompression"); + #else // _WIN32 + pWrapperTable->m_BinaryStream_DisableDiscretizedArrayCompression = (PLib3MFBinaryStream_DisableDiscretizedArrayCompressionPtr) dlsym(hLibrary, "lib3mf_binarystream_disablediscretizedarraycompression"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_BinaryStream_DisableDiscretizedArrayCompression == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_BinaryStream_EnableDiscretizedArrayCompression = (PLib3MFBinaryStream_EnableDiscretizedArrayCompressionPtr) GetProcAddress(hLibrary, "lib3mf_binarystream_enablediscretizedarraycompression"); + #else // _WIN32 + pWrapperTable->m_BinaryStream_EnableDiscretizedArrayCompression = (PLib3MFBinaryStream_EnableDiscretizedArrayCompressionPtr) dlsym(hLibrary, "lib3mf_binarystream_enablediscretizedarraycompression"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_BinaryStream_EnableDiscretizedArrayCompression == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_BinaryStream_EnableLZMA = (PLib3MFBinaryStream_EnableLZMAPtr) GetProcAddress(hLibrary, "lib3mf_binarystream_enablelzma"); + #else // _WIN32 + pWrapperTable->m_BinaryStream_EnableLZMA = (PLib3MFBinaryStream_EnableLZMAPtr) dlsym(hLibrary, "lib3mf_binarystream_enablelzma"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_BinaryStream_EnableLZMA == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_BinaryStream_DisableLZMA = (PLib3MFBinaryStream_DisableLZMAPtr) GetProcAddress(hLibrary, "lib3mf_binarystream_disablelzma"); + #else // _WIN32 + pWrapperTable->m_BinaryStream_DisableLZMA = (PLib3MFBinaryStream_DisableLZMAPtr) dlsym(hLibrary, "lib3mf_binarystream_disablelzma"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_BinaryStream_DisableLZMA == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + #ifdef _WIN32 pWrapperTable->m_Writer_WriteToFile = (PLib3MFWriter_WriteToFilePtr) GetProcAddress(hLibrary, "lib3mf_writer_writetofile"); #else // _WIN32 diff --git a/Autogenerated/Bindings/NodeJS/lib3mf_dynamic.h b/Autogenerated/Bindings/NodeJS/lib3mf_dynamic.h index 80cae6777..a37b58a86 100644 --- a/Autogenerated/Bindings/NodeJS/lib3mf_dynamic.h +++ b/Autogenerated/Bindings/NodeJS/lib3mf_dynamic.h @@ -79,6 +79,41 @@ typedef Lib3MFResult (*PLib3MFBinaryStream_GetPathPtr) (Lib3MF_BinaryStream pBin */ typedef Lib3MFResult (*PLib3MFBinaryStream_GetUUIDPtr) (Lib3MF_BinaryStream pBinaryStream, const Lib3MF_uint32 nUUIDBufferSize, Lib3MF_uint32* pUUIDNeededChars, char * pUUIDBuffer); +/** +* Sets the float compression mode to raw. All subsequent writes will adhere to this mode. +* +* @param[in] pBinaryStream - BinaryStream instance. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFBinaryStream_DisableDiscretizedArrayCompressionPtr) (Lib3MF_BinaryStream pBinaryStream); + +/** +* Sets the compression mode to a quantized array. All subsequent writes will adhere to this mode. +* +* @param[in] pBinaryStream - BinaryStream instance. +* @param[in] dUnits - Unit factor to use for quantization. +* @param[in] ePredictionType - Prediction type to use for arrays. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFBinaryStream_EnableDiscretizedArrayCompressionPtr) (Lib3MF_BinaryStream pBinaryStream, Lib3MF_double dUnits, eLib3MFBinaryStreamPredictionType ePredictionType); + +/** +* Enables LZMA mode. +* +* @param[in] pBinaryStream - BinaryStream instance. +* @param[in] nLZMALevel - LZMA Level (0-9) +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFBinaryStream_EnableLZMAPtr) (Lib3MF_BinaryStream pBinaryStream, Lib3MF_uint32 nLZMALevel); + +/** +* Disables LZMA mode. +* +* @param[in] pBinaryStream - BinaryStream instance. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFBinaryStream_DisableLZMAPtr) (Lib3MF_BinaryStream pBinaryStream); + /************************************************************************************************************************* Class definition for Writer **************************************************************************************************************************/ @@ -223,7 +258,7 @@ typedef Lib3MFResult (*PLib3MFWriter_SetContentEncryptionCallbackPtr) (Lib3MF_Wr typedef Lib3MFResult (*PLib3MFWriter_CreateBinaryStreamPtr) (Lib3MF_Writer pWriter, const char * pPath, Lib3MF_BinaryStream * pBinaryStream); /** -* Sets a binary stream for a mesh object. Currently supported objects are Meshes and Toolpath layers. +* Sets a binary stream for an object. Currently supported objects are Meshes and Toolpath layers. * * @param[in] pWriter - Writer instance. * @param[in] pInstance - Object instance to assign Binary stream to. @@ -5113,6 +5148,10 @@ typedef struct { PLib3MFBase_ClassTypeIdPtr m_Base_ClassTypeId; PLib3MFBinaryStream_GetPathPtr m_BinaryStream_GetPath; PLib3MFBinaryStream_GetUUIDPtr m_BinaryStream_GetUUID; + PLib3MFBinaryStream_DisableDiscretizedArrayCompressionPtr m_BinaryStream_DisableDiscretizedArrayCompression; + PLib3MFBinaryStream_EnableDiscretizedArrayCompressionPtr m_BinaryStream_EnableDiscretizedArrayCompression; + PLib3MFBinaryStream_EnableLZMAPtr m_BinaryStream_EnableLZMA; + PLib3MFBinaryStream_DisableLZMAPtr m_BinaryStream_DisableLZMA; PLib3MFWriter_WriteToFilePtr m_Writer_WriteToFile; PLib3MFWriter_GetStreamSizePtr m_Writer_GetStreamSize; PLib3MFWriter_WriteToBufferPtr m_Writer_WriteToBuffer; diff --git a/Autogenerated/Bindings/NodeJS/lib3mf_nodewrapper.cc b/Autogenerated/Bindings/NodeJS/lib3mf_nodewrapper.cc index b86115d25..3db010f28 100644 --- a/Autogenerated/Bindings/NodeJS/lib3mf_nodewrapper.cc +++ b/Autogenerated/Bindings/NodeJS/lib3mf_nodewrapper.cc @@ -1262,6 +1262,10 @@ void CLib3MFBinaryStream::Init() // Prototype NODE_SET_PROTOTYPE_METHOD(tpl, "GetPath", GetPath); NODE_SET_PROTOTYPE_METHOD(tpl, "GetUUID", GetUUID); + NODE_SET_PROTOTYPE_METHOD(tpl, "DisableDiscretizedArrayCompression", DisableDiscretizedArrayCompression); + NODE_SET_PROTOTYPE_METHOD(tpl, "EnableDiscretizedArrayCompression", EnableDiscretizedArrayCompression); + NODE_SET_PROTOTYPE_METHOD(tpl, "EnableLZMA", EnableLZMA); + NODE_SET_PROTOTYPE_METHOD(tpl, "DisableLZMA", DisableLZMA); constructor.Reset(isolate, tpl->GetFunction(isolate->GetCurrentContext()).ToLocalChecked()); } @@ -1348,6 +1352,98 @@ void CLib3MFBinaryStream::GetUUID(const FunctionCallbackInfo& args) } } + +void CLib3MFBinaryStream::DisableDiscretizedArrayCompression(const FunctionCallbackInfo& args) +{ + Isolate* isolate = args.GetIsolate(); + HandleScope scope(isolate); + try { + sLib3MFDynamicWrapperTable * wrapperTable = CLib3MFBaseClass::getDynamicWrapperTable(args.Holder()); + if (wrapperTable == nullptr) + throw std::runtime_error("Could not get wrapper table for Lib3MF method DisableDiscretizedArrayCompression."); + if (wrapperTable->m_BinaryStream_DisableDiscretizedArrayCompression == nullptr) + throw std::runtime_error("Could not call Lib3MF method BinaryStream::DisableDiscretizedArrayCompression."); + Lib3MFHandle instanceHandle = CLib3MFBaseClass::getHandle(args.Holder()); + Lib3MFResult errorCode = wrapperTable->m_BinaryStream_DisableDiscretizedArrayCompression(instanceHandle); + CheckError(isolate, wrapperTable, instanceHandle, errorCode); + + } catch (std::exception & E) { + RaiseError(isolate, E.what()); + } +} + + +void CLib3MFBinaryStream::EnableDiscretizedArrayCompression(const FunctionCallbackInfo& args) +{ + Isolate* isolate = args.GetIsolate(); + HandleScope scope(isolate); + try { + if (!args[0]->IsNumber()) { + throw std::runtime_error("Expected double parameter 0 (Units)"); + } + if (!args[1]->IsUint32()) { + throw std::runtime_error("Expected enum parameter 1 (PredictionType)"); + } + double dUnits = (double) args[0]->NumberValue(isolate->GetCurrentContext()).ToChecked(); + unsigned int ePredictionType = (unsigned int) args[1]->IntegerValue(isolate->GetCurrentContext()).ToChecked(); + sLib3MFDynamicWrapperTable * wrapperTable = CLib3MFBaseClass::getDynamicWrapperTable(args.Holder()); + if (wrapperTable == nullptr) + throw std::runtime_error("Could not get wrapper table for Lib3MF method EnableDiscretizedArrayCompression."); + if (wrapperTable->m_BinaryStream_EnableDiscretizedArrayCompression == nullptr) + throw std::runtime_error("Could not call Lib3MF method BinaryStream::EnableDiscretizedArrayCompression."); + Lib3MFHandle instanceHandle = CLib3MFBaseClass::getHandle(args.Holder()); + Lib3MFResult errorCode = wrapperTable->m_BinaryStream_EnableDiscretizedArrayCompression(instanceHandle, dUnits, (eLib3MFBinaryStreamPredictionType) ePredictionType); + CheckError(isolate, wrapperTable, instanceHandle, errorCode); + + } catch (std::exception & E) { + RaiseError(isolate, E.what()); + } +} + + +void CLib3MFBinaryStream::EnableLZMA(const FunctionCallbackInfo& args) +{ + Isolate* isolate = args.GetIsolate(); + HandleScope scope(isolate); + try { + if (!args[0]->IsUint32()) { + throw std::runtime_error("Expected uint32 parameter 0 (LZMALevel)"); + } + unsigned int nLZMALevel = (unsigned int) args[0]->IntegerValue(isolate->GetCurrentContext()).ToChecked(); + sLib3MFDynamicWrapperTable * wrapperTable = CLib3MFBaseClass::getDynamicWrapperTable(args.Holder()); + if (wrapperTable == nullptr) + throw std::runtime_error("Could not get wrapper table for Lib3MF method EnableLZMA."); + if (wrapperTable->m_BinaryStream_EnableLZMA == nullptr) + throw std::runtime_error("Could not call Lib3MF method BinaryStream::EnableLZMA."); + Lib3MFHandle instanceHandle = CLib3MFBaseClass::getHandle(args.Holder()); + Lib3MFResult errorCode = wrapperTable->m_BinaryStream_EnableLZMA(instanceHandle, nLZMALevel); + CheckError(isolate, wrapperTable, instanceHandle, errorCode); + + } catch (std::exception & E) { + RaiseError(isolate, E.what()); + } +} + + +void CLib3MFBinaryStream::DisableLZMA(const FunctionCallbackInfo& args) +{ + Isolate* isolate = args.GetIsolate(); + HandleScope scope(isolate); + try { + sLib3MFDynamicWrapperTable * wrapperTable = CLib3MFBaseClass::getDynamicWrapperTable(args.Holder()); + if (wrapperTable == nullptr) + throw std::runtime_error("Could not get wrapper table for Lib3MF method DisableLZMA."); + if (wrapperTable->m_BinaryStream_DisableLZMA == nullptr) + throw std::runtime_error("Could not call Lib3MF method BinaryStream::DisableLZMA."); + Lib3MFHandle instanceHandle = CLib3MFBaseClass::getHandle(args.Holder()); + Lib3MFResult errorCode = wrapperTable->m_BinaryStream_DisableLZMA(instanceHandle); + CheckError(isolate, wrapperTable, instanceHandle, errorCode); + + } catch (std::exception & E) { + RaiseError(isolate, E.what()); + } +} + /************************************************************************************************************************* Class CLib3MFWriter Implementation **************************************************************************************************************************/ @@ -16773,6 +16869,8 @@ void CLib3MFWrapper::New(const FunctionCallbackInfo& args) newObject->Set(isolate->GetCurrentContext(), String::NewFromUtf8(isolate, "eBeamLatticeBallMode_None"), Integer::New(isolate, 0)); newObject->Set(isolate->GetCurrentContext(), String::NewFromUtf8(isolate, "eBeamLatticeBallMode_Mixed"), Integer::New(isolate, 1)); newObject->Set(isolate->GetCurrentContext(), String::NewFromUtf8(isolate, "eBeamLatticeBallMode_All"), Integer::New(isolate, 2)); + newObject->Set(isolate->GetCurrentContext(), String::NewFromUtf8(isolate, "eBinaryStreamPredictionType_NoPrediction"), Integer::New(isolate, 0)); + newObject->Set(isolate->GetCurrentContext(), String::NewFromUtf8(isolate, "eBinaryStreamPredictionType_DeltaPrediction"), Integer::New(isolate, 1)); newObject->Set(isolate->GetCurrentContext(), String::NewFromUtf8(isolate, "eProgressIdentifier_QUERYCANCELED"), Integer::New(isolate, 0)); newObject->Set(isolate->GetCurrentContext(), String::NewFromUtf8(isolate, "eProgressIdentifier_DONE"), Integer::New(isolate, 1)); newObject->Set(isolate->GetCurrentContext(), String::NewFromUtf8(isolate, "eProgressIdentifier_CLEANUP"), Integer::New(isolate, 2)); diff --git a/Autogenerated/Bindings/NodeJS/lib3mf_nodewrapper.h b/Autogenerated/Bindings/NodeJS/lib3mf_nodewrapper.h index 336e5007d..c5f1bc902 100644 --- a/Autogenerated/Bindings/NodeJS/lib3mf_nodewrapper.h +++ b/Autogenerated/Bindings/NodeJS/lib3mf_nodewrapper.h @@ -96,6 +96,10 @@ class CLib3MFBinaryStream : public CLib3MFBaseClass { static v8::Persistent constructor; static void GetPath(const v8::FunctionCallbackInfo& args); static void GetUUID(const v8::FunctionCallbackInfo& args); + static void DisableDiscretizedArrayCompression(const v8::FunctionCallbackInfo& args); + static void EnableDiscretizedArrayCompression(const v8::FunctionCallbackInfo& args); + static void EnableLZMA(const v8::FunctionCallbackInfo& args); + static void DisableLZMA(const v8::FunctionCallbackInfo& args); public: CLib3MFBinaryStream(); diff --git a/Autogenerated/Bindings/NodeJS/lib3mf_types.h b/Autogenerated/Bindings/NodeJS/lib3mf_types.h index b5fbad4c7..9730f77e5 100644 --- a/Autogenerated/Bindings/NodeJS/lib3mf_types.h +++ b/Autogenerated/Bindings/NodeJS/lib3mf_types.h @@ -356,6 +356,11 @@ typedef enum eLib3MFBeamLatticeBallMode { eBeamLatticeBallModeAll = 2 } eLib3MFBeamLatticeBallMode; +typedef enum eLib3MFBinaryStreamPredictionType { + eBinaryStreamPredictionTypeNoPrediction = 0, + eBinaryStreamPredictionTypeDeltaPrediction = 1 +} eLib3MFBinaryStreamPredictionType; + typedef enum eLib3MFProgressIdentifier { eProgressIdentifierQUERYCANCELED = 0, eProgressIdentifierDONE = 1, @@ -487,6 +492,11 @@ typedef union { int m_code; } structEnumLib3MFBeamLatticeBallMode; +typedef union { + eLib3MFBinaryStreamPredictionType m_enum; + int m_code; +} structEnumLib3MFBinaryStreamPredictionType; + typedef union { eLib3MFProgressIdentifier m_enum; int m_code; diff --git a/Autogenerated/Bindings/Pascal/Unit_Lib3MF.pas b/Autogenerated/Bindings/Pascal/Unit_Lib3MF.pas index d4f24c1cc..f999fada0 100644 --- a/Autogenerated/Bindings/Pascal/Unit_Lib3MF.pas +++ b/Autogenerated/Bindings/Pascal/Unit_Lib3MF.pas @@ -215,6 +215,11 @@ interface eBeamLatticeBallModeAll ); + TLib3MFBinaryStreamPredictionType = ( + eBinaryStreamPredictionTypeNoPrediction, + eBinaryStreamPredictionTypeDeltaPrediction + ); + TLib3MFProgressIdentifier = ( eProgressIdentifierQUERYCANCELED, eProgressIdentifierDONE, @@ -497,6 +502,41 @@ TLib3MFModel = class; *) TLib3MFBinaryStream_GetUUIDFunc = function(pBinaryStream: TLib3MFHandle; const nUUIDBufferSize: Cardinal; out pUUIDNeededChars: Cardinal; pUUIDBuffer: PAnsiChar): TLib3MFResult; cdecl; + (** + * Sets the float compression mode to raw. All subsequent writes will adhere to this mode. + * + * @param[in] pBinaryStream - BinaryStream instance. + * @return error code or 0 (success) + *) + TLib3MFBinaryStream_DisableDiscretizedArrayCompressionFunc = function(pBinaryStream: TLib3MFHandle): TLib3MFResult; cdecl; + + (** + * Sets the compression mode to a quantized array. All subsequent writes will adhere to this mode. + * + * @param[in] pBinaryStream - BinaryStream instance. + * @param[in] dUnits - Unit factor to use for quantization. + * @param[in] ePredictionType - Prediction type to use for arrays. + * @return error code or 0 (success) + *) + TLib3MFBinaryStream_EnableDiscretizedArrayCompressionFunc = function(pBinaryStream: TLib3MFHandle; const dUnits: Double; const ePredictionType: Integer): TLib3MFResult; cdecl; + + (** + * Enables LZMA mode. + * + * @param[in] pBinaryStream - BinaryStream instance. + * @param[in] nLZMALevel - LZMA Level (0-9) + * @return error code or 0 (success) + *) + TLib3MFBinaryStream_EnableLZMAFunc = function(pBinaryStream: TLib3MFHandle; const nLZMALevel: Cardinal): TLib3MFResult; cdecl; + + (** + * Disables LZMA mode. + * + * @param[in] pBinaryStream - BinaryStream instance. + * @return error code or 0 (success) + *) + TLib3MFBinaryStream_DisableLZMAFunc = function(pBinaryStream: TLib3MFHandle): TLib3MFResult; cdecl; + (************************************************************************************************************************* Function type definitions for Writer @@ -642,7 +682,7 @@ TLib3MFModel = class; TLib3MFWriter_CreateBinaryStreamFunc = function(pWriter: TLib3MFHandle; const pPath: PAnsiChar; out pBinaryStream: TLib3MFHandle): TLib3MFResult; cdecl; (** - * Sets a binary stream for a mesh object. Currently supported objects are Meshes and Toolpath layers. + * Sets a binary stream for an object. Currently supported objects are Meshes and Toolpath layers. * * @param[in] pWriter - Writer instance. * @param[in] pInstance - Object instance to assign Binary stream to. @@ -5621,6 +5661,10 @@ TLib3MFBinaryStream = class(TLib3MFBase) destructor Destroy; override; function GetPath(): String; function GetUUID(): String; + procedure DisableDiscretizedArrayCompression(); + procedure EnableDiscretizedArrayCompression(const AUnits: Double; const APredictionType: TLib3MFBinaryStreamPredictionType); + procedure EnableLZMA(const ALZMALevel: Cardinal); + procedure DisableLZMA(); end; @@ -6660,6 +6704,10 @@ TLib3MFWrapper = class(TObject) FLib3MFBase_ClassTypeIdFunc: TLib3MFBase_ClassTypeIdFunc; FLib3MFBinaryStream_GetPathFunc: TLib3MFBinaryStream_GetPathFunc; FLib3MFBinaryStream_GetUUIDFunc: TLib3MFBinaryStream_GetUUIDFunc; + FLib3MFBinaryStream_DisableDiscretizedArrayCompressionFunc: TLib3MFBinaryStream_DisableDiscretizedArrayCompressionFunc; + FLib3MFBinaryStream_EnableDiscretizedArrayCompressionFunc: TLib3MFBinaryStream_EnableDiscretizedArrayCompressionFunc; + FLib3MFBinaryStream_EnableLZMAFunc: TLib3MFBinaryStream_EnableLZMAFunc; + FLib3MFBinaryStream_DisableLZMAFunc: TLib3MFBinaryStream_DisableLZMAFunc; FLib3MFWriter_WriteToFileFunc: TLib3MFWriter_WriteToFileFunc; FLib3MFWriter_GetStreamSizeFunc: TLib3MFWriter_GetStreamSizeFunc; FLib3MFWriter_WriteToBufferFunc: TLib3MFWriter_WriteToBufferFunc; @@ -7158,6 +7206,10 @@ TLib3MFWrapper = class(TObject) property Lib3MFBase_ClassTypeIdFunc: TLib3MFBase_ClassTypeIdFunc read FLib3MFBase_ClassTypeIdFunc; property Lib3MFBinaryStream_GetPathFunc: TLib3MFBinaryStream_GetPathFunc read FLib3MFBinaryStream_GetPathFunc; property Lib3MFBinaryStream_GetUUIDFunc: TLib3MFBinaryStream_GetUUIDFunc read FLib3MFBinaryStream_GetUUIDFunc; + property Lib3MFBinaryStream_DisableDiscretizedArrayCompressionFunc: TLib3MFBinaryStream_DisableDiscretizedArrayCompressionFunc read FLib3MFBinaryStream_DisableDiscretizedArrayCompressionFunc; + property Lib3MFBinaryStream_EnableDiscretizedArrayCompressionFunc: TLib3MFBinaryStream_EnableDiscretizedArrayCompressionFunc read FLib3MFBinaryStream_EnableDiscretizedArrayCompressionFunc; + property Lib3MFBinaryStream_EnableLZMAFunc: TLib3MFBinaryStream_EnableLZMAFunc read FLib3MFBinaryStream_EnableLZMAFunc; + property Lib3MFBinaryStream_DisableLZMAFunc: TLib3MFBinaryStream_DisableLZMAFunc read FLib3MFBinaryStream_DisableLZMAFunc; property Lib3MFWriter_WriteToFileFunc: TLib3MFWriter_WriteToFileFunc read FLib3MFWriter_WriteToFileFunc; property Lib3MFWriter_GetStreamSizeFunc: TLib3MFWriter_GetStreamSizeFunc read FLib3MFWriter_GetStreamSizeFunc; property Lib3MFWriter_WriteToBufferFunc: TLib3MFWriter_WriteToBufferFunc read FLib3MFWriter_WriteToBufferFunc; @@ -7695,6 +7747,8 @@ TLib3MFWrapper = class(TObject) function convertConstToBeamLatticeClipMode(const AValue: Integer): TLib3MFBeamLatticeClipMode; function convertBeamLatticeBallModeToConst(const AValue: TLib3MFBeamLatticeBallMode): Integer; function convertConstToBeamLatticeBallMode(const AValue: Integer): TLib3MFBeamLatticeBallMode; + function convertBinaryStreamPredictionTypeToConst(const AValue: TLib3MFBinaryStreamPredictionType): Integer; + function convertConstToBinaryStreamPredictionType(const AValue: Integer): TLib3MFBinaryStreamPredictionType; function convertProgressIdentifierToConst(const AValue: TLib3MFProgressIdentifier): Integer; function convertConstToProgressIdentifier(const AValue: Integer): TLib3MFProgressIdentifier; function convertBlendMethodToConst(const AValue: TLib3MFBlendMethod): Integer; @@ -8046,6 +8100,27 @@ implementation end; + function convertBinaryStreamPredictionTypeToConst(const AValue: TLib3MFBinaryStreamPredictionType): Integer; + begin + case AValue of + eBinaryStreamPredictionTypeNoPrediction: Result := 0; + eBinaryStreamPredictionTypeDeltaPrediction: Result := 1; + else + raise ELib3MFException.CreateCustomMessage(LIB3MF_ERROR_INVALIDPARAM, 'invalid enum value'); + end; + end; + + function convertConstToBinaryStreamPredictionType(const AValue: Integer): TLib3MFBinaryStreamPredictionType; + begin + case AValue of + 0: Result := eBinaryStreamPredictionTypeNoPrediction; + 1: Result := eBinaryStreamPredictionTypeDeltaPrediction; + else + raise ELib3MFException.CreateCustomMessage(LIB3MF_ERROR_INVALIDPARAM, 'invalid enum constant'); + end; + end; + + function convertProgressIdentifierToConst(const AValue: TLib3MFProgressIdentifier): Integer; begin case AValue of @@ -8729,6 +8804,26 @@ implementation Result := StrPas(@bufferUUID[0]); end; + procedure TLib3MFBinaryStream.DisableDiscretizedArrayCompression(); + begin + FWrapper.CheckError(Self, FWrapper.Lib3MFBinaryStream_DisableDiscretizedArrayCompressionFunc(FHandle)); + end; + + procedure TLib3MFBinaryStream.EnableDiscretizedArrayCompression(const AUnits: Double; const APredictionType: TLib3MFBinaryStreamPredictionType); + begin + FWrapper.CheckError(Self, FWrapper.Lib3MFBinaryStream_EnableDiscretizedArrayCompressionFunc(FHandle, AUnits, convertBinaryStreamPredictionTypeToConst(APredictionType))); + end; + + procedure TLib3MFBinaryStream.EnableLZMA(const ALZMALevel: Cardinal); + begin + FWrapper.CheckError(Self, FWrapper.Lib3MFBinaryStream_EnableLZMAFunc(FHandle, ALZMALevel)); + end; + + procedure TLib3MFBinaryStream.DisableLZMA(); + begin + FWrapper.CheckError(Self, FWrapper.Lib3MFBinaryStream_DisableLZMAFunc(FHandle)); + end; + (************************************************************************************************************************* Class implementation for Writer **************************************************************************************************************************) @@ -13801,6 +13896,10 @@ implementation FLib3MFBase_ClassTypeIdFunc := LoadFunction('lib3mf_base_classtypeid'); FLib3MFBinaryStream_GetPathFunc := LoadFunction('lib3mf_binarystream_getpath'); FLib3MFBinaryStream_GetUUIDFunc := LoadFunction('lib3mf_binarystream_getuuid'); + FLib3MFBinaryStream_DisableDiscretizedArrayCompressionFunc := LoadFunction('lib3mf_binarystream_disablediscretizedarraycompression'); + FLib3MFBinaryStream_EnableDiscretizedArrayCompressionFunc := LoadFunction('lib3mf_binarystream_enablediscretizedarraycompression'); + FLib3MFBinaryStream_EnableLZMAFunc := LoadFunction('lib3mf_binarystream_enablelzma'); + FLib3MFBinaryStream_DisableLZMAFunc := LoadFunction('lib3mf_binarystream_disablelzma'); FLib3MFWriter_WriteToFileFunc := LoadFunction('lib3mf_writer_writetofile'); FLib3MFWriter_GetStreamSizeFunc := LoadFunction('lib3mf_writer_getstreamsize'); FLib3MFWriter_WriteToBufferFunc := LoadFunction('lib3mf_writer_writetobuffer'); @@ -14304,6 +14403,18 @@ implementation if AResult <> LIB3MF_SUCCESS then raise ELib3MFException.CreateCustomMessage(LIB3MF_ERROR_COULDNOTLOADLIBRARY, ''); AResult := ALookupMethod(PAnsiChar('lib3mf_binarystream_getuuid'), @FLib3MFBinaryStream_GetUUIDFunc); + if AResult <> LIB3MF_SUCCESS then + raise ELib3MFException.CreateCustomMessage(LIB3MF_ERROR_COULDNOTLOADLIBRARY, ''); + AResult := ALookupMethod(PAnsiChar('lib3mf_binarystream_disablediscretizedarraycompression'), @FLib3MFBinaryStream_DisableDiscretizedArrayCompressionFunc); + if AResult <> LIB3MF_SUCCESS then + raise ELib3MFException.CreateCustomMessage(LIB3MF_ERROR_COULDNOTLOADLIBRARY, ''); + AResult := ALookupMethod(PAnsiChar('lib3mf_binarystream_enablediscretizedarraycompression'), @FLib3MFBinaryStream_EnableDiscretizedArrayCompressionFunc); + if AResult <> LIB3MF_SUCCESS then + raise ELib3MFException.CreateCustomMessage(LIB3MF_ERROR_COULDNOTLOADLIBRARY, ''); + AResult := ALookupMethod(PAnsiChar('lib3mf_binarystream_enablelzma'), @FLib3MFBinaryStream_EnableLZMAFunc); + if AResult <> LIB3MF_SUCCESS then + raise ELib3MFException.CreateCustomMessage(LIB3MF_ERROR_COULDNOTLOADLIBRARY, ''); + AResult := ALookupMethod(PAnsiChar('lib3mf_binarystream_disablelzma'), @FLib3MFBinaryStream_DisableLZMAFunc); if AResult <> LIB3MF_SUCCESS then raise ELib3MFException.CreateCustomMessage(LIB3MF_ERROR_COULDNOTLOADLIBRARY, ''); AResult := ALookupMethod(PAnsiChar('lib3mf_writer_writetofile'), @FLib3MFWriter_WriteToFileFunc); diff --git a/Autogenerated/Bindings/Python/Lib3MF.py b/Autogenerated/Bindings/Python/Lib3MF.py index 4a1c7591e..e3c93f433 100644 --- a/Autogenerated/Bindings/Python/Lib3MF.py +++ b/Autogenerated/Bindings/Python/Lib3MF.py @@ -147,6 +147,10 @@ class FunctionTable: lib3mf_base_classtypeid = None lib3mf_binarystream_getpath = None lib3mf_binarystream_getuuid = None + lib3mf_binarystream_disablediscretizedarraycompression = None + lib3mf_binarystream_enablediscretizedarraycompression = None + lib3mf_binarystream_enablelzma = None + lib3mf_binarystream_disablelzma = None lib3mf_writer_writetofile = None lib3mf_writer_getstreamsize = None lib3mf_writer_writetobuffer = None @@ -697,6 +701,11 @@ class BeamLatticeBallMode(CTypesEnum): None = 0 Mixed = 1 All = 2 +'''Definition of BinaryStreamPredictionType +''' +class BinaryStreamPredictionType(CTypesEnum): + NoPrediction = 0 + DeltaPrediction = 1 '''Definition of ProgressIdentifier ''' class ProgressIdentifier(CTypesEnum): @@ -1073,6 +1082,30 @@ def _loadFunctionTableFromMethod(self, symbolLookupMethodAddress): methodType = ctypes.CFUNCTYPE(ctypes.c_int32, ctypes.c_void_p, ctypes.c_uint64, ctypes.POINTER(ctypes.c_uint64), ctypes.c_char_p) self.lib.lib3mf_binarystream_getuuid = methodType(int(methodAddress.value)) + err = symbolLookupMethod(ctypes.c_char_p(str.encode("lib3mf_binarystream_disablediscretizedarraycompression")), methodAddress) + if err != 0: + raise ELib3MFException(ErrorCodes.COULDNOTLOADLIBRARY, str(err)) + methodType = ctypes.CFUNCTYPE(ctypes.c_int32, ctypes.c_void_p) + self.lib.lib3mf_binarystream_disablediscretizedarraycompression = methodType(int(methodAddress.value)) + + err = symbolLookupMethod(ctypes.c_char_p(str.encode("lib3mf_binarystream_enablediscretizedarraycompression")), methodAddress) + if err != 0: + raise ELib3MFException(ErrorCodes.COULDNOTLOADLIBRARY, str(err)) + methodType = ctypes.CFUNCTYPE(ctypes.c_int32, ctypes.c_void_p, ctypes.c_double, BinaryStreamPredictionType) + self.lib.lib3mf_binarystream_enablediscretizedarraycompression = methodType(int(methodAddress.value)) + + err = symbolLookupMethod(ctypes.c_char_p(str.encode("lib3mf_binarystream_enablelzma")), methodAddress) + if err != 0: + raise ELib3MFException(ErrorCodes.COULDNOTLOADLIBRARY, str(err)) + methodType = ctypes.CFUNCTYPE(ctypes.c_int32, ctypes.c_void_p, ctypes.c_uint32) + self.lib.lib3mf_binarystream_enablelzma = methodType(int(methodAddress.value)) + + err = symbolLookupMethod(ctypes.c_char_p(str.encode("lib3mf_binarystream_disablelzma")), methodAddress) + if err != 0: + raise ELib3MFException(ErrorCodes.COULDNOTLOADLIBRARY, str(err)) + methodType = ctypes.CFUNCTYPE(ctypes.c_int32, ctypes.c_void_p) + self.lib.lib3mf_binarystream_disablelzma = methodType(int(methodAddress.value)) + err = symbolLookupMethod(ctypes.c_char_p(str.encode("lib3mf_writer_writetofile")), methodAddress) if err != 0: raise ELib3MFException(ErrorCodes.COULDNOTLOADLIBRARY, str(err)) @@ -3940,6 +3973,18 @@ def _loadFunctionTable(self): self.lib.lib3mf_binarystream_getuuid.restype = ctypes.c_int32 self.lib.lib3mf_binarystream_getuuid.argtypes = [ctypes.c_void_p, ctypes.c_uint64, ctypes.POINTER(ctypes.c_uint64), ctypes.c_char_p] + self.lib.lib3mf_binarystream_disablediscretizedarraycompression.restype = ctypes.c_int32 + self.lib.lib3mf_binarystream_disablediscretizedarraycompression.argtypes = [ctypes.c_void_p] + + self.lib.lib3mf_binarystream_enablediscretizedarraycompression.restype = ctypes.c_int32 + self.lib.lib3mf_binarystream_enablediscretizedarraycompression.argtypes = [ctypes.c_void_p, ctypes.c_double, BinaryStreamPredictionType] + + self.lib.lib3mf_binarystream_enablelzma.restype = ctypes.c_int32 + self.lib.lib3mf_binarystream_enablelzma.argtypes = [ctypes.c_void_p, ctypes.c_uint32] + + self.lib.lib3mf_binarystream_disablelzma.restype = ctypes.c_int32 + self.lib.lib3mf_binarystream_disablelzma.argtypes = [ctypes.c_void_p] + self.lib.lib3mf_writer_writetofile.restype = ctypes.c_int32 self.lib.lib3mf_writer_writetofile.argtypes = [ctypes.c_void_p, ctypes.c_char_p] @@ -5706,6 +5751,24 @@ def GetUUID(self): return pUUIDBuffer.value.decode() + def DisableDiscretizedArrayCompression(self): + self._wrapper.checkError(self, self._wrapper.lib.lib3mf_binarystream_disablediscretizedarraycompression(self._handle)) + + + def EnableDiscretizedArrayCompression(self, Units, PredictionType): + dUnits = ctypes.c_double(Units) + self._wrapper.checkError(self, self._wrapper.lib.lib3mf_binarystream_enablediscretizedarraycompression(self._handle, dUnits, PredictionType)) + + + def EnableLZMA(self, LZMALevel): + nLZMALevel = ctypes.c_uint32(LZMALevel) + self._wrapper.checkError(self, self._wrapper.lib.lib3mf_binarystream_enablelzma(self._handle, nLZMALevel)) + + + def DisableLZMA(self): + self._wrapper.checkError(self, self._wrapper.lib.lib3mf_binarystream_disablelzma(self._handle)) + + ''' Class Implementation for Writer diff --git a/Autogenerated/Source/lib3mf_abi.hpp b/Autogenerated/Source/lib3mf_abi.hpp index d83d8d969..9027344b1 100644 --- a/Autogenerated/Source/lib3mf_abi.hpp +++ b/Autogenerated/Source/lib3mf_abi.hpp @@ -92,6 +92,41 @@ LIB3MF_DECLSPEC Lib3MFResult lib3mf_binarystream_getpath(Lib3MF_BinaryStream pBi */ LIB3MF_DECLSPEC Lib3MFResult lib3mf_binarystream_getuuid(Lib3MF_BinaryStream pBinaryStream, const Lib3MF_uint32 nUUIDBufferSize, Lib3MF_uint32* pUUIDNeededChars, char * pUUIDBuffer); +/** +* Sets the float compression mode to raw. All subsequent writes will adhere to this mode. +* +* @param[in] pBinaryStream - BinaryStream instance. +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_binarystream_disablediscretizedarraycompression(Lib3MF_BinaryStream pBinaryStream); + +/** +* Sets the compression mode to a quantized array. All subsequent writes will adhere to this mode. +* +* @param[in] pBinaryStream - BinaryStream instance. +* @param[in] dUnits - Unit factor to use for quantization. +* @param[in] ePredictionType - Prediction type to use for arrays. +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_binarystream_enablediscretizedarraycompression(Lib3MF_BinaryStream pBinaryStream, Lib3MF_double dUnits, Lib3MF::eBinaryStreamPredictionType ePredictionType); + +/** +* Enables LZMA mode. +* +* @param[in] pBinaryStream - BinaryStream instance. +* @param[in] nLZMALevel - LZMA Level (0-9) +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_binarystream_enablelzma(Lib3MF_BinaryStream pBinaryStream, Lib3MF_uint32 nLZMALevel); + +/** +* Disables LZMA mode. +* +* @param[in] pBinaryStream - BinaryStream instance. +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_binarystream_disablelzma(Lib3MF_BinaryStream pBinaryStream); + /************************************************************************************************************************* Class definition for Writer **************************************************************************************************************************/ @@ -236,7 +271,7 @@ LIB3MF_DECLSPEC Lib3MFResult lib3mf_writer_setcontentencryptioncallback(Lib3MF_W LIB3MF_DECLSPEC Lib3MFResult lib3mf_writer_createbinarystream(Lib3MF_Writer pWriter, const char * pPath, Lib3MF_BinaryStream * pBinaryStream); /** -* Sets a binary stream for a mesh object. Currently supported objects are Meshes and Toolpath layers. +* Sets a binary stream for an object. Currently supported objects are Meshes and Toolpath layers. * * @param[in] pWriter - Writer instance. * @param[in] pInstance - Object instance to assign Binary stream to. diff --git a/Autogenerated/Source/lib3mf_interfaces.hpp b/Autogenerated/Source/lib3mf_interfaces.hpp index 166b254ba..d15953c55 100644 --- a/Autogenerated/Source/lib3mf_interfaces.hpp +++ b/Autogenerated/Source/lib3mf_interfaces.hpp @@ -337,6 +337,29 @@ class IBinaryStream : public virtual IBase { */ virtual std::string GetUUID() = 0; + /** + * IBinaryStream::DisableDiscretizedArrayCompression - Sets the float compression mode to raw. All subsequent writes will adhere to this mode. + */ + virtual void DisableDiscretizedArrayCompression() = 0; + + /** + * IBinaryStream::EnableDiscretizedArrayCompression - Sets the compression mode to a quantized array. All subsequent writes will adhere to this mode. + * @param[in] dUnits - Unit factor to use for quantization. + * @param[in] ePredictionType - Prediction type to use for arrays. + */ + virtual void EnableDiscretizedArrayCompression(const Lib3MF_double dUnits, const Lib3MF::eBinaryStreamPredictionType ePredictionType) = 0; + + /** + * IBinaryStream::EnableLZMA - Enables LZMA mode. + * @param[in] nLZMALevel - LZMA Level (0-9) + */ + virtual void EnableLZMA(const Lib3MF_uint32 nLZMALevel) = 0; + + /** + * IBinaryStream::DisableLZMA - Disables LZMA mode. + */ + virtual void DisableLZMA() = 0; + }; typedef IBaseSharedPtr PIBinaryStream; @@ -453,7 +476,7 @@ class IWriter : public virtual IBase { virtual IBinaryStream * CreateBinaryStream(const std::string & sPath) = 0; /** - * IWriter::AssignBinaryStream - Sets a binary stream for a mesh object. Currently supported objects are Meshes and Toolpath layers. + * IWriter::AssignBinaryStream - Sets a binary stream for an object. Currently supported objects are Meshes and Toolpath layers. * @param[in] pInstance - Object instance to assign Binary stream to. * @param[in] pBinaryStream - Binary stream object to use for this layer. */ diff --git a/Autogenerated/Source/lib3mf_interfacewrapper.cpp b/Autogenerated/Source/lib3mf_interfacewrapper.cpp index 83baded8c..6ef586230 100644 --- a/Autogenerated/Source/lib3mf_interfacewrapper.cpp +++ b/Autogenerated/Source/lib3mf_interfacewrapper.cpp @@ -238,6 +238,133 @@ Lib3MFResult lib3mf_binarystream_getuuid(Lib3MF_BinaryStream pBinaryStream, cons } } +Lib3MFResult lib3mf_binarystream_disablediscretizedarraycompression(Lib3MF_BinaryStream pBinaryStream) +{ + IBase* pIBaseClass = (IBase *)pBinaryStream; + + PLib3MFInterfaceJournalEntry pJournalEntry; + try { + if (m_GlobalJournal.get() != nullptr) { + pJournalEntry = m_GlobalJournal->beginClassMethod(pBinaryStream, "BinaryStream", "DisableDiscretizedArrayCompression"); + } + IBinaryStream* pIBinaryStream = dynamic_cast(pIBaseClass); + if (!pIBinaryStream) + throw ELib3MFInterfaceException(LIB3MF_ERROR_INVALIDCAST); + + pIBinaryStream->DisableDiscretizedArrayCompression(); + + if (pJournalEntry.get() != nullptr) { + pJournalEntry->writeSuccess(); + } + return LIB3MF_SUCCESS; + } + catch (ELib3MFInterfaceException & Exception) { + return handleLib3MFException(pIBaseClass, Exception, pJournalEntry.get()); + } + catch (std::exception & StdException) { + return handleStdException(pIBaseClass, StdException, pJournalEntry.get()); + } + catch (...) { + return handleUnhandledException(pIBaseClass, pJournalEntry.get()); + } +} + +Lib3MFResult lib3mf_binarystream_enablediscretizedarraycompression(Lib3MF_BinaryStream pBinaryStream, Lib3MF_double dUnits, eLib3MFBinaryStreamPredictionType ePredictionType) +{ + IBase* pIBaseClass = (IBase *)pBinaryStream; + + PLib3MFInterfaceJournalEntry pJournalEntry; + try { + if (m_GlobalJournal.get() != nullptr) { + pJournalEntry = m_GlobalJournal->beginClassMethod(pBinaryStream, "BinaryStream", "EnableDiscretizedArrayCompression"); + pJournalEntry->addDoubleParameter("Units", dUnits); + pJournalEntry->addEnumParameter("PredictionType", "BinaryStreamPredictionType", (Lib3MF_int32)(ePredictionType)); + } + IBinaryStream* pIBinaryStream = dynamic_cast(pIBaseClass); + if (!pIBinaryStream) + throw ELib3MFInterfaceException(LIB3MF_ERROR_INVALIDCAST); + + pIBinaryStream->EnableDiscretizedArrayCompression(dUnits, ePredictionType); + + if (pJournalEntry.get() != nullptr) { + pJournalEntry->writeSuccess(); + } + return LIB3MF_SUCCESS; + } + catch (ELib3MFInterfaceException & Exception) { + return handleLib3MFException(pIBaseClass, Exception, pJournalEntry.get()); + } + catch (std::exception & StdException) { + return handleStdException(pIBaseClass, StdException, pJournalEntry.get()); + } + catch (...) { + return handleUnhandledException(pIBaseClass, pJournalEntry.get()); + } +} + +Lib3MFResult lib3mf_binarystream_enablelzma(Lib3MF_BinaryStream pBinaryStream, Lib3MF_uint32 nLZMALevel) +{ + IBase* pIBaseClass = (IBase *)pBinaryStream; + + PLib3MFInterfaceJournalEntry pJournalEntry; + try { + if (m_GlobalJournal.get() != nullptr) { + pJournalEntry = m_GlobalJournal->beginClassMethod(pBinaryStream, "BinaryStream", "EnableLZMA"); + pJournalEntry->addUInt32Parameter("LZMALevel", nLZMALevel); + } + IBinaryStream* pIBinaryStream = dynamic_cast(pIBaseClass); + if (!pIBinaryStream) + throw ELib3MFInterfaceException(LIB3MF_ERROR_INVALIDCAST); + + pIBinaryStream->EnableLZMA(nLZMALevel); + + if (pJournalEntry.get() != nullptr) { + pJournalEntry->writeSuccess(); + } + return LIB3MF_SUCCESS; + } + catch (ELib3MFInterfaceException & Exception) { + return handleLib3MFException(pIBaseClass, Exception, pJournalEntry.get()); + } + catch (std::exception & StdException) { + return handleStdException(pIBaseClass, StdException, pJournalEntry.get()); + } + catch (...) { + return handleUnhandledException(pIBaseClass, pJournalEntry.get()); + } +} + +Lib3MFResult lib3mf_binarystream_disablelzma(Lib3MF_BinaryStream pBinaryStream) +{ + IBase* pIBaseClass = (IBase *)pBinaryStream; + + PLib3MFInterfaceJournalEntry pJournalEntry; + try { + if (m_GlobalJournal.get() != nullptr) { + pJournalEntry = m_GlobalJournal->beginClassMethod(pBinaryStream, "BinaryStream", "DisableLZMA"); + } + IBinaryStream* pIBinaryStream = dynamic_cast(pIBaseClass); + if (!pIBinaryStream) + throw ELib3MFInterfaceException(LIB3MF_ERROR_INVALIDCAST); + + pIBinaryStream->DisableLZMA(); + + if (pJournalEntry.get() != nullptr) { + pJournalEntry->writeSuccess(); + } + return LIB3MF_SUCCESS; + } + catch (ELib3MFInterfaceException & Exception) { + return handleLib3MFException(pIBaseClass, Exception, pJournalEntry.get()); + } + catch (std::exception & StdException) { + return handleStdException(pIBaseClass, StdException, pJournalEntry.get()); + } + catch (...) { + return handleUnhandledException(pIBaseClass, pJournalEntry.get()); + } +} + /************************************************************************************************************************* Class implementation for Writer @@ -18145,6 +18272,14 @@ Lib3MFResult Lib3MF::Impl::Lib3MF_GetProcAddress (const char * pProcName, void * *ppProcAddress = (void*) &lib3mf_binarystream_getpath; if (sProcName == "lib3mf_binarystream_getuuid") *ppProcAddress = (void*) &lib3mf_binarystream_getuuid; + if (sProcName == "lib3mf_binarystream_disablediscretizedarraycompression") + *ppProcAddress = (void*) &lib3mf_binarystream_disablediscretizedarraycompression; + if (sProcName == "lib3mf_binarystream_enablediscretizedarraycompression") + *ppProcAddress = (void*) &lib3mf_binarystream_enablediscretizedarraycompression; + if (sProcName == "lib3mf_binarystream_enablelzma") + *ppProcAddress = (void*) &lib3mf_binarystream_enablelzma; + if (sProcName == "lib3mf_binarystream_disablelzma") + *ppProcAddress = (void*) &lib3mf_binarystream_disablelzma; if (sProcName == "lib3mf_writer_writetofile") *ppProcAddress = (void*) &lib3mf_writer_writetofile; if (sProcName == "lib3mf_writer_getstreamsize") diff --git a/Autogenerated/Source/lib3mf_types.hpp b/Autogenerated/Source/lib3mf_types.hpp index 96033c1b3..5bbee6bba 100644 --- a/Autogenerated/Source/lib3mf_types.hpp +++ b/Autogenerated/Source/lib3mf_types.hpp @@ -357,6 +357,11 @@ namespace Lib3MF { All = 2 }; + enum class eBinaryStreamPredictionType : Lib3MF_int32 { + NoPrediction = 0, + DeltaPrediction = 1 + }; + enum class eProgressIdentifier : Lib3MF_int32 { QUERYCANCELED = 0, DONE = 1, @@ -588,6 +593,7 @@ typedef Lib3MF::eTextureFilter eLib3MFTextureFilter; typedef Lib3MF::eBeamLatticeCapMode eLib3MFBeamLatticeCapMode; typedef Lib3MF::eBeamLatticeClipMode eLib3MFBeamLatticeClipMode; typedef Lib3MF::eBeamLatticeBallMode eLib3MFBeamLatticeBallMode; +typedef Lib3MF::eBinaryStreamPredictionType eLib3MFBinaryStreamPredictionType; typedef Lib3MF::eProgressIdentifier eLib3MFProgressIdentifier; typedef Lib3MF::eBlendMethod eLib3MFBlendMethod; typedef Lib3MF::eToolpathSegmentType eLib3MFToolpathSegmentType; diff --git a/AutomaticComponentToolkit/lib3mf.xml b/AutomaticComponentToolkit/lib3mf.xml index 7bd3eb2fb..11e44e345 100644 --- a/AutomaticComponentToolkit/lib3mf.xml +++ b/AutomaticComponentToolkit/lib3mf.xml @@ -180,6 +180,12 @@