diff --git a/Autogenerated/Bindings/C/lib3mf.h b/Autogenerated/Bindings/C/lib3mf.h index 4d2634c2c..b48db374a 100644 --- a/Autogenerated/Bindings/C/lib3mf.h +++ b/Autogenerated/Bindings/C/lib3mf.h @@ -3334,6 +3334,28 @@ LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerreader_getsegmentpart(Lib3MF_To */ LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerreader_getsegmentpartuuid(Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nIndex, const Lib3MF_uint32 nPartUUIDBufferSize, Lib3MF_uint32* pPartUUIDNeededChars, char * pPartUUIDBuffer); +/** +* Retrieves the assigned segment part id. ATTENTION: This ID is only unique within the layer and there is no guarantee to be globally unique or consistent across layers. +* +* @param[in] pToolpathLayerReader - ToolpathLayerReader instance. +* @param[in] nIndex - Index. Must be between 0 and Count - 1. +* @param[out] pLocalPartID - Local Segment Part ID +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerreader_getsegmentlocalpartid(Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nIndex, Lib3MF_uint32 * pLocalPartID); + +/** +* Retrieves the global part UUID by the local part ID. Fails if part ID does not exist in this layer. ATTENTION: This ID is only unique within the layer and there is no guarantee to be globally unique or consistent across layers. +* +* @param[in] pToolpathLayerReader - ToolpathLayerReader instance. +* @param[in] nLocalPartID - Local Segment Part ID +* @param[in] nPartUUIDBufferSize - size of the buffer (including trailing 0) +* @param[out] pPartUUIDNeededChars - will be filled with the count of the written bytes, or needed buffer size. +* @param[out] pPartUUIDBuffer - buffer of Segment Part UUID, may be NULL +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerreader_getpartuuidbylocalpartid(Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nLocalPartID, const Lib3MF_uint32 nPartUUIDBufferSize, Lib3MF_uint32* pPartUUIDNeededChars, char * pPartUUIDBuffer); + /** * Retrieves the assigned segment point list. For type hatch, the points are taken pairwise. * diff --git a/Autogenerated/Bindings/CDynamic/lib3mf_dynamic.cc b/Autogenerated/Bindings/CDynamic/lib3mf_dynamic.cc index 78acea397..173420f3c 100644 --- a/Autogenerated/Bindings/CDynamic/lib3mf_dynamic.cc +++ b/Autogenerated/Bindings/CDynamic/lib3mf_dynamic.cc @@ -363,6 +363,8 @@ Lib3MFResult InitLib3MFWrapperTable(sLib3MFDynamicWrapperTable * pWrapperTable) pWrapperTable->m_ToolpathLayerReader_GetSegmentProfileUUID = NULL; pWrapperTable->m_ToolpathLayerReader_GetSegmentPart = NULL; pWrapperTable->m_ToolpathLayerReader_GetSegmentPartUUID = NULL; + pWrapperTable->m_ToolpathLayerReader_GetSegmentLocalPartID = NULL; + pWrapperTable->m_ToolpathLayerReader_GetPartUUIDByLocalPartID = NULL; pWrapperTable->m_ToolpathLayerReader_GetSegmentPointData = NULL; pWrapperTable->m_ToolpathLayerReader_FindAttributeInfoByName = NULL; pWrapperTable->m_ToolpathLayerReader_FindAttributeIDByName = NULL; @@ -3430,6 +3432,24 @@ Lib3MFResult LoadLib3MFWrapperTable(sLib3MFDynamicWrapperTable * pWrapperTable, if (pWrapperTable->m_ToolpathLayerReader_GetSegmentPartUUID == NULL) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + #ifdef _WIN32 + pWrapperTable->m_ToolpathLayerReader_GetSegmentLocalPartID = (PLib3MFToolpathLayerReader_GetSegmentLocalPartIDPtr) GetProcAddress(hLibrary, "lib3mf_toolpathlayerreader_getsegmentlocalpartid"); + #else // _WIN32 + pWrapperTable->m_ToolpathLayerReader_GetSegmentLocalPartID = (PLib3MFToolpathLayerReader_GetSegmentLocalPartIDPtr) dlsym(hLibrary, "lib3mf_toolpathlayerreader_getsegmentlocalpartid"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_ToolpathLayerReader_GetSegmentLocalPartID == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_ToolpathLayerReader_GetPartUUIDByLocalPartID = (PLib3MFToolpathLayerReader_GetPartUUIDByLocalPartIDPtr) GetProcAddress(hLibrary, "lib3mf_toolpathlayerreader_getpartuuidbylocalpartid"); + #else // _WIN32 + pWrapperTable->m_ToolpathLayerReader_GetPartUUIDByLocalPartID = (PLib3MFToolpathLayerReader_GetPartUUIDByLocalPartIDPtr) dlsym(hLibrary, "lib3mf_toolpathlayerreader_getpartuuidbylocalpartid"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_ToolpathLayerReader_GetPartUUIDByLocalPartID == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + #ifdef _WIN32 pWrapperTable->m_ToolpathLayerReader_GetSegmentPointData = (PLib3MFToolpathLayerReader_GetSegmentPointDataPtr) GetProcAddress(hLibrary, "lib3mf_toolpathlayerreader_getsegmentpointdata"); #else // _WIN32 diff --git a/Autogenerated/Bindings/CDynamic/lib3mf_dynamic.h b/Autogenerated/Bindings/CDynamic/lib3mf_dynamic.h index 3d2e2cb83..8beac171f 100644 --- a/Autogenerated/Bindings/CDynamic/lib3mf_dynamic.h +++ b/Autogenerated/Bindings/CDynamic/lib3mf_dynamic.h @@ -3321,6 +3321,28 @@ typedef Lib3MFResult (*PLib3MFToolpathLayerReader_GetSegmentPartPtr) (Lib3MF_Too */ typedef Lib3MFResult (*PLib3MFToolpathLayerReader_GetSegmentPartUUIDPtr) (Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nIndex, const Lib3MF_uint32 nPartUUIDBufferSize, Lib3MF_uint32* pPartUUIDNeededChars, char * pPartUUIDBuffer); +/** +* Retrieves the assigned segment part id. ATTENTION: This ID is only unique within the layer and there is no guarantee to be globally unique or consistent across layers. +* +* @param[in] pToolpathLayerReader - ToolpathLayerReader instance. +* @param[in] nIndex - Index. Must be between 0 and Count - 1. +* @param[out] pLocalPartID - Local Segment Part ID +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFToolpathLayerReader_GetSegmentLocalPartIDPtr) (Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nIndex, Lib3MF_uint32 * pLocalPartID); + +/** +* Retrieves the global part UUID by the local part ID. Fails if part ID does not exist in this layer. ATTENTION: This ID is only unique within the layer and there is no guarantee to be globally unique or consistent across layers. +* +* @param[in] pToolpathLayerReader - ToolpathLayerReader instance. +* @param[in] nLocalPartID - Local Segment Part ID +* @param[in] nPartUUIDBufferSize - size of the buffer (including trailing 0) +* @param[out] pPartUUIDNeededChars - will be filled with the count of the written bytes, or needed buffer size. +* @param[out] pPartUUIDBuffer - buffer of Segment Part UUID, may be NULL +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFToolpathLayerReader_GetPartUUIDByLocalPartIDPtr) (Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nLocalPartID, const Lib3MF_uint32 nPartUUIDBufferSize, Lib3MF_uint32* pPartUUIDNeededChars, char * pPartUUIDBuffer); + /** * Retrieves the assigned segment point list. For type hatch, the points are taken pairwise. * @@ -5472,6 +5494,8 @@ typedef struct { PLib3MFToolpathLayerReader_GetSegmentProfileUUIDPtr m_ToolpathLayerReader_GetSegmentProfileUUID; PLib3MFToolpathLayerReader_GetSegmentPartPtr m_ToolpathLayerReader_GetSegmentPart; PLib3MFToolpathLayerReader_GetSegmentPartUUIDPtr m_ToolpathLayerReader_GetSegmentPartUUID; + PLib3MFToolpathLayerReader_GetSegmentLocalPartIDPtr m_ToolpathLayerReader_GetSegmentLocalPartID; + PLib3MFToolpathLayerReader_GetPartUUIDByLocalPartIDPtr m_ToolpathLayerReader_GetPartUUIDByLocalPartID; PLib3MFToolpathLayerReader_GetSegmentPointDataPtr m_ToolpathLayerReader_GetSegmentPointData; PLib3MFToolpathLayerReader_FindAttributeInfoByNamePtr m_ToolpathLayerReader_FindAttributeInfoByName; PLib3MFToolpathLayerReader_FindAttributeIDByNamePtr m_ToolpathLayerReader_FindAttributeIDByName; diff --git a/Autogenerated/Bindings/CSharp/Lib3MF.cs b/Autogenerated/Bindings/CSharp/Lib3MF.cs index 645e1c26b..73f047e17 100644 --- a/Autogenerated/Bindings/CSharp/Lib3MF.cs +++ b/Autogenerated/Bindings/CSharp/Lib3MF.cs @@ -1295,6 +1295,12 @@ public class Lib3MFWrapper [DllImport("lib3mf.dll", EntryPoint = "lib3mf_toolpathlayerreader_getsegmentpartuuid", CallingConvention=CallingConvention.Cdecl)] public unsafe extern static Int32 ToolpathLayerReader_GetSegmentPartUUID (IntPtr Handle, UInt32 AIndex, UInt32 sizePartUUID, out UInt32 neededPartUUID, IntPtr dataPartUUID); + [DllImport("lib3mf.dll", EntryPoint = "lib3mf_toolpathlayerreader_getsegmentlocalpartid", CallingConvention=CallingConvention.Cdecl)] + public unsafe extern static Int32 ToolpathLayerReader_GetSegmentLocalPartID (IntPtr Handle, UInt32 AIndex, out UInt32 ALocalPartID); + + [DllImport("lib3mf.dll", EntryPoint = "lib3mf_toolpathlayerreader_getpartuuidbylocalpartid", CallingConvention=CallingConvention.Cdecl)] + public unsafe extern static Int32 ToolpathLayerReader_GetPartUUIDByLocalPartID (IntPtr Handle, UInt32 ALocalPartID, UInt32 sizePartUUID, out UInt32 neededPartUUID, IntPtr dataPartUUID); + [DllImport("lib3mf.dll", EntryPoint = "lib3mf_toolpathlayerreader_getsegmentpointdata", CallingConvention=CallingConvention.Cdecl)] public unsafe extern static Int32 ToolpathLayerReader_GetSegmentPointData (IntPtr Handle, UInt32 AIndex, UInt64 sizePointData, out UInt64 neededPointData, IntPtr dataPointData); @@ -5416,6 +5422,28 @@ public String GetSegmentPartUUID (UInt32 AIndex) return Encoding.UTF8.GetString(bytesPartUUID).TrimEnd(char.MinValue); } + public UInt32 GetSegmentLocalPartID (UInt32 AIndex) + { + UInt32 resultLocalPartID = 0; + + CheckError(Internal.Lib3MFWrapper.ToolpathLayerReader_GetSegmentLocalPartID (Handle, AIndex, out resultLocalPartID)); + return resultLocalPartID; + } + + public String GetPartUUIDByLocalPartID (UInt32 ALocalPartID) + { + UInt32 sizePartUUID = 0; + UInt32 neededPartUUID = 0; + CheckError(Internal.Lib3MFWrapper.ToolpathLayerReader_GetPartUUIDByLocalPartID (Handle, ALocalPartID, sizePartUUID, out neededPartUUID, IntPtr.Zero)); + sizePartUUID = neededPartUUID; + byte[] bytesPartUUID = new byte[sizePartUUID]; + GCHandle dataPartUUID = GCHandle.Alloc(bytesPartUUID, GCHandleType.Pinned); + + CheckError(Internal.Lib3MFWrapper.ToolpathLayerReader_GetPartUUIDByLocalPartID (Handle, ALocalPartID, sizePartUUID, out neededPartUUID, dataPartUUID.AddrOfPinnedObject())); + dataPartUUID.Free(); + return Encoding.UTF8.GetString(bytesPartUUID).TrimEnd(char.MinValue); + } + public void GetSegmentPointData (UInt32 AIndex, out sPosition2D[] APointData) { UInt64 sizePointData = 0; diff --git a/Autogenerated/Bindings/Cpp/lib3mf_abi.hpp b/Autogenerated/Bindings/Cpp/lib3mf_abi.hpp index 0813789a5..cd0489ab7 100644 --- a/Autogenerated/Bindings/Cpp/lib3mf_abi.hpp +++ b/Autogenerated/Bindings/Cpp/lib3mf_abi.hpp @@ -3334,6 +3334,28 @@ LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerreader_getsegmentpart(Lib3MF_To */ LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerreader_getsegmentpartuuid(Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nIndex, const Lib3MF_uint32 nPartUUIDBufferSize, Lib3MF_uint32* pPartUUIDNeededChars, char * pPartUUIDBuffer); +/** +* Retrieves the assigned segment part id. ATTENTION: This ID is only unique within the layer and there is no guarantee to be globally unique or consistent across layers. +* +* @param[in] pToolpathLayerReader - ToolpathLayerReader instance. +* @param[in] nIndex - Index. Must be between 0 and Count - 1. +* @param[out] pLocalPartID - Local Segment Part ID +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerreader_getsegmentlocalpartid(Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nIndex, Lib3MF_uint32 * pLocalPartID); + +/** +* Retrieves the global part UUID by the local part ID. Fails if part ID does not exist in this layer. ATTENTION: This ID is only unique within the layer and there is no guarantee to be globally unique or consistent across layers. +* +* @param[in] pToolpathLayerReader - ToolpathLayerReader instance. +* @param[in] nLocalPartID - Local Segment Part ID +* @param[in] nPartUUIDBufferSize - size of the buffer (including trailing 0) +* @param[out] pPartUUIDNeededChars - will be filled with the count of the written bytes, or needed buffer size. +* @param[out] pPartUUIDBuffer - buffer of Segment Part UUID, may be NULL +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerreader_getpartuuidbylocalpartid(Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nLocalPartID, const Lib3MF_uint32 nPartUUIDBufferSize, Lib3MF_uint32* pPartUUIDNeededChars, char * pPartUUIDBuffer); + /** * Retrieves the assigned segment point list. For type hatch, the points are taken pairwise. * diff --git a/Autogenerated/Bindings/Cpp/lib3mf_implicit.hpp b/Autogenerated/Bindings/Cpp/lib3mf_implicit.hpp index cfc30186f..cc576ce0e 100644 --- a/Autogenerated/Bindings/Cpp/lib3mf_implicit.hpp +++ b/Autogenerated/Bindings/Cpp/lib3mf_implicit.hpp @@ -1675,6 +1675,8 @@ class CToolpathLayerReader : public CBase { inline std::string GetSegmentProfileUUID(const Lib3MF_uint32 nIndex); inline PBuildItem GetSegmentPart(const Lib3MF_uint32 nIndex); inline std::string GetSegmentPartUUID(const Lib3MF_uint32 nIndex); + inline Lib3MF_uint32 GetSegmentLocalPartID(const Lib3MF_uint32 nIndex); + inline std::string GetPartUUIDByLocalPartID(const Lib3MF_uint32 nLocalPartID); inline void GetSegmentPointData(const Lib3MF_uint32 nIndex, std::vector & PointDataBuffer); inline void FindAttributeInfoByName(const std::string & sNameSpace, const std::string & sAttributeName, Lib3MF_uint32 & nID, eToolpathAttributeType & eAttributeType); inline Lib3MF_uint32 FindAttributeIDByName(const std::string & sNameSpace, const std::string & sAttributeName); @@ -6417,6 +6419,35 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle) return std::string(&bufferPartUUID[0]); } + /** + * CToolpathLayerReader::GetSegmentLocalPartID - Retrieves the assigned segment part id. ATTENTION: This ID is only unique within the layer and there is no guarantee to be globally unique or consistent across layers. + * @param[in] nIndex - Index. Must be between 0 and Count - 1. + * @return Local Segment Part ID + */ + Lib3MF_uint32 CToolpathLayerReader::GetSegmentLocalPartID(const Lib3MF_uint32 nIndex) + { + Lib3MF_uint32 resultLocalPartID = 0; + CheckError(lib3mf_toolpathlayerreader_getsegmentlocalpartid(m_pHandle, nIndex, &resultLocalPartID)); + + return resultLocalPartID; + } + + /** + * CToolpathLayerReader::GetPartUUIDByLocalPartID - Retrieves the global part UUID by the local part ID. Fails if part ID does not exist in this layer. ATTENTION: This ID is only unique within the layer and there is no guarantee to be globally unique or consistent across layers. + * @param[in] nLocalPartID - Local Segment Part ID + * @return Segment Part UUID + */ + std::string CToolpathLayerReader::GetPartUUIDByLocalPartID(const Lib3MF_uint32 nLocalPartID) + { + Lib3MF_uint32 bytesNeededPartUUID = 0; + Lib3MF_uint32 bytesWrittenPartUUID = 0; + CheckError(lib3mf_toolpathlayerreader_getpartuuidbylocalpartid(m_pHandle, nLocalPartID, 0, &bytesNeededPartUUID, nullptr)); + std::vector bufferPartUUID(bytesNeededPartUUID); + CheckError(lib3mf_toolpathlayerreader_getpartuuidbylocalpartid(m_pHandle, nLocalPartID, bytesNeededPartUUID, &bytesWrittenPartUUID, &bufferPartUUID[0])); + + return std::string(&bufferPartUUID[0]); + } + /** * CToolpathLayerReader::GetSegmentPointData - Retrieves the assigned segment point list. For type hatch, the points are taken pairwise. * @param[in] nIndex - Index. Must be between 0 and Count - 1. diff --git a/Autogenerated/Bindings/CppDynamic/lib3mf_dynamic.h b/Autogenerated/Bindings/CppDynamic/lib3mf_dynamic.h index b7442c448..7be8224a5 100644 --- a/Autogenerated/Bindings/CppDynamic/lib3mf_dynamic.h +++ b/Autogenerated/Bindings/CppDynamic/lib3mf_dynamic.h @@ -3321,6 +3321,28 @@ typedef Lib3MFResult (*PLib3MFToolpathLayerReader_GetSegmentPartPtr) (Lib3MF_Too */ typedef Lib3MFResult (*PLib3MFToolpathLayerReader_GetSegmentPartUUIDPtr) (Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nIndex, const Lib3MF_uint32 nPartUUIDBufferSize, Lib3MF_uint32* pPartUUIDNeededChars, char * pPartUUIDBuffer); +/** +* Retrieves the assigned segment part id. ATTENTION: This ID is only unique within the layer and there is no guarantee to be globally unique or consistent across layers. +* +* @param[in] pToolpathLayerReader - ToolpathLayerReader instance. +* @param[in] nIndex - Index. Must be between 0 and Count - 1. +* @param[out] pLocalPartID - Local Segment Part ID +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFToolpathLayerReader_GetSegmentLocalPartIDPtr) (Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nIndex, Lib3MF_uint32 * pLocalPartID); + +/** +* Retrieves the global part UUID by the local part ID. Fails if part ID does not exist in this layer. ATTENTION: This ID is only unique within the layer and there is no guarantee to be globally unique or consistent across layers. +* +* @param[in] pToolpathLayerReader - ToolpathLayerReader instance. +* @param[in] nLocalPartID - Local Segment Part ID +* @param[in] nPartUUIDBufferSize - size of the buffer (including trailing 0) +* @param[out] pPartUUIDNeededChars - will be filled with the count of the written bytes, or needed buffer size. +* @param[out] pPartUUIDBuffer - buffer of Segment Part UUID, may be NULL +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFToolpathLayerReader_GetPartUUIDByLocalPartIDPtr) (Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nLocalPartID, const Lib3MF_uint32 nPartUUIDBufferSize, Lib3MF_uint32* pPartUUIDNeededChars, char * pPartUUIDBuffer); + /** * Retrieves the assigned segment point list. For type hatch, the points are taken pairwise. * @@ -5472,6 +5494,8 @@ typedef struct { PLib3MFToolpathLayerReader_GetSegmentProfileUUIDPtr m_ToolpathLayerReader_GetSegmentProfileUUID; PLib3MFToolpathLayerReader_GetSegmentPartPtr m_ToolpathLayerReader_GetSegmentPart; PLib3MFToolpathLayerReader_GetSegmentPartUUIDPtr m_ToolpathLayerReader_GetSegmentPartUUID; + PLib3MFToolpathLayerReader_GetSegmentLocalPartIDPtr m_ToolpathLayerReader_GetSegmentLocalPartID; + PLib3MFToolpathLayerReader_GetPartUUIDByLocalPartIDPtr m_ToolpathLayerReader_GetPartUUIDByLocalPartID; PLib3MFToolpathLayerReader_GetSegmentPointDataPtr m_ToolpathLayerReader_GetSegmentPointData; PLib3MFToolpathLayerReader_FindAttributeInfoByNamePtr m_ToolpathLayerReader_FindAttributeInfoByName; PLib3MFToolpathLayerReader_FindAttributeIDByNamePtr m_ToolpathLayerReader_FindAttributeIDByName; diff --git a/Autogenerated/Bindings/CppDynamic/lib3mf_dynamic.hpp b/Autogenerated/Bindings/CppDynamic/lib3mf_dynamic.hpp index 614beea1c..6821c7168 100644 --- a/Autogenerated/Bindings/CppDynamic/lib3mf_dynamic.hpp +++ b/Autogenerated/Bindings/CppDynamic/lib3mf_dynamic.hpp @@ -1699,6 +1699,8 @@ class CToolpathLayerReader : public CBase { inline std::string GetSegmentProfileUUID(const Lib3MF_uint32 nIndex); inline PBuildItem GetSegmentPart(const Lib3MF_uint32 nIndex); inline std::string GetSegmentPartUUID(const Lib3MF_uint32 nIndex); + inline Lib3MF_uint32 GetSegmentLocalPartID(const Lib3MF_uint32 nIndex); + inline std::string GetPartUUIDByLocalPartID(const Lib3MF_uint32 nLocalPartID); inline void GetSegmentPointData(const Lib3MF_uint32 nIndex, std::vector & PointDataBuffer); inline void FindAttributeInfoByName(const std::string & sNameSpace, const std::string & sAttributeName, Lib3MF_uint32 & nID, eToolpathAttributeType & eAttributeType); inline Lib3MF_uint32 FindAttributeIDByName(const std::string & sNameSpace, const std::string & sAttributeName); @@ -2706,6 +2708,8 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle) pWrapperTable->m_ToolpathLayerReader_GetSegmentProfileUUID = nullptr; pWrapperTable->m_ToolpathLayerReader_GetSegmentPart = nullptr; pWrapperTable->m_ToolpathLayerReader_GetSegmentPartUUID = nullptr; + pWrapperTable->m_ToolpathLayerReader_GetSegmentLocalPartID = nullptr; + pWrapperTable->m_ToolpathLayerReader_GetPartUUIDByLocalPartID = nullptr; pWrapperTable->m_ToolpathLayerReader_GetSegmentPointData = nullptr; pWrapperTable->m_ToolpathLayerReader_FindAttributeInfoByName = nullptr; pWrapperTable->m_ToolpathLayerReader_FindAttributeIDByName = nullptr; @@ -5769,6 +5773,24 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle) if (pWrapperTable->m_ToolpathLayerReader_GetSegmentPartUUID == nullptr) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + #ifdef _WIN32 + pWrapperTable->m_ToolpathLayerReader_GetSegmentLocalPartID = (PLib3MFToolpathLayerReader_GetSegmentLocalPartIDPtr) GetProcAddress(hLibrary, "lib3mf_toolpathlayerreader_getsegmentlocalpartid"); + #else // _WIN32 + pWrapperTable->m_ToolpathLayerReader_GetSegmentLocalPartID = (PLib3MFToolpathLayerReader_GetSegmentLocalPartIDPtr) dlsym(hLibrary, "lib3mf_toolpathlayerreader_getsegmentlocalpartid"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_ToolpathLayerReader_GetSegmentLocalPartID == nullptr) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_ToolpathLayerReader_GetPartUUIDByLocalPartID = (PLib3MFToolpathLayerReader_GetPartUUIDByLocalPartIDPtr) GetProcAddress(hLibrary, "lib3mf_toolpathlayerreader_getpartuuidbylocalpartid"); + #else // _WIN32 + pWrapperTable->m_ToolpathLayerReader_GetPartUUIDByLocalPartID = (PLib3MFToolpathLayerReader_GetPartUUIDByLocalPartIDPtr) dlsym(hLibrary, "lib3mf_toolpathlayerreader_getpartuuidbylocalpartid"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_ToolpathLayerReader_GetPartUUIDByLocalPartID == nullptr) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + #ifdef _WIN32 pWrapperTable->m_ToolpathLayerReader_GetSegmentPointData = (PLib3MFToolpathLayerReader_GetSegmentPointDataPtr) GetProcAddress(hLibrary, "lib3mf_toolpathlayerreader_getsegmentpointdata"); #else // _WIN32 @@ -8647,6 +8669,14 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle) if ( (eLookupError != 0) || (pWrapperTable->m_ToolpathLayerReader_GetSegmentPartUUID == nullptr) ) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + eLookupError = (*pLookup)("lib3mf_toolpathlayerreader_getsegmentlocalpartid", (void**)&(pWrapperTable->m_ToolpathLayerReader_GetSegmentLocalPartID)); + if ( (eLookupError != 0) || (pWrapperTable->m_ToolpathLayerReader_GetSegmentLocalPartID == nullptr) ) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + eLookupError = (*pLookup)("lib3mf_toolpathlayerreader_getpartuuidbylocalpartid", (void**)&(pWrapperTable->m_ToolpathLayerReader_GetPartUUIDByLocalPartID)); + if ( (eLookupError != 0) || (pWrapperTable->m_ToolpathLayerReader_GetPartUUIDByLocalPartID == nullptr) ) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + eLookupError = (*pLookup)("lib3mf_toolpathlayerreader_getsegmentpointdata", (void**)&(pWrapperTable->m_ToolpathLayerReader_GetSegmentPointData)); if ( (eLookupError != 0) || (pWrapperTable->m_ToolpathLayerReader_GetSegmentPointData == nullptr) ) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; @@ -13419,6 +13449,35 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle) return std::string(&bufferPartUUID[0]); } + /** + * CToolpathLayerReader::GetSegmentLocalPartID - Retrieves the assigned segment part id. ATTENTION: This ID is only unique within the layer and there is no guarantee to be globally unique or consistent across layers. + * @param[in] nIndex - Index. Must be between 0 and Count - 1. + * @return Local Segment Part ID + */ + Lib3MF_uint32 CToolpathLayerReader::GetSegmentLocalPartID(const Lib3MF_uint32 nIndex) + { + Lib3MF_uint32 resultLocalPartID = 0; + CheckError(m_pWrapper->m_WrapperTable.m_ToolpathLayerReader_GetSegmentLocalPartID(m_pHandle, nIndex, &resultLocalPartID)); + + return resultLocalPartID; + } + + /** + * CToolpathLayerReader::GetPartUUIDByLocalPartID - Retrieves the global part UUID by the local part ID. Fails if part ID does not exist in this layer. ATTENTION: This ID is only unique within the layer and there is no guarantee to be globally unique or consistent across layers. + * @param[in] nLocalPartID - Local Segment Part ID + * @return Segment Part UUID + */ + std::string CToolpathLayerReader::GetPartUUIDByLocalPartID(const Lib3MF_uint32 nLocalPartID) + { + Lib3MF_uint32 bytesNeededPartUUID = 0; + Lib3MF_uint32 bytesWrittenPartUUID = 0; + CheckError(m_pWrapper->m_WrapperTable.m_ToolpathLayerReader_GetPartUUIDByLocalPartID(m_pHandle, nLocalPartID, 0, &bytesNeededPartUUID, nullptr)); + std::vector bufferPartUUID(bytesNeededPartUUID); + CheckError(m_pWrapper->m_WrapperTable.m_ToolpathLayerReader_GetPartUUIDByLocalPartID(m_pHandle, nLocalPartID, bytesNeededPartUUID, &bytesWrittenPartUUID, &bufferPartUUID[0])); + + return std::string(&bufferPartUUID[0]); + } + /** * CToolpathLayerReader::GetSegmentPointData - Retrieves the assigned segment point list. For type hatch, the points are taken pairwise. * @param[in] nIndex - Index. Must be between 0 and Count - 1. diff --git a/Autogenerated/Bindings/Go/lib3mf.go b/Autogenerated/Bindings/Go/lib3mf.go index dc46e7065..33eebc9ad 100644 --- a/Autogenerated/Bindings/Go/lib3mf.go +++ b/Autogenerated/Bindings/Go/lib3mf.go @@ -2907,6 +2907,24 @@ Lib3MFResult CCall_lib3mf_toolpathlayerreader_getsegmentpartuuid(Lib3MFHandle li } +Lib3MFResult CCall_lib3mf_toolpathlayerreader_getsegmentlocalpartid(Lib3MFHandle libraryHandle, Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nIndex, Lib3MF_uint32 * pLocalPartID) +{ + if (libraryHandle == 0) + return LIB3MF_ERROR_INVALIDCAST; + sLib3MFDynamicWrapperTable * wrapperTable = (sLib3MFDynamicWrapperTable *) libraryHandle; + return wrapperTable->m_ToolpathLayerReader_GetSegmentLocalPartID (pToolpathLayerReader, nIndex, pLocalPartID); +} + + +Lib3MFResult CCall_lib3mf_toolpathlayerreader_getpartuuidbylocalpartid(Lib3MFHandle libraryHandle, Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nLocalPartID, const Lib3MF_uint32 nPartUUIDBufferSize, Lib3MF_uint32* pPartUUIDNeededChars, char * pPartUUIDBuffer) +{ + if (libraryHandle == 0) + return LIB3MF_ERROR_INVALIDCAST; + sLib3MFDynamicWrapperTable * wrapperTable = (sLib3MFDynamicWrapperTable *) libraryHandle; + return wrapperTable->m_ToolpathLayerReader_GetPartUUIDByLocalPartID (pToolpathLayerReader, nLocalPartID, nPartUUIDBufferSize, pPartUUIDNeededChars, pPartUUIDBuffer); +} + + Lib3MFResult CCall_lib3mf_toolpathlayerreader_getsegmentpointdata(Lib3MFHandle libraryHandle, Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nIndex, const Lib3MF_uint64 nPointDataBufferSize, Lib3MF_uint64* pPointDataNeededCount, sLib3MFPosition2D * pPointDataBuffer) { if (libraryHandle == 0) @@ -9010,6 +9028,33 @@ func (inst ToolpathLayerReader) GetSegmentPartUUID(index uint32) (string, error) return string(bufferpartUUID[:(filledinpartUUID-1)]), nil } +// GetSegmentLocalPartID retrieves the assigned segment part id. ATTENTION: This ID is only unique within the layer and there is no guarantee to be globally unique or consistent across layers. +func (inst ToolpathLayerReader) GetSegmentLocalPartID(index uint32) (uint32, error) { + var localPartID C.uint32_t + ret := C.CCall_lib3mf_toolpathlayerreader_getsegmentlocalpartid(inst.wrapperRef.LibraryHandle, inst.Ref, C.uint32_t(index), &localPartID) + if ret != 0 { + return 0, makeError(uint32(ret)) + } + return uint32(localPartID), nil +} + +// GetPartUUIDByLocalPartID retrieves the global part UUID by the local part ID. Fails if part ID does not exist in this layer. ATTENTION: This ID is only unique within the layer and there is no guarantee to be globally unique or consistent across layers. +func (inst ToolpathLayerReader) GetPartUUIDByLocalPartID(localPartID uint32) (string, error) { + var neededforpartUUID C.uint32_t + var filledinpartUUID C.uint32_t + ret := C.CCall_lib3mf_toolpathlayerreader_getpartuuidbylocalpartid(inst.wrapperRef.LibraryHandle, inst.Ref, C.uint32_t(localPartID), 0, &neededforpartUUID, nil) + if ret != 0 { + return "", makeError(uint32(ret)) + } + bufferSizepartUUID := neededforpartUUID + bufferpartUUID := make([]byte, bufferSizepartUUID) + ret = C.CCall_lib3mf_toolpathlayerreader_getpartuuidbylocalpartid(inst.wrapperRef.LibraryHandle, inst.Ref, C.uint32_t(localPartID), bufferSizepartUUID, &filledinpartUUID, (*C.char)(unsafe.Pointer(&bufferpartUUID[0]))) + if ret != 0 { + return "", makeError(uint32(ret)) + } + return string(bufferpartUUID[:(filledinpartUUID-1)]), nil +} + // GetSegmentPointData retrieves the assigned segment point list. For type hatch, the points are taken pairwise. func (inst ToolpathLayerReader) GetSegmentPointData(index uint32, pointData []Position2D) ([]Position2D, error) { var neededforpointData C.uint64_t diff --git a/Autogenerated/Bindings/Go/lib3mf_dynamic.cc b/Autogenerated/Bindings/Go/lib3mf_dynamic.cc index 78acea397..173420f3c 100644 --- a/Autogenerated/Bindings/Go/lib3mf_dynamic.cc +++ b/Autogenerated/Bindings/Go/lib3mf_dynamic.cc @@ -363,6 +363,8 @@ Lib3MFResult InitLib3MFWrapperTable(sLib3MFDynamicWrapperTable * pWrapperTable) pWrapperTable->m_ToolpathLayerReader_GetSegmentProfileUUID = NULL; pWrapperTable->m_ToolpathLayerReader_GetSegmentPart = NULL; pWrapperTable->m_ToolpathLayerReader_GetSegmentPartUUID = NULL; + pWrapperTable->m_ToolpathLayerReader_GetSegmentLocalPartID = NULL; + pWrapperTable->m_ToolpathLayerReader_GetPartUUIDByLocalPartID = NULL; pWrapperTable->m_ToolpathLayerReader_GetSegmentPointData = NULL; pWrapperTable->m_ToolpathLayerReader_FindAttributeInfoByName = NULL; pWrapperTable->m_ToolpathLayerReader_FindAttributeIDByName = NULL; @@ -3430,6 +3432,24 @@ Lib3MFResult LoadLib3MFWrapperTable(sLib3MFDynamicWrapperTable * pWrapperTable, if (pWrapperTable->m_ToolpathLayerReader_GetSegmentPartUUID == NULL) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + #ifdef _WIN32 + pWrapperTable->m_ToolpathLayerReader_GetSegmentLocalPartID = (PLib3MFToolpathLayerReader_GetSegmentLocalPartIDPtr) GetProcAddress(hLibrary, "lib3mf_toolpathlayerreader_getsegmentlocalpartid"); + #else // _WIN32 + pWrapperTable->m_ToolpathLayerReader_GetSegmentLocalPartID = (PLib3MFToolpathLayerReader_GetSegmentLocalPartIDPtr) dlsym(hLibrary, "lib3mf_toolpathlayerreader_getsegmentlocalpartid"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_ToolpathLayerReader_GetSegmentLocalPartID == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_ToolpathLayerReader_GetPartUUIDByLocalPartID = (PLib3MFToolpathLayerReader_GetPartUUIDByLocalPartIDPtr) GetProcAddress(hLibrary, "lib3mf_toolpathlayerreader_getpartuuidbylocalpartid"); + #else // _WIN32 + pWrapperTable->m_ToolpathLayerReader_GetPartUUIDByLocalPartID = (PLib3MFToolpathLayerReader_GetPartUUIDByLocalPartIDPtr) dlsym(hLibrary, "lib3mf_toolpathlayerreader_getpartuuidbylocalpartid"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_ToolpathLayerReader_GetPartUUIDByLocalPartID == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + #ifdef _WIN32 pWrapperTable->m_ToolpathLayerReader_GetSegmentPointData = (PLib3MFToolpathLayerReader_GetSegmentPointDataPtr) GetProcAddress(hLibrary, "lib3mf_toolpathlayerreader_getsegmentpointdata"); #else // _WIN32 diff --git a/Autogenerated/Bindings/Go/lib3mf_dynamic.h b/Autogenerated/Bindings/Go/lib3mf_dynamic.h index 3d2e2cb83..8beac171f 100644 --- a/Autogenerated/Bindings/Go/lib3mf_dynamic.h +++ b/Autogenerated/Bindings/Go/lib3mf_dynamic.h @@ -3321,6 +3321,28 @@ typedef Lib3MFResult (*PLib3MFToolpathLayerReader_GetSegmentPartPtr) (Lib3MF_Too */ typedef Lib3MFResult (*PLib3MFToolpathLayerReader_GetSegmentPartUUIDPtr) (Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nIndex, const Lib3MF_uint32 nPartUUIDBufferSize, Lib3MF_uint32* pPartUUIDNeededChars, char * pPartUUIDBuffer); +/** +* Retrieves the assigned segment part id. ATTENTION: This ID is only unique within the layer and there is no guarantee to be globally unique or consistent across layers. +* +* @param[in] pToolpathLayerReader - ToolpathLayerReader instance. +* @param[in] nIndex - Index. Must be between 0 and Count - 1. +* @param[out] pLocalPartID - Local Segment Part ID +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFToolpathLayerReader_GetSegmentLocalPartIDPtr) (Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nIndex, Lib3MF_uint32 * pLocalPartID); + +/** +* Retrieves the global part UUID by the local part ID. Fails if part ID does not exist in this layer. ATTENTION: This ID is only unique within the layer and there is no guarantee to be globally unique or consistent across layers. +* +* @param[in] pToolpathLayerReader - ToolpathLayerReader instance. +* @param[in] nLocalPartID - Local Segment Part ID +* @param[in] nPartUUIDBufferSize - size of the buffer (including trailing 0) +* @param[out] pPartUUIDNeededChars - will be filled with the count of the written bytes, or needed buffer size. +* @param[out] pPartUUIDBuffer - buffer of Segment Part UUID, may be NULL +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFToolpathLayerReader_GetPartUUIDByLocalPartIDPtr) (Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nLocalPartID, const Lib3MF_uint32 nPartUUIDBufferSize, Lib3MF_uint32* pPartUUIDNeededChars, char * pPartUUIDBuffer); + /** * Retrieves the assigned segment point list. For type hatch, the points are taken pairwise. * @@ -5472,6 +5494,8 @@ typedef struct { PLib3MFToolpathLayerReader_GetSegmentProfileUUIDPtr m_ToolpathLayerReader_GetSegmentProfileUUID; PLib3MFToolpathLayerReader_GetSegmentPartPtr m_ToolpathLayerReader_GetSegmentPart; PLib3MFToolpathLayerReader_GetSegmentPartUUIDPtr m_ToolpathLayerReader_GetSegmentPartUUID; + PLib3MFToolpathLayerReader_GetSegmentLocalPartIDPtr m_ToolpathLayerReader_GetSegmentLocalPartID; + PLib3MFToolpathLayerReader_GetPartUUIDByLocalPartIDPtr m_ToolpathLayerReader_GetPartUUIDByLocalPartID; PLib3MFToolpathLayerReader_GetSegmentPointDataPtr m_ToolpathLayerReader_GetSegmentPointData; PLib3MFToolpathLayerReader_FindAttributeInfoByNamePtr m_ToolpathLayerReader_FindAttributeInfoByName; PLib3MFToolpathLayerReader_FindAttributeIDByNamePtr m_ToolpathLayerReader_FindAttributeIDByName; diff --git a/Autogenerated/Bindings/NodeJS/lib3mf_dynamic.cc b/Autogenerated/Bindings/NodeJS/lib3mf_dynamic.cc index 78acea397..173420f3c 100644 --- a/Autogenerated/Bindings/NodeJS/lib3mf_dynamic.cc +++ b/Autogenerated/Bindings/NodeJS/lib3mf_dynamic.cc @@ -363,6 +363,8 @@ Lib3MFResult InitLib3MFWrapperTable(sLib3MFDynamicWrapperTable * pWrapperTable) pWrapperTable->m_ToolpathLayerReader_GetSegmentProfileUUID = NULL; pWrapperTable->m_ToolpathLayerReader_GetSegmentPart = NULL; pWrapperTable->m_ToolpathLayerReader_GetSegmentPartUUID = NULL; + pWrapperTable->m_ToolpathLayerReader_GetSegmentLocalPartID = NULL; + pWrapperTable->m_ToolpathLayerReader_GetPartUUIDByLocalPartID = NULL; pWrapperTable->m_ToolpathLayerReader_GetSegmentPointData = NULL; pWrapperTable->m_ToolpathLayerReader_FindAttributeInfoByName = NULL; pWrapperTable->m_ToolpathLayerReader_FindAttributeIDByName = NULL; @@ -3430,6 +3432,24 @@ Lib3MFResult LoadLib3MFWrapperTable(sLib3MFDynamicWrapperTable * pWrapperTable, if (pWrapperTable->m_ToolpathLayerReader_GetSegmentPartUUID == NULL) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + #ifdef _WIN32 + pWrapperTable->m_ToolpathLayerReader_GetSegmentLocalPartID = (PLib3MFToolpathLayerReader_GetSegmentLocalPartIDPtr) GetProcAddress(hLibrary, "lib3mf_toolpathlayerreader_getsegmentlocalpartid"); + #else // _WIN32 + pWrapperTable->m_ToolpathLayerReader_GetSegmentLocalPartID = (PLib3MFToolpathLayerReader_GetSegmentLocalPartIDPtr) dlsym(hLibrary, "lib3mf_toolpathlayerreader_getsegmentlocalpartid"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_ToolpathLayerReader_GetSegmentLocalPartID == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_ToolpathLayerReader_GetPartUUIDByLocalPartID = (PLib3MFToolpathLayerReader_GetPartUUIDByLocalPartIDPtr) GetProcAddress(hLibrary, "lib3mf_toolpathlayerreader_getpartuuidbylocalpartid"); + #else // _WIN32 + pWrapperTable->m_ToolpathLayerReader_GetPartUUIDByLocalPartID = (PLib3MFToolpathLayerReader_GetPartUUIDByLocalPartIDPtr) dlsym(hLibrary, "lib3mf_toolpathlayerreader_getpartuuidbylocalpartid"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_ToolpathLayerReader_GetPartUUIDByLocalPartID == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + #ifdef _WIN32 pWrapperTable->m_ToolpathLayerReader_GetSegmentPointData = (PLib3MFToolpathLayerReader_GetSegmentPointDataPtr) GetProcAddress(hLibrary, "lib3mf_toolpathlayerreader_getsegmentpointdata"); #else // _WIN32 diff --git a/Autogenerated/Bindings/NodeJS/lib3mf_dynamic.h b/Autogenerated/Bindings/NodeJS/lib3mf_dynamic.h index 3d2e2cb83..8beac171f 100644 --- a/Autogenerated/Bindings/NodeJS/lib3mf_dynamic.h +++ b/Autogenerated/Bindings/NodeJS/lib3mf_dynamic.h @@ -3321,6 +3321,28 @@ typedef Lib3MFResult (*PLib3MFToolpathLayerReader_GetSegmentPartPtr) (Lib3MF_Too */ typedef Lib3MFResult (*PLib3MFToolpathLayerReader_GetSegmentPartUUIDPtr) (Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nIndex, const Lib3MF_uint32 nPartUUIDBufferSize, Lib3MF_uint32* pPartUUIDNeededChars, char * pPartUUIDBuffer); +/** +* Retrieves the assigned segment part id. ATTENTION: This ID is only unique within the layer and there is no guarantee to be globally unique or consistent across layers. +* +* @param[in] pToolpathLayerReader - ToolpathLayerReader instance. +* @param[in] nIndex - Index. Must be between 0 and Count - 1. +* @param[out] pLocalPartID - Local Segment Part ID +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFToolpathLayerReader_GetSegmentLocalPartIDPtr) (Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nIndex, Lib3MF_uint32 * pLocalPartID); + +/** +* Retrieves the global part UUID by the local part ID. Fails if part ID does not exist in this layer. ATTENTION: This ID is only unique within the layer and there is no guarantee to be globally unique or consistent across layers. +* +* @param[in] pToolpathLayerReader - ToolpathLayerReader instance. +* @param[in] nLocalPartID - Local Segment Part ID +* @param[in] nPartUUIDBufferSize - size of the buffer (including trailing 0) +* @param[out] pPartUUIDNeededChars - will be filled with the count of the written bytes, or needed buffer size. +* @param[out] pPartUUIDBuffer - buffer of Segment Part UUID, may be NULL +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFToolpathLayerReader_GetPartUUIDByLocalPartIDPtr) (Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nLocalPartID, const Lib3MF_uint32 nPartUUIDBufferSize, Lib3MF_uint32* pPartUUIDNeededChars, char * pPartUUIDBuffer); + /** * Retrieves the assigned segment point list. For type hatch, the points are taken pairwise. * @@ -5472,6 +5494,8 @@ typedef struct { PLib3MFToolpathLayerReader_GetSegmentProfileUUIDPtr m_ToolpathLayerReader_GetSegmentProfileUUID; PLib3MFToolpathLayerReader_GetSegmentPartPtr m_ToolpathLayerReader_GetSegmentPart; PLib3MFToolpathLayerReader_GetSegmentPartUUIDPtr m_ToolpathLayerReader_GetSegmentPartUUID; + PLib3MFToolpathLayerReader_GetSegmentLocalPartIDPtr m_ToolpathLayerReader_GetSegmentLocalPartID; + PLib3MFToolpathLayerReader_GetPartUUIDByLocalPartIDPtr m_ToolpathLayerReader_GetPartUUIDByLocalPartID; PLib3MFToolpathLayerReader_GetSegmentPointDataPtr m_ToolpathLayerReader_GetSegmentPointData; PLib3MFToolpathLayerReader_FindAttributeInfoByNamePtr m_ToolpathLayerReader_FindAttributeInfoByName; PLib3MFToolpathLayerReader_FindAttributeIDByNamePtr m_ToolpathLayerReader_FindAttributeIDByName; diff --git a/Autogenerated/Bindings/NodeJS/lib3mf_nodewrapper.cc b/Autogenerated/Bindings/NodeJS/lib3mf_nodewrapper.cc index 7dccf3652..885b776aa 100644 --- a/Autogenerated/Bindings/NodeJS/lib3mf_nodewrapper.cc +++ b/Autogenerated/Bindings/NodeJS/lib3mf_nodewrapper.cc @@ -11567,6 +11567,8 @@ void CLib3MFToolpathLayerReader::Init() NODE_SET_PROTOTYPE_METHOD(tpl, "GetSegmentProfileUUID", GetSegmentProfileUUID); NODE_SET_PROTOTYPE_METHOD(tpl, "GetSegmentPart", GetSegmentPart); NODE_SET_PROTOTYPE_METHOD(tpl, "GetSegmentPartUUID", GetSegmentPartUUID); + NODE_SET_PROTOTYPE_METHOD(tpl, "GetSegmentLocalPartID", GetSegmentLocalPartID); + NODE_SET_PROTOTYPE_METHOD(tpl, "GetPartUUIDByLocalPartID", GetPartUUIDByLocalPartID); NODE_SET_PROTOTYPE_METHOD(tpl, "GetSegmentPointData", GetSegmentPointData); NODE_SET_PROTOTYPE_METHOD(tpl, "FindAttributeInfoByName", FindAttributeInfoByName); NODE_SET_PROTOTYPE_METHOD(tpl, "FindAttributeIDByName", FindAttributeIDByName); @@ -11806,6 +11808,63 @@ void CLib3MFToolpathLayerReader::GetSegmentPartUUID(const FunctionCallbackInfo& args) +{ + Isolate* isolate = args.GetIsolate(); + HandleScope scope(isolate); + try { + if (!args[0]->IsUint32()) { + throw std::runtime_error("Expected uint32 parameter 0 (Index)"); + } + unsigned int nIndex = (unsigned int) args[0]->IntegerValue(isolate->GetCurrentContext()).ToChecked(); + unsigned int nReturnLocalPartID = 0; + sLib3MFDynamicWrapperTable * wrapperTable = CLib3MFBaseClass::getDynamicWrapperTable(args.Holder()); + if (wrapperTable == nullptr) + throw std::runtime_error("Could not get wrapper table for Lib3MF method GetSegmentLocalPartID."); + if (wrapperTable->m_ToolpathLayerReader_GetSegmentLocalPartID == nullptr) + throw std::runtime_error("Could not call Lib3MF method ToolpathLayerReader::GetSegmentLocalPartID."); + Lib3MFHandle instanceHandle = CLib3MFBaseClass::getHandle(args.Holder()); + Lib3MFResult errorCode = wrapperTable->m_ToolpathLayerReader_GetSegmentLocalPartID(instanceHandle, nIndex, &nReturnLocalPartID); + CheckError(isolate, wrapperTable, instanceHandle, errorCode); + args.GetReturnValue().Set(Integer::NewFromUnsigned(isolate, nReturnLocalPartID)); + + } catch (std::exception & E) { + RaiseError(isolate, E.what()); + } +} + + +void CLib3MFToolpathLayerReader::GetPartUUIDByLocalPartID(const FunctionCallbackInfo& args) +{ + Isolate* isolate = args.GetIsolate(); + HandleScope scope(isolate); + try { + if (!args[0]->IsUint32()) { + throw std::runtime_error("Expected uint32 parameter 0 (LocalPartID)"); + } + unsigned int nLocalPartID = (unsigned int) args[0]->IntegerValue(isolate->GetCurrentContext()).ToChecked(); + unsigned int bytesNeededPartUUID = 0; + unsigned int bytesWrittenPartUUID = 0; + sLib3MFDynamicWrapperTable * wrapperTable = CLib3MFBaseClass::getDynamicWrapperTable(args.Holder()); + if (wrapperTable == nullptr) + throw std::runtime_error("Could not get wrapper table for Lib3MF method GetPartUUIDByLocalPartID."); + if (wrapperTable->m_ToolpathLayerReader_GetPartUUIDByLocalPartID == nullptr) + throw std::runtime_error("Could not call Lib3MF method ToolpathLayerReader::GetPartUUIDByLocalPartID."); + Lib3MFHandle instanceHandle = CLib3MFBaseClass::getHandle(args.Holder()); + Lib3MFResult initErrorCode = wrapperTable->m_ToolpathLayerReader_GetPartUUIDByLocalPartID(instanceHandle, nLocalPartID, 0, &bytesNeededPartUUID, nullptr); + CheckError(isolate, wrapperTable, instanceHandle, initErrorCode); + std::vector bufferPartUUID; + bufferPartUUID.resize(bytesNeededPartUUID); + Lib3MFResult errorCode = wrapperTable->m_ToolpathLayerReader_GetPartUUIDByLocalPartID(instanceHandle, nLocalPartID, bytesNeededPartUUID, &bytesWrittenPartUUID, &bufferPartUUID[0]); + CheckError(isolate, wrapperTable, instanceHandle, errorCode); + args.GetReturnValue().Set(String::NewFromUtf8(isolate, &bufferPartUUID[0])); + + } catch (std::exception & E) { + RaiseError(isolate, E.what()); + } +} + + void CLib3MFToolpathLayerReader::GetSegmentPointData(const FunctionCallbackInfo& args) { Isolate* isolate = args.GetIsolate(); diff --git a/Autogenerated/Bindings/NodeJS/lib3mf_nodewrapper.h b/Autogenerated/Bindings/NodeJS/lib3mf_nodewrapper.h index c0aa3ab7c..581a2ca22 100644 --- a/Autogenerated/Bindings/NodeJS/lib3mf_nodewrapper.h +++ b/Autogenerated/Bindings/NodeJS/lib3mf_nodewrapper.h @@ -1088,6 +1088,8 @@ class CLib3MFToolpathLayerReader : public CLib3MFBaseClass { static void GetSegmentProfileUUID(const v8::FunctionCallbackInfo& args); static void GetSegmentPart(const v8::FunctionCallbackInfo& args); static void GetSegmentPartUUID(const v8::FunctionCallbackInfo& args); + static void GetSegmentLocalPartID(const v8::FunctionCallbackInfo& args); + static void GetPartUUIDByLocalPartID(const v8::FunctionCallbackInfo& args); static void GetSegmentPointData(const v8::FunctionCallbackInfo& args); static void FindAttributeInfoByName(const v8::FunctionCallbackInfo& args); static void FindAttributeIDByName(const v8::FunctionCallbackInfo& args); diff --git a/Autogenerated/Bindings/Pascal/Unit_Lib3MF.pas b/Autogenerated/Bindings/Pascal/Unit_Lib3MF.pas index 7540d01ad..95e3e6756 100644 --- a/Autogenerated/Bindings/Pascal/Unit_Lib3MF.pas +++ b/Autogenerated/Bindings/Pascal/Unit_Lib3MF.pas @@ -3784,6 +3784,28 @@ TLib3MFModel = class; *) TLib3MFToolpathLayerReader_GetSegmentPartUUIDFunc = function(pToolpathLayerReader: TLib3MFHandle; const nIndex: Cardinal; const nPartUUIDBufferSize: Cardinal; out pPartUUIDNeededChars: Cardinal; pPartUUIDBuffer: PAnsiChar): TLib3MFResult; cdecl; + (** + * Retrieves the assigned segment part id. ATTENTION: This ID is only unique within the layer and there is no guarantee to be globally unique or consistent across layers. + * + * @param[in] pToolpathLayerReader - ToolpathLayerReader instance. + * @param[in] nIndex - Index. Must be between 0 and Count - 1. + * @param[out] pLocalPartID - Local Segment Part ID + * @return error code or 0 (success) + *) + TLib3MFToolpathLayerReader_GetSegmentLocalPartIDFunc = function(pToolpathLayerReader: TLib3MFHandle; const nIndex: Cardinal; out pLocalPartID: Cardinal): TLib3MFResult; cdecl; + + (** + * Retrieves the global part UUID by the local part ID. Fails if part ID does not exist in this layer. ATTENTION: This ID is only unique within the layer and there is no guarantee to be globally unique or consistent across layers. + * + * @param[in] pToolpathLayerReader - ToolpathLayerReader instance. + * @param[in] nLocalPartID - Local Segment Part ID + * @param[in] nPartUUIDBufferSize - size of the buffer (including trailing 0) + * @param[out] pPartUUIDNeededChars - will be filled with the count of the written bytes, or needed buffer size. + * @param[out] pPartUUIDBuffer - buffer of Segment Part UUID, may be NULL + * @return error code or 0 (success) + *) + TLib3MFToolpathLayerReader_GetPartUUIDByLocalPartIDFunc = function(pToolpathLayerReader: TLib3MFHandle; const nLocalPartID: Cardinal; const nPartUUIDBufferSize: Cardinal; out pPartUUIDNeededChars: Cardinal; pPartUUIDBuffer: PAnsiChar): TLib3MFResult; cdecl; + (** * Retrieves the assigned segment point list. For type hatch, the points are taken pairwise. * @@ -6425,6 +6447,8 @@ TLib3MFToolpathLayerReader = class(TLib3MFBase) function GetSegmentProfileUUID(const AIndex: Cardinal): String; function GetSegmentPart(const AIndex: Cardinal): TLib3MFBuildItem; function GetSegmentPartUUID(const AIndex: Cardinal): String; + function GetSegmentLocalPartID(const AIndex: Cardinal): Cardinal; + function GetPartUUIDByLocalPartID(const ALocalPartID: Cardinal): String; procedure GetSegmentPointData(const AIndex: Cardinal; out APointData: ArrayOfLib3MFPosition2D); procedure FindAttributeInfoByName(const ANameSpace: String; const AAttributeName: String; out AID: Cardinal; out AAttributeType: TLib3MFToolpathAttributeType); function FindAttributeIDByName(const ANameSpace: String; const AAttributeName: String): Cardinal; @@ -7029,6 +7053,8 @@ TLib3MFWrapper = class(TObject) FLib3MFToolpathLayerReader_GetSegmentProfileUUIDFunc: TLib3MFToolpathLayerReader_GetSegmentProfileUUIDFunc; FLib3MFToolpathLayerReader_GetSegmentPartFunc: TLib3MFToolpathLayerReader_GetSegmentPartFunc; FLib3MFToolpathLayerReader_GetSegmentPartUUIDFunc: TLib3MFToolpathLayerReader_GetSegmentPartUUIDFunc; + FLib3MFToolpathLayerReader_GetSegmentLocalPartIDFunc: TLib3MFToolpathLayerReader_GetSegmentLocalPartIDFunc; + FLib3MFToolpathLayerReader_GetPartUUIDByLocalPartIDFunc: TLib3MFToolpathLayerReader_GetPartUUIDByLocalPartIDFunc; FLib3MFToolpathLayerReader_GetSegmentPointDataFunc: TLib3MFToolpathLayerReader_GetSegmentPointDataFunc; FLib3MFToolpathLayerReader_FindAttributeInfoByNameFunc: TLib3MFToolpathLayerReader_FindAttributeInfoByNameFunc; FLib3MFToolpathLayerReader_FindAttributeIDByNameFunc: TLib3MFToolpathLayerReader_FindAttributeIDByNameFunc; @@ -7532,6 +7558,8 @@ TLib3MFWrapper = class(TObject) property Lib3MFToolpathLayerReader_GetSegmentProfileUUIDFunc: TLib3MFToolpathLayerReader_GetSegmentProfileUUIDFunc read FLib3MFToolpathLayerReader_GetSegmentProfileUUIDFunc; property Lib3MFToolpathLayerReader_GetSegmentPartFunc: TLib3MFToolpathLayerReader_GetSegmentPartFunc read FLib3MFToolpathLayerReader_GetSegmentPartFunc; property Lib3MFToolpathLayerReader_GetSegmentPartUUIDFunc: TLib3MFToolpathLayerReader_GetSegmentPartUUIDFunc read FLib3MFToolpathLayerReader_GetSegmentPartUUIDFunc; + property Lib3MFToolpathLayerReader_GetSegmentLocalPartIDFunc: TLib3MFToolpathLayerReader_GetSegmentLocalPartIDFunc read FLib3MFToolpathLayerReader_GetSegmentLocalPartIDFunc; + property Lib3MFToolpathLayerReader_GetPartUUIDByLocalPartIDFunc: TLib3MFToolpathLayerReader_GetPartUUIDByLocalPartIDFunc read FLib3MFToolpathLayerReader_GetPartUUIDByLocalPartIDFunc; property Lib3MFToolpathLayerReader_GetSegmentPointDataFunc: TLib3MFToolpathLayerReader_GetSegmentPointDataFunc read FLib3MFToolpathLayerReader_GetSegmentPointDataFunc; property Lib3MFToolpathLayerReader_FindAttributeInfoByNameFunc: TLib3MFToolpathLayerReader_FindAttributeInfoByNameFunc read FLib3MFToolpathLayerReader_FindAttributeInfoByNameFunc; property Lib3MFToolpathLayerReader_FindAttributeIDByNameFunc: TLib3MFToolpathLayerReader_FindAttributeIDByNameFunc read FLib3MFToolpathLayerReader_FindAttributeIDByNameFunc; @@ -12074,6 +12102,25 @@ implementation Result := StrPas(@bufferPartUUID[0]); end; + function TLib3MFToolpathLayerReader.GetSegmentLocalPartID(const AIndex: Cardinal): Cardinal; + begin + FWrapper.CheckError(Self, FWrapper.Lib3MFToolpathLayerReader_GetSegmentLocalPartIDFunc(FHandle, AIndex, Result)); + end; + + function TLib3MFToolpathLayerReader.GetPartUUIDByLocalPartID(const ALocalPartID: Cardinal): String; + var + bytesNeededPartUUID: Cardinal; + bytesWrittenPartUUID: Cardinal; + bufferPartUUID: array of Char; + begin + bytesNeededPartUUID:= 0; + bytesWrittenPartUUID:= 0; + FWrapper.CheckError(Self, FWrapper.Lib3MFToolpathLayerReader_GetPartUUIDByLocalPartIDFunc(FHandle, ALocalPartID, 0, bytesNeededPartUUID, nil)); + SetLength(bufferPartUUID, bytesNeededPartUUID); + FWrapper.CheckError(Self, FWrapper.Lib3MFToolpathLayerReader_GetPartUUIDByLocalPartIDFunc(FHandle, ALocalPartID, bytesNeededPartUUID, bytesWrittenPartUUID, @bufferPartUUID[0])); + Result := StrPas(@bufferPartUUID[0]); + end; + procedure TLib3MFToolpathLayerReader.GetSegmentPointData(const AIndex: Cardinal; out APointData: ArrayOfLib3MFPosition2D); var countNeededPointData: QWord; @@ -14237,6 +14284,8 @@ implementation FLib3MFToolpathLayerReader_GetSegmentProfileUUIDFunc := LoadFunction('lib3mf_toolpathlayerreader_getsegmentprofileuuid'); FLib3MFToolpathLayerReader_GetSegmentPartFunc := LoadFunction('lib3mf_toolpathlayerreader_getsegmentpart'); FLib3MFToolpathLayerReader_GetSegmentPartUUIDFunc := LoadFunction('lib3mf_toolpathlayerreader_getsegmentpartuuid'); + FLib3MFToolpathLayerReader_GetSegmentLocalPartIDFunc := LoadFunction('lib3mf_toolpathlayerreader_getsegmentlocalpartid'); + FLib3MFToolpathLayerReader_GetPartUUIDByLocalPartIDFunc := LoadFunction('lib3mf_toolpathlayerreader_getpartuuidbylocalpartid'); FLib3MFToolpathLayerReader_GetSegmentPointDataFunc := LoadFunction('lib3mf_toolpathlayerreader_getsegmentpointdata'); FLib3MFToolpathLayerReader_FindAttributeInfoByNameFunc := LoadFunction('lib3mf_toolpathlayerreader_findattributeinfobyname'); FLib3MFToolpathLayerReader_FindAttributeIDByNameFunc := LoadFunction('lib3mf_toolpathlayerreader_findattributeidbyname'); @@ -15369,6 +15418,12 @@ implementation if AResult <> LIB3MF_SUCCESS then raise ELib3MFException.CreateCustomMessage(LIB3MF_ERROR_COULDNOTLOADLIBRARY, ''); AResult := ALookupMethod(PAnsiChar('lib3mf_toolpathlayerreader_getsegmentpartuuid'), @FLib3MFToolpathLayerReader_GetSegmentPartUUIDFunc); + if AResult <> LIB3MF_SUCCESS then + raise ELib3MFException.CreateCustomMessage(LIB3MF_ERROR_COULDNOTLOADLIBRARY, ''); + AResult := ALookupMethod(PAnsiChar('lib3mf_toolpathlayerreader_getsegmentlocalpartid'), @FLib3MFToolpathLayerReader_GetSegmentLocalPartIDFunc); + if AResult <> LIB3MF_SUCCESS then + raise ELib3MFException.CreateCustomMessage(LIB3MF_ERROR_COULDNOTLOADLIBRARY, ''); + AResult := ALookupMethod(PAnsiChar('lib3mf_toolpathlayerreader_getpartuuidbylocalpartid'), @FLib3MFToolpathLayerReader_GetPartUUIDByLocalPartIDFunc); if AResult <> LIB3MF_SUCCESS then raise ELib3MFException.CreateCustomMessage(LIB3MF_ERROR_COULDNOTLOADLIBRARY, ''); AResult := ALookupMethod(PAnsiChar('lib3mf_toolpathlayerreader_getsegmentpointdata'), @FLib3MFToolpathLayerReader_GetSegmentPointDataFunc); diff --git a/Autogenerated/Bindings/Python/Lib3MF.py b/Autogenerated/Bindings/Python/Lib3MF.py index 7cc1e1c1b..55e036ef2 100644 --- a/Autogenerated/Bindings/Python/Lib3MF.py +++ b/Autogenerated/Bindings/Python/Lib3MF.py @@ -459,6 +459,8 @@ class FunctionTable: lib3mf_toolpathlayerreader_getsegmentprofileuuid = None lib3mf_toolpathlayerreader_getsegmentpart = None lib3mf_toolpathlayerreader_getsegmentpartuuid = None + lib3mf_toolpathlayerreader_getsegmentlocalpartid = None + lib3mf_toolpathlayerreader_getpartuuidbylocalpartid = None lib3mf_toolpathlayerreader_getsegmentpointdata = None lib3mf_toolpathlayerreader_findattributeinfobyname = None lib3mf_toolpathlayerreader_findattributeidbyname = None @@ -2955,6 +2957,18 @@ def _loadFunctionTableFromMethod(self, symbolLookupMethodAddress): methodType = ctypes.CFUNCTYPE(ctypes.c_int32, ctypes.c_void_p, ctypes.c_uint32, ctypes.c_uint64, ctypes.POINTER(ctypes.c_uint64), ctypes.c_char_p) self.lib.lib3mf_toolpathlayerreader_getsegmentpartuuid = methodType(int(methodAddress.value)) + err = symbolLookupMethod(ctypes.c_char_p(str.encode("lib3mf_toolpathlayerreader_getsegmentlocalpartid")), methodAddress) + if err != 0: + raise ELib3MFException(ErrorCodes.COULDNOTLOADLIBRARY, str(err)) + methodType = ctypes.CFUNCTYPE(ctypes.c_int32, ctypes.c_void_p, ctypes.c_uint32, ctypes.POINTER(ctypes.c_uint32)) + self.lib.lib3mf_toolpathlayerreader_getsegmentlocalpartid = methodType(int(methodAddress.value)) + + err = symbolLookupMethod(ctypes.c_char_p(str.encode("lib3mf_toolpathlayerreader_getpartuuidbylocalpartid")), methodAddress) + if err != 0: + raise ELib3MFException(ErrorCodes.COULDNOTLOADLIBRARY, str(err)) + methodType = ctypes.CFUNCTYPE(ctypes.c_int32, ctypes.c_void_p, ctypes.c_uint32, ctypes.c_uint64, ctypes.POINTER(ctypes.c_uint64), ctypes.c_char_p) + self.lib.lib3mf_toolpathlayerreader_getpartuuidbylocalpartid = methodType(int(methodAddress.value)) + err = symbolLookupMethod(ctypes.c_char_p(str.encode("lib3mf_toolpathlayerreader_getsegmentpointdata")), methodAddress) if err != 0: raise ELib3MFException(ErrorCodes.COULDNOTLOADLIBRARY, str(err)) @@ -4916,6 +4930,12 @@ def _loadFunctionTable(self): self.lib.lib3mf_toolpathlayerreader_getsegmentpartuuid.restype = ctypes.c_int32 self.lib.lib3mf_toolpathlayerreader_getsegmentpartuuid.argtypes = [ctypes.c_void_p, ctypes.c_uint32, ctypes.c_uint64, ctypes.POINTER(ctypes.c_uint64), ctypes.c_char_p] + self.lib.lib3mf_toolpathlayerreader_getsegmentlocalpartid.restype = ctypes.c_int32 + self.lib.lib3mf_toolpathlayerreader_getsegmentlocalpartid.argtypes = [ctypes.c_void_p, ctypes.c_uint32, ctypes.POINTER(ctypes.c_uint32)] + + self.lib.lib3mf_toolpathlayerreader_getpartuuidbylocalpartid.restype = ctypes.c_int32 + self.lib.lib3mf_toolpathlayerreader_getpartuuidbylocalpartid.argtypes = [ctypes.c_void_p, ctypes.c_uint32, ctypes.c_uint64, ctypes.POINTER(ctypes.c_uint64), ctypes.c_char_p] + self.lib.lib3mf_toolpathlayerreader_getsegmentpointdata.restype = ctypes.c_int32 self.lib.lib3mf_toolpathlayerreader_getsegmentpointdata.argtypes = [ctypes.c_void_p, ctypes.c_uint32, ctypes.c_uint64, ctypes.POINTER(ctypes.c_uint64), ctypes.POINTER(Position2D)] @@ -8427,6 +8447,25 @@ def GetSegmentPartUUID(self, Index): return pPartUUIDBuffer.value.decode() + def GetSegmentLocalPartID(self, Index): + nIndex = ctypes.c_uint32(Index) + pLocalPartID = ctypes.c_uint32() + self._wrapper.checkError(self, self._wrapper.lib.lib3mf_toolpathlayerreader_getsegmentlocalpartid(self._handle, nIndex, pLocalPartID)) + + return pLocalPartID.value + + def GetPartUUIDByLocalPartID(self, LocalPartID): + nLocalPartID = ctypes.c_uint32(LocalPartID) + nPartUUIDBufferSize = ctypes.c_uint64(0) + nPartUUIDNeededChars = ctypes.c_uint64(0) + pPartUUIDBuffer = ctypes.c_char_p(None) + self._wrapper.checkError(self, self._wrapper.lib.lib3mf_toolpathlayerreader_getpartuuidbylocalpartid(self._handle, nLocalPartID, nPartUUIDBufferSize, nPartUUIDNeededChars, pPartUUIDBuffer)) + nPartUUIDBufferSize = ctypes.c_uint64(nPartUUIDNeededChars.value) + pPartUUIDBuffer = (ctypes.c_char * (nPartUUIDNeededChars.value))() + self._wrapper.checkError(self, self._wrapper.lib.lib3mf_toolpathlayerreader_getpartuuidbylocalpartid(self._handle, nLocalPartID, nPartUUIDBufferSize, nPartUUIDNeededChars, pPartUUIDBuffer)) + + return pPartUUIDBuffer.value.decode() + def GetSegmentPointData(self, Index): nIndex = ctypes.c_uint32(Index) nPointDataCount = ctypes.c_uint64(0) diff --git a/Autogenerated/Source/lib3mf_abi.hpp b/Autogenerated/Source/lib3mf_abi.hpp index 0813789a5..cd0489ab7 100644 --- a/Autogenerated/Source/lib3mf_abi.hpp +++ b/Autogenerated/Source/lib3mf_abi.hpp @@ -3334,6 +3334,28 @@ LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerreader_getsegmentpart(Lib3MF_To */ LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerreader_getsegmentpartuuid(Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nIndex, const Lib3MF_uint32 nPartUUIDBufferSize, Lib3MF_uint32* pPartUUIDNeededChars, char * pPartUUIDBuffer); +/** +* Retrieves the assigned segment part id. ATTENTION: This ID is only unique within the layer and there is no guarantee to be globally unique or consistent across layers. +* +* @param[in] pToolpathLayerReader - ToolpathLayerReader instance. +* @param[in] nIndex - Index. Must be between 0 and Count - 1. +* @param[out] pLocalPartID - Local Segment Part ID +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerreader_getsegmentlocalpartid(Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nIndex, Lib3MF_uint32 * pLocalPartID); + +/** +* Retrieves the global part UUID by the local part ID. Fails if part ID does not exist in this layer. ATTENTION: This ID is only unique within the layer and there is no guarantee to be globally unique or consistent across layers. +* +* @param[in] pToolpathLayerReader - ToolpathLayerReader instance. +* @param[in] nLocalPartID - Local Segment Part ID +* @param[in] nPartUUIDBufferSize - size of the buffer (including trailing 0) +* @param[out] pPartUUIDNeededChars - will be filled with the count of the written bytes, or needed buffer size. +* @param[out] pPartUUIDBuffer - buffer of Segment Part UUID, may be NULL +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerreader_getpartuuidbylocalpartid(Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nLocalPartID, const Lib3MF_uint32 nPartUUIDBufferSize, Lib3MF_uint32* pPartUUIDNeededChars, char * pPartUUIDBuffer); + /** * Retrieves the assigned segment point list. For type hatch, the points are taken pairwise. * diff --git a/Autogenerated/Source/lib3mf_interfaces.hpp b/Autogenerated/Source/lib3mf_interfaces.hpp index ca34e676e..6e6f9c2a8 100644 --- a/Autogenerated/Source/lib3mf_interfaces.hpp +++ b/Autogenerated/Source/lib3mf_interfaces.hpp @@ -3213,6 +3213,20 @@ class IToolpathLayerReader : public virtual IBase { */ virtual std::string GetSegmentPartUUID(const Lib3MF_uint32 nIndex) = 0; + /** + * IToolpathLayerReader::GetSegmentLocalPartID - Retrieves the assigned segment part id. ATTENTION: This ID is only unique within the layer and there is no guarantee to be globally unique or consistent across layers. + * @param[in] nIndex - Index. Must be between 0 and Count - 1. + * @return Local Segment Part ID + */ + virtual Lib3MF_uint32 GetSegmentLocalPartID(const Lib3MF_uint32 nIndex) = 0; + + /** + * IToolpathLayerReader::GetPartUUIDByLocalPartID - Retrieves the global part UUID by the local part ID. Fails if part ID does not exist in this layer. ATTENTION: This ID is only unique within the layer and there is no guarantee to be globally unique or consistent across layers. + * @param[in] nLocalPartID - Local Segment Part ID + * @return Segment Part UUID + */ + virtual std::string GetPartUUIDByLocalPartID(const Lib3MF_uint32 nLocalPartID) = 0; + /** * IToolpathLayerReader::GetSegmentPointData - Retrieves the assigned segment point list. For type hatch, the points are taken pairwise. * @param[in] nIndex - Index. Must be between 0 and Count - 1. diff --git a/Autogenerated/Source/lib3mf_interfacewrapper.cpp b/Autogenerated/Source/lib3mf_interfacewrapper.cpp index 7c6f3a6fc..5eb02fd8f 100644 --- a/Autogenerated/Source/lib3mf_interfacewrapper.cpp +++ b/Autogenerated/Source/lib3mf_interfacewrapper.cpp @@ -12096,6 +12096,98 @@ Lib3MFResult lib3mf_toolpathlayerreader_getsegmentpartuuid(Lib3MF_ToolpathLayerR } } +Lib3MFResult lib3mf_toolpathlayerreader_getsegmentlocalpartid(Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nIndex, Lib3MF_uint32 * pLocalPartID) +{ + IBase* pIBaseClass = (IBase *)pToolpathLayerReader; + + PLib3MFInterfaceJournalEntry pJournalEntry; + try { + if (m_GlobalJournal.get() != nullptr) { + pJournalEntry = m_GlobalJournal->beginClassMethod(pToolpathLayerReader, "ToolpathLayerReader", "GetSegmentLocalPartID"); + pJournalEntry->addUInt32Parameter("Index", nIndex); + } + if (pLocalPartID == nullptr) + throw ELib3MFInterfaceException (LIB3MF_ERROR_INVALIDPARAM); + IToolpathLayerReader* pIToolpathLayerReader = dynamic_cast(pIBaseClass); + if (!pIToolpathLayerReader) + throw ELib3MFInterfaceException(LIB3MF_ERROR_INVALIDCAST); + + *pLocalPartID = pIToolpathLayerReader->GetSegmentLocalPartID(nIndex); + + if (pJournalEntry.get() != nullptr) { + pJournalEntry->addUInt32Result("LocalPartID", *pLocalPartID); + 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_toolpathlayerreader_getpartuuidbylocalpartid(Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nLocalPartID, const Lib3MF_uint32 nPartUUIDBufferSize, Lib3MF_uint32* pPartUUIDNeededChars, char * pPartUUIDBuffer) +{ + IBase* pIBaseClass = (IBase *)pToolpathLayerReader; + + PLib3MFInterfaceJournalEntry pJournalEntry; + try { + if (m_GlobalJournal.get() != nullptr) { + pJournalEntry = m_GlobalJournal->beginClassMethod(pToolpathLayerReader, "ToolpathLayerReader", "GetPartUUIDByLocalPartID"); + pJournalEntry->addUInt32Parameter("LocalPartID", nLocalPartID); + } + if ( (!pPartUUIDBuffer) && !(pPartUUIDNeededChars) ) + throw ELib3MFInterfaceException (LIB3MF_ERROR_INVALIDPARAM); + std::string sPartUUID(""); + IToolpathLayerReader* pIToolpathLayerReader = dynamic_cast(pIBaseClass); + if (!pIToolpathLayerReader) + throw ELib3MFInterfaceException(LIB3MF_ERROR_INVALIDCAST); + + bool isCacheCall = (pPartUUIDBuffer == nullptr); + if (isCacheCall) { + sPartUUID = pIToolpathLayerReader->GetPartUUIDByLocalPartID(nLocalPartID); + + pIToolpathLayerReader->_setCache (new ParameterCache_1 (sPartUUID)); + } + else { + auto cache = dynamic_cast*> (pIToolpathLayerReader->_getCache ()); + if (cache == nullptr) + throw ELib3MFInterfaceException(LIB3MF_ERROR_INVALIDCAST); + cache->retrieveData (sPartUUID); + pIToolpathLayerReader->_setCache (nullptr); + } + + if (pPartUUIDNeededChars) + *pPartUUIDNeededChars = (Lib3MF_uint32) (sPartUUID.size()+1); + if (pPartUUIDBuffer) { + if (sPartUUID.size() >= nPartUUIDBufferSize) + throw ELib3MFInterfaceException (LIB3MF_ERROR_BUFFERTOOSMALL); + for (size_t iPartUUID = 0; iPartUUID < sPartUUID.size(); iPartUUID++) + pPartUUIDBuffer[iPartUUID] = sPartUUID[iPartUUID]; + pPartUUIDBuffer[sPartUUID.size()] = 0; + } + if (pJournalEntry.get() != nullptr) { + pJournalEntry->addStringResult("PartUUID", sPartUUID.c_str()); + 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_toolpathlayerreader_getsegmentpointdata(Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nIndex, const Lib3MF_uint64 nPointDataBufferSize, Lib3MF_uint64* pPointDataNeededCount, sLib3MFPosition2D * pPointDataBuffer) { IBase* pIBaseClass = (IBase *)pToolpathLayerReader; @@ -18956,6 +19048,10 @@ Lib3MFResult Lib3MF::Impl::Lib3MF_GetProcAddress (const char * pProcName, void * *ppProcAddress = (void*) &lib3mf_toolpathlayerreader_getsegmentpart; if (sProcName == "lib3mf_toolpathlayerreader_getsegmentpartuuid") *ppProcAddress = (void*) &lib3mf_toolpathlayerreader_getsegmentpartuuid; + if (sProcName == "lib3mf_toolpathlayerreader_getsegmentlocalpartid") + *ppProcAddress = (void*) &lib3mf_toolpathlayerreader_getsegmentlocalpartid; + if (sProcName == "lib3mf_toolpathlayerreader_getpartuuidbylocalpartid") + *ppProcAddress = (void*) &lib3mf_toolpathlayerreader_getpartuuidbylocalpartid; if (sProcName == "lib3mf_toolpathlayerreader_getsegmentpointdata") *ppProcAddress = (void*) &lib3mf_toolpathlayerreader_getsegmentpointdata; if (sProcName == "lib3mf_toolpathlayerreader_findattributeinfobyname") diff --git a/AutomaticComponentToolkit/lib3mf.xml b/AutomaticComponentToolkit/lib3mf.xml index a35ae828c..6e7983222 100644 --- a/AutomaticComponentToolkit/lib3mf.xml +++ b/AutomaticComponentToolkit/lib3mf.xml @@ -1664,7 +1664,17 @@ - + + + + + + + + + + + diff --git a/Source/API/lib3mf_toolpathlayerreader.cpp b/Source/API/lib3mf_toolpathlayerreader.cpp index b4460e3af..d2c98cff8 100644 --- a/Source/API/lib3mf_toolpathlayerreader.cpp +++ b/Source/API/lib3mf_toolpathlayerreader.cpp @@ -109,6 +109,23 @@ std::string CToolpathLayerReader::GetSegmentPartUUID(const Lib3MF_uint32 nIndex) return m_pReadData->mapIDtoUUID(nPartID); } +Lib3MF_uint32 CToolpathLayerReader::GetSegmentLocalPartID(const Lib3MF_uint32 nIndex) +{ + NMR::eModelToolpathSegmentType eNMRType; + uint32_t nProfileID; + uint32_t nPartID; + uint32_t nPointCount; + m_pReadData->getSegmentInfo(nIndex, eNMRType, nProfileID, nPartID, nPointCount); + + return nPartID; +} + +std::string CToolpathLayerReader::GetPartUUIDByLocalPartID(const Lib3MF_uint32 nLocalPartID) +{ + return m_pReadData->mapIDtoUUID(nLocalPartID); +} + + void CToolpathLayerReader::GetSegmentPointData(const Lib3MF_uint32 nIndex, Lib3MF_uint64 nPointDataBufferSize, Lib3MF_uint64* pPointDataNeededCount, Lib3MF::sPosition2D* pPointDataBuffer) { NMR::eModelToolpathSegmentType eNMRType; diff --git a/Source/API/lib3mf_toolpathlayerreader.hpp b/Source/API/lib3mf_toolpathlayerreader.hpp index 36caf1592..b127f135d 100644 --- a/Source/API/lib3mf_toolpathlayerreader.hpp +++ b/Source/API/lib3mf_toolpathlayerreader.hpp @@ -80,6 +80,10 @@ class CToolpathLayerReader : public virtual IToolpathLayerReader, public virtual std::string GetSegmentPartUUID(const Lib3MF_uint32 nIndex) override; + Lib3MF_uint32 GetSegmentLocalPartID(const Lib3MF_uint32 nIndex) override; + + std::string GetPartUUIDByLocalPartID(const Lib3MF_uint32 nLocalPartID) override; + void GetSegmentPointData(const Lib3MF_uint32 nIndex, Lib3MF_uint64 nPointDataBufferSize, Lib3MF_uint64* pPointDataNeededCount, Lib3MF::sPosition2D * pPointDataBuffer) override; Lib3MF_uint32 GetCustomDataCount() override;