Skip to content

Commit

Permalink
Added PartID to Toolpath Reader
Browse files Browse the repository at this point in the history
  • Loading branch information
netfabb committed Jul 20, 2024
1 parent 1c3e445 commit c852ea7
Show file tree
Hide file tree
Showing 23 changed files with 682 additions and 1 deletion.
22 changes: 22 additions & 0 deletions Autogenerated/Bindings/C/lib3mf.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down
20 changes: 20 additions & 0 deletions Autogenerated/Bindings/CDynamic/lib3mf_dynamic.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down
24 changes: 24 additions & 0 deletions Autogenerated/Bindings/CDynamic/lib3mf_dynamic.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down Expand Up @@ -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;
Expand Down
28 changes: 28 additions & 0 deletions Autogenerated/Bindings/CSharp/Lib3MF.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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;
Expand Down
22 changes: 22 additions & 0 deletions Autogenerated/Bindings/Cpp/lib3mf_abi.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down
31 changes: 31 additions & 0 deletions Autogenerated/Bindings/Cpp/lib3mf_implicit.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<sPosition2D> & 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);
Expand Down Expand Up @@ -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<char> 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.
Expand Down
24 changes: 24 additions & 0 deletions Autogenerated/Bindings/CppDynamic/lib3mf_dynamic.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down Expand Up @@ -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;
Expand Down
Loading

0 comments on commit c852ea7

Please sign in to comment.