diff --git a/Autogenerated/Bindings/C/lib3mf.h b/Autogenerated/Bindings/C/lib3mf.h index cae6e016..03814e42 100644 --- a/Autogenerated/Bindings/C/lib3mf.h +++ b/Autogenerated/Bindings/C/lib3mf.h @@ -793,6 +793,135 @@ LIB3MF_DECLSPEC Lib3MFResult lib3mf_metadatagroup_removemetadata(Lib3MF_MetaData */ LIB3MF_DECLSPEC Lib3MFResult lib3mf_metadatagroup_addmetadata(Lib3MF_MetaDataGroup pMetaDataGroup, const char * pNameSpace, const char * pName, const char * pValue, const char * pType, bool bMustPreserve, Lib3MF_MetaData * pMetaData); +/************************************************************************************************************************* + Class definition for TriangleSet +**************************************************************************************************************************/ + +/** +* sets the name of the triangle set +* +* @param[in] pTriangleSet - TriangleSet instance. +* @param[in] pName - the new name +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_triangleset_setname(Lib3MF_TriangleSet pTriangleSet, const char * pName); + +/** +* returns the name of the triangle set +* +* @param[in] pTriangleSet - TriangleSet instance. +* @param[in] nNameBufferSize - size of the buffer (including trailing 0) +* @param[out] pNameNeededChars - will be filled with the count of the written bytes, or needed buffer size. +* @param[out] pNameBuffer - buffer of returns the name, may be NULL +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_triangleset_getname(Lib3MF_TriangleSet pTriangleSet, const Lib3MF_uint32 nNameBufferSize, Lib3MF_uint32* pNameNeededChars, char * pNameBuffer); + +/** +* sets the identifier of the triangle set. +* +* @param[in] pTriangleSet - TriangleSet instance. +* @param[in] pIdentifier - the new identifier. MUST be unique within the mesh. MUST NOT be an empty string +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_triangleset_setidentifier(Lib3MF_TriangleSet pTriangleSet, const char * pIdentifier); + +/** +* returns the identifier of the triangle set +* +* @param[in] pTriangleSet - TriangleSet instance. +* @param[in] nIdentifierBufferSize - size of the buffer (including trailing 0) +* @param[out] pIdentifierNeededChars - will be filled with the count of the written bytes, or needed buffer size. +* @param[out] pIdentifierBuffer - buffer of returns the identifier, may be NULL +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_triangleset_getidentifier(Lib3MF_TriangleSet pTriangleSet, const Lib3MF_uint32 nIdentifierBufferSize, Lib3MF_uint32* pIdentifierNeededChars, char * pIdentifierBuffer); + +/** +* adds a triangle to the set. Does nothing if triangle is already in the set. +* +* @param[in] pTriangleSet - TriangleSet instance. +* @param[in] nTriangleIndex - Triangle index to add. MUST be between 0 and TriangleCount - 1. +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_triangleset_addtriangle(Lib3MF_TriangleSet pTriangleSet, Lib3MF_uint32 nTriangleIndex); + +/** +* removes a triangle from the set +* +* @param[in] pTriangleSet - TriangleSet instance. +* @param[in] nTriangleIndex - Triangle index to remove. MUST be between 0 and TriangleCount - 1. +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_triangleset_removetriangle(Lib3MF_TriangleSet pTriangleSet, Lib3MF_uint32 nTriangleIndex); + +/** +* clears all triangles from the list +* +* @param[in] pTriangleSet - TriangleSet instance. +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_triangleset_clear(Lib3MF_TriangleSet pTriangleSet); + +/** +* Sets all triangles in the list, while clearing old values. Duplicates will be merged. +* +* @param[in] pTriangleSet - TriangleSet instance. +* @param[in] nTriangleIndicesBufferSize - Number of elements in buffer +* @param[in] pTriangleIndicesBuffer - uint32 buffer of Triangle indices to add. Every element MUST be between 0 and TriangleCount - 1. +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_triangleset_settrianglelist(Lib3MF_TriangleSet pTriangleSet, Lib3MF_uint64 nTriangleIndicesBufferSize, const Lib3MF_uint32 * pTriangleIndicesBuffer); + +/** +* Retrieves all the triangles in the TriangleSet +* +* @param[in] pTriangleSet - TriangleSet instance. +* @param[in] nTriangleIndicesBufferSize - Number of elements in buffer +* @param[out] pTriangleIndicesNeededCount - will be filled with the count of the written elements, or needed buffer size. +* @param[out] pTriangleIndicesBuffer - uint32 buffer of retrieves the indices of the triangles in this TriangleSet +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_triangleset_gettrianglelist(Lib3MF_TriangleSet pTriangleSet, const Lib3MF_uint64 nTriangleIndicesBufferSize, Lib3MF_uint64* pTriangleIndicesNeededCount, Lib3MF_uint32 * pTriangleIndicesBuffer); + +/** +* Adds multiple triangles in the list. Duplicates will be merged. +* +* @param[in] pTriangleSet - TriangleSet instance. +* @param[in] nTriangleIndicesBufferSize - Number of elements in buffer +* @param[in] pTriangleIndicesBuffer - uint32 buffer of Triangle indices to add. Every element MUST be between 0 and TriangleCount - 1. +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_triangleset_addtrianglelist(Lib3MF_TriangleSet pTriangleSet, Lib3MF_uint64 nTriangleIndicesBufferSize, const Lib3MF_uint32 * pTriangleIndicesBuffer); + +/** +* Merges another Triangle set. +* +* @param[in] pTriangleSet - TriangleSet instance. +* @param[in] pOtherTriangleSet - Other triangle set to merge. +* @param[in] bDeleteOther - Flag if other triangle set is getting removed. +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_triangleset_merge(Lib3MF_TriangleSet pTriangleSet, Lib3MF_TriangleSet pOtherTriangleSet, bool bDeleteOther); + +/** +* Deletes the whole set from the mesh. +* +* @param[in] pTriangleSet - TriangleSet instance. +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_triangleset_deleteset(Lib3MF_TriangleSet pTriangleSet); + +/** +* Duplicates the set in the mesh. +* +* @param[in] pTriangleSet - TriangleSet instance. +* @param[in] pIdentifier - the new identifier. MUST be unique within the mesh. MUST NOT be an empty string +* @param[out] pNewSet - Copy of the triangle set. +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_triangleset_duplicate(Lib3MF_TriangleSet pTriangleSet, const char * pIdentifier, Lib3MF_TriangleSet * pNewSet); + /************************************************************************************************************************* Class definition for Object **************************************************************************************************************************/ @@ -1232,6 +1361,56 @@ LIB3MF_DECLSPEC Lib3MFResult lib3mf_meshobject_getvolumedata(Lib3MF_MeshObject p */ LIB3MF_DECLSPEC Lib3MFResult lib3mf_meshobject_setvolumedata(Lib3MF_MeshObject pMeshObject, Lib3MF_VolumeData pTheVolumeData); +/** +* Adds a new triangle set. +* +* @param[in] pMeshObject - MeshObject instance. +* @param[in] pIdentifier - the new identifier. MUST be unique within the mesh. MUST NOT be an empty string +* @param[in] pName - the human readable name. MUST NOT be an empty string +* @param[out] pTheTriangleSet - the new Triangle Set Instance. +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_meshobject_addtriangleset(Lib3MF_MeshObject pMeshObject, const char * pIdentifier, const char * pName, Lib3MF_TriangleSet * pTheTriangleSet); + +/** +* Checks if a triangle set exists. +* +* @param[in] pMeshObject - MeshObject instance. +* @param[in] pIdentifier - the identifier to be found. +* @param[out] pTriangleSetExists - flag if the triangles set exists. +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_meshobject_hastriangleset(Lib3MF_MeshObject pMeshObject, const char * pIdentifier, bool * pTriangleSetExists); + +/** +* Finds a new triangle set by identifier. Fails if not existing. +* +* @param[in] pMeshObject - MeshObject instance. +* @param[in] pIdentifier - the identifier to be found. +* @param[out] pTheTriangleSet - the triangle Set Instance. +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_meshobject_findtriangleset(Lib3MF_MeshObject pMeshObject, const char * pIdentifier, Lib3MF_TriangleSet * pTheTriangleSet); + +/** +* Returns number of triangle sets. +* +* @param[in] pMeshObject - MeshObject instance. +* @param[out] pCount - the number of triangle sets of this mesh. +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_meshobject_gettrianglesetcount(Lib3MF_MeshObject pMeshObject, Lib3MF_uint32 * pCount); + +/** +* Returns a specific triangle set by index. +* +* @param[in] pMeshObject - MeshObject instance. +* @param[in] nIndex - the index of the triangle set. +* @param[out] pTheTriangleSet - the triangle Set Instance. +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_meshobject_gettriangleset(Lib3MF_MeshObject pMeshObject, Lib3MF_uint32 nIndex, Lib3MF_TriangleSet * pTheTriangleSet); + /************************************************************************************************************************* Class definition for LevelSet **************************************************************************************************************************/ diff --git a/Autogenerated/Bindings/C/lib3mf_types.h b/Autogenerated/Bindings/C/lib3mf_types.h index a5d436da..241f77f8 100644 --- a/Autogenerated/Bindings/C/lib3mf_types.h +++ b/Autogenerated/Bindings/C/lib3mf_types.h @@ -131,6 +131,8 @@ typedef void * Lib3MF_pvoid; #define LIB3MF_ERROR_ELEMENTCOUNTEXCEEDSLIMIT 141 /** An element buffer exceeds its spec limit */ #define LIB3MF_ERROR_INVALIDRESOURCE 142 /** A resource is invalid */ #define LIB3MF_ERROR_INVALIDLEVELSET 143 /** A level set is invalid */ +#define LIB3MF_ERROR_COULDNOTFINDTRIANGLESET 144 /** Could not find triangle set */ +#define LIB3MF_ERROR_INVALIDTRIANGLESETINDEX 145 /** Invalid triangle set index */ #define LIB3MF_ERROR_BEAMLATTICE_INVALID_OBJECTTYPE 2000 /** This object type is not valid for beamlattices */ #define LIB3MF_ERROR_INVALIDKEYSTORE 3000 /** The keystore object is invalid */ #define LIB3MF_ERROR_INVALIDKEYSTORECONSUMER 3001 /** The consumer keystore object is invalid */ @@ -187,6 +189,8 @@ inline const char * LIB3MF_GETERRORSTRING (Lib3MFResult nErrorCode) { case LIB3MF_ERROR_ELEMENTCOUNTEXCEEDSLIMIT: return "An element buffer exceeds its spec limit"; case LIB3MF_ERROR_INVALIDRESOURCE: return "A resource is invalid"; case LIB3MF_ERROR_INVALIDLEVELSET: return "A level set is invalid"; + case LIB3MF_ERROR_COULDNOTFINDTRIANGLESET: return "Could not find triangle set"; + case LIB3MF_ERROR_INVALIDTRIANGLESETINDEX: return "Invalid triangle set index"; case LIB3MF_ERROR_BEAMLATTICE_INVALID_OBJECTTYPE: return "This object type is not valid for beamlattices"; case LIB3MF_ERROR_INVALIDKEYSTORE: return "The keystore object is invalid"; case LIB3MF_ERROR_INVALIDKEYSTORECONSUMER: return "The consumer keystore object is invalid"; @@ -227,6 +231,7 @@ typedef Lib3MFHandle Lib3MF_FunctionIterator; typedef Lib3MFHandle Lib3MF_LevelSetIterator; typedef Lib3MFHandle Lib3MF_MetaData; typedef Lib3MFHandle Lib3MF_MetaDataGroup; +typedef Lib3MFHandle Lib3MF_TriangleSet; typedef Lib3MFHandle Lib3MF_Object; typedef Lib3MFHandle Lib3MF_MeshObject; typedef Lib3MFHandle Lib3MF_LevelSet; diff --git a/Autogenerated/Bindings/CDynamic/lib3mf_dynamic.cc b/Autogenerated/Bindings/CDynamic/lib3mf_dynamic.cc index e15559ef..2bd0c452 100644 --- a/Autogenerated/Bindings/CDynamic/lib3mf_dynamic.cc +++ b/Autogenerated/Bindings/CDynamic/lib3mf_dynamic.cc @@ -116,6 +116,19 @@ Lib3MFResult InitLib3MFWrapperTable(sLib3MFDynamicWrapperTable * pWrapperTable) pWrapperTable->m_MetaDataGroup_RemoveMetaDataByIndex = NULL; pWrapperTable->m_MetaDataGroup_RemoveMetaData = NULL; pWrapperTable->m_MetaDataGroup_AddMetaData = NULL; + pWrapperTable->m_TriangleSet_SetName = NULL; + pWrapperTable->m_TriangleSet_GetName = NULL; + pWrapperTable->m_TriangleSet_SetIdentifier = NULL; + pWrapperTable->m_TriangleSet_GetIdentifier = NULL; + pWrapperTable->m_TriangleSet_AddTriangle = NULL; + pWrapperTable->m_TriangleSet_RemoveTriangle = NULL; + pWrapperTable->m_TriangleSet_Clear = NULL; + pWrapperTable->m_TriangleSet_SetTriangleList = NULL; + pWrapperTable->m_TriangleSet_GetTriangleList = NULL; + pWrapperTable->m_TriangleSet_AddTriangleList = NULL; + pWrapperTable->m_TriangleSet_Merge = NULL; + pWrapperTable->m_TriangleSet_DeleteSet = NULL; + pWrapperTable->m_TriangleSet_Duplicate = NULL; pWrapperTable->m_Object_GetType = NULL; pWrapperTable->m_Object_SetType = NULL; pWrapperTable->m_Object_GetName = NULL; @@ -161,6 +174,11 @@ Lib3MFResult InitLib3MFWrapperTable(sLib3MFDynamicWrapperTable * pWrapperTable) pWrapperTable->m_MeshObject_BeamLattice = NULL; pWrapperTable->m_MeshObject_GetVolumeData = NULL; pWrapperTable->m_MeshObject_SetVolumeData = NULL; + pWrapperTable->m_MeshObject_AddTriangleSet = NULL; + pWrapperTable->m_MeshObject_HasTriangleSet = NULL; + pWrapperTable->m_MeshObject_FindTriangleSet = NULL; + pWrapperTable->m_MeshObject_GetTriangleSetCount = NULL; + pWrapperTable->m_MeshObject_GetTriangleSet = NULL; pWrapperTable->m_LevelSet_GetFunction = NULL; pWrapperTable->m_LevelSet_SetFunction = NULL; pWrapperTable->m_LevelSet_GetTransform = NULL; @@ -1316,6 +1334,123 @@ Lib3MFResult LoadLib3MFWrapperTable(sLib3MFDynamicWrapperTable * pWrapperTable, if (pWrapperTable->m_MetaDataGroup_AddMetaData == NULL) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + #ifdef _WIN32 + pWrapperTable->m_TriangleSet_SetName = (PLib3MFTriangleSet_SetNamePtr) GetProcAddress(hLibrary, "lib3mf_triangleset_setname"); + #else // _WIN32 + pWrapperTable->m_TriangleSet_SetName = (PLib3MFTriangleSet_SetNamePtr) dlsym(hLibrary, "lib3mf_triangleset_setname"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_TriangleSet_SetName == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_TriangleSet_GetName = (PLib3MFTriangleSet_GetNamePtr) GetProcAddress(hLibrary, "lib3mf_triangleset_getname"); + #else // _WIN32 + pWrapperTable->m_TriangleSet_GetName = (PLib3MFTriangleSet_GetNamePtr) dlsym(hLibrary, "lib3mf_triangleset_getname"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_TriangleSet_GetName == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_TriangleSet_SetIdentifier = (PLib3MFTriangleSet_SetIdentifierPtr) GetProcAddress(hLibrary, "lib3mf_triangleset_setidentifier"); + #else // _WIN32 + pWrapperTable->m_TriangleSet_SetIdentifier = (PLib3MFTriangleSet_SetIdentifierPtr) dlsym(hLibrary, "lib3mf_triangleset_setidentifier"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_TriangleSet_SetIdentifier == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_TriangleSet_GetIdentifier = (PLib3MFTriangleSet_GetIdentifierPtr) GetProcAddress(hLibrary, "lib3mf_triangleset_getidentifier"); + #else // _WIN32 + pWrapperTable->m_TriangleSet_GetIdentifier = (PLib3MFTriangleSet_GetIdentifierPtr) dlsym(hLibrary, "lib3mf_triangleset_getidentifier"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_TriangleSet_GetIdentifier == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_TriangleSet_AddTriangle = (PLib3MFTriangleSet_AddTrianglePtr) GetProcAddress(hLibrary, "lib3mf_triangleset_addtriangle"); + #else // _WIN32 + pWrapperTable->m_TriangleSet_AddTriangle = (PLib3MFTriangleSet_AddTrianglePtr) dlsym(hLibrary, "lib3mf_triangleset_addtriangle"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_TriangleSet_AddTriangle == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_TriangleSet_RemoveTriangle = (PLib3MFTriangleSet_RemoveTrianglePtr) GetProcAddress(hLibrary, "lib3mf_triangleset_removetriangle"); + #else // _WIN32 + pWrapperTable->m_TriangleSet_RemoveTriangle = (PLib3MFTriangleSet_RemoveTrianglePtr) dlsym(hLibrary, "lib3mf_triangleset_removetriangle"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_TriangleSet_RemoveTriangle == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_TriangleSet_Clear = (PLib3MFTriangleSet_ClearPtr) GetProcAddress(hLibrary, "lib3mf_triangleset_clear"); + #else // _WIN32 + pWrapperTable->m_TriangleSet_Clear = (PLib3MFTriangleSet_ClearPtr) dlsym(hLibrary, "lib3mf_triangleset_clear"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_TriangleSet_Clear == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_TriangleSet_SetTriangleList = (PLib3MFTriangleSet_SetTriangleListPtr) GetProcAddress(hLibrary, "lib3mf_triangleset_settrianglelist"); + #else // _WIN32 + pWrapperTable->m_TriangleSet_SetTriangleList = (PLib3MFTriangleSet_SetTriangleListPtr) dlsym(hLibrary, "lib3mf_triangleset_settrianglelist"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_TriangleSet_SetTriangleList == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_TriangleSet_GetTriangleList = (PLib3MFTriangleSet_GetTriangleListPtr) GetProcAddress(hLibrary, "lib3mf_triangleset_gettrianglelist"); + #else // _WIN32 + pWrapperTable->m_TriangleSet_GetTriangleList = (PLib3MFTriangleSet_GetTriangleListPtr) dlsym(hLibrary, "lib3mf_triangleset_gettrianglelist"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_TriangleSet_GetTriangleList == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_TriangleSet_AddTriangleList = (PLib3MFTriangleSet_AddTriangleListPtr) GetProcAddress(hLibrary, "lib3mf_triangleset_addtrianglelist"); + #else // _WIN32 + pWrapperTable->m_TriangleSet_AddTriangleList = (PLib3MFTriangleSet_AddTriangleListPtr) dlsym(hLibrary, "lib3mf_triangleset_addtrianglelist"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_TriangleSet_AddTriangleList == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_TriangleSet_Merge = (PLib3MFTriangleSet_MergePtr) GetProcAddress(hLibrary, "lib3mf_triangleset_merge"); + #else // _WIN32 + pWrapperTable->m_TriangleSet_Merge = (PLib3MFTriangleSet_MergePtr) dlsym(hLibrary, "lib3mf_triangleset_merge"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_TriangleSet_Merge == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_TriangleSet_DeleteSet = (PLib3MFTriangleSet_DeleteSetPtr) GetProcAddress(hLibrary, "lib3mf_triangleset_deleteset"); + #else // _WIN32 + pWrapperTable->m_TriangleSet_DeleteSet = (PLib3MFTriangleSet_DeleteSetPtr) dlsym(hLibrary, "lib3mf_triangleset_deleteset"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_TriangleSet_DeleteSet == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_TriangleSet_Duplicate = (PLib3MFTriangleSet_DuplicatePtr) GetProcAddress(hLibrary, "lib3mf_triangleset_duplicate"); + #else // _WIN32 + pWrapperTable->m_TriangleSet_Duplicate = (PLib3MFTriangleSet_DuplicatePtr) dlsym(hLibrary, "lib3mf_triangleset_duplicate"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_TriangleSet_Duplicate == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + #ifdef _WIN32 pWrapperTable->m_Object_GetType = (PLib3MFObject_GetTypePtr) GetProcAddress(hLibrary, "lib3mf_object_gettype"); #else // _WIN32 @@ -1721,6 +1856,51 @@ Lib3MFResult LoadLib3MFWrapperTable(sLib3MFDynamicWrapperTable * pWrapperTable, if (pWrapperTable->m_MeshObject_SetVolumeData == NULL) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + #ifdef _WIN32 + pWrapperTable->m_MeshObject_AddTriangleSet = (PLib3MFMeshObject_AddTriangleSetPtr) GetProcAddress(hLibrary, "lib3mf_meshobject_addtriangleset"); + #else // _WIN32 + pWrapperTable->m_MeshObject_AddTriangleSet = (PLib3MFMeshObject_AddTriangleSetPtr) dlsym(hLibrary, "lib3mf_meshobject_addtriangleset"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_MeshObject_AddTriangleSet == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_MeshObject_HasTriangleSet = (PLib3MFMeshObject_HasTriangleSetPtr) GetProcAddress(hLibrary, "lib3mf_meshobject_hastriangleset"); + #else // _WIN32 + pWrapperTable->m_MeshObject_HasTriangleSet = (PLib3MFMeshObject_HasTriangleSetPtr) dlsym(hLibrary, "lib3mf_meshobject_hastriangleset"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_MeshObject_HasTriangleSet == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_MeshObject_FindTriangleSet = (PLib3MFMeshObject_FindTriangleSetPtr) GetProcAddress(hLibrary, "lib3mf_meshobject_findtriangleset"); + #else // _WIN32 + pWrapperTable->m_MeshObject_FindTriangleSet = (PLib3MFMeshObject_FindTriangleSetPtr) dlsym(hLibrary, "lib3mf_meshobject_findtriangleset"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_MeshObject_FindTriangleSet == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_MeshObject_GetTriangleSetCount = (PLib3MFMeshObject_GetTriangleSetCountPtr) GetProcAddress(hLibrary, "lib3mf_meshobject_gettrianglesetcount"); + #else // _WIN32 + pWrapperTable->m_MeshObject_GetTriangleSetCount = (PLib3MFMeshObject_GetTriangleSetCountPtr) dlsym(hLibrary, "lib3mf_meshobject_gettrianglesetcount"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_MeshObject_GetTriangleSetCount == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_MeshObject_GetTriangleSet = (PLib3MFMeshObject_GetTriangleSetPtr) GetProcAddress(hLibrary, "lib3mf_meshobject_gettriangleset"); + #else // _WIN32 + pWrapperTable->m_MeshObject_GetTriangleSet = (PLib3MFMeshObject_GetTriangleSetPtr) dlsym(hLibrary, "lib3mf_meshobject_gettriangleset"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_MeshObject_GetTriangleSet == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + #ifdef _WIN32 pWrapperTable->m_LevelSet_GetFunction = (PLib3MFLevelSet_GetFunctionPtr) GetProcAddress(hLibrary, "lib3mf_levelset_getfunction"); #else // _WIN32 diff --git a/Autogenerated/Bindings/CDynamic/lib3mf_dynamic.h b/Autogenerated/Bindings/CDynamic/lib3mf_dynamic.h index 0211b290..972d3637 100644 --- a/Autogenerated/Bindings/CDynamic/lib3mf_dynamic.h +++ b/Autogenerated/Bindings/CDynamic/lib3mf_dynamic.h @@ -780,6 +780,135 @@ typedef Lib3MFResult (*PLib3MFMetaDataGroup_RemoveMetaDataPtr) (Lib3MF_MetaDataG */ typedef Lib3MFResult (*PLib3MFMetaDataGroup_AddMetaDataPtr) (Lib3MF_MetaDataGroup pMetaDataGroup, const char * pNameSpace, const char * pName, const char * pValue, const char * pType, bool bMustPreserve, Lib3MF_MetaData * pMetaData); +/************************************************************************************************************************* + Class definition for TriangleSet +**************************************************************************************************************************/ + +/** +* sets the name of the triangle set +* +* @param[in] pTriangleSet - TriangleSet instance. +* @param[in] pName - the new name +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFTriangleSet_SetNamePtr) (Lib3MF_TriangleSet pTriangleSet, const char * pName); + +/** +* returns the name of the triangle set +* +* @param[in] pTriangleSet - TriangleSet instance. +* @param[in] nNameBufferSize - size of the buffer (including trailing 0) +* @param[out] pNameNeededChars - will be filled with the count of the written bytes, or needed buffer size. +* @param[out] pNameBuffer - buffer of returns the name, may be NULL +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFTriangleSet_GetNamePtr) (Lib3MF_TriangleSet pTriangleSet, const Lib3MF_uint32 nNameBufferSize, Lib3MF_uint32* pNameNeededChars, char * pNameBuffer); + +/** +* sets the identifier of the triangle set. +* +* @param[in] pTriangleSet - TriangleSet instance. +* @param[in] pIdentifier - the new identifier. MUST be unique within the mesh. MUST NOT be an empty string +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFTriangleSet_SetIdentifierPtr) (Lib3MF_TriangleSet pTriangleSet, const char * pIdentifier); + +/** +* returns the identifier of the triangle set +* +* @param[in] pTriangleSet - TriangleSet instance. +* @param[in] nIdentifierBufferSize - size of the buffer (including trailing 0) +* @param[out] pIdentifierNeededChars - will be filled with the count of the written bytes, or needed buffer size. +* @param[out] pIdentifierBuffer - buffer of returns the identifier, may be NULL +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFTriangleSet_GetIdentifierPtr) (Lib3MF_TriangleSet pTriangleSet, const Lib3MF_uint32 nIdentifierBufferSize, Lib3MF_uint32* pIdentifierNeededChars, char * pIdentifierBuffer); + +/** +* adds a triangle to the set. Does nothing if triangle is already in the set. +* +* @param[in] pTriangleSet - TriangleSet instance. +* @param[in] nTriangleIndex - Triangle index to add. MUST be between 0 and TriangleCount - 1. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFTriangleSet_AddTrianglePtr) (Lib3MF_TriangleSet pTriangleSet, Lib3MF_uint32 nTriangleIndex); + +/** +* removes a triangle from the set +* +* @param[in] pTriangleSet - TriangleSet instance. +* @param[in] nTriangleIndex - Triangle index to remove. MUST be between 0 and TriangleCount - 1. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFTriangleSet_RemoveTrianglePtr) (Lib3MF_TriangleSet pTriangleSet, Lib3MF_uint32 nTriangleIndex); + +/** +* clears all triangles from the list +* +* @param[in] pTriangleSet - TriangleSet instance. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFTriangleSet_ClearPtr) (Lib3MF_TriangleSet pTriangleSet); + +/** +* Sets all triangles in the list, while clearing old values. Duplicates will be merged. +* +* @param[in] pTriangleSet - TriangleSet instance. +* @param[in] nTriangleIndicesBufferSize - Number of elements in buffer +* @param[in] pTriangleIndicesBuffer - uint32 buffer of Triangle indices to add. Every element MUST be between 0 and TriangleCount - 1. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFTriangleSet_SetTriangleListPtr) (Lib3MF_TriangleSet pTriangleSet, Lib3MF_uint64 nTriangleIndicesBufferSize, const Lib3MF_uint32 * pTriangleIndicesBuffer); + +/** +* Retrieves all the triangles in the TriangleSet +* +* @param[in] pTriangleSet - TriangleSet instance. +* @param[in] nTriangleIndicesBufferSize - Number of elements in buffer +* @param[out] pTriangleIndicesNeededCount - will be filled with the count of the written elements, or needed buffer size. +* @param[out] pTriangleIndicesBuffer - uint32 buffer of retrieves the indices of the triangles in this TriangleSet +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFTriangleSet_GetTriangleListPtr) (Lib3MF_TriangleSet pTriangleSet, const Lib3MF_uint64 nTriangleIndicesBufferSize, Lib3MF_uint64* pTriangleIndicesNeededCount, Lib3MF_uint32 * pTriangleIndicesBuffer); + +/** +* Adds multiple triangles in the list. Duplicates will be merged. +* +* @param[in] pTriangleSet - TriangleSet instance. +* @param[in] nTriangleIndicesBufferSize - Number of elements in buffer +* @param[in] pTriangleIndicesBuffer - uint32 buffer of Triangle indices to add. Every element MUST be between 0 and TriangleCount - 1. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFTriangleSet_AddTriangleListPtr) (Lib3MF_TriangleSet pTriangleSet, Lib3MF_uint64 nTriangleIndicesBufferSize, const Lib3MF_uint32 * pTriangleIndicesBuffer); + +/** +* Merges another Triangle set. +* +* @param[in] pTriangleSet - TriangleSet instance. +* @param[in] pOtherTriangleSet - Other triangle set to merge. +* @param[in] bDeleteOther - Flag if other triangle set is getting removed. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFTriangleSet_MergePtr) (Lib3MF_TriangleSet pTriangleSet, Lib3MF_TriangleSet pOtherTriangleSet, bool bDeleteOther); + +/** +* Deletes the whole set from the mesh. +* +* @param[in] pTriangleSet - TriangleSet instance. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFTriangleSet_DeleteSetPtr) (Lib3MF_TriangleSet pTriangleSet); + +/** +* Duplicates the set in the mesh. +* +* @param[in] pTriangleSet - TriangleSet instance. +* @param[in] pIdentifier - the new identifier. MUST be unique within the mesh. MUST NOT be an empty string +* @param[out] pNewSet - Copy of the triangle set. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFTriangleSet_DuplicatePtr) (Lib3MF_TriangleSet pTriangleSet, const char * pIdentifier, Lib3MF_TriangleSet * pNewSet); + /************************************************************************************************************************* Class definition for Object **************************************************************************************************************************/ @@ -1219,6 +1348,56 @@ typedef Lib3MFResult (*PLib3MFMeshObject_GetVolumeDataPtr) (Lib3MF_MeshObject pM */ typedef Lib3MFResult (*PLib3MFMeshObject_SetVolumeDataPtr) (Lib3MF_MeshObject pMeshObject, Lib3MF_VolumeData pTheVolumeData); +/** +* Adds a new triangle set. +* +* @param[in] pMeshObject - MeshObject instance. +* @param[in] pIdentifier - the new identifier. MUST be unique within the mesh. MUST NOT be an empty string +* @param[in] pName - the human readable name. MUST NOT be an empty string +* @param[out] pTheTriangleSet - the new Triangle Set Instance. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFMeshObject_AddTriangleSetPtr) (Lib3MF_MeshObject pMeshObject, const char * pIdentifier, const char * pName, Lib3MF_TriangleSet * pTheTriangleSet); + +/** +* Checks if a triangle set exists. +* +* @param[in] pMeshObject - MeshObject instance. +* @param[in] pIdentifier - the identifier to be found. +* @param[out] pTriangleSetExists - flag if the triangles set exists. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFMeshObject_HasTriangleSetPtr) (Lib3MF_MeshObject pMeshObject, const char * pIdentifier, bool * pTriangleSetExists); + +/** +* Finds a new triangle set by identifier. Fails if not existing. +* +* @param[in] pMeshObject - MeshObject instance. +* @param[in] pIdentifier - the identifier to be found. +* @param[out] pTheTriangleSet - the triangle Set Instance. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFMeshObject_FindTriangleSetPtr) (Lib3MF_MeshObject pMeshObject, const char * pIdentifier, Lib3MF_TriangleSet * pTheTriangleSet); + +/** +* Returns number of triangle sets. +* +* @param[in] pMeshObject - MeshObject instance. +* @param[out] pCount - the number of triangle sets of this mesh. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFMeshObject_GetTriangleSetCountPtr) (Lib3MF_MeshObject pMeshObject, Lib3MF_uint32 * pCount); + +/** +* Returns a specific triangle set by index. +* +* @param[in] pMeshObject - MeshObject instance. +* @param[in] nIndex - the index of the triangle set. +* @param[out] pTheTriangleSet - the triangle Set Instance. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFMeshObject_GetTriangleSetPtr) (Lib3MF_MeshObject pMeshObject, Lib3MF_uint32 nIndex, Lib3MF_TriangleSet * pTheTriangleSet); + /************************************************************************************************************************* Class definition for LevelSet **************************************************************************************************************************/ @@ -6512,6 +6691,19 @@ typedef struct { PLib3MFMetaDataGroup_RemoveMetaDataByIndexPtr m_MetaDataGroup_RemoveMetaDataByIndex; PLib3MFMetaDataGroup_RemoveMetaDataPtr m_MetaDataGroup_RemoveMetaData; PLib3MFMetaDataGroup_AddMetaDataPtr m_MetaDataGroup_AddMetaData; + PLib3MFTriangleSet_SetNamePtr m_TriangleSet_SetName; + PLib3MFTriangleSet_GetNamePtr m_TriangleSet_GetName; + PLib3MFTriangleSet_SetIdentifierPtr m_TriangleSet_SetIdentifier; + PLib3MFTriangleSet_GetIdentifierPtr m_TriangleSet_GetIdentifier; + PLib3MFTriangleSet_AddTrianglePtr m_TriangleSet_AddTriangle; + PLib3MFTriangleSet_RemoveTrianglePtr m_TriangleSet_RemoveTriangle; + PLib3MFTriangleSet_ClearPtr m_TriangleSet_Clear; + PLib3MFTriangleSet_SetTriangleListPtr m_TriangleSet_SetTriangleList; + PLib3MFTriangleSet_GetTriangleListPtr m_TriangleSet_GetTriangleList; + PLib3MFTriangleSet_AddTriangleListPtr m_TriangleSet_AddTriangleList; + PLib3MFTriangleSet_MergePtr m_TriangleSet_Merge; + PLib3MFTriangleSet_DeleteSetPtr m_TriangleSet_DeleteSet; + PLib3MFTriangleSet_DuplicatePtr m_TriangleSet_Duplicate; PLib3MFObject_GetTypePtr m_Object_GetType; PLib3MFObject_SetTypePtr m_Object_SetType; PLib3MFObject_GetNamePtr m_Object_GetName; @@ -6557,6 +6749,11 @@ typedef struct { PLib3MFMeshObject_BeamLatticePtr m_MeshObject_BeamLattice; PLib3MFMeshObject_GetVolumeDataPtr m_MeshObject_GetVolumeData; PLib3MFMeshObject_SetVolumeDataPtr m_MeshObject_SetVolumeData; + PLib3MFMeshObject_AddTriangleSetPtr m_MeshObject_AddTriangleSet; + PLib3MFMeshObject_HasTriangleSetPtr m_MeshObject_HasTriangleSet; + PLib3MFMeshObject_FindTriangleSetPtr m_MeshObject_FindTriangleSet; + PLib3MFMeshObject_GetTriangleSetCountPtr m_MeshObject_GetTriangleSetCount; + PLib3MFMeshObject_GetTriangleSetPtr m_MeshObject_GetTriangleSet; PLib3MFLevelSet_GetFunctionPtr m_LevelSet_GetFunction; PLib3MFLevelSet_SetFunctionPtr m_LevelSet_SetFunction; PLib3MFLevelSet_GetTransformPtr m_LevelSet_GetTransform; diff --git a/Autogenerated/Bindings/CDynamic/lib3mf_types.h b/Autogenerated/Bindings/CDynamic/lib3mf_types.h index a5d436da..241f77f8 100644 --- a/Autogenerated/Bindings/CDynamic/lib3mf_types.h +++ b/Autogenerated/Bindings/CDynamic/lib3mf_types.h @@ -131,6 +131,8 @@ typedef void * Lib3MF_pvoid; #define LIB3MF_ERROR_ELEMENTCOUNTEXCEEDSLIMIT 141 /** An element buffer exceeds its spec limit */ #define LIB3MF_ERROR_INVALIDRESOURCE 142 /** A resource is invalid */ #define LIB3MF_ERROR_INVALIDLEVELSET 143 /** A level set is invalid */ +#define LIB3MF_ERROR_COULDNOTFINDTRIANGLESET 144 /** Could not find triangle set */ +#define LIB3MF_ERROR_INVALIDTRIANGLESETINDEX 145 /** Invalid triangle set index */ #define LIB3MF_ERROR_BEAMLATTICE_INVALID_OBJECTTYPE 2000 /** This object type is not valid for beamlattices */ #define LIB3MF_ERROR_INVALIDKEYSTORE 3000 /** The keystore object is invalid */ #define LIB3MF_ERROR_INVALIDKEYSTORECONSUMER 3001 /** The consumer keystore object is invalid */ @@ -187,6 +189,8 @@ inline const char * LIB3MF_GETERRORSTRING (Lib3MFResult nErrorCode) { case LIB3MF_ERROR_ELEMENTCOUNTEXCEEDSLIMIT: return "An element buffer exceeds its spec limit"; case LIB3MF_ERROR_INVALIDRESOURCE: return "A resource is invalid"; case LIB3MF_ERROR_INVALIDLEVELSET: return "A level set is invalid"; + case LIB3MF_ERROR_COULDNOTFINDTRIANGLESET: return "Could not find triangle set"; + case LIB3MF_ERROR_INVALIDTRIANGLESETINDEX: return "Invalid triangle set index"; case LIB3MF_ERROR_BEAMLATTICE_INVALID_OBJECTTYPE: return "This object type is not valid for beamlattices"; case LIB3MF_ERROR_INVALIDKEYSTORE: return "The keystore object is invalid"; case LIB3MF_ERROR_INVALIDKEYSTORECONSUMER: return "The consumer keystore object is invalid"; @@ -227,6 +231,7 @@ typedef Lib3MFHandle Lib3MF_FunctionIterator; typedef Lib3MFHandle Lib3MF_LevelSetIterator; typedef Lib3MFHandle Lib3MF_MetaData; typedef Lib3MFHandle Lib3MF_MetaDataGroup; +typedef Lib3MFHandle Lib3MF_TriangleSet; typedef Lib3MFHandle Lib3MF_Object; typedef Lib3MFHandle Lib3MF_MeshObject; typedef Lib3MFHandle Lib3MF_LevelSet; diff --git a/Autogenerated/Bindings/CSharp/Lib3MF.cs b/Autogenerated/Bindings/CSharp/Lib3MF.cs index b43b8beb..40166c03 100644 --- a/Autogenerated/Bindings/CSharp/Lib3MF.cs +++ b/Autogenerated/Bindings/CSharp/Lib3MF.cs @@ -639,6 +639,45 @@ public class Lib3MFWrapper [DllImport("lib3mf.dll", EntryPoint = "lib3mf_metadatagroup_addmetadata", CallingConvention=CallingConvention.Cdecl)] public unsafe extern static Int32 MetaDataGroup_AddMetaData (IntPtr Handle, byte[] ANameSpace, byte[] AName, byte[] AValue, byte[] AType, Byte AMustPreserve, out IntPtr AMetaData); + [DllImport("lib3mf.dll", EntryPoint = "lib3mf_triangleset_setname", CallingConvention=CallingConvention.Cdecl)] + public unsafe extern static Int32 TriangleSet_SetName (IntPtr Handle, byte[] AName); + + [DllImport("lib3mf.dll", EntryPoint = "lib3mf_triangleset_getname", CallingConvention=CallingConvention.Cdecl)] + public unsafe extern static Int32 TriangleSet_GetName (IntPtr Handle, UInt32 sizeName, out UInt32 neededName, IntPtr dataName); + + [DllImport("lib3mf.dll", EntryPoint = "lib3mf_triangleset_setidentifier", CallingConvention=CallingConvention.Cdecl)] + public unsafe extern static Int32 TriangleSet_SetIdentifier (IntPtr Handle, byte[] AIdentifier); + + [DllImport("lib3mf.dll", EntryPoint = "lib3mf_triangleset_getidentifier", CallingConvention=CallingConvention.Cdecl)] + public unsafe extern static Int32 TriangleSet_GetIdentifier (IntPtr Handle, UInt32 sizeIdentifier, out UInt32 neededIdentifier, IntPtr dataIdentifier); + + [DllImport("lib3mf.dll", EntryPoint = "lib3mf_triangleset_addtriangle", CallingConvention=CallingConvention.Cdecl)] + public unsafe extern static Int32 TriangleSet_AddTriangle (IntPtr Handle, UInt32 ATriangleIndex); + + [DllImport("lib3mf.dll", EntryPoint = "lib3mf_triangleset_removetriangle", CallingConvention=CallingConvention.Cdecl)] + public unsafe extern static Int32 TriangleSet_RemoveTriangle (IntPtr Handle, UInt32 ATriangleIndex); + + [DllImport("lib3mf.dll", EntryPoint = "lib3mf_triangleset_clear", CallingConvention=CallingConvention.Cdecl)] + public unsafe extern static Int32 TriangleSet_Clear (IntPtr Handle); + + [DllImport("lib3mf.dll", EntryPoint = "lib3mf_triangleset_settrianglelist", CallingConvention=CallingConvention.Cdecl)] + public unsafe extern static Int32 TriangleSet_SetTriangleList (IntPtr Handle, UInt64 sizeTriangleIndices, IntPtr dataTriangleIndices); + + [DllImport("lib3mf.dll", EntryPoint = "lib3mf_triangleset_gettrianglelist", CallingConvention=CallingConvention.Cdecl)] + public unsafe extern static Int32 TriangleSet_GetTriangleList (IntPtr Handle, UInt64 sizeTriangleIndices, out UInt64 neededTriangleIndices, IntPtr dataTriangleIndices); + + [DllImport("lib3mf.dll", EntryPoint = "lib3mf_triangleset_addtrianglelist", CallingConvention=CallingConvention.Cdecl)] + public unsafe extern static Int32 TriangleSet_AddTriangleList (IntPtr Handle, UInt64 sizeTriangleIndices, IntPtr dataTriangleIndices); + + [DllImport("lib3mf.dll", EntryPoint = "lib3mf_triangleset_merge", CallingConvention=CallingConvention.Cdecl)] + public unsafe extern static Int32 TriangleSet_Merge (IntPtr Handle, IntPtr AOtherTriangleSet, Byte ADeleteOther); + + [DllImport("lib3mf.dll", EntryPoint = "lib3mf_triangleset_deleteset", CallingConvention=CallingConvention.Cdecl)] + public unsafe extern static Int32 TriangleSet_DeleteSet (IntPtr Handle); + + [DllImport("lib3mf.dll", EntryPoint = "lib3mf_triangleset_duplicate", CallingConvention=CallingConvention.Cdecl)] + public unsafe extern static Int32 TriangleSet_Duplicate (IntPtr Handle, byte[] AIdentifier, out IntPtr ANewSet); + [DllImport("lib3mf.dll", EntryPoint = "lib3mf_object_gettype", CallingConvention=CallingConvention.Cdecl)] public unsafe extern static Int32 Object_GetType (IntPtr Handle, out Int32 AObjectType); @@ -774,6 +813,21 @@ public class Lib3MFWrapper [DllImport("lib3mf.dll", EntryPoint = "lib3mf_meshobject_setvolumedata", CallingConvention=CallingConvention.Cdecl)] public unsafe extern static Int32 MeshObject_SetVolumeData (IntPtr Handle, IntPtr ATheVolumeData); + [DllImport("lib3mf.dll", EntryPoint = "lib3mf_meshobject_addtriangleset", CallingConvention=CallingConvention.Cdecl)] + public unsafe extern static Int32 MeshObject_AddTriangleSet (IntPtr Handle, byte[] AIdentifier, byte[] AName, out IntPtr ATheTriangleSet); + + [DllImport("lib3mf.dll", EntryPoint = "lib3mf_meshobject_hastriangleset", CallingConvention=CallingConvention.Cdecl)] + public unsafe extern static Int32 MeshObject_HasTriangleSet (IntPtr Handle, byte[] AIdentifier, out Byte ATriangleSetExists); + + [DllImport("lib3mf.dll", EntryPoint = "lib3mf_meshobject_findtriangleset", CallingConvention=CallingConvention.Cdecl)] + public unsafe extern static Int32 MeshObject_FindTriangleSet (IntPtr Handle, byte[] AIdentifier, out IntPtr ATheTriangleSet); + + [DllImport("lib3mf.dll", EntryPoint = "lib3mf_meshobject_gettrianglesetcount", CallingConvention=CallingConvention.Cdecl)] + public unsafe extern static Int32 MeshObject_GetTriangleSetCount (IntPtr Handle, out UInt32 ACount); + + [DllImport("lib3mf.dll", EntryPoint = "lib3mf_meshobject_gettriangleset", CallingConvention=CallingConvention.Cdecl)] + public unsafe extern static Int32 MeshObject_GetTriangleSet (IntPtr Handle, UInt32 AIndex, out IntPtr ATheTriangleSet); + [DllImport("lib3mf.dll", EntryPoint = "lib3mf_levelset_getfunction", CallingConvention=CallingConvention.Cdecl)] public unsafe extern static Int32 LevelSet_GetFunction (IntPtr Handle, out IntPtr ATheFunction); @@ -2617,6 +2671,7 @@ public static T PolymorphicFactory(IntPtr Handle) where T : class case 0xA0C005C035D5371D: Object = new CLevelSetIterator(Handle) as T; break; // First 64 bits of SHA1 of a string: "Lib3MF::LevelSetIterator" case 0xD17716D063DE2C22: Object = new CMetaData(Handle) as T; break; // First 64 bits of SHA1 of a string: "Lib3MF::MetaData" case 0x0C3B85369E9B25D3: Object = new CMetaDataGroup(Handle) as T; break; // First 64 bits of SHA1 of a string: "Lib3MF::MetaDataGroup" + case 0x5950BB3EE8A82090: Object = new CTriangleSet(Handle) as T; break; // First 64 bits of SHA1 of a string: "Lib3MF::TriangleSet" case 0x2DA2136F577A779C: Object = new CObject(Handle) as T; break; // First 64 bits of SHA1 of a string: "Lib3MF::Object" case 0x3B3A6DC6EC610497: Object = new CMeshObject(Handle) as T; break; // First 64 bits of SHA1 of a string: "Lib3MF::MeshObject" case 0xE8A7D9C192EFD0E2: Object = new CLevelSet(Handle) as T; break; // First 64 bits of SHA1 of a string: "Lib3MF::LevelSet" @@ -3497,6 +3552,127 @@ public CMetaData AddMetaData (String ANameSpace, String AName, String AValue, St } + public class CTriangleSet : CBase + { + public CTriangleSet (IntPtr NewHandle) : base (NewHandle) + { + } + + public void SetName (String AName) + { + byte[] byteName = Encoding.UTF8.GetBytes(AName + char.MinValue); + + CheckError(Internal.Lib3MFWrapper.TriangleSet_SetName (Handle, byteName)); + } + + public String GetName () + { + UInt32 sizeName = 0; + UInt32 neededName = 0; + CheckError(Internal.Lib3MFWrapper.TriangleSet_GetName (Handle, sizeName, out neededName, IntPtr.Zero)); + sizeName = neededName; + byte[] bytesName = new byte[sizeName]; + GCHandle dataName = GCHandle.Alloc(bytesName, GCHandleType.Pinned); + + CheckError(Internal.Lib3MFWrapper.TriangleSet_GetName (Handle, sizeName, out neededName, dataName.AddrOfPinnedObject())); + dataName.Free(); + return Encoding.UTF8.GetString(bytesName).TrimEnd(char.MinValue); + } + + public void SetIdentifier (String AIdentifier) + { + byte[] byteIdentifier = Encoding.UTF8.GetBytes(AIdentifier + char.MinValue); + + CheckError(Internal.Lib3MFWrapper.TriangleSet_SetIdentifier (Handle, byteIdentifier)); + } + + public String GetIdentifier () + { + UInt32 sizeIdentifier = 0; + UInt32 neededIdentifier = 0; + CheckError(Internal.Lib3MFWrapper.TriangleSet_GetIdentifier (Handle, sizeIdentifier, out neededIdentifier, IntPtr.Zero)); + sizeIdentifier = neededIdentifier; + byte[] bytesIdentifier = new byte[sizeIdentifier]; + GCHandle dataIdentifier = GCHandle.Alloc(bytesIdentifier, GCHandleType.Pinned); + + CheckError(Internal.Lib3MFWrapper.TriangleSet_GetIdentifier (Handle, sizeIdentifier, out neededIdentifier, dataIdentifier.AddrOfPinnedObject())); + dataIdentifier.Free(); + return Encoding.UTF8.GetString(bytesIdentifier).TrimEnd(char.MinValue); + } + + public void AddTriangle (UInt32 ATriangleIndex) + { + + CheckError(Internal.Lib3MFWrapper.TriangleSet_AddTriangle (Handle, ATriangleIndex)); + } + + public void RemoveTriangle (UInt32 ATriangleIndex) + { + + CheckError(Internal.Lib3MFWrapper.TriangleSet_RemoveTriangle (Handle, ATriangleIndex)); + } + + public void Clear () + { + + CheckError(Internal.Lib3MFWrapper.TriangleSet_Clear (Handle)); + } + + public void SetTriangleList (UInt32[] ATriangleIndices) + { + GCHandle dataTriangleIndices = GCHandle.Alloc(ATriangleIndices, GCHandleType.Pinned); + + CheckError(Internal.Lib3MFWrapper.TriangleSet_SetTriangleList (Handle, (UInt64) ATriangleIndices.Length, dataTriangleIndices.AddrOfPinnedObject())); + dataTriangleIndices.Free (); + } + + public void GetTriangleList (out UInt32[] ATriangleIndices) + { + UInt64 sizeTriangleIndices = 0; + UInt64 neededTriangleIndices = 0; + CheckError(Internal.Lib3MFWrapper.TriangleSet_GetTriangleList (Handle, sizeTriangleIndices, out neededTriangleIndices, IntPtr.Zero)); + sizeTriangleIndices = neededTriangleIndices; + ATriangleIndices = new UInt32[sizeTriangleIndices]; + GCHandle dataTriangleIndices = GCHandle.Alloc(ATriangleIndices, GCHandleType.Pinned); + + CheckError(Internal.Lib3MFWrapper.TriangleSet_GetTriangleList (Handle, sizeTriangleIndices, out neededTriangleIndices, dataTriangleIndices.AddrOfPinnedObject())); + dataTriangleIndices.Free(); + } + + public void AddTriangleList (UInt32[] ATriangleIndices) + { + GCHandle dataTriangleIndices = GCHandle.Alloc(ATriangleIndices, GCHandleType.Pinned); + + CheckError(Internal.Lib3MFWrapper.TriangleSet_AddTriangleList (Handle, (UInt64) ATriangleIndices.Length, dataTriangleIndices.AddrOfPinnedObject())); + dataTriangleIndices.Free (); + } + + public void Merge (CTriangleSet AOtherTriangleSet, bool ADeleteOther) + { + IntPtr AOtherTriangleSetHandle = IntPtr.Zero; + if (AOtherTriangleSet != null) + AOtherTriangleSetHandle = AOtherTriangleSet.GetHandle(); + + CheckError(Internal.Lib3MFWrapper.TriangleSet_Merge (Handle, AOtherTriangleSetHandle, (Byte)( ADeleteOther ? 1 : 0 ))); + } + + public void DeleteSet () + { + + CheckError(Internal.Lib3MFWrapper.TriangleSet_DeleteSet (Handle)); + } + + public CTriangleSet Duplicate (String AIdentifier) + { + byte[] byteIdentifier = Encoding.UTF8.GetBytes(AIdentifier + char.MinValue); + IntPtr newNewSet = IntPtr.Zero; + + CheckError(Internal.Lib3MFWrapper.TriangleSet_Duplicate (Handle, byteIdentifier, out newNewSet)); + return Internal.Lib3MFWrapper.PolymorphicFactory(newNewSet); + } + + } + public class CObject : CResource { public CObject (IntPtr NewHandle) : base (NewHandle) @@ -3915,6 +4091,50 @@ public void SetVolumeData (CVolumeData ATheVolumeData) CheckError(Internal.Lib3MFWrapper.MeshObject_SetVolumeData (Handle, ATheVolumeDataHandle)); } + public CTriangleSet AddTriangleSet (String AIdentifier, String AName) + { + byte[] byteIdentifier = Encoding.UTF8.GetBytes(AIdentifier + char.MinValue); + byte[] byteName = Encoding.UTF8.GetBytes(AName + char.MinValue); + IntPtr newTheTriangleSet = IntPtr.Zero; + + CheckError(Internal.Lib3MFWrapper.MeshObject_AddTriangleSet (Handle, byteIdentifier, byteName, out newTheTriangleSet)); + return Internal.Lib3MFWrapper.PolymorphicFactory(newTheTriangleSet); + } + + public bool HasTriangleSet (String AIdentifier) + { + byte[] byteIdentifier = Encoding.UTF8.GetBytes(AIdentifier + char.MinValue); + Byte resultTriangleSetExists = 0; + + CheckError(Internal.Lib3MFWrapper.MeshObject_HasTriangleSet (Handle, byteIdentifier, out resultTriangleSetExists)); + return (resultTriangleSetExists != 0); + } + + public CTriangleSet FindTriangleSet (String AIdentifier) + { + byte[] byteIdentifier = Encoding.UTF8.GetBytes(AIdentifier + char.MinValue); + IntPtr newTheTriangleSet = IntPtr.Zero; + + CheckError(Internal.Lib3MFWrapper.MeshObject_FindTriangleSet (Handle, byteIdentifier, out newTheTriangleSet)); + return Internal.Lib3MFWrapper.PolymorphicFactory(newTheTriangleSet); + } + + public UInt32 GetTriangleSetCount () + { + UInt32 resultCount = 0; + + CheckError(Internal.Lib3MFWrapper.MeshObject_GetTriangleSetCount (Handle, out resultCount)); + return resultCount; + } + + public CTriangleSet GetTriangleSet (UInt32 AIndex) + { + IntPtr newTheTriangleSet = IntPtr.Zero; + + CheckError(Internal.Lib3MFWrapper.MeshObject_GetTriangleSet (Handle, AIndex, out newTheTriangleSet)); + return Internal.Lib3MFWrapper.PolymorphicFactory(newTheTriangleSet); + } + } public class CLevelSet : CObject diff --git a/Autogenerated/Bindings/Cpp/lib3mf_abi.hpp b/Autogenerated/Bindings/Cpp/lib3mf_abi.hpp index 1e3907a6..608d1bd0 100644 --- a/Autogenerated/Bindings/Cpp/lib3mf_abi.hpp +++ b/Autogenerated/Bindings/Cpp/lib3mf_abi.hpp @@ -793,6 +793,135 @@ LIB3MF_DECLSPEC Lib3MFResult lib3mf_metadatagroup_removemetadata(Lib3MF_MetaData */ LIB3MF_DECLSPEC Lib3MFResult lib3mf_metadatagroup_addmetadata(Lib3MF_MetaDataGroup pMetaDataGroup, const char * pNameSpace, const char * pName, const char * pValue, const char * pType, bool bMustPreserve, Lib3MF_MetaData * pMetaData); +/************************************************************************************************************************* + Class definition for TriangleSet +**************************************************************************************************************************/ + +/** +* sets the name of the triangle set +* +* @param[in] pTriangleSet - TriangleSet instance. +* @param[in] pName - the new name +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_triangleset_setname(Lib3MF_TriangleSet pTriangleSet, const char * pName); + +/** +* returns the name of the triangle set +* +* @param[in] pTriangleSet - TriangleSet instance. +* @param[in] nNameBufferSize - size of the buffer (including trailing 0) +* @param[out] pNameNeededChars - will be filled with the count of the written bytes, or needed buffer size. +* @param[out] pNameBuffer - buffer of returns the name, may be NULL +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_triangleset_getname(Lib3MF_TriangleSet pTriangleSet, const Lib3MF_uint32 nNameBufferSize, Lib3MF_uint32* pNameNeededChars, char * pNameBuffer); + +/** +* sets the identifier of the triangle set. +* +* @param[in] pTriangleSet - TriangleSet instance. +* @param[in] pIdentifier - the new identifier. MUST be unique within the mesh. MUST NOT be an empty string +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_triangleset_setidentifier(Lib3MF_TriangleSet pTriangleSet, const char * pIdentifier); + +/** +* returns the identifier of the triangle set +* +* @param[in] pTriangleSet - TriangleSet instance. +* @param[in] nIdentifierBufferSize - size of the buffer (including trailing 0) +* @param[out] pIdentifierNeededChars - will be filled with the count of the written bytes, or needed buffer size. +* @param[out] pIdentifierBuffer - buffer of returns the identifier, may be NULL +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_triangleset_getidentifier(Lib3MF_TriangleSet pTriangleSet, const Lib3MF_uint32 nIdentifierBufferSize, Lib3MF_uint32* pIdentifierNeededChars, char * pIdentifierBuffer); + +/** +* adds a triangle to the set. Does nothing if triangle is already in the set. +* +* @param[in] pTriangleSet - TriangleSet instance. +* @param[in] nTriangleIndex - Triangle index to add. MUST be between 0 and TriangleCount - 1. +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_triangleset_addtriangle(Lib3MF_TriangleSet pTriangleSet, Lib3MF_uint32 nTriangleIndex); + +/** +* removes a triangle from the set +* +* @param[in] pTriangleSet - TriangleSet instance. +* @param[in] nTriangleIndex - Triangle index to remove. MUST be between 0 and TriangleCount - 1. +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_triangleset_removetriangle(Lib3MF_TriangleSet pTriangleSet, Lib3MF_uint32 nTriangleIndex); + +/** +* clears all triangles from the list +* +* @param[in] pTriangleSet - TriangleSet instance. +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_triangleset_clear(Lib3MF_TriangleSet pTriangleSet); + +/** +* Sets all triangles in the list, while clearing old values. Duplicates will be merged. +* +* @param[in] pTriangleSet - TriangleSet instance. +* @param[in] nTriangleIndicesBufferSize - Number of elements in buffer +* @param[in] pTriangleIndicesBuffer - uint32 buffer of Triangle indices to add. Every element MUST be between 0 and TriangleCount - 1. +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_triangleset_settrianglelist(Lib3MF_TriangleSet pTriangleSet, Lib3MF_uint64 nTriangleIndicesBufferSize, const Lib3MF_uint32 * pTriangleIndicesBuffer); + +/** +* Retrieves all the triangles in the TriangleSet +* +* @param[in] pTriangleSet - TriangleSet instance. +* @param[in] nTriangleIndicesBufferSize - Number of elements in buffer +* @param[out] pTriangleIndicesNeededCount - will be filled with the count of the written elements, or needed buffer size. +* @param[out] pTriangleIndicesBuffer - uint32 buffer of retrieves the indices of the triangles in this TriangleSet +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_triangleset_gettrianglelist(Lib3MF_TriangleSet pTriangleSet, const Lib3MF_uint64 nTriangleIndicesBufferSize, Lib3MF_uint64* pTriangleIndicesNeededCount, Lib3MF_uint32 * pTriangleIndicesBuffer); + +/** +* Adds multiple triangles in the list. Duplicates will be merged. +* +* @param[in] pTriangleSet - TriangleSet instance. +* @param[in] nTriangleIndicesBufferSize - Number of elements in buffer +* @param[in] pTriangleIndicesBuffer - uint32 buffer of Triangle indices to add. Every element MUST be between 0 and TriangleCount - 1. +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_triangleset_addtrianglelist(Lib3MF_TriangleSet pTriangleSet, Lib3MF_uint64 nTriangleIndicesBufferSize, const Lib3MF_uint32 * pTriangleIndicesBuffer); + +/** +* Merges another Triangle set. +* +* @param[in] pTriangleSet - TriangleSet instance. +* @param[in] pOtherTriangleSet - Other triangle set to merge. +* @param[in] bDeleteOther - Flag if other triangle set is getting removed. +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_triangleset_merge(Lib3MF_TriangleSet pTriangleSet, Lib3MF_TriangleSet pOtherTriangleSet, bool bDeleteOther); + +/** +* Deletes the whole set from the mesh. +* +* @param[in] pTriangleSet - TriangleSet instance. +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_triangleset_deleteset(Lib3MF_TriangleSet pTriangleSet); + +/** +* Duplicates the set in the mesh. +* +* @param[in] pTriangleSet - TriangleSet instance. +* @param[in] pIdentifier - the new identifier. MUST be unique within the mesh. MUST NOT be an empty string +* @param[out] pNewSet - Copy of the triangle set. +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_triangleset_duplicate(Lib3MF_TriangleSet pTriangleSet, const char * pIdentifier, Lib3MF_TriangleSet * pNewSet); + /************************************************************************************************************************* Class definition for Object **************************************************************************************************************************/ @@ -1232,6 +1361,56 @@ LIB3MF_DECLSPEC Lib3MFResult lib3mf_meshobject_getvolumedata(Lib3MF_MeshObject p */ LIB3MF_DECLSPEC Lib3MFResult lib3mf_meshobject_setvolumedata(Lib3MF_MeshObject pMeshObject, Lib3MF_VolumeData pTheVolumeData); +/** +* Adds a new triangle set. +* +* @param[in] pMeshObject - MeshObject instance. +* @param[in] pIdentifier - the new identifier. MUST be unique within the mesh. MUST NOT be an empty string +* @param[in] pName - the human readable name. MUST NOT be an empty string +* @param[out] pTheTriangleSet - the new Triangle Set Instance. +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_meshobject_addtriangleset(Lib3MF_MeshObject pMeshObject, const char * pIdentifier, const char * pName, Lib3MF_TriangleSet * pTheTriangleSet); + +/** +* Checks if a triangle set exists. +* +* @param[in] pMeshObject - MeshObject instance. +* @param[in] pIdentifier - the identifier to be found. +* @param[out] pTriangleSetExists - flag if the triangles set exists. +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_meshobject_hastriangleset(Lib3MF_MeshObject pMeshObject, const char * pIdentifier, bool * pTriangleSetExists); + +/** +* Finds a new triangle set by identifier. Fails if not existing. +* +* @param[in] pMeshObject - MeshObject instance. +* @param[in] pIdentifier - the identifier to be found. +* @param[out] pTheTriangleSet - the triangle Set Instance. +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_meshobject_findtriangleset(Lib3MF_MeshObject pMeshObject, const char * pIdentifier, Lib3MF_TriangleSet * pTheTriangleSet); + +/** +* Returns number of triangle sets. +* +* @param[in] pMeshObject - MeshObject instance. +* @param[out] pCount - the number of triangle sets of this mesh. +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_meshobject_gettrianglesetcount(Lib3MF_MeshObject pMeshObject, Lib3MF_uint32 * pCount); + +/** +* Returns a specific triangle set by index. +* +* @param[in] pMeshObject - MeshObject instance. +* @param[in] nIndex - the index of the triangle set. +* @param[out] pTheTriangleSet - the triangle Set Instance. +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_meshobject_gettriangleset(Lib3MF_MeshObject pMeshObject, Lib3MF_uint32 nIndex, Lib3MF_TriangleSet * pTheTriangleSet); + /************************************************************************************************************************* Class definition for LevelSet **************************************************************************************************************************/ diff --git a/Autogenerated/Bindings/Cpp/lib3mf_implicit.hpp b/Autogenerated/Bindings/Cpp/lib3mf_implicit.hpp index cc9e59ba..3de401e0 100644 --- a/Autogenerated/Bindings/Cpp/lib3mf_implicit.hpp +++ b/Autogenerated/Bindings/Cpp/lib3mf_implicit.hpp @@ -78,6 +78,7 @@ class CFunctionIterator; class CLevelSetIterator; class CMetaData; class CMetaDataGroup; +class CTriangleSet; class CObject; class CMeshObject; class CLevelSet; @@ -198,6 +199,7 @@ typedef CFunctionIterator CLib3MFFunctionIterator; typedef CLevelSetIterator CLib3MFLevelSetIterator; typedef CMetaData CLib3MFMetaData; typedef CMetaDataGroup CLib3MFMetaDataGroup; +typedef CTriangleSet CLib3MFTriangleSet; typedef CObject CLib3MFObject; typedef CMeshObject CLib3MFMeshObject; typedef CLevelSet CLib3MFLevelSet; @@ -318,6 +320,7 @@ typedef std::shared_ptr PFunctionIterator; typedef std::shared_ptr PLevelSetIterator; typedef std::shared_ptr PMetaData; typedef std::shared_ptr PMetaDataGroup; +typedef std::shared_ptr PTriangleSet; typedef std::shared_ptr PObject; typedef std::shared_ptr PMeshObject; typedef std::shared_ptr PLevelSet; @@ -438,6 +441,7 @@ typedef PFunctionIterator PLib3MFFunctionIterator; typedef PLevelSetIterator PLib3MFLevelSetIterator; typedef PMetaData PLib3MFMetaData; typedef PMetaDataGroup PLib3MFMetaDataGroup; +typedef PTriangleSet PLib3MFTriangleSet; typedef PObject PLib3MFObject; typedef PMeshObject PLib3MFMeshObject; typedef PLevelSet PLib3MFLevelSet; @@ -650,6 +654,8 @@ class ELib3MFException : public std::exception { case LIB3MF_ERROR_ELEMENTCOUNTEXCEEDSLIMIT: return "ELEMENTCOUNTEXCEEDSLIMIT"; case LIB3MF_ERROR_INVALIDRESOURCE: return "INVALIDRESOURCE"; case LIB3MF_ERROR_INVALIDLEVELSET: return "INVALIDLEVELSET"; + case LIB3MF_ERROR_COULDNOTFINDTRIANGLESET: return "COULDNOTFINDTRIANGLESET"; + case LIB3MF_ERROR_INVALIDTRIANGLESETINDEX: return "INVALIDTRIANGLESETINDEX"; case LIB3MF_ERROR_BEAMLATTICE_INVALID_OBJECTTYPE: return "BEAMLATTICE_INVALID_OBJECTTYPE"; case LIB3MF_ERROR_INVALIDKEYSTORE: return "INVALIDKEYSTORE"; case LIB3MF_ERROR_INVALIDKEYSTORECONSUMER: return "INVALIDKEYSTORECONSUMER"; @@ -706,6 +712,8 @@ class ELib3MFException : public std::exception { case LIB3MF_ERROR_ELEMENTCOUNTEXCEEDSLIMIT: return "An element buffer exceeds its spec limit"; case LIB3MF_ERROR_INVALIDRESOURCE: return "A resource is invalid"; case LIB3MF_ERROR_INVALIDLEVELSET: return "A level set is invalid"; + case LIB3MF_ERROR_COULDNOTFINDTRIANGLESET: return "Could not find triangle set"; + case LIB3MF_ERROR_INVALIDTRIANGLESETINDEX: return "Invalid triangle set index"; case LIB3MF_ERROR_BEAMLATTICE_INVALID_OBJECTTYPE: return "This object type is not valid for beamlattices"; case LIB3MF_ERROR_INVALIDKEYSTORE: return "The keystore object is invalid"; case LIB3MF_ERROR_INVALIDKEYSTORECONSUMER: return "The consumer keystore object is invalid"; @@ -846,6 +854,7 @@ class CWrapper { friend class CLevelSetIterator; friend class CMetaData; friend class CMetaDataGroup; + friend class CTriangleSet; friend class CObject; friend class CMeshObject; friend class CLevelSet; @@ -1388,6 +1397,35 @@ class CMetaDataGroup : public CBase { inline PMetaData AddMetaData(const std::string & sNameSpace, const std::string & sName, const std::string & sValue, const std::string & sType, const bool bMustPreserve); }; +/************************************************************************************************************************* + Class CTriangleSet +**************************************************************************************************************************/ +class CTriangleSet : public CBase { +public: + + /** + * CTriangleSet::CTriangleSet - Constructor for TriangleSet class. + */ + CTriangleSet(CWrapper* pWrapper, Lib3MFHandle pHandle) + : CBase(pWrapper, pHandle) + { + } + + inline void SetName(const std::string & sName); + inline std::string GetName(); + inline void SetIdentifier(const std::string & sIdentifier); + inline std::string GetIdentifier(); + inline void AddTriangle(const Lib3MF_uint32 nTriangleIndex); + inline void RemoveTriangle(const Lib3MF_uint32 nTriangleIndex); + inline void Clear(); + inline void SetTriangleList(const CInputVector & TriangleIndicesBuffer); + inline void GetTriangleList(std::vector & TriangleIndicesBuffer); + inline void AddTriangleList(const CInputVector & TriangleIndicesBuffer); + inline void Merge(classParam pOtherTriangleSet, const bool bDeleteOther); + inline void DeleteSet(); + inline PTriangleSet Duplicate(const std::string & sIdentifier); +}; + /************************************************************************************************************************* Class CObject **************************************************************************************************************************/ @@ -1463,6 +1501,11 @@ class CMeshObject : public CObject { inline PBeamLattice BeamLattice(); inline PVolumeData GetVolumeData(); inline void SetVolumeData(classParam pTheVolumeData); + inline PTriangleSet AddTriangleSet(const std::string & sIdentifier, const std::string & sName); + inline bool HasTriangleSet(const std::string & sIdentifier); + inline PTriangleSet FindTriangleSet(const std::string & sIdentifier); + inline Lib3MF_uint32 GetTriangleSetCount(); + inline PTriangleSet GetTriangleSet(const Lib3MF_uint32 nIndex); }; /************************************************************************************************************************* @@ -3444,6 +3487,7 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle) case 0xA0C005C035D5371DUL: return new CLevelSetIterator(this, pHandle); break; // First 64 bits of SHA1 of a string: "Lib3MF::LevelSetIterator" case 0xD17716D063DE2C22UL: return new CMetaData(this, pHandle); break; // First 64 bits of SHA1 of a string: "Lib3MF::MetaData" case 0x0C3B85369E9B25D3UL: return new CMetaDataGroup(this, pHandle); break; // First 64 bits of SHA1 of a string: "Lib3MF::MetaDataGroup" + case 0x5950BB3EE8A82090UL: return new CTriangleSet(this, pHandle); break; // First 64 bits of SHA1 of a string: "Lib3MF::TriangleSet" case 0x2DA2136F577A779CUL: return new CObject(this, pHandle); break; // First 64 bits of SHA1 of a string: "Lib3MF::Object" case 0x3B3A6DC6EC610497UL: return new CMeshObject(this, pHandle); break; // First 64 bits of SHA1 of a string: "Lib3MF::MeshObject" case 0xE8A7D9C192EFD0E2UL: return new CLevelSet(this, pHandle); break; // First 64 bits of SHA1 of a string: "Lib3MF::LevelSet" @@ -4754,6 +4798,152 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle) return std::shared_ptr(dynamic_cast(m_pWrapper->polymorphicFactory(hMetaData))); } + /** + * Method definitions for class CTriangleSet + */ + + /** + * CTriangleSet::SetName - sets the name of the triangle set + * @param[in] sName - the new name + */ + void CTriangleSet::SetName(const std::string & sName) + { + CheckError(lib3mf_triangleset_setname(m_pHandle, sName.c_str())); + } + + /** + * CTriangleSet::GetName - returns the name of the triangle set + * @return returns the name + */ + std::string CTriangleSet::GetName() + { + Lib3MF_uint32 bytesNeededName = 0; + Lib3MF_uint32 bytesWrittenName = 0; + CheckError(lib3mf_triangleset_getname(m_pHandle, 0, &bytesNeededName, nullptr)); + std::vector bufferName(bytesNeededName); + CheckError(lib3mf_triangleset_getname(m_pHandle, bytesNeededName, &bytesWrittenName, &bufferName[0])); + + return std::string(&bufferName[0]); + } + + /** + * CTriangleSet::SetIdentifier - sets the identifier of the triangle set. + * @param[in] sIdentifier - the new identifier. MUST be unique within the mesh. MUST NOT be an empty string + */ + void CTriangleSet::SetIdentifier(const std::string & sIdentifier) + { + CheckError(lib3mf_triangleset_setidentifier(m_pHandle, sIdentifier.c_str())); + } + + /** + * CTriangleSet::GetIdentifier - returns the identifier of the triangle set + * @return returns the identifier + */ + std::string CTriangleSet::GetIdentifier() + { + Lib3MF_uint32 bytesNeededIdentifier = 0; + Lib3MF_uint32 bytesWrittenIdentifier = 0; + CheckError(lib3mf_triangleset_getidentifier(m_pHandle, 0, &bytesNeededIdentifier, nullptr)); + std::vector bufferIdentifier(bytesNeededIdentifier); + CheckError(lib3mf_triangleset_getidentifier(m_pHandle, bytesNeededIdentifier, &bytesWrittenIdentifier, &bufferIdentifier[0])); + + return std::string(&bufferIdentifier[0]); + } + + /** + * CTriangleSet::AddTriangle - adds a triangle to the set. Does nothing if triangle is already in the set. + * @param[in] nTriangleIndex - Triangle index to add. MUST be between 0 and TriangleCount - 1. + */ + void CTriangleSet::AddTriangle(const Lib3MF_uint32 nTriangleIndex) + { + CheckError(lib3mf_triangleset_addtriangle(m_pHandle, nTriangleIndex)); + } + + /** + * CTriangleSet::RemoveTriangle - removes a triangle from the set + * @param[in] nTriangleIndex - Triangle index to remove. MUST be between 0 and TriangleCount - 1. + */ + void CTriangleSet::RemoveTriangle(const Lib3MF_uint32 nTriangleIndex) + { + CheckError(lib3mf_triangleset_removetriangle(m_pHandle, nTriangleIndex)); + } + + /** + * CTriangleSet::Clear - clears all triangles from the list + */ + void CTriangleSet::Clear() + { + CheckError(lib3mf_triangleset_clear(m_pHandle)); + } + + /** + * CTriangleSet::SetTriangleList - Sets all triangles in the list, while clearing old values. Duplicates will be merged. + * @param[in] TriangleIndicesBuffer - Triangle indices to add. Every element MUST be between 0 and TriangleCount - 1. + */ + void CTriangleSet::SetTriangleList(const CInputVector & TriangleIndicesBuffer) + { + Lib3MF_uint64 nTriangleIndicesSize = TriangleIndicesBuffer.size(); + CheckError(lib3mf_triangleset_settrianglelist(m_pHandle, nTriangleIndicesSize, TriangleIndicesBuffer.data())); + } + + /** + * CTriangleSet::GetTriangleList - Retrieves all the triangles in the TriangleSet + * @param[out] TriangleIndicesBuffer - retrieves the indices of the triangles in this TriangleSet + */ + void CTriangleSet::GetTriangleList(std::vector & TriangleIndicesBuffer) + { + Lib3MF_uint64 elementsNeededTriangleIndices = 0; + Lib3MF_uint64 elementsWrittenTriangleIndices = 0; + CheckError(lib3mf_triangleset_gettrianglelist(m_pHandle, 0, &elementsNeededTriangleIndices, nullptr)); + TriangleIndicesBuffer.resize((size_t) elementsNeededTriangleIndices); + CheckError(lib3mf_triangleset_gettrianglelist(m_pHandle, elementsNeededTriangleIndices, &elementsWrittenTriangleIndices, TriangleIndicesBuffer.data())); + } + + /** + * CTriangleSet::AddTriangleList - Adds multiple triangles in the list. Duplicates will be merged. + * @param[in] TriangleIndicesBuffer - Triangle indices to add. Every element MUST be between 0 and TriangleCount - 1. + */ + void CTriangleSet::AddTriangleList(const CInputVector & TriangleIndicesBuffer) + { + Lib3MF_uint64 nTriangleIndicesSize = TriangleIndicesBuffer.size(); + CheckError(lib3mf_triangleset_addtrianglelist(m_pHandle, nTriangleIndicesSize, TriangleIndicesBuffer.data())); + } + + /** + * CTriangleSet::Merge - Merges another Triangle set. + * @param[in] pOtherTriangleSet - Other triangle set to merge. + * @param[in] bDeleteOther - Flag if other triangle set is getting removed. + */ + void CTriangleSet::Merge(classParam pOtherTriangleSet, const bool bDeleteOther) + { + Lib3MFHandle hOtherTriangleSet = pOtherTriangleSet.GetHandle(); + CheckError(lib3mf_triangleset_merge(m_pHandle, hOtherTriangleSet, bDeleteOther)); + } + + /** + * CTriangleSet::DeleteSet - Deletes the whole set from the mesh. + */ + void CTriangleSet::DeleteSet() + { + CheckError(lib3mf_triangleset_deleteset(m_pHandle)); + } + + /** + * CTriangleSet::Duplicate - Duplicates the set in the mesh. + * @param[in] sIdentifier - the new identifier. MUST be unique within the mesh. MUST NOT be an empty string + * @return Copy of the triangle set. + */ + PTriangleSet CTriangleSet::Duplicate(const std::string & sIdentifier) + { + Lib3MFHandle hNewSet = (Lib3MFHandle)nullptr; + CheckError(lib3mf_triangleset_duplicate(m_pHandle, sIdentifier.c_str(), &hNewSet)); + + if (!hNewSet) { + CheckError(LIB3MF_ERROR_INVALIDPARAM); + } + return std::shared_ptr(dynamic_cast(m_pWrapper->polymorphicFactory(hNewSet))); + } + /** * Method definitions for class CObject */ @@ -5294,6 +5484,80 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle) CheckError(lib3mf_meshobject_setvolumedata(m_pHandle, hTheVolumeData)); } + /** + * CMeshObject::AddTriangleSet - Adds a new triangle set. + * @param[in] sIdentifier - the new identifier. MUST be unique within the mesh. MUST NOT be an empty string + * @param[in] sName - the human readable name. MUST NOT be an empty string + * @return the new Triangle Set Instance. + */ + PTriangleSet CMeshObject::AddTriangleSet(const std::string & sIdentifier, const std::string & sName) + { + Lib3MFHandle hTheTriangleSet = (Lib3MFHandle)nullptr; + CheckError(lib3mf_meshobject_addtriangleset(m_pHandle, sIdentifier.c_str(), sName.c_str(), &hTheTriangleSet)); + + if (!hTheTriangleSet) { + CheckError(LIB3MF_ERROR_INVALIDPARAM); + } + return std::shared_ptr(dynamic_cast(m_pWrapper->polymorphicFactory(hTheTriangleSet))); + } + + /** + * CMeshObject::HasTriangleSet - Checks if a triangle set exists. + * @param[in] sIdentifier - the identifier to be found. + * @return flag if the triangles set exists. + */ + bool CMeshObject::HasTriangleSet(const std::string & sIdentifier) + { + bool resultTriangleSetExists = 0; + CheckError(lib3mf_meshobject_hastriangleset(m_pHandle, sIdentifier.c_str(), &resultTriangleSetExists)); + + return resultTriangleSetExists; + } + + /** + * CMeshObject::FindTriangleSet - Finds a new triangle set by identifier. Fails if not existing. + * @param[in] sIdentifier - the identifier to be found. + * @return the triangle Set Instance. + */ + PTriangleSet CMeshObject::FindTriangleSet(const std::string & sIdentifier) + { + Lib3MFHandle hTheTriangleSet = (Lib3MFHandle)nullptr; + CheckError(lib3mf_meshobject_findtriangleset(m_pHandle, sIdentifier.c_str(), &hTheTriangleSet)); + + if (!hTheTriangleSet) { + CheckError(LIB3MF_ERROR_INVALIDPARAM); + } + return std::shared_ptr(dynamic_cast(m_pWrapper->polymorphicFactory(hTheTriangleSet))); + } + + /** + * CMeshObject::GetTriangleSetCount - Returns number of triangle sets. + * @return the number of triangle sets of this mesh. + */ + Lib3MF_uint32 CMeshObject::GetTriangleSetCount() + { + Lib3MF_uint32 resultCount = 0; + CheckError(lib3mf_meshobject_gettrianglesetcount(m_pHandle, &resultCount)); + + return resultCount; + } + + /** + * CMeshObject::GetTriangleSet - Returns a specific triangle set by index. + * @param[in] nIndex - the index of the triangle set. + * @return the triangle Set Instance. + */ + PTriangleSet CMeshObject::GetTriangleSet(const Lib3MF_uint32 nIndex) + { + Lib3MFHandle hTheTriangleSet = (Lib3MFHandle)nullptr; + CheckError(lib3mf_meshobject_gettriangleset(m_pHandle, nIndex, &hTheTriangleSet)); + + if (!hTheTriangleSet) { + CheckError(LIB3MF_ERROR_INVALIDPARAM); + } + return std::shared_ptr(dynamic_cast(m_pWrapper->polymorphicFactory(hTheTriangleSet))); + } + /** * Method definitions for class CLevelSet */ diff --git a/Autogenerated/Bindings/Cpp/lib3mf_types.hpp b/Autogenerated/Bindings/Cpp/lib3mf_types.hpp index 4ba95915..0d520b82 100644 --- a/Autogenerated/Bindings/Cpp/lib3mf_types.hpp +++ b/Autogenerated/Bindings/Cpp/lib3mf_types.hpp @@ -130,6 +130,8 @@ typedef void * Lib3MF_pvoid; #define LIB3MF_ERROR_ELEMENTCOUNTEXCEEDSLIMIT 141 /** An element buffer exceeds its spec limit */ #define LIB3MF_ERROR_INVALIDRESOURCE 142 /** A resource is invalid */ #define LIB3MF_ERROR_INVALIDLEVELSET 143 /** A level set is invalid */ +#define LIB3MF_ERROR_COULDNOTFINDTRIANGLESET 144 /** Could not find triangle set */ +#define LIB3MF_ERROR_INVALIDTRIANGLESETINDEX 145 /** Invalid triangle set index */ #define LIB3MF_ERROR_BEAMLATTICE_INVALID_OBJECTTYPE 2000 /** This object type is not valid for beamlattices */ #define LIB3MF_ERROR_INVALIDKEYSTORE 3000 /** The keystore object is invalid */ #define LIB3MF_ERROR_INVALIDKEYSTORECONSUMER 3001 /** The consumer keystore object is invalid */ @@ -186,6 +188,8 @@ inline const char * LIB3MF_GETERRORSTRING (Lib3MFResult nErrorCode) { case LIB3MF_ERROR_ELEMENTCOUNTEXCEEDSLIMIT: return "An element buffer exceeds its spec limit"; case LIB3MF_ERROR_INVALIDRESOURCE: return "A resource is invalid"; case LIB3MF_ERROR_INVALIDLEVELSET: return "A level set is invalid"; + case LIB3MF_ERROR_COULDNOTFINDTRIANGLESET: return "Could not find triangle set"; + case LIB3MF_ERROR_INVALIDTRIANGLESETINDEX: return "Invalid triangle set index"; case LIB3MF_ERROR_BEAMLATTICE_INVALID_OBJECTTYPE: return "This object type is not valid for beamlattices"; case LIB3MF_ERROR_INVALIDKEYSTORE: return "The keystore object is invalid"; case LIB3MF_ERROR_INVALIDKEYSTORECONSUMER: return "The consumer keystore object is invalid"; @@ -226,6 +230,7 @@ typedef Lib3MFHandle Lib3MF_FunctionIterator; typedef Lib3MFHandle Lib3MF_LevelSetIterator; typedef Lib3MFHandle Lib3MF_MetaData; typedef Lib3MFHandle Lib3MF_MetaDataGroup; +typedef Lib3MFHandle Lib3MF_TriangleSet; typedef Lib3MFHandle Lib3MF_Object; typedef Lib3MFHandle Lib3MF_MeshObject; typedef Lib3MFHandle Lib3MF_LevelSet; diff --git a/Autogenerated/Bindings/CppDynamic/lib3mf_dynamic.h b/Autogenerated/Bindings/CppDynamic/lib3mf_dynamic.h index 217e5561..3189ac21 100644 --- a/Autogenerated/Bindings/CppDynamic/lib3mf_dynamic.h +++ b/Autogenerated/Bindings/CppDynamic/lib3mf_dynamic.h @@ -780,6 +780,135 @@ typedef Lib3MFResult (*PLib3MFMetaDataGroup_RemoveMetaDataPtr) (Lib3MF_MetaDataG */ typedef Lib3MFResult (*PLib3MFMetaDataGroup_AddMetaDataPtr) (Lib3MF_MetaDataGroup pMetaDataGroup, const char * pNameSpace, const char * pName, const char * pValue, const char * pType, bool bMustPreserve, Lib3MF_MetaData * pMetaData); +/************************************************************************************************************************* + Class definition for TriangleSet +**************************************************************************************************************************/ + +/** +* sets the name of the triangle set +* +* @param[in] pTriangleSet - TriangleSet instance. +* @param[in] pName - the new name +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFTriangleSet_SetNamePtr) (Lib3MF_TriangleSet pTriangleSet, const char * pName); + +/** +* returns the name of the triangle set +* +* @param[in] pTriangleSet - TriangleSet instance. +* @param[in] nNameBufferSize - size of the buffer (including trailing 0) +* @param[out] pNameNeededChars - will be filled with the count of the written bytes, or needed buffer size. +* @param[out] pNameBuffer - buffer of returns the name, may be NULL +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFTriangleSet_GetNamePtr) (Lib3MF_TriangleSet pTriangleSet, const Lib3MF_uint32 nNameBufferSize, Lib3MF_uint32* pNameNeededChars, char * pNameBuffer); + +/** +* sets the identifier of the triangle set. +* +* @param[in] pTriangleSet - TriangleSet instance. +* @param[in] pIdentifier - the new identifier. MUST be unique within the mesh. MUST NOT be an empty string +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFTriangleSet_SetIdentifierPtr) (Lib3MF_TriangleSet pTriangleSet, const char * pIdentifier); + +/** +* returns the identifier of the triangle set +* +* @param[in] pTriangleSet - TriangleSet instance. +* @param[in] nIdentifierBufferSize - size of the buffer (including trailing 0) +* @param[out] pIdentifierNeededChars - will be filled with the count of the written bytes, or needed buffer size. +* @param[out] pIdentifierBuffer - buffer of returns the identifier, may be NULL +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFTriangleSet_GetIdentifierPtr) (Lib3MF_TriangleSet pTriangleSet, const Lib3MF_uint32 nIdentifierBufferSize, Lib3MF_uint32* pIdentifierNeededChars, char * pIdentifierBuffer); + +/** +* adds a triangle to the set. Does nothing if triangle is already in the set. +* +* @param[in] pTriangleSet - TriangleSet instance. +* @param[in] nTriangleIndex - Triangle index to add. MUST be between 0 and TriangleCount - 1. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFTriangleSet_AddTrianglePtr) (Lib3MF_TriangleSet pTriangleSet, Lib3MF_uint32 nTriangleIndex); + +/** +* removes a triangle from the set +* +* @param[in] pTriangleSet - TriangleSet instance. +* @param[in] nTriangleIndex - Triangle index to remove. MUST be between 0 and TriangleCount - 1. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFTriangleSet_RemoveTrianglePtr) (Lib3MF_TriangleSet pTriangleSet, Lib3MF_uint32 nTriangleIndex); + +/** +* clears all triangles from the list +* +* @param[in] pTriangleSet - TriangleSet instance. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFTriangleSet_ClearPtr) (Lib3MF_TriangleSet pTriangleSet); + +/** +* Sets all triangles in the list, while clearing old values. Duplicates will be merged. +* +* @param[in] pTriangleSet - TriangleSet instance. +* @param[in] nTriangleIndicesBufferSize - Number of elements in buffer +* @param[in] pTriangleIndicesBuffer - uint32 buffer of Triangle indices to add. Every element MUST be between 0 and TriangleCount - 1. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFTriangleSet_SetTriangleListPtr) (Lib3MF_TriangleSet pTriangleSet, Lib3MF_uint64 nTriangleIndicesBufferSize, const Lib3MF_uint32 * pTriangleIndicesBuffer); + +/** +* Retrieves all the triangles in the TriangleSet +* +* @param[in] pTriangleSet - TriangleSet instance. +* @param[in] nTriangleIndicesBufferSize - Number of elements in buffer +* @param[out] pTriangleIndicesNeededCount - will be filled with the count of the written elements, or needed buffer size. +* @param[out] pTriangleIndicesBuffer - uint32 buffer of retrieves the indices of the triangles in this TriangleSet +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFTriangleSet_GetTriangleListPtr) (Lib3MF_TriangleSet pTriangleSet, const Lib3MF_uint64 nTriangleIndicesBufferSize, Lib3MF_uint64* pTriangleIndicesNeededCount, Lib3MF_uint32 * pTriangleIndicesBuffer); + +/** +* Adds multiple triangles in the list. Duplicates will be merged. +* +* @param[in] pTriangleSet - TriangleSet instance. +* @param[in] nTriangleIndicesBufferSize - Number of elements in buffer +* @param[in] pTriangleIndicesBuffer - uint32 buffer of Triangle indices to add. Every element MUST be between 0 and TriangleCount - 1. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFTriangleSet_AddTriangleListPtr) (Lib3MF_TriangleSet pTriangleSet, Lib3MF_uint64 nTriangleIndicesBufferSize, const Lib3MF_uint32 * pTriangleIndicesBuffer); + +/** +* Merges another Triangle set. +* +* @param[in] pTriangleSet - TriangleSet instance. +* @param[in] pOtherTriangleSet - Other triangle set to merge. +* @param[in] bDeleteOther - Flag if other triangle set is getting removed. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFTriangleSet_MergePtr) (Lib3MF_TriangleSet pTriangleSet, Lib3MF_TriangleSet pOtherTriangleSet, bool bDeleteOther); + +/** +* Deletes the whole set from the mesh. +* +* @param[in] pTriangleSet - TriangleSet instance. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFTriangleSet_DeleteSetPtr) (Lib3MF_TriangleSet pTriangleSet); + +/** +* Duplicates the set in the mesh. +* +* @param[in] pTriangleSet - TriangleSet instance. +* @param[in] pIdentifier - the new identifier. MUST be unique within the mesh. MUST NOT be an empty string +* @param[out] pNewSet - Copy of the triangle set. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFTriangleSet_DuplicatePtr) (Lib3MF_TriangleSet pTriangleSet, const char * pIdentifier, Lib3MF_TriangleSet * pNewSet); + /************************************************************************************************************************* Class definition for Object **************************************************************************************************************************/ @@ -1219,6 +1348,56 @@ typedef Lib3MFResult (*PLib3MFMeshObject_GetVolumeDataPtr) (Lib3MF_MeshObject pM */ typedef Lib3MFResult (*PLib3MFMeshObject_SetVolumeDataPtr) (Lib3MF_MeshObject pMeshObject, Lib3MF_VolumeData pTheVolumeData); +/** +* Adds a new triangle set. +* +* @param[in] pMeshObject - MeshObject instance. +* @param[in] pIdentifier - the new identifier. MUST be unique within the mesh. MUST NOT be an empty string +* @param[in] pName - the human readable name. MUST NOT be an empty string +* @param[out] pTheTriangleSet - the new Triangle Set Instance. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFMeshObject_AddTriangleSetPtr) (Lib3MF_MeshObject pMeshObject, const char * pIdentifier, const char * pName, Lib3MF_TriangleSet * pTheTriangleSet); + +/** +* Checks if a triangle set exists. +* +* @param[in] pMeshObject - MeshObject instance. +* @param[in] pIdentifier - the identifier to be found. +* @param[out] pTriangleSetExists - flag if the triangles set exists. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFMeshObject_HasTriangleSetPtr) (Lib3MF_MeshObject pMeshObject, const char * pIdentifier, bool * pTriangleSetExists); + +/** +* Finds a new triangle set by identifier. Fails if not existing. +* +* @param[in] pMeshObject - MeshObject instance. +* @param[in] pIdentifier - the identifier to be found. +* @param[out] pTheTriangleSet - the triangle Set Instance. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFMeshObject_FindTriangleSetPtr) (Lib3MF_MeshObject pMeshObject, const char * pIdentifier, Lib3MF_TriangleSet * pTheTriangleSet); + +/** +* Returns number of triangle sets. +* +* @param[in] pMeshObject - MeshObject instance. +* @param[out] pCount - the number of triangle sets of this mesh. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFMeshObject_GetTriangleSetCountPtr) (Lib3MF_MeshObject pMeshObject, Lib3MF_uint32 * pCount); + +/** +* Returns a specific triangle set by index. +* +* @param[in] pMeshObject - MeshObject instance. +* @param[in] nIndex - the index of the triangle set. +* @param[out] pTheTriangleSet - the triangle Set Instance. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFMeshObject_GetTriangleSetPtr) (Lib3MF_MeshObject pMeshObject, Lib3MF_uint32 nIndex, Lib3MF_TriangleSet * pTheTriangleSet); + /************************************************************************************************************************* Class definition for LevelSet **************************************************************************************************************************/ @@ -6512,6 +6691,19 @@ typedef struct { PLib3MFMetaDataGroup_RemoveMetaDataByIndexPtr m_MetaDataGroup_RemoveMetaDataByIndex; PLib3MFMetaDataGroup_RemoveMetaDataPtr m_MetaDataGroup_RemoveMetaData; PLib3MFMetaDataGroup_AddMetaDataPtr m_MetaDataGroup_AddMetaData; + PLib3MFTriangleSet_SetNamePtr m_TriangleSet_SetName; + PLib3MFTriangleSet_GetNamePtr m_TriangleSet_GetName; + PLib3MFTriangleSet_SetIdentifierPtr m_TriangleSet_SetIdentifier; + PLib3MFTriangleSet_GetIdentifierPtr m_TriangleSet_GetIdentifier; + PLib3MFTriangleSet_AddTrianglePtr m_TriangleSet_AddTriangle; + PLib3MFTriangleSet_RemoveTrianglePtr m_TriangleSet_RemoveTriangle; + PLib3MFTriangleSet_ClearPtr m_TriangleSet_Clear; + PLib3MFTriangleSet_SetTriangleListPtr m_TriangleSet_SetTriangleList; + PLib3MFTriangleSet_GetTriangleListPtr m_TriangleSet_GetTriangleList; + PLib3MFTriangleSet_AddTriangleListPtr m_TriangleSet_AddTriangleList; + PLib3MFTriangleSet_MergePtr m_TriangleSet_Merge; + PLib3MFTriangleSet_DeleteSetPtr m_TriangleSet_DeleteSet; + PLib3MFTriangleSet_DuplicatePtr m_TriangleSet_Duplicate; PLib3MFObject_GetTypePtr m_Object_GetType; PLib3MFObject_SetTypePtr m_Object_SetType; PLib3MFObject_GetNamePtr m_Object_GetName; @@ -6557,6 +6749,11 @@ typedef struct { PLib3MFMeshObject_BeamLatticePtr m_MeshObject_BeamLattice; PLib3MFMeshObject_GetVolumeDataPtr m_MeshObject_GetVolumeData; PLib3MFMeshObject_SetVolumeDataPtr m_MeshObject_SetVolumeData; + PLib3MFMeshObject_AddTriangleSetPtr m_MeshObject_AddTriangleSet; + PLib3MFMeshObject_HasTriangleSetPtr m_MeshObject_HasTriangleSet; + PLib3MFMeshObject_FindTriangleSetPtr m_MeshObject_FindTriangleSet; + PLib3MFMeshObject_GetTriangleSetCountPtr m_MeshObject_GetTriangleSetCount; + PLib3MFMeshObject_GetTriangleSetPtr m_MeshObject_GetTriangleSet; PLib3MFLevelSet_GetFunctionPtr m_LevelSet_GetFunction; PLib3MFLevelSet_SetFunctionPtr m_LevelSet_SetFunction; PLib3MFLevelSet_GetTransformPtr m_LevelSet_GetTransform; diff --git a/Autogenerated/Bindings/CppDynamic/lib3mf_dynamic.hpp b/Autogenerated/Bindings/CppDynamic/lib3mf_dynamic.hpp index ce245d95..b763295e 100644 --- a/Autogenerated/Bindings/CppDynamic/lib3mf_dynamic.hpp +++ b/Autogenerated/Bindings/CppDynamic/lib3mf_dynamic.hpp @@ -78,6 +78,7 @@ class CFunctionIterator; class CLevelSetIterator; class CMetaData; class CMetaDataGroup; +class CTriangleSet; class CObject; class CMeshObject; class CLevelSet; @@ -198,6 +199,7 @@ typedef CFunctionIterator CLib3MFFunctionIterator; typedef CLevelSetIterator CLib3MFLevelSetIterator; typedef CMetaData CLib3MFMetaData; typedef CMetaDataGroup CLib3MFMetaDataGroup; +typedef CTriangleSet CLib3MFTriangleSet; typedef CObject CLib3MFObject; typedef CMeshObject CLib3MFMeshObject; typedef CLevelSet CLib3MFLevelSet; @@ -318,6 +320,7 @@ typedef std::shared_ptr PFunctionIterator; typedef std::shared_ptr PLevelSetIterator; typedef std::shared_ptr PMetaData; typedef std::shared_ptr PMetaDataGroup; +typedef std::shared_ptr PTriangleSet; typedef std::shared_ptr PObject; typedef std::shared_ptr PMeshObject; typedef std::shared_ptr PLevelSet; @@ -438,6 +441,7 @@ typedef PFunctionIterator PLib3MFFunctionIterator; typedef PLevelSetIterator PLib3MFLevelSetIterator; typedef PMetaData PLib3MFMetaData; typedef PMetaDataGroup PLib3MFMetaDataGroup; +typedef PTriangleSet PLib3MFTriangleSet; typedef PObject PLib3MFObject; typedef PMeshObject PLib3MFMeshObject; typedef PLevelSet PLib3MFLevelSet; @@ -650,6 +654,8 @@ class ELib3MFException : public std::exception { case LIB3MF_ERROR_ELEMENTCOUNTEXCEEDSLIMIT: return "ELEMENTCOUNTEXCEEDSLIMIT"; case LIB3MF_ERROR_INVALIDRESOURCE: return "INVALIDRESOURCE"; case LIB3MF_ERROR_INVALIDLEVELSET: return "INVALIDLEVELSET"; + case LIB3MF_ERROR_COULDNOTFINDTRIANGLESET: return "COULDNOTFINDTRIANGLESET"; + case LIB3MF_ERROR_INVALIDTRIANGLESETINDEX: return "INVALIDTRIANGLESETINDEX"; case LIB3MF_ERROR_BEAMLATTICE_INVALID_OBJECTTYPE: return "BEAMLATTICE_INVALID_OBJECTTYPE"; case LIB3MF_ERROR_INVALIDKEYSTORE: return "INVALIDKEYSTORE"; case LIB3MF_ERROR_INVALIDKEYSTORECONSUMER: return "INVALIDKEYSTORECONSUMER"; @@ -706,6 +712,8 @@ class ELib3MFException : public std::exception { case LIB3MF_ERROR_ELEMENTCOUNTEXCEEDSLIMIT: return "An element buffer exceeds its spec limit"; case LIB3MF_ERROR_INVALIDRESOURCE: return "A resource is invalid"; case LIB3MF_ERROR_INVALIDLEVELSET: return "A level set is invalid"; + case LIB3MF_ERROR_COULDNOTFINDTRIANGLESET: return "Could not find triangle set"; + case LIB3MF_ERROR_INVALIDTRIANGLESETINDEX: return "Invalid triangle set index"; case LIB3MF_ERROR_BEAMLATTICE_INVALID_OBJECTTYPE: return "This object type is not valid for beamlattices"; case LIB3MF_ERROR_INVALIDKEYSTORE: return "The keystore object is invalid"; case LIB3MF_ERROR_INVALIDKEYSTORECONSUMER: return "The consumer keystore object is invalid"; @@ -870,6 +878,7 @@ class CWrapper { friend class CLevelSetIterator; friend class CMetaData; friend class CMetaDataGroup; + friend class CTriangleSet; friend class CObject; friend class CMeshObject; friend class CLevelSet; @@ -1412,6 +1421,35 @@ class CMetaDataGroup : public CBase { inline PMetaData AddMetaData(const std::string & sNameSpace, const std::string & sName, const std::string & sValue, const std::string & sType, const bool bMustPreserve); }; +/************************************************************************************************************************* + Class CTriangleSet +**************************************************************************************************************************/ +class CTriangleSet : public CBase { +public: + + /** + * CTriangleSet::CTriangleSet - Constructor for TriangleSet class. + */ + CTriangleSet(CWrapper* pWrapper, Lib3MFHandle pHandle) + : CBase(pWrapper, pHandle) + { + } + + inline void SetName(const std::string & sName); + inline std::string GetName(); + inline void SetIdentifier(const std::string & sIdentifier); + inline std::string GetIdentifier(); + inline void AddTriangle(const Lib3MF_uint32 nTriangleIndex); + inline void RemoveTriangle(const Lib3MF_uint32 nTriangleIndex); + inline void Clear(); + inline void SetTriangleList(const CInputVector & TriangleIndicesBuffer); + inline void GetTriangleList(std::vector & TriangleIndicesBuffer); + inline void AddTriangleList(const CInputVector & TriangleIndicesBuffer); + inline void Merge(classParam pOtherTriangleSet, const bool bDeleteOther); + inline void DeleteSet(); + inline PTriangleSet Duplicate(const std::string & sIdentifier); +}; + /************************************************************************************************************************* Class CObject **************************************************************************************************************************/ @@ -1487,6 +1525,11 @@ class CMeshObject : public CObject { inline PBeamLattice BeamLattice(); inline PVolumeData GetVolumeData(); inline void SetVolumeData(classParam pTheVolumeData); + inline PTriangleSet AddTriangleSet(const std::string & sIdentifier, const std::string & sName); + inline bool HasTriangleSet(const std::string & sIdentifier); + inline PTriangleSet FindTriangleSet(const std::string & sIdentifier); + inline Lib3MF_uint32 GetTriangleSetCount(); + inline PTriangleSet GetTriangleSet(const Lib3MF_uint32 nIndex); }; /************************************************************************************************************************* @@ -3468,6 +3511,7 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle) case 0xA0C005C035D5371DUL: return new CLevelSetIterator(this, pHandle); break; // First 64 bits of SHA1 of a string: "Lib3MF::LevelSetIterator" case 0xD17716D063DE2C22UL: return new CMetaData(this, pHandle); break; // First 64 bits of SHA1 of a string: "Lib3MF::MetaData" case 0x0C3B85369E9B25D3UL: return new CMetaDataGroup(this, pHandle); break; // First 64 bits of SHA1 of a string: "Lib3MF::MetaDataGroup" + case 0x5950BB3EE8A82090UL: return new CTriangleSet(this, pHandle); break; // First 64 bits of SHA1 of a string: "Lib3MF::TriangleSet" case 0x2DA2136F577A779CUL: return new CObject(this, pHandle); break; // First 64 bits of SHA1 of a string: "Lib3MF::Object" case 0x3B3A6DC6EC610497UL: return new CMeshObject(this, pHandle); break; // First 64 bits of SHA1 of a string: "Lib3MF::MeshObject" case 0xE8A7D9C192EFD0E2UL: return new CLevelSet(this, pHandle); break; // First 64 bits of SHA1 of a string: "Lib3MF::LevelSet" @@ -3916,6 +3960,19 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle) pWrapperTable->m_MetaDataGroup_RemoveMetaDataByIndex = nullptr; pWrapperTable->m_MetaDataGroup_RemoveMetaData = nullptr; pWrapperTable->m_MetaDataGroup_AddMetaData = nullptr; + pWrapperTable->m_TriangleSet_SetName = nullptr; + pWrapperTable->m_TriangleSet_GetName = nullptr; + pWrapperTable->m_TriangleSet_SetIdentifier = nullptr; + pWrapperTable->m_TriangleSet_GetIdentifier = nullptr; + pWrapperTable->m_TriangleSet_AddTriangle = nullptr; + pWrapperTable->m_TriangleSet_RemoveTriangle = nullptr; + pWrapperTable->m_TriangleSet_Clear = nullptr; + pWrapperTable->m_TriangleSet_SetTriangleList = nullptr; + pWrapperTable->m_TriangleSet_GetTriangleList = nullptr; + pWrapperTable->m_TriangleSet_AddTriangleList = nullptr; + pWrapperTable->m_TriangleSet_Merge = nullptr; + pWrapperTable->m_TriangleSet_DeleteSet = nullptr; + pWrapperTable->m_TriangleSet_Duplicate = nullptr; pWrapperTable->m_Object_GetType = nullptr; pWrapperTable->m_Object_SetType = nullptr; pWrapperTable->m_Object_GetName = nullptr; @@ -3961,6 +4018,11 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle) pWrapperTable->m_MeshObject_BeamLattice = nullptr; pWrapperTable->m_MeshObject_GetVolumeData = nullptr; pWrapperTable->m_MeshObject_SetVolumeData = nullptr; + pWrapperTable->m_MeshObject_AddTriangleSet = nullptr; + pWrapperTable->m_MeshObject_HasTriangleSet = nullptr; + pWrapperTable->m_MeshObject_FindTriangleSet = nullptr; + pWrapperTable->m_MeshObject_GetTriangleSetCount = nullptr; + pWrapperTable->m_MeshObject_GetTriangleSet = nullptr; pWrapperTable->m_LevelSet_GetFunction = nullptr; pWrapperTable->m_LevelSet_SetFunction = nullptr; pWrapperTable->m_LevelSet_GetTransform = nullptr; @@ -5112,6 +5174,123 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle) if (pWrapperTable->m_MetaDataGroup_AddMetaData == nullptr) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + #ifdef _WIN32 + pWrapperTable->m_TriangleSet_SetName = (PLib3MFTriangleSet_SetNamePtr) GetProcAddress(hLibrary, "lib3mf_triangleset_setname"); + #else // _WIN32 + pWrapperTable->m_TriangleSet_SetName = (PLib3MFTriangleSet_SetNamePtr) dlsym(hLibrary, "lib3mf_triangleset_setname"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_TriangleSet_SetName == nullptr) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_TriangleSet_GetName = (PLib3MFTriangleSet_GetNamePtr) GetProcAddress(hLibrary, "lib3mf_triangleset_getname"); + #else // _WIN32 + pWrapperTable->m_TriangleSet_GetName = (PLib3MFTriangleSet_GetNamePtr) dlsym(hLibrary, "lib3mf_triangleset_getname"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_TriangleSet_GetName == nullptr) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_TriangleSet_SetIdentifier = (PLib3MFTriangleSet_SetIdentifierPtr) GetProcAddress(hLibrary, "lib3mf_triangleset_setidentifier"); + #else // _WIN32 + pWrapperTable->m_TriangleSet_SetIdentifier = (PLib3MFTriangleSet_SetIdentifierPtr) dlsym(hLibrary, "lib3mf_triangleset_setidentifier"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_TriangleSet_SetIdentifier == nullptr) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_TriangleSet_GetIdentifier = (PLib3MFTriangleSet_GetIdentifierPtr) GetProcAddress(hLibrary, "lib3mf_triangleset_getidentifier"); + #else // _WIN32 + pWrapperTable->m_TriangleSet_GetIdentifier = (PLib3MFTriangleSet_GetIdentifierPtr) dlsym(hLibrary, "lib3mf_triangleset_getidentifier"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_TriangleSet_GetIdentifier == nullptr) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_TriangleSet_AddTriangle = (PLib3MFTriangleSet_AddTrianglePtr) GetProcAddress(hLibrary, "lib3mf_triangleset_addtriangle"); + #else // _WIN32 + pWrapperTable->m_TriangleSet_AddTriangle = (PLib3MFTriangleSet_AddTrianglePtr) dlsym(hLibrary, "lib3mf_triangleset_addtriangle"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_TriangleSet_AddTriangle == nullptr) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_TriangleSet_RemoveTriangle = (PLib3MFTriangleSet_RemoveTrianglePtr) GetProcAddress(hLibrary, "lib3mf_triangleset_removetriangle"); + #else // _WIN32 + pWrapperTable->m_TriangleSet_RemoveTriangle = (PLib3MFTriangleSet_RemoveTrianglePtr) dlsym(hLibrary, "lib3mf_triangleset_removetriangle"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_TriangleSet_RemoveTriangle == nullptr) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_TriangleSet_Clear = (PLib3MFTriangleSet_ClearPtr) GetProcAddress(hLibrary, "lib3mf_triangleset_clear"); + #else // _WIN32 + pWrapperTable->m_TriangleSet_Clear = (PLib3MFTriangleSet_ClearPtr) dlsym(hLibrary, "lib3mf_triangleset_clear"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_TriangleSet_Clear == nullptr) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_TriangleSet_SetTriangleList = (PLib3MFTriangleSet_SetTriangleListPtr) GetProcAddress(hLibrary, "lib3mf_triangleset_settrianglelist"); + #else // _WIN32 + pWrapperTable->m_TriangleSet_SetTriangleList = (PLib3MFTriangleSet_SetTriangleListPtr) dlsym(hLibrary, "lib3mf_triangleset_settrianglelist"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_TriangleSet_SetTriangleList == nullptr) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_TriangleSet_GetTriangleList = (PLib3MFTriangleSet_GetTriangleListPtr) GetProcAddress(hLibrary, "lib3mf_triangleset_gettrianglelist"); + #else // _WIN32 + pWrapperTable->m_TriangleSet_GetTriangleList = (PLib3MFTriangleSet_GetTriangleListPtr) dlsym(hLibrary, "lib3mf_triangleset_gettrianglelist"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_TriangleSet_GetTriangleList == nullptr) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_TriangleSet_AddTriangleList = (PLib3MFTriangleSet_AddTriangleListPtr) GetProcAddress(hLibrary, "lib3mf_triangleset_addtrianglelist"); + #else // _WIN32 + pWrapperTable->m_TriangleSet_AddTriangleList = (PLib3MFTriangleSet_AddTriangleListPtr) dlsym(hLibrary, "lib3mf_triangleset_addtrianglelist"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_TriangleSet_AddTriangleList == nullptr) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_TriangleSet_Merge = (PLib3MFTriangleSet_MergePtr) GetProcAddress(hLibrary, "lib3mf_triangleset_merge"); + #else // _WIN32 + pWrapperTable->m_TriangleSet_Merge = (PLib3MFTriangleSet_MergePtr) dlsym(hLibrary, "lib3mf_triangleset_merge"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_TriangleSet_Merge == nullptr) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_TriangleSet_DeleteSet = (PLib3MFTriangleSet_DeleteSetPtr) GetProcAddress(hLibrary, "lib3mf_triangleset_deleteset"); + #else // _WIN32 + pWrapperTable->m_TriangleSet_DeleteSet = (PLib3MFTriangleSet_DeleteSetPtr) dlsym(hLibrary, "lib3mf_triangleset_deleteset"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_TriangleSet_DeleteSet == nullptr) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_TriangleSet_Duplicate = (PLib3MFTriangleSet_DuplicatePtr) GetProcAddress(hLibrary, "lib3mf_triangleset_duplicate"); + #else // _WIN32 + pWrapperTable->m_TriangleSet_Duplicate = (PLib3MFTriangleSet_DuplicatePtr) dlsym(hLibrary, "lib3mf_triangleset_duplicate"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_TriangleSet_Duplicate == nullptr) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + #ifdef _WIN32 pWrapperTable->m_Object_GetType = (PLib3MFObject_GetTypePtr) GetProcAddress(hLibrary, "lib3mf_object_gettype"); #else // _WIN32 @@ -5517,6 +5696,51 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle) if (pWrapperTable->m_MeshObject_SetVolumeData == nullptr) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + #ifdef _WIN32 + pWrapperTable->m_MeshObject_AddTriangleSet = (PLib3MFMeshObject_AddTriangleSetPtr) GetProcAddress(hLibrary, "lib3mf_meshobject_addtriangleset"); + #else // _WIN32 + pWrapperTable->m_MeshObject_AddTriangleSet = (PLib3MFMeshObject_AddTriangleSetPtr) dlsym(hLibrary, "lib3mf_meshobject_addtriangleset"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_MeshObject_AddTriangleSet == nullptr) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_MeshObject_HasTriangleSet = (PLib3MFMeshObject_HasTriangleSetPtr) GetProcAddress(hLibrary, "lib3mf_meshobject_hastriangleset"); + #else // _WIN32 + pWrapperTable->m_MeshObject_HasTriangleSet = (PLib3MFMeshObject_HasTriangleSetPtr) dlsym(hLibrary, "lib3mf_meshobject_hastriangleset"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_MeshObject_HasTriangleSet == nullptr) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_MeshObject_FindTriangleSet = (PLib3MFMeshObject_FindTriangleSetPtr) GetProcAddress(hLibrary, "lib3mf_meshobject_findtriangleset"); + #else // _WIN32 + pWrapperTable->m_MeshObject_FindTriangleSet = (PLib3MFMeshObject_FindTriangleSetPtr) dlsym(hLibrary, "lib3mf_meshobject_findtriangleset"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_MeshObject_FindTriangleSet == nullptr) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_MeshObject_GetTriangleSetCount = (PLib3MFMeshObject_GetTriangleSetCountPtr) GetProcAddress(hLibrary, "lib3mf_meshobject_gettrianglesetcount"); + #else // _WIN32 + pWrapperTable->m_MeshObject_GetTriangleSetCount = (PLib3MFMeshObject_GetTriangleSetCountPtr) dlsym(hLibrary, "lib3mf_meshobject_gettrianglesetcount"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_MeshObject_GetTriangleSetCount == nullptr) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_MeshObject_GetTriangleSet = (PLib3MFMeshObject_GetTriangleSetPtr) GetProcAddress(hLibrary, "lib3mf_meshobject_gettriangleset"); + #else // _WIN32 + pWrapperTable->m_MeshObject_GetTriangleSet = (PLib3MFMeshObject_GetTriangleSetPtr) dlsym(hLibrary, "lib3mf_meshobject_gettriangleset"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_MeshObject_GetTriangleSet == nullptr) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + #ifdef _WIN32 pWrapperTable->m_LevelSet_GetFunction = (PLib3MFLevelSet_GetFunctionPtr) GetProcAddress(hLibrary, "lib3mf_levelset_getfunction"); #else // _WIN32 @@ -10206,6 +10430,58 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle) if ( (eLookupError != 0) || (pWrapperTable->m_MetaDataGroup_AddMetaData == nullptr) ) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + eLookupError = (*pLookup)("lib3mf_triangleset_setname", (void**)&(pWrapperTable->m_TriangleSet_SetName)); + if ( (eLookupError != 0) || (pWrapperTable->m_TriangleSet_SetName == nullptr) ) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + eLookupError = (*pLookup)("lib3mf_triangleset_getname", (void**)&(pWrapperTable->m_TriangleSet_GetName)); + if ( (eLookupError != 0) || (pWrapperTable->m_TriangleSet_GetName == nullptr) ) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + eLookupError = (*pLookup)("lib3mf_triangleset_setidentifier", (void**)&(pWrapperTable->m_TriangleSet_SetIdentifier)); + if ( (eLookupError != 0) || (pWrapperTable->m_TriangleSet_SetIdentifier == nullptr) ) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + eLookupError = (*pLookup)("lib3mf_triangleset_getidentifier", (void**)&(pWrapperTable->m_TriangleSet_GetIdentifier)); + if ( (eLookupError != 0) || (pWrapperTable->m_TriangleSet_GetIdentifier == nullptr) ) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + eLookupError = (*pLookup)("lib3mf_triangleset_addtriangle", (void**)&(pWrapperTable->m_TriangleSet_AddTriangle)); + if ( (eLookupError != 0) || (pWrapperTable->m_TriangleSet_AddTriangle == nullptr) ) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + eLookupError = (*pLookup)("lib3mf_triangleset_removetriangle", (void**)&(pWrapperTable->m_TriangleSet_RemoveTriangle)); + if ( (eLookupError != 0) || (pWrapperTable->m_TriangleSet_RemoveTriangle == nullptr) ) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + eLookupError = (*pLookup)("lib3mf_triangleset_clear", (void**)&(pWrapperTable->m_TriangleSet_Clear)); + if ( (eLookupError != 0) || (pWrapperTable->m_TriangleSet_Clear == nullptr) ) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + eLookupError = (*pLookup)("lib3mf_triangleset_settrianglelist", (void**)&(pWrapperTable->m_TriangleSet_SetTriangleList)); + if ( (eLookupError != 0) || (pWrapperTable->m_TriangleSet_SetTriangleList == nullptr) ) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + eLookupError = (*pLookup)("lib3mf_triangleset_gettrianglelist", (void**)&(pWrapperTable->m_TriangleSet_GetTriangleList)); + if ( (eLookupError != 0) || (pWrapperTable->m_TriangleSet_GetTriangleList == nullptr) ) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + eLookupError = (*pLookup)("lib3mf_triangleset_addtrianglelist", (void**)&(pWrapperTable->m_TriangleSet_AddTriangleList)); + if ( (eLookupError != 0) || (pWrapperTable->m_TriangleSet_AddTriangleList == nullptr) ) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + eLookupError = (*pLookup)("lib3mf_triangleset_merge", (void**)&(pWrapperTable->m_TriangleSet_Merge)); + if ( (eLookupError != 0) || (pWrapperTable->m_TriangleSet_Merge == nullptr) ) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + eLookupError = (*pLookup)("lib3mf_triangleset_deleteset", (void**)&(pWrapperTable->m_TriangleSet_DeleteSet)); + if ( (eLookupError != 0) || (pWrapperTable->m_TriangleSet_DeleteSet == nullptr) ) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + eLookupError = (*pLookup)("lib3mf_triangleset_duplicate", (void**)&(pWrapperTable->m_TriangleSet_Duplicate)); + if ( (eLookupError != 0) || (pWrapperTable->m_TriangleSet_Duplicate == nullptr) ) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + eLookupError = (*pLookup)("lib3mf_object_gettype", (void**)&(pWrapperTable->m_Object_GetType)); if ( (eLookupError != 0) || (pWrapperTable->m_Object_GetType == nullptr) ) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; @@ -10386,6 +10662,26 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle) if ( (eLookupError != 0) || (pWrapperTable->m_MeshObject_SetVolumeData == nullptr) ) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + eLookupError = (*pLookup)("lib3mf_meshobject_addtriangleset", (void**)&(pWrapperTable->m_MeshObject_AddTriangleSet)); + if ( (eLookupError != 0) || (pWrapperTable->m_MeshObject_AddTriangleSet == nullptr) ) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + eLookupError = (*pLookup)("lib3mf_meshobject_hastriangleset", (void**)&(pWrapperTable->m_MeshObject_HasTriangleSet)); + if ( (eLookupError != 0) || (pWrapperTable->m_MeshObject_HasTriangleSet == nullptr) ) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + eLookupError = (*pLookup)("lib3mf_meshobject_findtriangleset", (void**)&(pWrapperTable->m_MeshObject_FindTriangleSet)); + if ( (eLookupError != 0) || (pWrapperTable->m_MeshObject_FindTriangleSet == nullptr) ) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + eLookupError = (*pLookup)("lib3mf_meshobject_gettrianglesetcount", (void**)&(pWrapperTable->m_MeshObject_GetTriangleSetCount)); + if ( (eLookupError != 0) || (pWrapperTable->m_MeshObject_GetTriangleSetCount == nullptr) ) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + eLookupError = (*pLookup)("lib3mf_meshobject_gettriangleset", (void**)&(pWrapperTable->m_MeshObject_GetTriangleSet)); + if ( (eLookupError != 0) || (pWrapperTable->m_MeshObject_GetTriangleSet == nullptr) ) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + eLookupError = (*pLookup)("lib3mf_levelset_getfunction", (void**)&(pWrapperTable->m_LevelSet_GetFunction)); if ( (eLookupError != 0) || (pWrapperTable->m_LevelSet_GetFunction == nullptr) ) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; @@ -13281,6 +13577,152 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle) return std::shared_ptr(dynamic_cast(m_pWrapper->polymorphicFactory(hMetaData))); } + /** + * Method definitions for class CTriangleSet + */ + + /** + * CTriangleSet::SetName - sets the name of the triangle set + * @param[in] sName - the new name + */ + void CTriangleSet::SetName(const std::string & sName) + { + CheckError(m_pWrapper->m_WrapperTable.m_TriangleSet_SetName(m_pHandle, sName.c_str())); + } + + /** + * CTriangleSet::GetName - returns the name of the triangle set + * @return returns the name + */ + std::string CTriangleSet::GetName() + { + Lib3MF_uint32 bytesNeededName = 0; + Lib3MF_uint32 bytesWrittenName = 0; + CheckError(m_pWrapper->m_WrapperTable.m_TriangleSet_GetName(m_pHandle, 0, &bytesNeededName, nullptr)); + std::vector bufferName(bytesNeededName); + CheckError(m_pWrapper->m_WrapperTable.m_TriangleSet_GetName(m_pHandle, bytesNeededName, &bytesWrittenName, &bufferName[0])); + + return std::string(&bufferName[0]); + } + + /** + * CTriangleSet::SetIdentifier - sets the identifier of the triangle set. + * @param[in] sIdentifier - the new identifier. MUST be unique within the mesh. MUST NOT be an empty string + */ + void CTriangleSet::SetIdentifier(const std::string & sIdentifier) + { + CheckError(m_pWrapper->m_WrapperTable.m_TriangleSet_SetIdentifier(m_pHandle, sIdentifier.c_str())); + } + + /** + * CTriangleSet::GetIdentifier - returns the identifier of the triangle set + * @return returns the identifier + */ + std::string CTriangleSet::GetIdentifier() + { + Lib3MF_uint32 bytesNeededIdentifier = 0; + Lib3MF_uint32 bytesWrittenIdentifier = 0; + CheckError(m_pWrapper->m_WrapperTable.m_TriangleSet_GetIdentifier(m_pHandle, 0, &bytesNeededIdentifier, nullptr)); + std::vector bufferIdentifier(bytesNeededIdentifier); + CheckError(m_pWrapper->m_WrapperTable.m_TriangleSet_GetIdentifier(m_pHandle, bytesNeededIdentifier, &bytesWrittenIdentifier, &bufferIdentifier[0])); + + return std::string(&bufferIdentifier[0]); + } + + /** + * CTriangleSet::AddTriangle - adds a triangle to the set. Does nothing if triangle is already in the set. + * @param[in] nTriangleIndex - Triangle index to add. MUST be between 0 and TriangleCount - 1. + */ + void CTriangleSet::AddTriangle(const Lib3MF_uint32 nTriangleIndex) + { + CheckError(m_pWrapper->m_WrapperTable.m_TriangleSet_AddTriangle(m_pHandle, nTriangleIndex)); + } + + /** + * CTriangleSet::RemoveTriangle - removes a triangle from the set + * @param[in] nTriangleIndex - Triangle index to remove. MUST be between 0 and TriangleCount - 1. + */ + void CTriangleSet::RemoveTriangle(const Lib3MF_uint32 nTriangleIndex) + { + CheckError(m_pWrapper->m_WrapperTable.m_TriangleSet_RemoveTriangle(m_pHandle, nTriangleIndex)); + } + + /** + * CTriangleSet::Clear - clears all triangles from the list + */ + void CTriangleSet::Clear() + { + CheckError(m_pWrapper->m_WrapperTable.m_TriangleSet_Clear(m_pHandle)); + } + + /** + * CTriangleSet::SetTriangleList - Sets all triangles in the list, while clearing old values. Duplicates will be merged. + * @param[in] TriangleIndicesBuffer - Triangle indices to add. Every element MUST be between 0 and TriangleCount - 1. + */ + void CTriangleSet::SetTriangleList(const CInputVector & TriangleIndicesBuffer) + { + Lib3MF_uint64 nTriangleIndicesSize = TriangleIndicesBuffer.size(); + CheckError(m_pWrapper->m_WrapperTable.m_TriangleSet_SetTriangleList(m_pHandle, nTriangleIndicesSize, TriangleIndicesBuffer.data())); + } + + /** + * CTriangleSet::GetTriangleList - Retrieves all the triangles in the TriangleSet + * @param[out] TriangleIndicesBuffer - retrieves the indices of the triangles in this TriangleSet + */ + void CTriangleSet::GetTriangleList(std::vector & TriangleIndicesBuffer) + { + Lib3MF_uint64 elementsNeededTriangleIndices = 0; + Lib3MF_uint64 elementsWrittenTriangleIndices = 0; + CheckError(m_pWrapper->m_WrapperTable.m_TriangleSet_GetTriangleList(m_pHandle, 0, &elementsNeededTriangleIndices, nullptr)); + TriangleIndicesBuffer.resize((size_t) elementsNeededTriangleIndices); + CheckError(m_pWrapper->m_WrapperTable.m_TriangleSet_GetTriangleList(m_pHandle, elementsNeededTriangleIndices, &elementsWrittenTriangleIndices, TriangleIndicesBuffer.data())); + } + + /** + * CTriangleSet::AddTriangleList - Adds multiple triangles in the list. Duplicates will be merged. + * @param[in] TriangleIndicesBuffer - Triangle indices to add. Every element MUST be between 0 and TriangleCount - 1. + */ + void CTriangleSet::AddTriangleList(const CInputVector & TriangleIndicesBuffer) + { + Lib3MF_uint64 nTriangleIndicesSize = TriangleIndicesBuffer.size(); + CheckError(m_pWrapper->m_WrapperTable.m_TriangleSet_AddTriangleList(m_pHandle, nTriangleIndicesSize, TriangleIndicesBuffer.data())); + } + + /** + * CTriangleSet::Merge - Merges another Triangle set. + * @param[in] pOtherTriangleSet - Other triangle set to merge. + * @param[in] bDeleteOther - Flag if other triangle set is getting removed. + */ + void CTriangleSet::Merge(classParam pOtherTriangleSet, const bool bDeleteOther) + { + Lib3MFHandle hOtherTriangleSet = pOtherTriangleSet.GetHandle(); + CheckError(m_pWrapper->m_WrapperTable.m_TriangleSet_Merge(m_pHandle, hOtherTriangleSet, bDeleteOther)); + } + + /** + * CTriangleSet::DeleteSet - Deletes the whole set from the mesh. + */ + void CTriangleSet::DeleteSet() + { + CheckError(m_pWrapper->m_WrapperTable.m_TriangleSet_DeleteSet(m_pHandle)); + } + + /** + * CTriangleSet::Duplicate - Duplicates the set in the mesh. + * @param[in] sIdentifier - the new identifier. MUST be unique within the mesh. MUST NOT be an empty string + * @return Copy of the triangle set. + */ + PTriangleSet CTriangleSet::Duplicate(const std::string & sIdentifier) + { + Lib3MFHandle hNewSet = (Lib3MFHandle)nullptr; + CheckError(m_pWrapper->m_WrapperTable.m_TriangleSet_Duplicate(m_pHandle, sIdentifier.c_str(), &hNewSet)); + + if (!hNewSet) { + CheckError(LIB3MF_ERROR_INVALIDPARAM); + } + return std::shared_ptr(dynamic_cast(m_pWrapper->polymorphicFactory(hNewSet))); + } + /** * Method definitions for class CObject */ @@ -13821,6 +14263,80 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle) CheckError(m_pWrapper->m_WrapperTable.m_MeshObject_SetVolumeData(m_pHandle, hTheVolumeData)); } + /** + * CMeshObject::AddTriangleSet - Adds a new triangle set. + * @param[in] sIdentifier - the new identifier. MUST be unique within the mesh. MUST NOT be an empty string + * @param[in] sName - the human readable name. MUST NOT be an empty string + * @return the new Triangle Set Instance. + */ + PTriangleSet CMeshObject::AddTriangleSet(const std::string & sIdentifier, const std::string & sName) + { + Lib3MFHandle hTheTriangleSet = (Lib3MFHandle)nullptr; + CheckError(m_pWrapper->m_WrapperTable.m_MeshObject_AddTriangleSet(m_pHandle, sIdentifier.c_str(), sName.c_str(), &hTheTriangleSet)); + + if (!hTheTriangleSet) { + CheckError(LIB3MF_ERROR_INVALIDPARAM); + } + return std::shared_ptr(dynamic_cast(m_pWrapper->polymorphicFactory(hTheTriangleSet))); + } + + /** + * CMeshObject::HasTriangleSet - Checks if a triangle set exists. + * @param[in] sIdentifier - the identifier to be found. + * @return flag if the triangles set exists. + */ + bool CMeshObject::HasTriangleSet(const std::string & sIdentifier) + { + bool resultTriangleSetExists = 0; + CheckError(m_pWrapper->m_WrapperTable.m_MeshObject_HasTriangleSet(m_pHandle, sIdentifier.c_str(), &resultTriangleSetExists)); + + return resultTriangleSetExists; + } + + /** + * CMeshObject::FindTriangleSet - Finds a new triangle set by identifier. Fails if not existing. + * @param[in] sIdentifier - the identifier to be found. + * @return the triangle Set Instance. + */ + PTriangleSet CMeshObject::FindTriangleSet(const std::string & sIdentifier) + { + Lib3MFHandle hTheTriangleSet = (Lib3MFHandle)nullptr; + CheckError(m_pWrapper->m_WrapperTable.m_MeshObject_FindTriangleSet(m_pHandle, sIdentifier.c_str(), &hTheTriangleSet)); + + if (!hTheTriangleSet) { + CheckError(LIB3MF_ERROR_INVALIDPARAM); + } + return std::shared_ptr(dynamic_cast(m_pWrapper->polymorphicFactory(hTheTriangleSet))); + } + + /** + * CMeshObject::GetTriangleSetCount - Returns number of triangle sets. + * @return the number of triangle sets of this mesh. + */ + Lib3MF_uint32 CMeshObject::GetTriangleSetCount() + { + Lib3MF_uint32 resultCount = 0; + CheckError(m_pWrapper->m_WrapperTable.m_MeshObject_GetTriangleSetCount(m_pHandle, &resultCount)); + + return resultCount; + } + + /** + * CMeshObject::GetTriangleSet - Returns a specific triangle set by index. + * @param[in] nIndex - the index of the triangle set. + * @return the triangle Set Instance. + */ + PTriangleSet CMeshObject::GetTriangleSet(const Lib3MF_uint32 nIndex) + { + Lib3MFHandle hTheTriangleSet = (Lib3MFHandle)nullptr; + CheckError(m_pWrapper->m_WrapperTable.m_MeshObject_GetTriangleSet(m_pHandle, nIndex, &hTheTriangleSet)); + + if (!hTheTriangleSet) { + CheckError(LIB3MF_ERROR_INVALIDPARAM); + } + return std::shared_ptr(dynamic_cast(m_pWrapper->polymorphicFactory(hTheTriangleSet))); + } + /** * Method definitions for class CLevelSet */ diff --git a/Autogenerated/Bindings/CppDynamic/lib3mf_types.hpp b/Autogenerated/Bindings/CppDynamic/lib3mf_types.hpp index 4ba95915..0d520b82 100644 --- a/Autogenerated/Bindings/CppDynamic/lib3mf_types.hpp +++ b/Autogenerated/Bindings/CppDynamic/lib3mf_types.hpp @@ -130,6 +130,8 @@ typedef void * Lib3MF_pvoid; #define LIB3MF_ERROR_ELEMENTCOUNTEXCEEDSLIMIT 141 /** An element buffer exceeds its spec limit */ #define LIB3MF_ERROR_INVALIDRESOURCE 142 /** A resource is invalid */ #define LIB3MF_ERROR_INVALIDLEVELSET 143 /** A level set is invalid */ +#define LIB3MF_ERROR_COULDNOTFINDTRIANGLESET 144 /** Could not find triangle set */ +#define LIB3MF_ERROR_INVALIDTRIANGLESETINDEX 145 /** Invalid triangle set index */ #define LIB3MF_ERROR_BEAMLATTICE_INVALID_OBJECTTYPE 2000 /** This object type is not valid for beamlattices */ #define LIB3MF_ERROR_INVALIDKEYSTORE 3000 /** The keystore object is invalid */ #define LIB3MF_ERROR_INVALIDKEYSTORECONSUMER 3001 /** The consumer keystore object is invalid */ @@ -186,6 +188,8 @@ inline const char * LIB3MF_GETERRORSTRING (Lib3MFResult nErrorCode) { case LIB3MF_ERROR_ELEMENTCOUNTEXCEEDSLIMIT: return "An element buffer exceeds its spec limit"; case LIB3MF_ERROR_INVALIDRESOURCE: return "A resource is invalid"; case LIB3MF_ERROR_INVALIDLEVELSET: return "A level set is invalid"; + case LIB3MF_ERROR_COULDNOTFINDTRIANGLESET: return "Could not find triangle set"; + case LIB3MF_ERROR_INVALIDTRIANGLESETINDEX: return "Invalid triangle set index"; case LIB3MF_ERROR_BEAMLATTICE_INVALID_OBJECTTYPE: return "This object type is not valid for beamlattices"; case LIB3MF_ERROR_INVALIDKEYSTORE: return "The keystore object is invalid"; case LIB3MF_ERROR_INVALIDKEYSTORECONSUMER: return "The consumer keystore object is invalid"; @@ -226,6 +230,7 @@ typedef Lib3MFHandle Lib3MF_FunctionIterator; typedef Lib3MFHandle Lib3MF_LevelSetIterator; typedef Lib3MFHandle Lib3MF_MetaData; typedef Lib3MFHandle Lib3MF_MetaDataGroup; +typedef Lib3MFHandle Lib3MF_TriangleSet; typedef Lib3MFHandle Lib3MF_Object; typedef Lib3MFHandle Lib3MF_MeshObject; typedef Lib3MFHandle Lib3MF_LevelSet; diff --git a/Autogenerated/Bindings/Go/lib3mf.go b/Autogenerated/Bindings/Go/lib3mf.go index 5adcaee1..9fcab2a7 100644 --- a/Autogenerated/Bindings/Go/lib3mf.go +++ b/Autogenerated/Bindings/Go/lib3mf.go @@ -455,6 +455,8 @@ const LIB3MF_ERROR_UNKOWNPROGRESSIDENTIFIER = 140; const LIB3MF_ERROR_ELEMENTCOUNTEXCEEDSLIMIT = 141; const LIB3MF_ERROR_INVALIDRESOURCE = 142; const LIB3MF_ERROR_INVALIDLEVELSET = 143; +const LIB3MF_ERROR_COULDNOTFINDTRIANGLESET = 144; +const LIB3MF_ERROR_INVALIDTRIANGLESETINDEX = 145; const LIB3MF_ERROR_BEAMLATTICE_INVALID_OBJECTTYPE = 2000; const LIB3MF_ERROR_INVALIDKEYSTORE = 3000; const LIB3MF_ERROR_INVALIDKEYSTORECONSUMER = 3001; @@ -553,6 +555,10 @@ func errorMessage(errorcode uint32) string { return "A resource is invalid"; case LIB3MF_ERROR_INVALIDLEVELSET: return "A level set is invalid"; + case LIB3MF_ERROR_COULDNOTFINDTRIANGLESET: + return "Could not find triangle set"; + case LIB3MF_ERROR_INVALIDTRIANGLESETINDEX: + return "Invalid triangle set index"; case LIB3MF_ERROR_BEAMLATTICE_INVALID_OBJECTTYPE: return "This object type is not valid for beamlattices"; case LIB3MF_ERROR_INVALIDKEYSTORE: @@ -1641,6 +1647,158 @@ func (inst MetaDataGroup) AddMetaData(nameSpace string, name string, value strin } +// TriangleSet represents a Lib3MF class. +type TriangleSet struct { + Base +} + +func (wrapper Wrapper) NewTriangleSet(r ref) TriangleSet { + return TriangleSet{wrapper.NewBase(r)} +} + +// SetName sets the name of the triangle set. +func (inst TriangleSet) SetName(name string) error { + ret := C.CCall_lib3mf_triangleset_setname(inst.wrapperRef.LibraryHandle, inst.Ref, (*C.char)(unsafe.Pointer(&[]byte(name)[0]))) + if ret != 0 { + return makeError(uint32(ret)) + } + return nil +} + +// GetName returns the name of the triangle set. +func (inst TriangleSet) GetName() (string, error) { + var neededforname C.uint32_t + var filledinname C.uint32_t + ret := C.CCall_lib3mf_triangleset_getname(inst.wrapperRef.LibraryHandle, inst.Ref, 0, &neededforname, nil) + if ret != 0 { + return "", makeError(uint32(ret)) + } + bufferSizename := neededforname + buffername := make([]byte, bufferSizename) + ret = C.CCall_lib3mf_triangleset_getname(inst.wrapperRef.LibraryHandle, inst.Ref, bufferSizename, &filledinname, (*C.char)(unsafe.Pointer(&buffername[0]))) + if ret != 0 { + return "", makeError(uint32(ret)) + } + return string(buffername[:(filledinname-1)]), nil +} + +// SetIdentifier sets the identifier of the triangle set. +func (inst TriangleSet) SetIdentifier(identifier string) error { + ret := C.CCall_lib3mf_triangleset_setidentifier(inst.wrapperRef.LibraryHandle, inst.Ref, (*C.char)(unsafe.Pointer(&[]byte(identifier)[0]))) + if ret != 0 { + return makeError(uint32(ret)) + } + return nil +} + +// GetIdentifier returns the identifier of the triangle set. +func (inst TriangleSet) GetIdentifier() (string, error) { + var neededforidentifier C.uint32_t + var filledinidentifier C.uint32_t + ret := C.CCall_lib3mf_triangleset_getidentifier(inst.wrapperRef.LibraryHandle, inst.Ref, 0, &neededforidentifier, nil) + if ret != 0 { + return "", makeError(uint32(ret)) + } + bufferSizeidentifier := neededforidentifier + bufferidentifier := make([]byte, bufferSizeidentifier) + ret = C.CCall_lib3mf_triangleset_getidentifier(inst.wrapperRef.LibraryHandle, inst.Ref, bufferSizeidentifier, &filledinidentifier, (*C.char)(unsafe.Pointer(&bufferidentifier[0]))) + if ret != 0 { + return "", makeError(uint32(ret)) + } + return string(bufferidentifier[:(filledinidentifier-1)]), nil +} + +// AddTriangle adds a triangle to the set. Does nothing if triangle is already in the set. +func (inst TriangleSet) AddTriangle(triangleIndex uint32) error { + ret := C.CCall_lib3mf_triangleset_addtriangle(inst.wrapperRef.LibraryHandle, inst.Ref, C.uint32_t(triangleIndex)) + if ret != 0 { + return makeError(uint32(ret)) + } + return nil +} + +// RemoveTriangle removes a triangle from the set. +func (inst TriangleSet) RemoveTriangle(triangleIndex uint32) error { + ret := C.CCall_lib3mf_triangleset_removetriangle(inst.wrapperRef.LibraryHandle, inst.Ref, C.uint32_t(triangleIndex)) + if ret != 0 { + return makeError(uint32(ret)) + } + return nil +} + +// Clear clears all triangles from the list. +func (inst TriangleSet) Clear() error { + ret := C.CCall_lib3mf_triangleset_clear(inst.wrapperRef.LibraryHandle, inst.Ref) + if ret != 0 { + return makeError(uint32(ret)) + } + return nil +} + +// SetTriangleList sets all triangles in the list, while clearing old values. Duplicates will be merged. +func (inst TriangleSet) SetTriangleList(triangleIndices []uint32) error { + ret := C.CCall_lib3mf_triangleset_settrianglelist(inst.wrapperRef.LibraryHandle, inst.Ref, C.uint64_t(len(triangleIndices)), (*C.uint32_t)(unsafe.Pointer(&triangleIndices[0]))) + if ret != 0 { + return makeError(uint32(ret)) + } + return nil +} + +// GetTriangleList retrieves all the triangles in the TriangleSet. +func (inst TriangleSet) GetTriangleList(triangleIndices []uint32) ([]uint32, error) { + var neededfortriangleIndices C.uint64_t + ret := C.CCall_lib3mf_triangleset_gettrianglelist(inst.wrapperRef.LibraryHandle, inst.Ref, 0, &neededfortriangleIndices, nil) + if ret != 0 { + return nil, makeError(uint32(ret)) + } + if len(triangleIndices) < int(neededfortriangleIndices) { + triangleIndices = append(triangleIndices, make([]uint32, int(neededfortriangleIndices)-len(triangleIndices))...) + } + ret = C.CCall_lib3mf_triangleset_gettrianglelist(inst.wrapperRef.LibraryHandle, inst.Ref, neededfortriangleIndices, nil, (*C.uint32_t)(unsafe.Pointer(&triangleIndices[0]))) + if ret != 0 { + return nil, makeError(uint32(ret)) + } + return triangleIndices[:int(neededfortriangleIndices)], nil +} + +// AddTriangleList adds multiple triangles in the list. Duplicates will be merged. +func (inst TriangleSet) AddTriangleList(triangleIndices []uint32) error { + ret := C.CCall_lib3mf_triangleset_addtrianglelist(inst.wrapperRef.LibraryHandle, inst.Ref, C.uint64_t(len(triangleIndices)), (*C.uint32_t)(unsafe.Pointer(&triangleIndices[0]))) + if ret != 0 { + return makeError(uint32(ret)) + } + return nil +} + +// Merge merges another Triangle set. +func (inst TriangleSet) Merge(otherTriangleSet TriangleSet, deleteOther bool) error { + ret := C.CCall_lib3mf_triangleset_merge(inst.wrapperRef.LibraryHandle, inst.Ref, otherTriangleSet.Ref, C.bool(deleteOther)) + if ret != 0 { + return makeError(uint32(ret)) + } + return nil +} + +// DeleteSet deletes the whole set from the mesh. +func (inst TriangleSet) DeleteSet() error { + ret := C.CCall_lib3mf_triangleset_deleteset(inst.wrapperRef.LibraryHandle, inst.Ref) + if ret != 0 { + return makeError(uint32(ret)) + } + return nil +} + +// Duplicate duplicates the set in the mesh. +func (inst TriangleSet) Duplicate(identifier string) (TriangleSet, error) { + var newSet ref + ret := C.CCall_lib3mf_triangleset_duplicate(inst.wrapperRef.LibraryHandle, inst.Ref, (*C.char)(unsafe.Pointer(&[]byte(identifier)[0])), &newSet) + if ret != 0 { + return TriangleSet{}, makeError(uint32(ret)) + } + return inst.wrapperRef.NewTriangleSet(newSet), nil +} + + // Object represents a Lib3MF class. type Object struct { Resource @@ -2148,6 +2306,56 @@ func (inst MeshObject) SetVolumeData(theVolumeData VolumeData) error { return nil } +// AddTriangleSet adds a new triangle set. +func (inst MeshObject) AddTriangleSet(identifier string, name string) (TriangleSet, error) { + var theTriangleSet ref + ret := C.CCall_lib3mf_meshobject_addtriangleset(inst.wrapperRef.LibraryHandle, inst.Ref, (*C.char)(unsafe.Pointer(&[]byte(identifier)[0])), (*C.char)(unsafe.Pointer(&[]byte(name)[0])), &theTriangleSet) + if ret != 0 { + return TriangleSet{}, makeError(uint32(ret)) + } + return inst.wrapperRef.NewTriangleSet(theTriangleSet), nil +} + +// HasTriangleSet checks if a triangle set exists. +func (inst MeshObject) HasTriangleSet(identifier string) (bool, error) { + var triangleSetExists C.bool + ret := C.CCall_lib3mf_meshobject_hastriangleset(inst.wrapperRef.LibraryHandle, inst.Ref, (*C.char)(unsafe.Pointer(&[]byte(identifier)[0])), &triangleSetExists) + if ret != 0 { + return false, makeError(uint32(ret)) + } + return bool(triangleSetExists), nil +} + +// FindTriangleSet finds a new triangle set by identifier. Fails if not existing. +func (inst MeshObject) FindTriangleSet(identifier string) (TriangleSet, error) { + var theTriangleSet ref + ret := C.CCall_lib3mf_meshobject_findtriangleset(inst.wrapperRef.LibraryHandle, inst.Ref, (*C.char)(unsafe.Pointer(&[]byte(identifier)[0])), &theTriangleSet) + if ret != 0 { + return TriangleSet{}, makeError(uint32(ret)) + } + return inst.wrapperRef.NewTriangleSet(theTriangleSet), nil +} + +// GetTriangleSetCount returns number of triangle sets. +func (inst MeshObject) GetTriangleSetCount() (uint32, error) { + var count C.uint32_t + ret := C.CCall_lib3mf_meshobject_gettrianglesetcount(inst.wrapperRef.LibraryHandle, inst.Ref, &count) + if ret != 0 { + return 0, makeError(uint32(ret)) + } + return uint32(count), nil +} + +// GetTriangleSet returns a specific triangle set by index. +func (inst MeshObject) GetTriangleSet(index uint32) (TriangleSet, error) { + var theTriangleSet ref + ret := C.CCall_lib3mf_meshobject_gettriangleset(inst.wrapperRef.LibraryHandle, inst.Ref, C.uint32_t(index), &theTriangleSet) + if ret != 0 { + return TriangleSet{}, makeError(uint32(ret)) + } + return inst.wrapperRef.NewTriangleSet(theTriangleSet), nil +} + // LevelSet represents a Lib3MF class. type LevelSet struct { diff --git a/Autogenerated/Bindings/Go/lib3mf_dynamic.c b/Autogenerated/Bindings/Go/lib3mf_dynamic.c index 2e0735ec..467e334d 100644 --- a/Autogenerated/Bindings/Go/lib3mf_dynamic.c +++ b/Autogenerated/Bindings/Go/lib3mf_dynamic.c @@ -116,6 +116,19 @@ Lib3MFResult InitLib3MFWrapperTable(sLib3MFDynamicWrapperTable * pWrapperTable) pWrapperTable->m_MetaDataGroup_RemoveMetaDataByIndex = NULL; pWrapperTable->m_MetaDataGroup_RemoveMetaData = NULL; pWrapperTable->m_MetaDataGroup_AddMetaData = NULL; + pWrapperTable->m_TriangleSet_SetName = NULL; + pWrapperTable->m_TriangleSet_GetName = NULL; + pWrapperTable->m_TriangleSet_SetIdentifier = NULL; + pWrapperTable->m_TriangleSet_GetIdentifier = NULL; + pWrapperTable->m_TriangleSet_AddTriangle = NULL; + pWrapperTable->m_TriangleSet_RemoveTriangle = NULL; + pWrapperTable->m_TriangleSet_Clear = NULL; + pWrapperTable->m_TriangleSet_SetTriangleList = NULL; + pWrapperTable->m_TriangleSet_GetTriangleList = NULL; + pWrapperTable->m_TriangleSet_AddTriangleList = NULL; + pWrapperTable->m_TriangleSet_Merge = NULL; + pWrapperTable->m_TriangleSet_DeleteSet = NULL; + pWrapperTable->m_TriangleSet_Duplicate = NULL; pWrapperTable->m_Object_GetType = NULL; pWrapperTable->m_Object_SetType = NULL; pWrapperTable->m_Object_GetName = NULL; @@ -161,6 +174,11 @@ Lib3MFResult InitLib3MFWrapperTable(sLib3MFDynamicWrapperTable * pWrapperTable) pWrapperTable->m_MeshObject_BeamLattice = NULL; pWrapperTable->m_MeshObject_GetVolumeData = NULL; pWrapperTable->m_MeshObject_SetVolumeData = NULL; + pWrapperTable->m_MeshObject_AddTriangleSet = NULL; + pWrapperTable->m_MeshObject_HasTriangleSet = NULL; + pWrapperTable->m_MeshObject_FindTriangleSet = NULL; + pWrapperTable->m_MeshObject_GetTriangleSetCount = NULL; + pWrapperTable->m_MeshObject_GetTriangleSet = NULL; pWrapperTable->m_LevelSet_GetFunction = NULL; pWrapperTable->m_LevelSet_SetFunction = NULL; pWrapperTable->m_LevelSet_GetTransform = NULL; @@ -1316,6 +1334,123 @@ Lib3MFResult LoadLib3MFWrapperTable(sLib3MFDynamicWrapperTable * pWrapperTable, if (pWrapperTable->m_MetaDataGroup_AddMetaData == NULL) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + #ifdef _WIN32 + pWrapperTable->m_TriangleSet_SetName = (PLib3MFTriangleSet_SetNamePtr) GetProcAddress(hLibrary, "lib3mf_triangleset_setname"); + #else // _WIN32 + pWrapperTable->m_TriangleSet_SetName = (PLib3MFTriangleSet_SetNamePtr) dlsym(hLibrary, "lib3mf_triangleset_setname"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_TriangleSet_SetName == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_TriangleSet_GetName = (PLib3MFTriangleSet_GetNamePtr) GetProcAddress(hLibrary, "lib3mf_triangleset_getname"); + #else // _WIN32 + pWrapperTable->m_TriangleSet_GetName = (PLib3MFTriangleSet_GetNamePtr) dlsym(hLibrary, "lib3mf_triangleset_getname"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_TriangleSet_GetName == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_TriangleSet_SetIdentifier = (PLib3MFTriangleSet_SetIdentifierPtr) GetProcAddress(hLibrary, "lib3mf_triangleset_setidentifier"); + #else // _WIN32 + pWrapperTable->m_TriangleSet_SetIdentifier = (PLib3MFTriangleSet_SetIdentifierPtr) dlsym(hLibrary, "lib3mf_triangleset_setidentifier"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_TriangleSet_SetIdentifier == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_TriangleSet_GetIdentifier = (PLib3MFTriangleSet_GetIdentifierPtr) GetProcAddress(hLibrary, "lib3mf_triangleset_getidentifier"); + #else // _WIN32 + pWrapperTable->m_TriangleSet_GetIdentifier = (PLib3MFTriangleSet_GetIdentifierPtr) dlsym(hLibrary, "lib3mf_triangleset_getidentifier"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_TriangleSet_GetIdentifier == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_TriangleSet_AddTriangle = (PLib3MFTriangleSet_AddTrianglePtr) GetProcAddress(hLibrary, "lib3mf_triangleset_addtriangle"); + #else // _WIN32 + pWrapperTable->m_TriangleSet_AddTriangle = (PLib3MFTriangleSet_AddTrianglePtr) dlsym(hLibrary, "lib3mf_triangleset_addtriangle"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_TriangleSet_AddTriangle == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_TriangleSet_RemoveTriangle = (PLib3MFTriangleSet_RemoveTrianglePtr) GetProcAddress(hLibrary, "lib3mf_triangleset_removetriangle"); + #else // _WIN32 + pWrapperTable->m_TriangleSet_RemoveTriangle = (PLib3MFTriangleSet_RemoveTrianglePtr) dlsym(hLibrary, "lib3mf_triangleset_removetriangle"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_TriangleSet_RemoveTriangle == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_TriangleSet_Clear = (PLib3MFTriangleSet_ClearPtr) GetProcAddress(hLibrary, "lib3mf_triangleset_clear"); + #else // _WIN32 + pWrapperTable->m_TriangleSet_Clear = (PLib3MFTriangleSet_ClearPtr) dlsym(hLibrary, "lib3mf_triangleset_clear"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_TriangleSet_Clear == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_TriangleSet_SetTriangleList = (PLib3MFTriangleSet_SetTriangleListPtr) GetProcAddress(hLibrary, "lib3mf_triangleset_settrianglelist"); + #else // _WIN32 + pWrapperTable->m_TriangleSet_SetTriangleList = (PLib3MFTriangleSet_SetTriangleListPtr) dlsym(hLibrary, "lib3mf_triangleset_settrianglelist"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_TriangleSet_SetTriangleList == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_TriangleSet_GetTriangleList = (PLib3MFTriangleSet_GetTriangleListPtr) GetProcAddress(hLibrary, "lib3mf_triangleset_gettrianglelist"); + #else // _WIN32 + pWrapperTable->m_TriangleSet_GetTriangleList = (PLib3MFTriangleSet_GetTriangleListPtr) dlsym(hLibrary, "lib3mf_triangleset_gettrianglelist"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_TriangleSet_GetTriangleList == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_TriangleSet_AddTriangleList = (PLib3MFTriangleSet_AddTriangleListPtr) GetProcAddress(hLibrary, "lib3mf_triangleset_addtrianglelist"); + #else // _WIN32 + pWrapperTable->m_TriangleSet_AddTriangleList = (PLib3MFTriangleSet_AddTriangleListPtr) dlsym(hLibrary, "lib3mf_triangleset_addtrianglelist"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_TriangleSet_AddTriangleList == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_TriangleSet_Merge = (PLib3MFTriangleSet_MergePtr) GetProcAddress(hLibrary, "lib3mf_triangleset_merge"); + #else // _WIN32 + pWrapperTable->m_TriangleSet_Merge = (PLib3MFTriangleSet_MergePtr) dlsym(hLibrary, "lib3mf_triangleset_merge"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_TriangleSet_Merge == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_TriangleSet_DeleteSet = (PLib3MFTriangleSet_DeleteSetPtr) GetProcAddress(hLibrary, "lib3mf_triangleset_deleteset"); + #else // _WIN32 + pWrapperTable->m_TriangleSet_DeleteSet = (PLib3MFTriangleSet_DeleteSetPtr) dlsym(hLibrary, "lib3mf_triangleset_deleteset"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_TriangleSet_DeleteSet == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_TriangleSet_Duplicate = (PLib3MFTriangleSet_DuplicatePtr) GetProcAddress(hLibrary, "lib3mf_triangleset_duplicate"); + #else // _WIN32 + pWrapperTable->m_TriangleSet_Duplicate = (PLib3MFTriangleSet_DuplicatePtr) dlsym(hLibrary, "lib3mf_triangleset_duplicate"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_TriangleSet_Duplicate == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + #ifdef _WIN32 pWrapperTable->m_Object_GetType = (PLib3MFObject_GetTypePtr) GetProcAddress(hLibrary, "lib3mf_object_gettype"); #else // _WIN32 @@ -1721,6 +1856,51 @@ Lib3MFResult LoadLib3MFWrapperTable(sLib3MFDynamicWrapperTable * pWrapperTable, if (pWrapperTable->m_MeshObject_SetVolumeData == NULL) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + #ifdef _WIN32 + pWrapperTable->m_MeshObject_AddTriangleSet = (PLib3MFMeshObject_AddTriangleSetPtr) GetProcAddress(hLibrary, "lib3mf_meshobject_addtriangleset"); + #else // _WIN32 + pWrapperTable->m_MeshObject_AddTriangleSet = (PLib3MFMeshObject_AddTriangleSetPtr) dlsym(hLibrary, "lib3mf_meshobject_addtriangleset"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_MeshObject_AddTriangleSet == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_MeshObject_HasTriangleSet = (PLib3MFMeshObject_HasTriangleSetPtr) GetProcAddress(hLibrary, "lib3mf_meshobject_hastriangleset"); + #else // _WIN32 + pWrapperTable->m_MeshObject_HasTriangleSet = (PLib3MFMeshObject_HasTriangleSetPtr) dlsym(hLibrary, "lib3mf_meshobject_hastriangleset"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_MeshObject_HasTriangleSet == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_MeshObject_FindTriangleSet = (PLib3MFMeshObject_FindTriangleSetPtr) GetProcAddress(hLibrary, "lib3mf_meshobject_findtriangleset"); + #else // _WIN32 + pWrapperTable->m_MeshObject_FindTriangleSet = (PLib3MFMeshObject_FindTriangleSetPtr) dlsym(hLibrary, "lib3mf_meshobject_findtriangleset"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_MeshObject_FindTriangleSet == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_MeshObject_GetTriangleSetCount = (PLib3MFMeshObject_GetTriangleSetCountPtr) GetProcAddress(hLibrary, "lib3mf_meshobject_gettrianglesetcount"); + #else // _WIN32 + pWrapperTable->m_MeshObject_GetTriangleSetCount = (PLib3MFMeshObject_GetTriangleSetCountPtr) dlsym(hLibrary, "lib3mf_meshobject_gettrianglesetcount"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_MeshObject_GetTriangleSetCount == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_MeshObject_GetTriangleSet = (PLib3MFMeshObject_GetTriangleSetPtr) GetProcAddress(hLibrary, "lib3mf_meshobject_gettriangleset"); + #else // _WIN32 + pWrapperTable->m_MeshObject_GetTriangleSet = (PLib3MFMeshObject_GetTriangleSetPtr) dlsym(hLibrary, "lib3mf_meshobject_gettriangleset"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_MeshObject_GetTriangleSet == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + #ifdef _WIN32 pWrapperTable->m_LevelSet_GetFunction = (PLib3MFLevelSet_GetFunctionPtr) GetProcAddress(hLibrary, "lib3mf_levelset_getfunction"); #else // _WIN32 @@ -6769,6 +6949,123 @@ Lib3MFResult CCall_lib3mf_metadatagroup_addmetadata(Lib3MFHandle libraryHandle, } +Lib3MFResult CCall_lib3mf_triangleset_setname(Lib3MFHandle libraryHandle, Lib3MF_TriangleSet pTriangleSet, const char * pName) +{ + if (libraryHandle == 0) + return LIB3MF_ERROR_INVALIDCAST; + sLib3MFDynamicWrapperTable * wrapperTable = (sLib3MFDynamicWrapperTable *) libraryHandle; + return wrapperTable->m_TriangleSet_SetName (pTriangleSet, pName); +} + + +Lib3MFResult CCall_lib3mf_triangleset_getname(Lib3MFHandle libraryHandle, Lib3MF_TriangleSet pTriangleSet, const Lib3MF_uint32 nNameBufferSize, Lib3MF_uint32* pNameNeededChars, char * pNameBuffer) +{ + if (libraryHandle == 0) + return LIB3MF_ERROR_INVALIDCAST; + sLib3MFDynamicWrapperTable * wrapperTable = (sLib3MFDynamicWrapperTable *) libraryHandle; + return wrapperTable->m_TriangleSet_GetName (pTriangleSet, nNameBufferSize, pNameNeededChars, pNameBuffer); +} + + +Lib3MFResult CCall_lib3mf_triangleset_setidentifier(Lib3MFHandle libraryHandle, Lib3MF_TriangleSet pTriangleSet, const char * pIdentifier) +{ + if (libraryHandle == 0) + return LIB3MF_ERROR_INVALIDCAST; + sLib3MFDynamicWrapperTable * wrapperTable = (sLib3MFDynamicWrapperTable *) libraryHandle; + return wrapperTable->m_TriangleSet_SetIdentifier (pTriangleSet, pIdentifier); +} + + +Lib3MFResult CCall_lib3mf_triangleset_getidentifier(Lib3MFHandle libraryHandle, Lib3MF_TriangleSet pTriangleSet, const Lib3MF_uint32 nIdentifierBufferSize, Lib3MF_uint32* pIdentifierNeededChars, char * pIdentifierBuffer) +{ + if (libraryHandle == 0) + return LIB3MF_ERROR_INVALIDCAST; + sLib3MFDynamicWrapperTable * wrapperTable = (sLib3MFDynamicWrapperTable *) libraryHandle; + return wrapperTable->m_TriangleSet_GetIdentifier (pTriangleSet, nIdentifierBufferSize, pIdentifierNeededChars, pIdentifierBuffer); +} + + +Lib3MFResult CCall_lib3mf_triangleset_addtriangle(Lib3MFHandle libraryHandle, Lib3MF_TriangleSet pTriangleSet, Lib3MF_uint32 nTriangleIndex) +{ + if (libraryHandle == 0) + return LIB3MF_ERROR_INVALIDCAST; + sLib3MFDynamicWrapperTable * wrapperTable = (sLib3MFDynamicWrapperTable *) libraryHandle; + return wrapperTable->m_TriangleSet_AddTriangle (pTriangleSet, nTriangleIndex); +} + + +Lib3MFResult CCall_lib3mf_triangleset_removetriangle(Lib3MFHandle libraryHandle, Lib3MF_TriangleSet pTriangleSet, Lib3MF_uint32 nTriangleIndex) +{ + if (libraryHandle == 0) + return LIB3MF_ERROR_INVALIDCAST; + sLib3MFDynamicWrapperTable * wrapperTable = (sLib3MFDynamicWrapperTable *) libraryHandle; + return wrapperTable->m_TriangleSet_RemoveTriangle (pTriangleSet, nTriangleIndex); +} + + +Lib3MFResult CCall_lib3mf_triangleset_clear(Lib3MFHandle libraryHandle, Lib3MF_TriangleSet pTriangleSet) +{ + if (libraryHandle == 0) + return LIB3MF_ERROR_INVALIDCAST; + sLib3MFDynamicWrapperTable * wrapperTable = (sLib3MFDynamicWrapperTable *) libraryHandle; + return wrapperTable->m_TriangleSet_Clear (pTriangleSet); +} + + +Lib3MFResult CCall_lib3mf_triangleset_settrianglelist(Lib3MFHandle libraryHandle, Lib3MF_TriangleSet pTriangleSet, Lib3MF_uint64 nTriangleIndicesBufferSize, const Lib3MF_uint32 * pTriangleIndicesBuffer) +{ + if (libraryHandle == 0) + return LIB3MF_ERROR_INVALIDCAST; + sLib3MFDynamicWrapperTable * wrapperTable = (sLib3MFDynamicWrapperTable *) libraryHandle; + return wrapperTable->m_TriangleSet_SetTriangleList (pTriangleSet, nTriangleIndicesBufferSize, pTriangleIndicesBuffer); +} + + +Lib3MFResult CCall_lib3mf_triangleset_gettrianglelist(Lib3MFHandle libraryHandle, Lib3MF_TriangleSet pTriangleSet, const Lib3MF_uint64 nTriangleIndicesBufferSize, Lib3MF_uint64* pTriangleIndicesNeededCount, Lib3MF_uint32 * pTriangleIndicesBuffer) +{ + if (libraryHandle == 0) + return LIB3MF_ERROR_INVALIDCAST; + sLib3MFDynamicWrapperTable * wrapperTable = (sLib3MFDynamicWrapperTable *) libraryHandle; + return wrapperTable->m_TriangleSet_GetTriangleList (pTriangleSet, nTriangleIndicesBufferSize, pTriangleIndicesNeededCount, pTriangleIndicesBuffer); +} + + +Lib3MFResult CCall_lib3mf_triangleset_addtrianglelist(Lib3MFHandle libraryHandle, Lib3MF_TriangleSet pTriangleSet, Lib3MF_uint64 nTriangleIndicesBufferSize, const Lib3MF_uint32 * pTriangleIndicesBuffer) +{ + if (libraryHandle == 0) + return LIB3MF_ERROR_INVALIDCAST; + sLib3MFDynamicWrapperTable * wrapperTable = (sLib3MFDynamicWrapperTable *) libraryHandle; + return wrapperTable->m_TriangleSet_AddTriangleList (pTriangleSet, nTriangleIndicesBufferSize, pTriangleIndicesBuffer); +} + + +Lib3MFResult CCall_lib3mf_triangleset_merge(Lib3MFHandle libraryHandle, Lib3MF_TriangleSet pTriangleSet, Lib3MF_TriangleSet pOtherTriangleSet, bool bDeleteOther) +{ + if (libraryHandle == 0) + return LIB3MF_ERROR_INVALIDCAST; + sLib3MFDynamicWrapperTable * wrapperTable = (sLib3MFDynamicWrapperTable *) libraryHandle; + return wrapperTable->m_TriangleSet_Merge (pTriangleSet, pOtherTriangleSet, bDeleteOther); +} + + +Lib3MFResult CCall_lib3mf_triangleset_deleteset(Lib3MFHandle libraryHandle, Lib3MF_TriangleSet pTriangleSet) +{ + if (libraryHandle == 0) + return LIB3MF_ERROR_INVALIDCAST; + sLib3MFDynamicWrapperTable * wrapperTable = (sLib3MFDynamicWrapperTable *) libraryHandle; + return wrapperTable->m_TriangleSet_DeleteSet (pTriangleSet); +} + + +Lib3MFResult CCall_lib3mf_triangleset_duplicate(Lib3MFHandle libraryHandle, Lib3MF_TriangleSet pTriangleSet, const char * pIdentifier, Lib3MF_TriangleSet * pNewSet) +{ + if (libraryHandle == 0) + return LIB3MF_ERROR_INVALIDCAST; + sLib3MFDynamicWrapperTable * wrapperTable = (sLib3MFDynamicWrapperTable *) libraryHandle; + return wrapperTable->m_TriangleSet_Duplicate (pTriangleSet, pIdentifier, pNewSet); +} + + Lib3MFResult CCall_lib3mf_object_gettype(Lib3MFHandle libraryHandle, Lib3MF_Object pObject, eLib3MFObjectType * pObjectType) { if (libraryHandle == 0) @@ -7174,6 +7471,51 @@ Lib3MFResult CCall_lib3mf_meshobject_setvolumedata(Lib3MFHandle libraryHandle, L } +Lib3MFResult CCall_lib3mf_meshobject_addtriangleset(Lib3MFHandle libraryHandle, Lib3MF_MeshObject pMeshObject, const char * pIdentifier, const char * pName, Lib3MF_TriangleSet * pTheTriangleSet) +{ + if (libraryHandle == 0) + return LIB3MF_ERROR_INVALIDCAST; + sLib3MFDynamicWrapperTable * wrapperTable = (sLib3MFDynamicWrapperTable *) libraryHandle; + return wrapperTable->m_MeshObject_AddTriangleSet (pMeshObject, pIdentifier, pName, pTheTriangleSet); +} + + +Lib3MFResult CCall_lib3mf_meshobject_hastriangleset(Lib3MFHandle libraryHandle, Lib3MF_MeshObject pMeshObject, const char * pIdentifier, bool * pTriangleSetExists) +{ + if (libraryHandle == 0) + return LIB3MF_ERROR_INVALIDCAST; + sLib3MFDynamicWrapperTable * wrapperTable = (sLib3MFDynamicWrapperTable *) libraryHandle; + return wrapperTable->m_MeshObject_HasTriangleSet (pMeshObject, pIdentifier, pTriangleSetExists); +} + + +Lib3MFResult CCall_lib3mf_meshobject_findtriangleset(Lib3MFHandle libraryHandle, Lib3MF_MeshObject pMeshObject, const char * pIdentifier, Lib3MF_TriangleSet * pTheTriangleSet) +{ + if (libraryHandle == 0) + return LIB3MF_ERROR_INVALIDCAST; + sLib3MFDynamicWrapperTable * wrapperTable = (sLib3MFDynamicWrapperTable *) libraryHandle; + return wrapperTable->m_MeshObject_FindTriangleSet (pMeshObject, pIdentifier, pTheTriangleSet); +} + + +Lib3MFResult CCall_lib3mf_meshobject_gettrianglesetcount(Lib3MFHandle libraryHandle, Lib3MF_MeshObject pMeshObject, Lib3MF_uint32 * pCount) +{ + if (libraryHandle == 0) + return LIB3MF_ERROR_INVALIDCAST; + sLib3MFDynamicWrapperTable * wrapperTable = (sLib3MFDynamicWrapperTable *) libraryHandle; + return wrapperTable->m_MeshObject_GetTriangleSetCount (pMeshObject, pCount); +} + + +Lib3MFResult CCall_lib3mf_meshobject_gettriangleset(Lib3MFHandle libraryHandle, Lib3MF_MeshObject pMeshObject, Lib3MF_uint32 nIndex, Lib3MF_TriangleSet * pTheTriangleSet) +{ + if (libraryHandle == 0) + return LIB3MF_ERROR_INVALIDCAST; + sLib3MFDynamicWrapperTable * wrapperTable = (sLib3MFDynamicWrapperTable *) libraryHandle; + return wrapperTable->m_MeshObject_GetTriangleSet (pMeshObject, nIndex, pTheTriangleSet); +} + + Lib3MFResult CCall_lib3mf_levelset_getfunction(Lib3MFHandle libraryHandle, Lib3MF_LevelSet pLevelSet, Lib3MF_Function * pTheFunction) { if (libraryHandle == 0) diff --git a/Autogenerated/Bindings/Go/lib3mf_dynamic.h b/Autogenerated/Bindings/Go/lib3mf_dynamic.h index 4442a20a..2e435690 100644 --- a/Autogenerated/Bindings/Go/lib3mf_dynamic.h +++ b/Autogenerated/Bindings/Go/lib3mf_dynamic.h @@ -780,6 +780,135 @@ typedef Lib3MFResult (*PLib3MFMetaDataGroup_RemoveMetaDataPtr) (Lib3MF_MetaDataG */ typedef Lib3MFResult (*PLib3MFMetaDataGroup_AddMetaDataPtr) (Lib3MF_MetaDataGroup pMetaDataGroup, const char * pNameSpace, const char * pName, const char * pValue, const char * pType, bool bMustPreserve, Lib3MF_MetaData * pMetaData); +/************************************************************************************************************************* + Class definition for TriangleSet +**************************************************************************************************************************/ + +/** +* sets the name of the triangle set +* +* @param[in] pTriangleSet - TriangleSet instance. +* @param[in] pName - the new name +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFTriangleSet_SetNamePtr) (Lib3MF_TriangleSet pTriangleSet, const char * pName); + +/** +* returns the name of the triangle set +* +* @param[in] pTriangleSet - TriangleSet instance. +* @param[in] nNameBufferSize - size of the buffer (including trailing 0) +* @param[out] pNameNeededChars - will be filled with the count of the written bytes, or needed buffer size. +* @param[out] pNameBuffer - buffer of returns the name, may be NULL +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFTriangleSet_GetNamePtr) (Lib3MF_TriangleSet pTriangleSet, const Lib3MF_uint32 nNameBufferSize, Lib3MF_uint32* pNameNeededChars, char * pNameBuffer); + +/** +* sets the identifier of the triangle set. +* +* @param[in] pTriangleSet - TriangleSet instance. +* @param[in] pIdentifier - the new identifier. MUST be unique within the mesh. MUST NOT be an empty string +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFTriangleSet_SetIdentifierPtr) (Lib3MF_TriangleSet pTriangleSet, const char * pIdentifier); + +/** +* returns the identifier of the triangle set +* +* @param[in] pTriangleSet - TriangleSet instance. +* @param[in] nIdentifierBufferSize - size of the buffer (including trailing 0) +* @param[out] pIdentifierNeededChars - will be filled with the count of the written bytes, or needed buffer size. +* @param[out] pIdentifierBuffer - buffer of returns the identifier, may be NULL +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFTriangleSet_GetIdentifierPtr) (Lib3MF_TriangleSet pTriangleSet, const Lib3MF_uint32 nIdentifierBufferSize, Lib3MF_uint32* pIdentifierNeededChars, char * pIdentifierBuffer); + +/** +* adds a triangle to the set. Does nothing if triangle is already in the set. +* +* @param[in] pTriangleSet - TriangleSet instance. +* @param[in] nTriangleIndex - Triangle index to add. MUST be between 0 and TriangleCount - 1. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFTriangleSet_AddTrianglePtr) (Lib3MF_TriangleSet pTriangleSet, Lib3MF_uint32 nTriangleIndex); + +/** +* removes a triangle from the set +* +* @param[in] pTriangleSet - TriangleSet instance. +* @param[in] nTriangleIndex - Triangle index to remove. MUST be between 0 and TriangleCount - 1. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFTriangleSet_RemoveTrianglePtr) (Lib3MF_TriangleSet pTriangleSet, Lib3MF_uint32 nTriangleIndex); + +/** +* clears all triangles from the list +* +* @param[in] pTriangleSet - TriangleSet instance. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFTriangleSet_ClearPtr) (Lib3MF_TriangleSet pTriangleSet); + +/** +* Sets all triangles in the list, while clearing old values. Duplicates will be merged. +* +* @param[in] pTriangleSet - TriangleSet instance. +* @param[in] nTriangleIndicesBufferSize - Number of elements in buffer +* @param[in] pTriangleIndicesBuffer - uint32 buffer of Triangle indices to add. Every element MUST be between 0 and TriangleCount - 1. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFTriangleSet_SetTriangleListPtr) (Lib3MF_TriangleSet pTriangleSet, Lib3MF_uint64 nTriangleIndicesBufferSize, const Lib3MF_uint32 * pTriangleIndicesBuffer); + +/** +* Retrieves all the triangles in the TriangleSet +* +* @param[in] pTriangleSet - TriangleSet instance. +* @param[in] nTriangleIndicesBufferSize - Number of elements in buffer +* @param[out] pTriangleIndicesNeededCount - will be filled with the count of the written elements, or needed buffer size. +* @param[out] pTriangleIndicesBuffer - uint32 buffer of retrieves the indices of the triangles in this TriangleSet +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFTriangleSet_GetTriangleListPtr) (Lib3MF_TriangleSet pTriangleSet, const Lib3MF_uint64 nTriangleIndicesBufferSize, Lib3MF_uint64* pTriangleIndicesNeededCount, Lib3MF_uint32 * pTriangleIndicesBuffer); + +/** +* Adds multiple triangles in the list. Duplicates will be merged. +* +* @param[in] pTriangleSet - TriangleSet instance. +* @param[in] nTriangleIndicesBufferSize - Number of elements in buffer +* @param[in] pTriangleIndicesBuffer - uint32 buffer of Triangle indices to add. Every element MUST be between 0 and TriangleCount - 1. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFTriangleSet_AddTriangleListPtr) (Lib3MF_TriangleSet pTriangleSet, Lib3MF_uint64 nTriangleIndicesBufferSize, const Lib3MF_uint32 * pTriangleIndicesBuffer); + +/** +* Merges another Triangle set. +* +* @param[in] pTriangleSet - TriangleSet instance. +* @param[in] pOtherTriangleSet - Other triangle set to merge. +* @param[in] bDeleteOther - Flag if other triangle set is getting removed. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFTriangleSet_MergePtr) (Lib3MF_TriangleSet pTriangleSet, Lib3MF_TriangleSet pOtherTriangleSet, bool bDeleteOther); + +/** +* Deletes the whole set from the mesh. +* +* @param[in] pTriangleSet - TriangleSet instance. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFTriangleSet_DeleteSetPtr) (Lib3MF_TriangleSet pTriangleSet); + +/** +* Duplicates the set in the mesh. +* +* @param[in] pTriangleSet - TriangleSet instance. +* @param[in] pIdentifier - the new identifier. MUST be unique within the mesh. MUST NOT be an empty string +* @param[out] pNewSet - Copy of the triangle set. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFTriangleSet_DuplicatePtr) (Lib3MF_TriangleSet pTriangleSet, const char * pIdentifier, Lib3MF_TriangleSet * pNewSet); + /************************************************************************************************************************* Class definition for Object **************************************************************************************************************************/ @@ -1219,6 +1348,56 @@ typedef Lib3MFResult (*PLib3MFMeshObject_GetVolumeDataPtr) (Lib3MF_MeshObject pM */ typedef Lib3MFResult (*PLib3MFMeshObject_SetVolumeDataPtr) (Lib3MF_MeshObject pMeshObject, Lib3MF_VolumeData pTheVolumeData); +/** +* Adds a new triangle set. +* +* @param[in] pMeshObject - MeshObject instance. +* @param[in] pIdentifier - the new identifier. MUST be unique within the mesh. MUST NOT be an empty string +* @param[in] pName - the human readable name. MUST NOT be an empty string +* @param[out] pTheTriangleSet - the new Triangle Set Instance. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFMeshObject_AddTriangleSetPtr) (Lib3MF_MeshObject pMeshObject, const char * pIdentifier, const char * pName, Lib3MF_TriangleSet * pTheTriangleSet); + +/** +* Checks if a triangle set exists. +* +* @param[in] pMeshObject - MeshObject instance. +* @param[in] pIdentifier - the identifier to be found. +* @param[out] pTriangleSetExists - flag if the triangles set exists. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFMeshObject_HasTriangleSetPtr) (Lib3MF_MeshObject pMeshObject, const char * pIdentifier, bool * pTriangleSetExists); + +/** +* Finds a new triangle set by identifier. Fails if not existing. +* +* @param[in] pMeshObject - MeshObject instance. +* @param[in] pIdentifier - the identifier to be found. +* @param[out] pTheTriangleSet - the triangle Set Instance. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFMeshObject_FindTriangleSetPtr) (Lib3MF_MeshObject pMeshObject, const char * pIdentifier, Lib3MF_TriangleSet * pTheTriangleSet); + +/** +* Returns number of triangle sets. +* +* @param[in] pMeshObject - MeshObject instance. +* @param[out] pCount - the number of triangle sets of this mesh. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFMeshObject_GetTriangleSetCountPtr) (Lib3MF_MeshObject pMeshObject, Lib3MF_uint32 * pCount); + +/** +* Returns a specific triangle set by index. +* +* @param[in] pMeshObject - MeshObject instance. +* @param[in] nIndex - the index of the triangle set. +* @param[out] pTheTriangleSet - the triangle Set Instance. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFMeshObject_GetTriangleSetPtr) (Lib3MF_MeshObject pMeshObject, Lib3MF_uint32 nIndex, Lib3MF_TriangleSet * pTheTriangleSet); + /************************************************************************************************************************* Class definition for LevelSet **************************************************************************************************************************/ @@ -6512,6 +6691,19 @@ typedef struct { PLib3MFMetaDataGroup_RemoveMetaDataByIndexPtr m_MetaDataGroup_RemoveMetaDataByIndex; PLib3MFMetaDataGroup_RemoveMetaDataPtr m_MetaDataGroup_RemoveMetaData; PLib3MFMetaDataGroup_AddMetaDataPtr m_MetaDataGroup_AddMetaData; + PLib3MFTriangleSet_SetNamePtr m_TriangleSet_SetName; + PLib3MFTriangleSet_GetNamePtr m_TriangleSet_GetName; + PLib3MFTriangleSet_SetIdentifierPtr m_TriangleSet_SetIdentifier; + PLib3MFTriangleSet_GetIdentifierPtr m_TriangleSet_GetIdentifier; + PLib3MFTriangleSet_AddTrianglePtr m_TriangleSet_AddTriangle; + PLib3MFTriangleSet_RemoveTrianglePtr m_TriangleSet_RemoveTriangle; + PLib3MFTriangleSet_ClearPtr m_TriangleSet_Clear; + PLib3MFTriangleSet_SetTriangleListPtr m_TriangleSet_SetTriangleList; + PLib3MFTriangleSet_GetTriangleListPtr m_TriangleSet_GetTriangleList; + PLib3MFTriangleSet_AddTriangleListPtr m_TriangleSet_AddTriangleList; + PLib3MFTriangleSet_MergePtr m_TriangleSet_Merge; + PLib3MFTriangleSet_DeleteSetPtr m_TriangleSet_DeleteSet; + PLib3MFTriangleSet_DuplicatePtr m_TriangleSet_Duplicate; PLib3MFObject_GetTypePtr m_Object_GetType; PLib3MFObject_SetTypePtr m_Object_SetType; PLib3MFObject_GetNamePtr m_Object_GetName; @@ -6557,6 +6749,11 @@ typedef struct { PLib3MFMeshObject_BeamLatticePtr m_MeshObject_BeamLattice; PLib3MFMeshObject_GetVolumeDataPtr m_MeshObject_GetVolumeData; PLib3MFMeshObject_SetVolumeDataPtr m_MeshObject_SetVolumeData; + PLib3MFMeshObject_AddTriangleSetPtr m_MeshObject_AddTriangleSet; + PLib3MFMeshObject_HasTriangleSetPtr m_MeshObject_HasTriangleSet; + PLib3MFMeshObject_FindTriangleSetPtr m_MeshObject_FindTriangleSet; + PLib3MFMeshObject_GetTriangleSetCountPtr m_MeshObject_GetTriangleSetCount; + PLib3MFMeshObject_GetTriangleSetPtr m_MeshObject_GetTriangleSet; PLib3MFLevelSet_GetFunctionPtr m_LevelSet_GetFunction; PLib3MFLevelSet_SetFunctionPtr m_LevelSet_SetFunction; PLib3MFLevelSet_GetTransformPtr m_LevelSet_GetTransform; @@ -7265,6 +7462,45 @@ Lib3MFResult CCall_lib3mf_metadatagroup_removemetadata(Lib3MFHandle libraryHandl Lib3MFResult CCall_lib3mf_metadatagroup_addmetadata(Lib3MFHandle libraryHandle, Lib3MF_MetaDataGroup pMetaDataGroup, const char * pNameSpace, const char * pName, const char * pValue, const char * pType, bool bMustPreserve, Lib3MF_MetaData * pMetaData); +Lib3MFResult CCall_lib3mf_triangleset_setname(Lib3MFHandle libraryHandle, Lib3MF_TriangleSet pTriangleSet, const char * pName); + + +Lib3MFResult CCall_lib3mf_triangleset_getname(Lib3MFHandle libraryHandle, Lib3MF_TriangleSet pTriangleSet, const Lib3MF_uint32 nNameBufferSize, Lib3MF_uint32* pNameNeededChars, char * pNameBuffer); + + +Lib3MFResult CCall_lib3mf_triangleset_setidentifier(Lib3MFHandle libraryHandle, Lib3MF_TriangleSet pTriangleSet, const char * pIdentifier); + + +Lib3MFResult CCall_lib3mf_triangleset_getidentifier(Lib3MFHandle libraryHandle, Lib3MF_TriangleSet pTriangleSet, const Lib3MF_uint32 nIdentifierBufferSize, Lib3MF_uint32* pIdentifierNeededChars, char * pIdentifierBuffer); + + +Lib3MFResult CCall_lib3mf_triangleset_addtriangle(Lib3MFHandle libraryHandle, Lib3MF_TriangleSet pTriangleSet, Lib3MF_uint32 nTriangleIndex); + + +Lib3MFResult CCall_lib3mf_triangleset_removetriangle(Lib3MFHandle libraryHandle, Lib3MF_TriangleSet pTriangleSet, Lib3MF_uint32 nTriangleIndex); + + +Lib3MFResult CCall_lib3mf_triangleset_clear(Lib3MFHandle libraryHandle, Lib3MF_TriangleSet pTriangleSet); + + +Lib3MFResult CCall_lib3mf_triangleset_settrianglelist(Lib3MFHandle libraryHandle, Lib3MF_TriangleSet pTriangleSet, Lib3MF_uint64 nTriangleIndicesBufferSize, const Lib3MF_uint32 * pTriangleIndicesBuffer); + + +Lib3MFResult CCall_lib3mf_triangleset_gettrianglelist(Lib3MFHandle libraryHandle, Lib3MF_TriangleSet pTriangleSet, const Lib3MF_uint64 nTriangleIndicesBufferSize, Lib3MF_uint64* pTriangleIndicesNeededCount, Lib3MF_uint32 * pTriangleIndicesBuffer); + + +Lib3MFResult CCall_lib3mf_triangleset_addtrianglelist(Lib3MFHandle libraryHandle, Lib3MF_TriangleSet pTriangleSet, Lib3MF_uint64 nTriangleIndicesBufferSize, const Lib3MF_uint32 * pTriangleIndicesBuffer); + + +Lib3MFResult CCall_lib3mf_triangleset_merge(Lib3MFHandle libraryHandle, Lib3MF_TriangleSet pTriangleSet, Lib3MF_TriangleSet pOtherTriangleSet, bool bDeleteOther); + + +Lib3MFResult CCall_lib3mf_triangleset_deleteset(Lib3MFHandle libraryHandle, Lib3MF_TriangleSet pTriangleSet); + + +Lib3MFResult CCall_lib3mf_triangleset_duplicate(Lib3MFHandle libraryHandle, Lib3MF_TriangleSet pTriangleSet, const char * pIdentifier, Lib3MF_TriangleSet * pNewSet); + + Lib3MFResult CCall_lib3mf_object_gettype(Lib3MFHandle libraryHandle, Lib3MF_Object pObject, eLib3MFObjectType * pObjectType); @@ -7400,6 +7636,21 @@ Lib3MFResult CCall_lib3mf_meshobject_getvolumedata(Lib3MFHandle libraryHandle, L Lib3MFResult CCall_lib3mf_meshobject_setvolumedata(Lib3MFHandle libraryHandle, Lib3MF_MeshObject pMeshObject, Lib3MF_VolumeData pTheVolumeData); +Lib3MFResult CCall_lib3mf_meshobject_addtriangleset(Lib3MFHandle libraryHandle, Lib3MF_MeshObject pMeshObject, const char * pIdentifier, const char * pName, Lib3MF_TriangleSet * pTheTriangleSet); + + +Lib3MFResult CCall_lib3mf_meshobject_hastriangleset(Lib3MFHandle libraryHandle, Lib3MF_MeshObject pMeshObject, const char * pIdentifier, bool * pTriangleSetExists); + + +Lib3MFResult CCall_lib3mf_meshobject_findtriangleset(Lib3MFHandle libraryHandle, Lib3MF_MeshObject pMeshObject, const char * pIdentifier, Lib3MF_TriangleSet * pTheTriangleSet); + + +Lib3MFResult CCall_lib3mf_meshobject_gettrianglesetcount(Lib3MFHandle libraryHandle, Lib3MF_MeshObject pMeshObject, Lib3MF_uint32 * pCount); + + +Lib3MFResult CCall_lib3mf_meshobject_gettriangleset(Lib3MFHandle libraryHandle, Lib3MF_MeshObject pMeshObject, Lib3MF_uint32 nIndex, Lib3MF_TriangleSet * pTheTriangleSet); + + Lib3MFResult CCall_lib3mf_levelset_getfunction(Lib3MFHandle libraryHandle, Lib3MF_LevelSet pLevelSet, Lib3MF_Function * pTheFunction); diff --git a/Autogenerated/Bindings/Go/lib3mf_types.h b/Autogenerated/Bindings/Go/lib3mf_types.h index a5d436da..241f77f8 100644 --- a/Autogenerated/Bindings/Go/lib3mf_types.h +++ b/Autogenerated/Bindings/Go/lib3mf_types.h @@ -131,6 +131,8 @@ typedef void * Lib3MF_pvoid; #define LIB3MF_ERROR_ELEMENTCOUNTEXCEEDSLIMIT 141 /** An element buffer exceeds its spec limit */ #define LIB3MF_ERROR_INVALIDRESOURCE 142 /** A resource is invalid */ #define LIB3MF_ERROR_INVALIDLEVELSET 143 /** A level set is invalid */ +#define LIB3MF_ERROR_COULDNOTFINDTRIANGLESET 144 /** Could not find triangle set */ +#define LIB3MF_ERROR_INVALIDTRIANGLESETINDEX 145 /** Invalid triangle set index */ #define LIB3MF_ERROR_BEAMLATTICE_INVALID_OBJECTTYPE 2000 /** This object type is not valid for beamlattices */ #define LIB3MF_ERROR_INVALIDKEYSTORE 3000 /** The keystore object is invalid */ #define LIB3MF_ERROR_INVALIDKEYSTORECONSUMER 3001 /** The consumer keystore object is invalid */ @@ -187,6 +189,8 @@ inline const char * LIB3MF_GETERRORSTRING (Lib3MFResult nErrorCode) { case LIB3MF_ERROR_ELEMENTCOUNTEXCEEDSLIMIT: return "An element buffer exceeds its spec limit"; case LIB3MF_ERROR_INVALIDRESOURCE: return "A resource is invalid"; case LIB3MF_ERROR_INVALIDLEVELSET: return "A level set is invalid"; + case LIB3MF_ERROR_COULDNOTFINDTRIANGLESET: return "Could not find triangle set"; + case LIB3MF_ERROR_INVALIDTRIANGLESETINDEX: return "Invalid triangle set index"; case LIB3MF_ERROR_BEAMLATTICE_INVALID_OBJECTTYPE: return "This object type is not valid for beamlattices"; case LIB3MF_ERROR_INVALIDKEYSTORE: return "The keystore object is invalid"; case LIB3MF_ERROR_INVALIDKEYSTORECONSUMER: return "The consumer keystore object is invalid"; @@ -227,6 +231,7 @@ typedef Lib3MFHandle Lib3MF_FunctionIterator; typedef Lib3MFHandle Lib3MF_LevelSetIterator; typedef Lib3MFHandle Lib3MF_MetaData; typedef Lib3MFHandle Lib3MF_MetaDataGroup; +typedef Lib3MFHandle Lib3MF_TriangleSet; typedef Lib3MFHandle Lib3MF_Object; typedef Lib3MFHandle Lib3MF_MeshObject; typedef Lib3MFHandle Lib3MF_LevelSet; diff --git a/Autogenerated/Bindings/NodeJS/lib3mf_dynamic.cc b/Autogenerated/Bindings/NodeJS/lib3mf_dynamic.cc index e15559ef..2bd0c452 100644 --- a/Autogenerated/Bindings/NodeJS/lib3mf_dynamic.cc +++ b/Autogenerated/Bindings/NodeJS/lib3mf_dynamic.cc @@ -116,6 +116,19 @@ Lib3MFResult InitLib3MFWrapperTable(sLib3MFDynamicWrapperTable * pWrapperTable) pWrapperTable->m_MetaDataGroup_RemoveMetaDataByIndex = NULL; pWrapperTable->m_MetaDataGroup_RemoveMetaData = NULL; pWrapperTable->m_MetaDataGroup_AddMetaData = NULL; + pWrapperTable->m_TriangleSet_SetName = NULL; + pWrapperTable->m_TriangleSet_GetName = NULL; + pWrapperTable->m_TriangleSet_SetIdentifier = NULL; + pWrapperTable->m_TriangleSet_GetIdentifier = NULL; + pWrapperTable->m_TriangleSet_AddTriangle = NULL; + pWrapperTable->m_TriangleSet_RemoveTriangle = NULL; + pWrapperTable->m_TriangleSet_Clear = NULL; + pWrapperTable->m_TriangleSet_SetTriangleList = NULL; + pWrapperTable->m_TriangleSet_GetTriangleList = NULL; + pWrapperTable->m_TriangleSet_AddTriangleList = NULL; + pWrapperTable->m_TriangleSet_Merge = NULL; + pWrapperTable->m_TriangleSet_DeleteSet = NULL; + pWrapperTable->m_TriangleSet_Duplicate = NULL; pWrapperTable->m_Object_GetType = NULL; pWrapperTable->m_Object_SetType = NULL; pWrapperTable->m_Object_GetName = NULL; @@ -161,6 +174,11 @@ Lib3MFResult InitLib3MFWrapperTable(sLib3MFDynamicWrapperTable * pWrapperTable) pWrapperTable->m_MeshObject_BeamLattice = NULL; pWrapperTable->m_MeshObject_GetVolumeData = NULL; pWrapperTable->m_MeshObject_SetVolumeData = NULL; + pWrapperTable->m_MeshObject_AddTriangleSet = NULL; + pWrapperTable->m_MeshObject_HasTriangleSet = NULL; + pWrapperTable->m_MeshObject_FindTriangleSet = NULL; + pWrapperTable->m_MeshObject_GetTriangleSetCount = NULL; + pWrapperTable->m_MeshObject_GetTriangleSet = NULL; pWrapperTable->m_LevelSet_GetFunction = NULL; pWrapperTable->m_LevelSet_SetFunction = NULL; pWrapperTable->m_LevelSet_GetTransform = NULL; @@ -1316,6 +1334,123 @@ Lib3MFResult LoadLib3MFWrapperTable(sLib3MFDynamicWrapperTable * pWrapperTable, if (pWrapperTable->m_MetaDataGroup_AddMetaData == NULL) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + #ifdef _WIN32 + pWrapperTable->m_TriangleSet_SetName = (PLib3MFTriangleSet_SetNamePtr) GetProcAddress(hLibrary, "lib3mf_triangleset_setname"); + #else // _WIN32 + pWrapperTable->m_TriangleSet_SetName = (PLib3MFTriangleSet_SetNamePtr) dlsym(hLibrary, "lib3mf_triangleset_setname"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_TriangleSet_SetName == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_TriangleSet_GetName = (PLib3MFTriangleSet_GetNamePtr) GetProcAddress(hLibrary, "lib3mf_triangleset_getname"); + #else // _WIN32 + pWrapperTable->m_TriangleSet_GetName = (PLib3MFTriangleSet_GetNamePtr) dlsym(hLibrary, "lib3mf_triangleset_getname"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_TriangleSet_GetName == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_TriangleSet_SetIdentifier = (PLib3MFTriangleSet_SetIdentifierPtr) GetProcAddress(hLibrary, "lib3mf_triangleset_setidentifier"); + #else // _WIN32 + pWrapperTable->m_TriangleSet_SetIdentifier = (PLib3MFTriangleSet_SetIdentifierPtr) dlsym(hLibrary, "lib3mf_triangleset_setidentifier"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_TriangleSet_SetIdentifier == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_TriangleSet_GetIdentifier = (PLib3MFTriangleSet_GetIdentifierPtr) GetProcAddress(hLibrary, "lib3mf_triangleset_getidentifier"); + #else // _WIN32 + pWrapperTable->m_TriangleSet_GetIdentifier = (PLib3MFTriangleSet_GetIdentifierPtr) dlsym(hLibrary, "lib3mf_triangleset_getidentifier"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_TriangleSet_GetIdentifier == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_TriangleSet_AddTriangle = (PLib3MFTriangleSet_AddTrianglePtr) GetProcAddress(hLibrary, "lib3mf_triangleset_addtriangle"); + #else // _WIN32 + pWrapperTable->m_TriangleSet_AddTriangle = (PLib3MFTriangleSet_AddTrianglePtr) dlsym(hLibrary, "lib3mf_triangleset_addtriangle"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_TriangleSet_AddTriangle == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_TriangleSet_RemoveTriangle = (PLib3MFTriangleSet_RemoveTrianglePtr) GetProcAddress(hLibrary, "lib3mf_triangleset_removetriangle"); + #else // _WIN32 + pWrapperTable->m_TriangleSet_RemoveTriangle = (PLib3MFTriangleSet_RemoveTrianglePtr) dlsym(hLibrary, "lib3mf_triangleset_removetriangle"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_TriangleSet_RemoveTriangle == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_TriangleSet_Clear = (PLib3MFTriangleSet_ClearPtr) GetProcAddress(hLibrary, "lib3mf_triangleset_clear"); + #else // _WIN32 + pWrapperTable->m_TriangleSet_Clear = (PLib3MFTriangleSet_ClearPtr) dlsym(hLibrary, "lib3mf_triangleset_clear"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_TriangleSet_Clear == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_TriangleSet_SetTriangleList = (PLib3MFTriangleSet_SetTriangleListPtr) GetProcAddress(hLibrary, "lib3mf_triangleset_settrianglelist"); + #else // _WIN32 + pWrapperTable->m_TriangleSet_SetTriangleList = (PLib3MFTriangleSet_SetTriangleListPtr) dlsym(hLibrary, "lib3mf_triangleset_settrianglelist"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_TriangleSet_SetTriangleList == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_TriangleSet_GetTriangleList = (PLib3MFTriangleSet_GetTriangleListPtr) GetProcAddress(hLibrary, "lib3mf_triangleset_gettrianglelist"); + #else // _WIN32 + pWrapperTable->m_TriangleSet_GetTriangleList = (PLib3MFTriangleSet_GetTriangleListPtr) dlsym(hLibrary, "lib3mf_triangleset_gettrianglelist"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_TriangleSet_GetTriangleList == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_TriangleSet_AddTriangleList = (PLib3MFTriangleSet_AddTriangleListPtr) GetProcAddress(hLibrary, "lib3mf_triangleset_addtrianglelist"); + #else // _WIN32 + pWrapperTable->m_TriangleSet_AddTriangleList = (PLib3MFTriangleSet_AddTriangleListPtr) dlsym(hLibrary, "lib3mf_triangleset_addtrianglelist"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_TriangleSet_AddTriangleList == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_TriangleSet_Merge = (PLib3MFTriangleSet_MergePtr) GetProcAddress(hLibrary, "lib3mf_triangleset_merge"); + #else // _WIN32 + pWrapperTable->m_TriangleSet_Merge = (PLib3MFTriangleSet_MergePtr) dlsym(hLibrary, "lib3mf_triangleset_merge"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_TriangleSet_Merge == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_TriangleSet_DeleteSet = (PLib3MFTriangleSet_DeleteSetPtr) GetProcAddress(hLibrary, "lib3mf_triangleset_deleteset"); + #else // _WIN32 + pWrapperTable->m_TriangleSet_DeleteSet = (PLib3MFTriangleSet_DeleteSetPtr) dlsym(hLibrary, "lib3mf_triangleset_deleteset"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_TriangleSet_DeleteSet == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_TriangleSet_Duplicate = (PLib3MFTriangleSet_DuplicatePtr) GetProcAddress(hLibrary, "lib3mf_triangleset_duplicate"); + #else // _WIN32 + pWrapperTable->m_TriangleSet_Duplicate = (PLib3MFTriangleSet_DuplicatePtr) dlsym(hLibrary, "lib3mf_triangleset_duplicate"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_TriangleSet_Duplicate == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + #ifdef _WIN32 pWrapperTable->m_Object_GetType = (PLib3MFObject_GetTypePtr) GetProcAddress(hLibrary, "lib3mf_object_gettype"); #else // _WIN32 @@ -1721,6 +1856,51 @@ Lib3MFResult LoadLib3MFWrapperTable(sLib3MFDynamicWrapperTable * pWrapperTable, if (pWrapperTable->m_MeshObject_SetVolumeData == NULL) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + #ifdef _WIN32 + pWrapperTable->m_MeshObject_AddTriangleSet = (PLib3MFMeshObject_AddTriangleSetPtr) GetProcAddress(hLibrary, "lib3mf_meshobject_addtriangleset"); + #else // _WIN32 + pWrapperTable->m_MeshObject_AddTriangleSet = (PLib3MFMeshObject_AddTriangleSetPtr) dlsym(hLibrary, "lib3mf_meshobject_addtriangleset"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_MeshObject_AddTriangleSet == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_MeshObject_HasTriangleSet = (PLib3MFMeshObject_HasTriangleSetPtr) GetProcAddress(hLibrary, "lib3mf_meshobject_hastriangleset"); + #else // _WIN32 + pWrapperTable->m_MeshObject_HasTriangleSet = (PLib3MFMeshObject_HasTriangleSetPtr) dlsym(hLibrary, "lib3mf_meshobject_hastriangleset"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_MeshObject_HasTriangleSet == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_MeshObject_FindTriangleSet = (PLib3MFMeshObject_FindTriangleSetPtr) GetProcAddress(hLibrary, "lib3mf_meshobject_findtriangleset"); + #else // _WIN32 + pWrapperTable->m_MeshObject_FindTriangleSet = (PLib3MFMeshObject_FindTriangleSetPtr) dlsym(hLibrary, "lib3mf_meshobject_findtriangleset"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_MeshObject_FindTriangleSet == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_MeshObject_GetTriangleSetCount = (PLib3MFMeshObject_GetTriangleSetCountPtr) GetProcAddress(hLibrary, "lib3mf_meshobject_gettrianglesetcount"); + #else // _WIN32 + pWrapperTable->m_MeshObject_GetTriangleSetCount = (PLib3MFMeshObject_GetTriangleSetCountPtr) dlsym(hLibrary, "lib3mf_meshobject_gettrianglesetcount"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_MeshObject_GetTriangleSetCount == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_MeshObject_GetTriangleSet = (PLib3MFMeshObject_GetTriangleSetPtr) GetProcAddress(hLibrary, "lib3mf_meshobject_gettriangleset"); + #else // _WIN32 + pWrapperTable->m_MeshObject_GetTriangleSet = (PLib3MFMeshObject_GetTriangleSetPtr) dlsym(hLibrary, "lib3mf_meshobject_gettriangleset"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_MeshObject_GetTriangleSet == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + #ifdef _WIN32 pWrapperTable->m_LevelSet_GetFunction = (PLib3MFLevelSet_GetFunctionPtr) GetProcAddress(hLibrary, "lib3mf_levelset_getfunction"); #else // _WIN32 diff --git a/Autogenerated/Bindings/NodeJS/lib3mf_dynamic.h b/Autogenerated/Bindings/NodeJS/lib3mf_dynamic.h index 0211b290..972d3637 100644 --- a/Autogenerated/Bindings/NodeJS/lib3mf_dynamic.h +++ b/Autogenerated/Bindings/NodeJS/lib3mf_dynamic.h @@ -780,6 +780,135 @@ typedef Lib3MFResult (*PLib3MFMetaDataGroup_RemoveMetaDataPtr) (Lib3MF_MetaDataG */ typedef Lib3MFResult (*PLib3MFMetaDataGroup_AddMetaDataPtr) (Lib3MF_MetaDataGroup pMetaDataGroup, const char * pNameSpace, const char * pName, const char * pValue, const char * pType, bool bMustPreserve, Lib3MF_MetaData * pMetaData); +/************************************************************************************************************************* + Class definition for TriangleSet +**************************************************************************************************************************/ + +/** +* sets the name of the triangle set +* +* @param[in] pTriangleSet - TriangleSet instance. +* @param[in] pName - the new name +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFTriangleSet_SetNamePtr) (Lib3MF_TriangleSet pTriangleSet, const char * pName); + +/** +* returns the name of the triangle set +* +* @param[in] pTriangleSet - TriangleSet instance. +* @param[in] nNameBufferSize - size of the buffer (including trailing 0) +* @param[out] pNameNeededChars - will be filled with the count of the written bytes, or needed buffer size. +* @param[out] pNameBuffer - buffer of returns the name, may be NULL +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFTriangleSet_GetNamePtr) (Lib3MF_TriangleSet pTriangleSet, const Lib3MF_uint32 nNameBufferSize, Lib3MF_uint32* pNameNeededChars, char * pNameBuffer); + +/** +* sets the identifier of the triangle set. +* +* @param[in] pTriangleSet - TriangleSet instance. +* @param[in] pIdentifier - the new identifier. MUST be unique within the mesh. MUST NOT be an empty string +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFTriangleSet_SetIdentifierPtr) (Lib3MF_TriangleSet pTriangleSet, const char * pIdentifier); + +/** +* returns the identifier of the triangle set +* +* @param[in] pTriangleSet - TriangleSet instance. +* @param[in] nIdentifierBufferSize - size of the buffer (including trailing 0) +* @param[out] pIdentifierNeededChars - will be filled with the count of the written bytes, or needed buffer size. +* @param[out] pIdentifierBuffer - buffer of returns the identifier, may be NULL +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFTriangleSet_GetIdentifierPtr) (Lib3MF_TriangleSet pTriangleSet, const Lib3MF_uint32 nIdentifierBufferSize, Lib3MF_uint32* pIdentifierNeededChars, char * pIdentifierBuffer); + +/** +* adds a triangle to the set. Does nothing if triangle is already in the set. +* +* @param[in] pTriangleSet - TriangleSet instance. +* @param[in] nTriangleIndex - Triangle index to add. MUST be between 0 and TriangleCount - 1. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFTriangleSet_AddTrianglePtr) (Lib3MF_TriangleSet pTriangleSet, Lib3MF_uint32 nTriangleIndex); + +/** +* removes a triangle from the set +* +* @param[in] pTriangleSet - TriangleSet instance. +* @param[in] nTriangleIndex - Triangle index to remove. MUST be between 0 and TriangleCount - 1. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFTriangleSet_RemoveTrianglePtr) (Lib3MF_TriangleSet pTriangleSet, Lib3MF_uint32 nTriangleIndex); + +/** +* clears all triangles from the list +* +* @param[in] pTriangleSet - TriangleSet instance. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFTriangleSet_ClearPtr) (Lib3MF_TriangleSet pTriangleSet); + +/** +* Sets all triangles in the list, while clearing old values. Duplicates will be merged. +* +* @param[in] pTriangleSet - TriangleSet instance. +* @param[in] nTriangleIndicesBufferSize - Number of elements in buffer +* @param[in] pTriangleIndicesBuffer - uint32 buffer of Triangle indices to add. Every element MUST be between 0 and TriangleCount - 1. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFTriangleSet_SetTriangleListPtr) (Lib3MF_TriangleSet pTriangleSet, Lib3MF_uint64 nTriangleIndicesBufferSize, const Lib3MF_uint32 * pTriangleIndicesBuffer); + +/** +* Retrieves all the triangles in the TriangleSet +* +* @param[in] pTriangleSet - TriangleSet instance. +* @param[in] nTriangleIndicesBufferSize - Number of elements in buffer +* @param[out] pTriangleIndicesNeededCount - will be filled with the count of the written elements, or needed buffer size. +* @param[out] pTriangleIndicesBuffer - uint32 buffer of retrieves the indices of the triangles in this TriangleSet +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFTriangleSet_GetTriangleListPtr) (Lib3MF_TriangleSet pTriangleSet, const Lib3MF_uint64 nTriangleIndicesBufferSize, Lib3MF_uint64* pTriangleIndicesNeededCount, Lib3MF_uint32 * pTriangleIndicesBuffer); + +/** +* Adds multiple triangles in the list. Duplicates will be merged. +* +* @param[in] pTriangleSet - TriangleSet instance. +* @param[in] nTriangleIndicesBufferSize - Number of elements in buffer +* @param[in] pTriangleIndicesBuffer - uint32 buffer of Triangle indices to add. Every element MUST be between 0 and TriangleCount - 1. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFTriangleSet_AddTriangleListPtr) (Lib3MF_TriangleSet pTriangleSet, Lib3MF_uint64 nTriangleIndicesBufferSize, const Lib3MF_uint32 * pTriangleIndicesBuffer); + +/** +* Merges another Triangle set. +* +* @param[in] pTriangleSet - TriangleSet instance. +* @param[in] pOtherTriangleSet - Other triangle set to merge. +* @param[in] bDeleteOther - Flag if other triangle set is getting removed. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFTriangleSet_MergePtr) (Lib3MF_TriangleSet pTriangleSet, Lib3MF_TriangleSet pOtherTriangleSet, bool bDeleteOther); + +/** +* Deletes the whole set from the mesh. +* +* @param[in] pTriangleSet - TriangleSet instance. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFTriangleSet_DeleteSetPtr) (Lib3MF_TriangleSet pTriangleSet); + +/** +* Duplicates the set in the mesh. +* +* @param[in] pTriangleSet - TriangleSet instance. +* @param[in] pIdentifier - the new identifier. MUST be unique within the mesh. MUST NOT be an empty string +* @param[out] pNewSet - Copy of the triangle set. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFTriangleSet_DuplicatePtr) (Lib3MF_TriangleSet pTriangleSet, const char * pIdentifier, Lib3MF_TriangleSet * pNewSet); + /************************************************************************************************************************* Class definition for Object **************************************************************************************************************************/ @@ -1219,6 +1348,56 @@ typedef Lib3MFResult (*PLib3MFMeshObject_GetVolumeDataPtr) (Lib3MF_MeshObject pM */ typedef Lib3MFResult (*PLib3MFMeshObject_SetVolumeDataPtr) (Lib3MF_MeshObject pMeshObject, Lib3MF_VolumeData pTheVolumeData); +/** +* Adds a new triangle set. +* +* @param[in] pMeshObject - MeshObject instance. +* @param[in] pIdentifier - the new identifier. MUST be unique within the mesh. MUST NOT be an empty string +* @param[in] pName - the human readable name. MUST NOT be an empty string +* @param[out] pTheTriangleSet - the new Triangle Set Instance. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFMeshObject_AddTriangleSetPtr) (Lib3MF_MeshObject pMeshObject, const char * pIdentifier, const char * pName, Lib3MF_TriangleSet * pTheTriangleSet); + +/** +* Checks if a triangle set exists. +* +* @param[in] pMeshObject - MeshObject instance. +* @param[in] pIdentifier - the identifier to be found. +* @param[out] pTriangleSetExists - flag if the triangles set exists. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFMeshObject_HasTriangleSetPtr) (Lib3MF_MeshObject pMeshObject, const char * pIdentifier, bool * pTriangleSetExists); + +/** +* Finds a new triangle set by identifier. Fails if not existing. +* +* @param[in] pMeshObject - MeshObject instance. +* @param[in] pIdentifier - the identifier to be found. +* @param[out] pTheTriangleSet - the triangle Set Instance. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFMeshObject_FindTriangleSetPtr) (Lib3MF_MeshObject pMeshObject, const char * pIdentifier, Lib3MF_TriangleSet * pTheTriangleSet); + +/** +* Returns number of triangle sets. +* +* @param[in] pMeshObject - MeshObject instance. +* @param[out] pCount - the number of triangle sets of this mesh. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFMeshObject_GetTriangleSetCountPtr) (Lib3MF_MeshObject pMeshObject, Lib3MF_uint32 * pCount); + +/** +* Returns a specific triangle set by index. +* +* @param[in] pMeshObject - MeshObject instance. +* @param[in] nIndex - the index of the triangle set. +* @param[out] pTheTriangleSet - the triangle Set Instance. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFMeshObject_GetTriangleSetPtr) (Lib3MF_MeshObject pMeshObject, Lib3MF_uint32 nIndex, Lib3MF_TriangleSet * pTheTriangleSet); + /************************************************************************************************************************* Class definition for LevelSet **************************************************************************************************************************/ @@ -6512,6 +6691,19 @@ typedef struct { PLib3MFMetaDataGroup_RemoveMetaDataByIndexPtr m_MetaDataGroup_RemoveMetaDataByIndex; PLib3MFMetaDataGroup_RemoveMetaDataPtr m_MetaDataGroup_RemoveMetaData; PLib3MFMetaDataGroup_AddMetaDataPtr m_MetaDataGroup_AddMetaData; + PLib3MFTriangleSet_SetNamePtr m_TriangleSet_SetName; + PLib3MFTriangleSet_GetNamePtr m_TriangleSet_GetName; + PLib3MFTriangleSet_SetIdentifierPtr m_TriangleSet_SetIdentifier; + PLib3MFTriangleSet_GetIdentifierPtr m_TriangleSet_GetIdentifier; + PLib3MFTriangleSet_AddTrianglePtr m_TriangleSet_AddTriangle; + PLib3MFTriangleSet_RemoveTrianglePtr m_TriangleSet_RemoveTriangle; + PLib3MFTriangleSet_ClearPtr m_TriangleSet_Clear; + PLib3MFTriangleSet_SetTriangleListPtr m_TriangleSet_SetTriangleList; + PLib3MFTriangleSet_GetTriangleListPtr m_TriangleSet_GetTriangleList; + PLib3MFTriangleSet_AddTriangleListPtr m_TriangleSet_AddTriangleList; + PLib3MFTriangleSet_MergePtr m_TriangleSet_Merge; + PLib3MFTriangleSet_DeleteSetPtr m_TriangleSet_DeleteSet; + PLib3MFTriangleSet_DuplicatePtr m_TriangleSet_Duplicate; PLib3MFObject_GetTypePtr m_Object_GetType; PLib3MFObject_SetTypePtr m_Object_SetType; PLib3MFObject_GetNamePtr m_Object_GetName; @@ -6557,6 +6749,11 @@ typedef struct { PLib3MFMeshObject_BeamLatticePtr m_MeshObject_BeamLattice; PLib3MFMeshObject_GetVolumeDataPtr m_MeshObject_GetVolumeData; PLib3MFMeshObject_SetVolumeDataPtr m_MeshObject_SetVolumeData; + PLib3MFMeshObject_AddTriangleSetPtr m_MeshObject_AddTriangleSet; + PLib3MFMeshObject_HasTriangleSetPtr m_MeshObject_HasTriangleSet; + PLib3MFMeshObject_FindTriangleSetPtr m_MeshObject_FindTriangleSet; + PLib3MFMeshObject_GetTriangleSetCountPtr m_MeshObject_GetTriangleSetCount; + PLib3MFMeshObject_GetTriangleSetPtr m_MeshObject_GetTriangleSet; PLib3MFLevelSet_GetFunctionPtr m_LevelSet_GetFunction; PLib3MFLevelSet_SetFunctionPtr m_LevelSet_SetFunction; PLib3MFLevelSet_GetTransformPtr m_LevelSet_GetTransform; diff --git a/Autogenerated/Bindings/NodeJS/lib3mf_nodeaddon.cc b/Autogenerated/Bindings/NodeJS/lib3mf_nodeaddon.cc index 5e403cfd..7ebb5ffb 100644 --- a/Autogenerated/Bindings/NodeJS/lib3mf_nodeaddon.cc +++ b/Autogenerated/Bindings/NodeJS/lib3mf_nodeaddon.cc @@ -69,6 +69,7 @@ void InitAll(v8::Local exports, v8::Local module) CLib3MFLevelSetIterator::Init(); CLib3MFMetaData::Init(); CLib3MFMetaDataGroup::Init(); + CLib3MFTriangleSet::Init(); CLib3MFObject::Init(); CLib3MFMeshObject::Init(); CLib3MFLevelSet::Init(); diff --git a/Autogenerated/Bindings/NodeJS/lib3mf_nodewrapper.cc b/Autogenerated/Bindings/NodeJS/lib3mf_nodewrapper.cc index 1914e2c2..6d5c5f0d 100644 --- a/Autogenerated/Bindings/NodeJS/lib3mf_nodewrapper.cc +++ b/Autogenerated/Bindings/NodeJS/lib3mf_nodewrapper.cc @@ -62,6 +62,7 @@ Persistent CLib3MFFunctionIterator::constructor; Persistent CLib3MFLevelSetIterator::constructor; Persistent CLib3MFMetaData::constructor; Persistent CLib3MFMetaDataGroup::constructor; +Persistent CLib3MFTriangleSet::constructor; Persistent CLib3MFObject::constructor; Persistent CLib3MFMeshObject::constructor; Persistent CLib3MFLevelSet::constructor; @@ -4307,6 +4308,386 @@ void CLib3MFMetaDataGroup::AddMetaData(const FunctionCallbackInfo& args) } } +/************************************************************************************************************************* + Class CLib3MFTriangleSet Implementation +**************************************************************************************************************************/ + +CLib3MFTriangleSet::CLib3MFTriangleSet() + : CLib3MFBaseClass() +{ +} + +CLib3MFTriangleSet::~CLib3MFTriangleSet() +{ +} + +void CLib3MFTriangleSet::Init() +{ + Isolate* isolate = Isolate::GetCurrent(); + + // Prepare constructor template + Local tpl = FunctionTemplate::New(isolate, New); + tpl->SetClassName(String::NewFromUtf8(isolate, "Lib3MFTriangleSet")); + tpl->InstanceTemplate()->SetInternalFieldCount(NODEWRAPPER_FIELDCOUNT); + + // Prototype + NODE_SET_PROTOTYPE_METHOD(tpl, "SetName", SetName); + NODE_SET_PROTOTYPE_METHOD(tpl, "GetName", GetName); + NODE_SET_PROTOTYPE_METHOD(tpl, "SetIdentifier", SetIdentifier); + NODE_SET_PROTOTYPE_METHOD(tpl, "GetIdentifier", GetIdentifier); + NODE_SET_PROTOTYPE_METHOD(tpl, "AddTriangle", AddTriangle); + NODE_SET_PROTOTYPE_METHOD(tpl, "RemoveTriangle", RemoveTriangle); + NODE_SET_PROTOTYPE_METHOD(tpl, "Clear", Clear); + NODE_SET_PROTOTYPE_METHOD(tpl, "SetTriangleList", SetTriangleList); + NODE_SET_PROTOTYPE_METHOD(tpl, "GetTriangleList", GetTriangleList); + NODE_SET_PROTOTYPE_METHOD(tpl, "AddTriangleList", AddTriangleList); + NODE_SET_PROTOTYPE_METHOD(tpl, "Merge", Merge); + NODE_SET_PROTOTYPE_METHOD(tpl, "DeleteSet", DeleteSet); + NODE_SET_PROTOTYPE_METHOD(tpl, "Duplicate", Duplicate); + constructor.Reset(isolate, tpl->GetFunction(isolate->GetCurrentContext()).ToLocalChecked()); + +} + +void CLib3MFTriangleSet::New(const FunctionCallbackInfo& args) +{ + Isolate* isolate = args.GetIsolate(); + HandleScope scope(isolate); + + if (args.IsConstructCall()) { + CLib3MFBaseClass * holderObj = ObjectWrap::Unwrap(args.Holder()); + CLib3MFTriangleSet * trianglesetInstance = new CLib3MFTriangleSet(); + trianglesetInstance->Wrap(args.This()); + args.GetReturnValue().Set(args.This()); + } else { + RaiseError(isolate, "Lib3MFTriangleSet: Invalid call to Constructor"); + } +} + +Local CLib3MFTriangleSet::NewInstance(Local pParent, Lib3MFHandle pHandle) +{ + Isolate* isolate = Isolate::GetCurrent(); + HandleScope scope(isolate); + Local cons = Local::New(isolate, constructor); + Local instance; + if (cons->NewInstance(isolate->GetCurrentContext()).ToLocal(&instance)) { + instance->SetInternalField(NODEWRAPPER_TABLEINDEX, External::New(isolate, CLib3MFBaseClass::getDynamicWrapperTable(pParent))); + instance->SetInternalField(NODEWRAPPER_HANDLEINDEX, External::New(isolate, pHandle)); + } + return instance; +} + + +void CLib3MFTriangleSet::SetName(const FunctionCallbackInfo& args) +{ + Isolate* isolate = args.GetIsolate(); + HandleScope scope(isolate); + try { + if (!args[0]->IsString()) { + throw std::runtime_error("Expected string parameter 0 (Name)"); + } + v8::String::Utf8Value sutf8Name(isolate, args[0]); + std::string sName = *sutf8Name; + sLib3MFDynamicWrapperTable * wrapperTable = CLib3MFBaseClass::getDynamicWrapperTable(args.Holder()); + if (wrapperTable == nullptr) + throw std::runtime_error("Could not get wrapper table for Lib3MF method SetName."); + if (wrapperTable->m_TriangleSet_SetName == nullptr) + throw std::runtime_error("Could not call Lib3MF method TriangleSet::SetName."); + Lib3MFHandle instanceHandle = CLib3MFBaseClass::getHandle(args.Holder()); + Lib3MFResult errorCode = wrapperTable->m_TriangleSet_SetName(instanceHandle, sName.c_str()); + CheckError(isolate, wrapperTable, instanceHandle, errorCode); + + } catch (std::exception & E) { + RaiseError(isolate, E.what()); + } +} + + +void CLib3MFTriangleSet::GetName(const FunctionCallbackInfo& args) +{ + Isolate* isolate = args.GetIsolate(); + HandleScope scope(isolate); + try { + unsigned int bytesNeededName = 0; + unsigned int bytesWrittenName = 0; + sLib3MFDynamicWrapperTable * wrapperTable = CLib3MFBaseClass::getDynamicWrapperTable(args.Holder()); + if (wrapperTable == nullptr) + throw std::runtime_error("Could not get wrapper table for Lib3MF method GetName."); + if (wrapperTable->m_TriangleSet_GetName == nullptr) + throw std::runtime_error("Could not call Lib3MF method TriangleSet::GetName."); + Lib3MFHandle instanceHandle = CLib3MFBaseClass::getHandle(args.Holder()); + Lib3MFResult initErrorCode = wrapperTable->m_TriangleSet_GetName(instanceHandle, 0, &bytesNeededName, nullptr); + CheckError(isolate, wrapperTable, instanceHandle, initErrorCode); + std::vector bufferName; + bufferName.resize(bytesNeededName); + Lib3MFResult errorCode = wrapperTable->m_TriangleSet_GetName(instanceHandle, bytesNeededName, &bytesWrittenName, &bufferName[0]); + CheckError(isolate, wrapperTable, instanceHandle, errorCode); + args.GetReturnValue().Set(String::NewFromUtf8(isolate, &bufferName[0])); + + } catch (std::exception & E) { + RaiseError(isolate, E.what()); + } +} + + +void CLib3MFTriangleSet::SetIdentifier(const FunctionCallbackInfo& args) +{ + Isolate* isolate = args.GetIsolate(); + HandleScope scope(isolate); + try { + if (!args[0]->IsString()) { + throw std::runtime_error("Expected string parameter 0 (Identifier)"); + } + v8::String::Utf8Value sutf8Identifier(isolate, args[0]); + std::string sIdentifier = *sutf8Identifier; + sLib3MFDynamicWrapperTable * wrapperTable = CLib3MFBaseClass::getDynamicWrapperTable(args.Holder()); + if (wrapperTable == nullptr) + throw std::runtime_error("Could not get wrapper table for Lib3MF method SetIdentifier."); + if (wrapperTable->m_TriangleSet_SetIdentifier == nullptr) + throw std::runtime_error("Could not call Lib3MF method TriangleSet::SetIdentifier."); + Lib3MFHandle instanceHandle = CLib3MFBaseClass::getHandle(args.Holder()); + Lib3MFResult errorCode = wrapperTable->m_TriangleSet_SetIdentifier(instanceHandle, sIdentifier.c_str()); + CheckError(isolate, wrapperTable, instanceHandle, errorCode); + + } catch (std::exception & E) { + RaiseError(isolate, E.what()); + } +} + + +void CLib3MFTriangleSet::GetIdentifier(const FunctionCallbackInfo& args) +{ + Isolate* isolate = args.GetIsolate(); + HandleScope scope(isolate); + try { + unsigned int bytesNeededIdentifier = 0; + unsigned int bytesWrittenIdentifier = 0; + sLib3MFDynamicWrapperTable * wrapperTable = CLib3MFBaseClass::getDynamicWrapperTable(args.Holder()); + if (wrapperTable == nullptr) + throw std::runtime_error("Could not get wrapper table for Lib3MF method GetIdentifier."); + if (wrapperTable->m_TriangleSet_GetIdentifier == nullptr) + throw std::runtime_error("Could not call Lib3MF method TriangleSet::GetIdentifier."); + Lib3MFHandle instanceHandle = CLib3MFBaseClass::getHandle(args.Holder()); + Lib3MFResult initErrorCode = wrapperTable->m_TriangleSet_GetIdentifier(instanceHandle, 0, &bytesNeededIdentifier, nullptr); + CheckError(isolate, wrapperTable, instanceHandle, initErrorCode); + std::vector bufferIdentifier; + bufferIdentifier.resize(bytesNeededIdentifier); + Lib3MFResult errorCode = wrapperTable->m_TriangleSet_GetIdentifier(instanceHandle, bytesNeededIdentifier, &bytesWrittenIdentifier, &bufferIdentifier[0]); + CheckError(isolate, wrapperTable, instanceHandle, errorCode); + args.GetReturnValue().Set(String::NewFromUtf8(isolate, &bufferIdentifier[0])); + + } catch (std::exception & E) { + RaiseError(isolate, E.what()); + } +} + + +void CLib3MFTriangleSet::AddTriangle(const FunctionCallbackInfo& args) +{ + Isolate* isolate = args.GetIsolate(); + HandleScope scope(isolate); + try { + if (!args[0]->IsUint32()) { + throw std::runtime_error("Expected uint32 parameter 0 (TriangleIndex)"); + } + unsigned int nTriangleIndex = (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 AddTriangle."); + if (wrapperTable->m_TriangleSet_AddTriangle == nullptr) + throw std::runtime_error("Could not call Lib3MF method TriangleSet::AddTriangle."); + Lib3MFHandle instanceHandle = CLib3MFBaseClass::getHandle(args.Holder()); + Lib3MFResult errorCode = wrapperTable->m_TriangleSet_AddTriangle(instanceHandle, nTriangleIndex); + CheckError(isolate, wrapperTable, instanceHandle, errorCode); + + } catch (std::exception & E) { + RaiseError(isolate, E.what()); + } +} + + +void CLib3MFTriangleSet::RemoveTriangle(const FunctionCallbackInfo& args) +{ + Isolate* isolate = args.GetIsolate(); + HandleScope scope(isolate); + try { + if (!args[0]->IsUint32()) { + throw std::runtime_error("Expected uint32 parameter 0 (TriangleIndex)"); + } + unsigned int nTriangleIndex = (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 RemoveTriangle."); + if (wrapperTable->m_TriangleSet_RemoveTriangle == nullptr) + throw std::runtime_error("Could not call Lib3MF method TriangleSet::RemoveTriangle."); + Lib3MFHandle instanceHandle = CLib3MFBaseClass::getHandle(args.Holder()); + Lib3MFResult errorCode = wrapperTable->m_TriangleSet_RemoveTriangle(instanceHandle, nTriangleIndex); + CheckError(isolate, wrapperTable, instanceHandle, errorCode); + + } catch (std::exception & E) { + RaiseError(isolate, E.what()); + } +} + + +void CLib3MFTriangleSet::Clear(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 Clear."); + if (wrapperTable->m_TriangleSet_Clear == nullptr) + throw std::runtime_error("Could not call Lib3MF method TriangleSet::Clear."); + Lib3MFHandle instanceHandle = CLib3MFBaseClass::getHandle(args.Holder()); + Lib3MFResult errorCode = wrapperTable->m_TriangleSet_Clear(instanceHandle); + CheckError(isolate, wrapperTable, instanceHandle, errorCode); + + } catch (std::exception & E) { + RaiseError(isolate, E.what()); + } +} + + +void CLib3MFTriangleSet::SetTriangleList(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 SetTriangleList."); + if (wrapperTable->m_TriangleSet_SetTriangleList == nullptr) + throw std::runtime_error("Could not call Lib3MF method TriangleSet::SetTriangleList."); + Lib3MFHandle instanceHandle = CLib3MFBaseClass::getHandle(args.Holder()); + Lib3MFResult errorCode = wrapperTable->m_TriangleSet_SetTriangleList(instanceHandle, 0, nullptr); + CheckError(isolate, wrapperTable, instanceHandle, errorCode); + + } catch (std::exception & E) { + RaiseError(isolate, E.what()); + } +} + + +void CLib3MFTriangleSet::GetTriangleList(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 GetTriangleList."); + if (wrapperTable->m_TriangleSet_GetTriangleList == nullptr) + throw std::runtime_error("Could not call Lib3MF method TriangleSet::GetTriangleList."); + Lib3MFHandle instanceHandle = CLib3MFBaseClass::getHandle(args.Holder()); + Lib3MFResult errorCode = wrapperTable->m_TriangleSet_GetTriangleList(instanceHandle, 0, nullptr, nullptr); + CheckError(isolate, wrapperTable, instanceHandle, errorCode); + + } catch (std::exception & E) { + RaiseError(isolate, E.what()); + } +} + + +void CLib3MFTriangleSet::AddTriangleList(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 AddTriangleList."); + if (wrapperTable->m_TriangleSet_AddTriangleList == nullptr) + throw std::runtime_error("Could not call Lib3MF method TriangleSet::AddTriangleList."); + Lib3MFHandle instanceHandle = CLib3MFBaseClass::getHandle(args.Holder()); + Lib3MFResult errorCode = wrapperTable->m_TriangleSet_AddTriangleList(instanceHandle, 0, nullptr); + CheckError(isolate, wrapperTable, instanceHandle, errorCode); + + } catch (std::exception & E) { + RaiseError(isolate, E.what()); + } +} + + +void CLib3MFTriangleSet::Merge(const FunctionCallbackInfo& args) +{ + Isolate* isolate = args.GetIsolate(); + HandleScope scope(isolate); + try { + if (!args[0]->IsObject()) { + throw std::runtime_error("Expected class parameter 0 (OtherTriangleSet)"); + } + if (!args[1]->IsBoolean()) { + throw std::runtime_error("Expected bool parameter 1 (DeleteOther)"); + } + Local objOtherTriangleSet = args[0]->ToObject(isolate->GetCurrentContext()).ToLocalChecked(); + CLib3MFTriangleSet * instanceOtherTriangleSet = ObjectWrap::Unwrap(objOtherTriangleSet); + if (instanceOtherTriangleSet == nullptr) + throw std::runtime_error("Invalid Object parameter 0 (OtherTriangleSet)"); + Lib3MFHandle hOtherTriangleSet = instanceOtherTriangleSet->getHandle( objOtherTriangleSet ); + bool bDeleteOther = args[1]->BooleanValue(isolate->GetCurrentContext()).ToChecked(); + sLib3MFDynamicWrapperTable * wrapperTable = CLib3MFBaseClass::getDynamicWrapperTable(args.Holder()); + if (wrapperTable == nullptr) + throw std::runtime_error("Could not get wrapper table for Lib3MF method Merge."); + if (wrapperTable->m_TriangleSet_Merge == nullptr) + throw std::runtime_error("Could not call Lib3MF method TriangleSet::Merge."); + Lib3MFHandle instanceHandle = CLib3MFBaseClass::getHandle(args.Holder()); + Lib3MFResult errorCode = wrapperTable->m_TriangleSet_Merge(instanceHandle, hOtherTriangleSet, bDeleteOther); + CheckError(isolate, wrapperTable, instanceHandle, errorCode); + + } catch (std::exception & E) { + RaiseError(isolate, E.what()); + } +} + + +void CLib3MFTriangleSet::DeleteSet(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 DeleteSet."); + if (wrapperTable->m_TriangleSet_DeleteSet == nullptr) + throw std::runtime_error("Could not call Lib3MF method TriangleSet::DeleteSet."); + Lib3MFHandle instanceHandle = CLib3MFBaseClass::getHandle(args.Holder()); + Lib3MFResult errorCode = wrapperTable->m_TriangleSet_DeleteSet(instanceHandle); + CheckError(isolate, wrapperTable, instanceHandle, errorCode); + + } catch (std::exception & E) { + RaiseError(isolate, E.what()); + } +} + + +void CLib3MFTriangleSet::Duplicate(const FunctionCallbackInfo& args) +{ + Isolate* isolate = args.GetIsolate(); + HandleScope scope(isolate); + try { + if (!args[0]->IsString()) { + throw std::runtime_error("Expected string parameter 0 (Identifier)"); + } + v8::String::Utf8Value sutf8Identifier(isolate, args[0]); + std::string sIdentifier = *sutf8Identifier; + Lib3MFHandle hReturnNewSet = nullptr; + sLib3MFDynamicWrapperTable * wrapperTable = CLib3MFBaseClass::getDynamicWrapperTable(args.Holder()); + if (wrapperTable == nullptr) + throw std::runtime_error("Could not get wrapper table for Lib3MF method Duplicate."); + if (wrapperTable->m_TriangleSet_Duplicate == nullptr) + throw std::runtime_error("Could not call Lib3MF method TriangleSet::Duplicate."); + Lib3MFHandle instanceHandle = CLib3MFBaseClass::getHandle(args.Holder()); + Lib3MFResult errorCode = wrapperTable->m_TriangleSet_Duplicate(instanceHandle, sIdentifier.c_str(), &hReturnNewSet); + CheckError(isolate, wrapperTable, instanceHandle, errorCode); + Local instanceObjNewSet = CLib3MFTriangleSet::NewInstance(args.Holder(), hReturnNewSet); + args.GetReturnValue().Set(instanceObjNewSet); + + } catch (std::exception & E) { + RaiseError(isolate, E.what()); + } +} + /************************************************************************************************************************* Class CLib3MFObject Implementation **************************************************************************************************************************/ @@ -4983,6 +5364,11 @@ void CLib3MFMeshObject::Init() NODE_SET_PROTOTYPE_METHOD(tpl, "BeamLattice", BeamLattice); NODE_SET_PROTOTYPE_METHOD(tpl, "GetVolumeData", GetVolumeData); NODE_SET_PROTOTYPE_METHOD(tpl, "SetVolumeData", SetVolumeData); + NODE_SET_PROTOTYPE_METHOD(tpl, "AddTriangleSet", AddTriangleSet); + NODE_SET_PROTOTYPE_METHOD(tpl, "HasTriangleSet", HasTriangleSet); + NODE_SET_PROTOTYPE_METHOD(tpl, "FindTriangleSet", FindTriangleSet); + NODE_SET_PROTOTYPE_METHOD(tpl, "GetTriangleSetCount", GetTriangleSetCount); + NODE_SET_PROTOTYPE_METHOD(tpl, "GetTriangleSet", GetTriangleSet); constructor.Reset(isolate, tpl->GetFunction(isolate->GetCurrentContext()).ToLocalChecked()); } @@ -5545,6 +5931,143 @@ void CLib3MFMeshObject::SetVolumeData(const FunctionCallbackInfo& args) } } + +void CLib3MFMeshObject::AddTriangleSet(const FunctionCallbackInfo& args) +{ + Isolate* isolate = args.GetIsolate(); + HandleScope scope(isolate); + try { + if (!args[0]->IsString()) { + throw std::runtime_error("Expected string parameter 0 (Identifier)"); + } + if (!args[1]->IsString()) { + throw std::runtime_error("Expected string parameter 1 (Name)"); + } + v8::String::Utf8Value sutf8Identifier(isolate, args[0]); + std::string sIdentifier = *sutf8Identifier; + v8::String::Utf8Value sutf8Name(isolate, args[1]); + std::string sName = *sutf8Name; + Lib3MFHandle hReturnTheTriangleSet = nullptr; + sLib3MFDynamicWrapperTable * wrapperTable = CLib3MFBaseClass::getDynamicWrapperTable(args.Holder()); + if (wrapperTable == nullptr) + throw std::runtime_error("Could not get wrapper table for Lib3MF method AddTriangleSet."); + if (wrapperTable->m_MeshObject_AddTriangleSet == nullptr) + throw std::runtime_error("Could not call Lib3MF method MeshObject::AddTriangleSet."); + Lib3MFHandle instanceHandle = CLib3MFBaseClass::getHandle(args.Holder()); + Lib3MFResult errorCode = wrapperTable->m_MeshObject_AddTriangleSet(instanceHandle, sIdentifier.c_str(), sName.c_str(), &hReturnTheTriangleSet); + CheckError(isolate, wrapperTable, instanceHandle, errorCode); + Local instanceObjTheTriangleSet = CLib3MFTriangleSet::NewInstance(args.Holder(), hReturnTheTriangleSet); + args.GetReturnValue().Set(instanceObjTheTriangleSet); + + } catch (std::exception & E) { + RaiseError(isolate, E.what()); + } +} + + +void CLib3MFMeshObject::HasTriangleSet(const FunctionCallbackInfo& args) +{ + Isolate* isolate = args.GetIsolate(); + HandleScope scope(isolate); + try { + if (!args[0]->IsString()) { + throw std::runtime_error("Expected string parameter 0 (Identifier)"); + } + v8::String::Utf8Value sutf8Identifier(isolate, args[0]); + std::string sIdentifier = *sutf8Identifier; + bool bReturnTriangleSetExists = false; + sLib3MFDynamicWrapperTable * wrapperTable = CLib3MFBaseClass::getDynamicWrapperTable(args.Holder()); + if (wrapperTable == nullptr) + throw std::runtime_error("Could not get wrapper table for Lib3MF method HasTriangleSet."); + if (wrapperTable->m_MeshObject_HasTriangleSet == nullptr) + throw std::runtime_error("Could not call Lib3MF method MeshObject::HasTriangleSet."); + Lib3MFHandle instanceHandle = CLib3MFBaseClass::getHandle(args.Holder()); + Lib3MFResult errorCode = wrapperTable->m_MeshObject_HasTriangleSet(instanceHandle, sIdentifier.c_str(), &bReturnTriangleSetExists); + CheckError(isolate, wrapperTable, instanceHandle, errorCode); + args.GetReturnValue().Set(Boolean::New(isolate, bReturnTriangleSetExists)); + + } catch (std::exception & E) { + RaiseError(isolate, E.what()); + } +} + + +void CLib3MFMeshObject::FindTriangleSet(const FunctionCallbackInfo& args) +{ + Isolate* isolate = args.GetIsolate(); + HandleScope scope(isolate); + try { + if (!args[0]->IsString()) { + throw std::runtime_error("Expected string parameter 0 (Identifier)"); + } + v8::String::Utf8Value sutf8Identifier(isolate, args[0]); + std::string sIdentifier = *sutf8Identifier; + Lib3MFHandle hReturnTheTriangleSet = nullptr; + sLib3MFDynamicWrapperTable * wrapperTable = CLib3MFBaseClass::getDynamicWrapperTable(args.Holder()); + if (wrapperTable == nullptr) + throw std::runtime_error("Could not get wrapper table for Lib3MF method FindTriangleSet."); + if (wrapperTable->m_MeshObject_FindTriangleSet == nullptr) + throw std::runtime_error("Could not call Lib3MF method MeshObject::FindTriangleSet."); + Lib3MFHandle instanceHandle = CLib3MFBaseClass::getHandle(args.Holder()); + Lib3MFResult errorCode = wrapperTable->m_MeshObject_FindTriangleSet(instanceHandle, sIdentifier.c_str(), &hReturnTheTriangleSet); + CheckError(isolate, wrapperTable, instanceHandle, errorCode); + Local instanceObjTheTriangleSet = CLib3MFTriangleSet::NewInstance(args.Holder(), hReturnTheTriangleSet); + args.GetReturnValue().Set(instanceObjTheTriangleSet); + + } catch (std::exception & E) { + RaiseError(isolate, E.what()); + } +} + + +void CLib3MFMeshObject::GetTriangleSetCount(const FunctionCallbackInfo& args) +{ + Isolate* isolate = args.GetIsolate(); + HandleScope scope(isolate); + try { + unsigned int nReturnCount = 0; + sLib3MFDynamicWrapperTable * wrapperTable = CLib3MFBaseClass::getDynamicWrapperTable(args.Holder()); + if (wrapperTable == nullptr) + throw std::runtime_error("Could not get wrapper table for Lib3MF method GetTriangleSetCount."); + if (wrapperTable->m_MeshObject_GetTriangleSetCount == nullptr) + throw std::runtime_error("Could not call Lib3MF method MeshObject::GetTriangleSetCount."); + Lib3MFHandle instanceHandle = CLib3MFBaseClass::getHandle(args.Holder()); + Lib3MFResult errorCode = wrapperTable->m_MeshObject_GetTriangleSetCount(instanceHandle, &nReturnCount); + CheckError(isolate, wrapperTable, instanceHandle, errorCode); + args.GetReturnValue().Set(Integer::NewFromUnsigned(isolate, nReturnCount)); + + } catch (std::exception & E) { + RaiseError(isolate, E.what()); + } +} + + +void CLib3MFMeshObject::GetTriangleSet(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(); + Lib3MFHandle hReturnTheTriangleSet = nullptr; + sLib3MFDynamicWrapperTable * wrapperTable = CLib3MFBaseClass::getDynamicWrapperTable(args.Holder()); + if (wrapperTable == nullptr) + throw std::runtime_error("Could not get wrapper table for Lib3MF method GetTriangleSet."); + if (wrapperTable->m_MeshObject_GetTriangleSet == nullptr) + throw std::runtime_error("Could not call Lib3MF method MeshObject::GetTriangleSet."); + Lib3MFHandle instanceHandle = CLib3MFBaseClass::getHandle(args.Holder()); + Lib3MFResult errorCode = wrapperTable->m_MeshObject_GetTriangleSet(instanceHandle, nIndex, &hReturnTheTriangleSet); + CheckError(isolate, wrapperTable, instanceHandle, errorCode); + Local instanceObjTheTriangleSet = CLib3MFTriangleSet::NewInstance(args.Holder(), hReturnTheTriangleSet); + args.GetReturnValue().Set(instanceObjTheTriangleSet); + + } catch (std::exception & E) { + RaiseError(isolate, E.what()); + } +} + /************************************************************************************************************************* Class CLib3MFLevelSet Implementation **************************************************************************************************************************/ diff --git a/Autogenerated/Bindings/NodeJS/lib3mf_nodewrapper.h b/Autogenerated/Bindings/NodeJS/lib3mf_nodewrapper.h index abc0e0a7..7de14221 100644 --- a/Autogenerated/Bindings/NodeJS/lib3mf_nodewrapper.h +++ b/Autogenerated/Bindings/NodeJS/lib3mf_nodewrapper.h @@ -494,6 +494,36 @@ class CLib3MFMetaDataGroup : public CLib3MFBaseClass { }; +/************************************************************************************************************************* + Class CLib3MFTriangleSet +**************************************************************************************************************************/ +class CLib3MFTriangleSet : public CLib3MFBaseClass { +private: + static void New(const v8::FunctionCallbackInfo& args); + static v8::Persistent constructor; + static void SetName(const v8::FunctionCallbackInfo& args); + static void GetName(const v8::FunctionCallbackInfo& args); + static void SetIdentifier(const v8::FunctionCallbackInfo& args); + static void GetIdentifier(const v8::FunctionCallbackInfo& args); + static void AddTriangle(const v8::FunctionCallbackInfo& args); + static void RemoveTriangle(const v8::FunctionCallbackInfo& args); + static void Clear(const v8::FunctionCallbackInfo& args); + static void SetTriangleList(const v8::FunctionCallbackInfo& args); + static void GetTriangleList(const v8::FunctionCallbackInfo& args); + static void AddTriangleList(const v8::FunctionCallbackInfo& args); + static void Merge(const v8::FunctionCallbackInfo& args); + static void DeleteSet(const v8::FunctionCallbackInfo& args); + static void Duplicate(const v8::FunctionCallbackInfo& args); + +public: + CLib3MFTriangleSet(); + ~CLib3MFTriangleSet(); + + static void Init(); + static v8::Local NewInstance(v8::Local, Lib3MFHandle pHandle); + +}; + /************************************************************************************************************************* Class CLib3MFObject **************************************************************************************************************************/ @@ -563,6 +593,11 @@ class CLib3MFMeshObject : public CLib3MFBaseClass { static void BeamLattice(const v8::FunctionCallbackInfo& args); static void GetVolumeData(const v8::FunctionCallbackInfo& args); static void SetVolumeData(const v8::FunctionCallbackInfo& args); + static void AddTriangleSet(const v8::FunctionCallbackInfo& args); + static void HasTriangleSet(const v8::FunctionCallbackInfo& args); + static void FindTriangleSet(const v8::FunctionCallbackInfo& args); + static void GetTriangleSetCount(const v8::FunctionCallbackInfo& args); + static void GetTriangleSet(const v8::FunctionCallbackInfo& args); public: CLib3MFMeshObject(); diff --git a/Autogenerated/Bindings/NodeJS/lib3mf_types.h b/Autogenerated/Bindings/NodeJS/lib3mf_types.h index a5d436da..241f77f8 100644 --- a/Autogenerated/Bindings/NodeJS/lib3mf_types.h +++ b/Autogenerated/Bindings/NodeJS/lib3mf_types.h @@ -131,6 +131,8 @@ typedef void * Lib3MF_pvoid; #define LIB3MF_ERROR_ELEMENTCOUNTEXCEEDSLIMIT 141 /** An element buffer exceeds its spec limit */ #define LIB3MF_ERROR_INVALIDRESOURCE 142 /** A resource is invalid */ #define LIB3MF_ERROR_INVALIDLEVELSET 143 /** A level set is invalid */ +#define LIB3MF_ERROR_COULDNOTFINDTRIANGLESET 144 /** Could not find triangle set */ +#define LIB3MF_ERROR_INVALIDTRIANGLESETINDEX 145 /** Invalid triangle set index */ #define LIB3MF_ERROR_BEAMLATTICE_INVALID_OBJECTTYPE 2000 /** This object type is not valid for beamlattices */ #define LIB3MF_ERROR_INVALIDKEYSTORE 3000 /** The keystore object is invalid */ #define LIB3MF_ERROR_INVALIDKEYSTORECONSUMER 3001 /** The consumer keystore object is invalid */ @@ -187,6 +189,8 @@ inline const char * LIB3MF_GETERRORSTRING (Lib3MFResult nErrorCode) { case LIB3MF_ERROR_ELEMENTCOUNTEXCEEDSLIMIT: return "An element buffer exceeds its spec limit"; case LIB3MF_ERROR_INVALIDRESOURCE: return "A resource is invalid"; case LIB3MF_ERROR_INVALIDLEVELSET: return "A level set is invalid"; + case LIB3MF_ERROR_COULDNOTFINDTRIANGLESET: return "Could not find triangle set"; + case LIB3MF_ERROR_INVALIDTRIANGLESETINDEX: return "Invalid triangle set index"; case LIB3MF_ERROR_BEAMLATTICE_INVALID_OBJECTTYPE: return "This object type is not valid for beamlattices"; case LIB3MF_ERROR_INVALIDKEYSTORE: return "The keystore object is invalid"; case LIB3MF_ERROR_INVALIDKEYSTORECONSUMER: return "The consumer keystore object is invalid"; @@ -227,6 +231,7 @@ typedef Lib3MFHandle Lib3MF_FunctionIterator; typedef Lib3MFHandle Lib3MF_LevelSetIterator; typedef Lib3MFHandle Lib3MF_MetaData; typedef Lib3MFHandle Lib3MF_MetaDataGroup; +typedef Lib3MFHandle Lib3MF_TriangleSet; typedef Lib3MFHandle Lib3MF_Object; typedef Lib3MFHandle Lib3MF_MeshObject; typedef Lib3MFHandle Lib3MF_LevelSet; diff --git a/Autogenerated/Bindings/Pascal/Unit_Lib3MF.pas b/Autogenerated/Bindings/Pascal/Unit_Lib3MF.pas index 98b5dd22..ada6145b 100644 --- a/Autogenerated/Bindings/Pascal/Unit_Lib3MF.pas +++ b/Autogenerated/Bindings/Pascal/Unit_Lib3MF.pas @@ -114,6 +114,8 @@ interface LIB3MF_ERROR_ELEMENTCOUNTEXCEEDSLIMIT = 141; LIB3MF_ERROR_INVALIDRESOURCE = 142; LIB3MF_ERROR_INVALIDLEVELSET = 143; + LIB3MF_ERROR_COULDNOTFINDTRIANGLESET = 144; + LIB3MF_ERROR_INVALIDTRIANGLESETINDEX = 145; LIB3MF_ERROR_BEAMLATTICE_INVALID_OBJECTTYPE = 2000; LIB3MF_ERROR_INVALIDKEYSTORE = 3000; LIB3MF_ERROR_INVALIDKEYSTORECONSUMER = 3001; @@ -494,6 +496,7 @@ TLib3MFFunctionIterator = class; TLib3MFLevelSetIterator = class; TLib3MFMetaData = class; TLib3MFMetaDataGroup = class; + TLib3MFTriangleSet = class; TLib3MFObject = class; TLib3MFMeshObject = class; TLib3MFLevelSet = class; @@ -1351,6 +1354,136 @@ TLib3MFModel = class; TLib3MFMetaDataGroup_AddMetaDataFunc = function(pMetaDataGroup: TLib3MFHandle; const pNameSpace: PAnsiChar; const pName: PAnsiChar; const pValue: PAnsiChar; const pType: PAnsiChar; const bMustPreserve: Byte; out pMetaData: TLib3MFHandle): TLib3MFResult; cdecl; +(************************************************************************************************************************* + Function type definitions for TriangleSet +**************************************************************************************************************************) + + (** + * sets the name of the triangle set + * + * @param[in] pTriangleSet - TriangleSet instance. + * @param[in] pName - the new name + * @return error code or 0 (success) + *) + TLib3MFTriangleSet_SetNameFunc = function(pTriangleSet: TLib3MFHandle; const pName: PAnsiChar): TLib3MFResult; cdecl; + + (** + * returns the name of the triangle set + * + * @param[in] pTriangleSet - TriangleSet instance. + * @param[in] nNameBufferSize - size of the buffer (including trailing 0) + * @param[out] pNameNeededChars - will be filled with the count of the written bytes, or needed buffer size. + * @param[out] pNameBuffer - buffer of returns the name, may be NULL + * @return error code or 0 (success) + *) + TLib3MFTriangleSet_GetNameFunc = function(pTriangleSet: TLib3MFHandle; const nNameBufferSize: Cardinal; out pNameNeededChars: Cardinal; pNameBuffer: PAnsiChar): TLib3MFResult; cdecl; + + (** + * sets the identifier of the triangle set. + * + * @param[in] pTriangleSet - TriangleSet instance. + * @param[in] pIdentifier - the new identifier. MUST be unique within the mesh. MUST NOT be an empty string + * @return error code or 0 (success) + *) + TLib3MFTriangleSet_SetIdentifierFunc = function(pTriangleSet: TLib3MFHandle; const pIdentifier: PAnsiChar): TLib3MFResult; cdecl; + + (** + * returns the identifier of the triangle set + * + * @param[in] pTriangleSet - TriangleSet instance. + * @param[in] nIdentifierBufferSize - size of the buffer (including trailing 0) + * @param[out] pIdentifierNeededChars - will be filled with the count of the written bytes, or needed buffer size. + * @param[out] pIdentifierBuffer - buffer of returns the identifier, may be NULL + * @return error code or 0 (success) + *) + TLib3MFTriangleSet_GetIdentifierFunc = function(pTriangleSet: TLib3MFHandle; const nIdentifierBufferSize: Cardinal; out pIdentifierNeededChars: Cardinal; pIdentifierBuffer: PAnsiChar): TLib3MFResult; cdecl; + + (** + * adds a triangle to the set. Does nothing if triangle is already in the set. + * + * @param[in] pTriangleSet - TriangleSet instance. + * @param[in] nTriangleIndex - Triangle index to add. MUST be between 0 and TriangleCount - 1. + * @return error code or 0 (success) + *) + TLib3MFTriangleSet_AddTriangleFunc = function(pTriangleSet: TLib3MFHandle; const nTriangleIndex: Cardinal): TLib3MFResult; cdecl; + + (** + * removes a triangle from the set + * + * @param[in] pTriangleSet - TriangleSet instance. + * @param[in] nTriangleIndex - Triangle index to remove. MUST be between 0 and TriangleCount - 1. + * @return error code or 0 (success) + *) + TLib3MFTriangleSet_RemoveTriangleFunc = function(pTriangleSet: TLib3MFHandle; const nTriangleIndex: Cardinal): TLib3MFResult; cdecl; + + (** + * clears all triangles from the list + * + * @param[in] pTriangleSet - TriangleSet instance. + * @return error code or 0 (success) + *) + TLib3MFTriangleSet_ClearFunc = function(pTriangleSet: TLib3MFHandle): TLib3MFResult; cdecl; + + (** + * Sets all triangles in the list, while clearing old values. Duplicates will be merged. + * + * @param[in] pTriangleSet - TriangleSet instance. + * @param[in] nTriangleIndicesCount - Number of elements in buffer + * @param[in] pTriangleIndicesBuffer - uint32 buffer of Triangle indices to add. Every element MUST be between 0 and TriangleCount - 1. + * @return error code or 0 (success) + *) + TLib3MFTriangleSet_SetTriangleListFunc = function(pTriangleSet: TLib3MFHandle; const nTriangleIndicesCount: QWord; const pTriangleIndicesBuffer: PCardinal): TLib3MFResult; cdecl; + + (** + * Retrieves all the triangles in the TriangleSet + * + * @param[in] pTriangleSet - TriangleSet instance. + * @param[in] nTriangleIndicesCount - Number of elements in buffer + * @param[out] pTriangleIndicesNeededCount - will be filled with the count of the written elements, or needed buffer size. + * @param[out] pTriangleIndicesBuffer - uint32 buffer of retrieves the indices of the triangles in this TriangleSet + * @return error code or 0 (success) + *) + TLib3MFTriangleSet_GetTriangleListFunc = function(pTriangleSet: TLib3MFHandle; const nTriangleIndicesCount: QWord; out pTriangleIndicesNeededCount: QWord; pTriangleIndicesBuffer: PCardinal): TLib3MFResult; cdecl; + + (** + * Adds multiple triangles in the list. Duplicates will be merged. + * + * @param[in] pTriangleSet - TriangleSet instance. + * @param[in] nTriangleIndicesCount - Number of elements in buffer + * @param[in] pTriangleIndicesBuffer - uint32 buffer of Triangle indices to add. Every element MUST be between 0 and TriangleCount - 1. + * @return error code or 0 (success) + *) + TLib3MFTriangleSet_AddTriangleListFunc = function(pTriangleSet: TLib3MFHandle; const nTriangleIndicesCount: QWord; const pTriangleIndicesBuffer: PCardinal): TLib3MFResult; cdecl; + + (** + * Merges another Triangle set. + * + * @param[in] pTriangleSet - TriangleSet instance. + * @param[in] pOtherTriangleSet - Other triangle set to merge. + * @param[in] bDeleteOther - Flag if other triangle set is getting removed. + * @return error code or 0 (success) + *) + TLib3MFTriangleSet_MergeFunc = function(pTriangleSet: TLib3MFHandle; const pOtherTriangleSet: TLib3MFHandle; const bDeleteOther: Byte): TLib3MFResult; cdecl; + + (** + * Deletes the whole set from the mesh. + * + * @param[in] pTriangleSet - TriangleSet instance. + * @return error code or 0 (success) + *) + TLib3MFTriangleSet_DeleteSetFunc = function(pTriangleSet: TLib3MFHandle): TLib3MFResult; cdecl; + + (** + * Duplicates the set in the mesh. + * + * @param[in] pTriangleSet - TriangleSet instance. + * @param[in] pIdentifier - the new identifier. MUST be unique within the mesh. MUST NOT be an empty string + * @param[out] pNewSet - Copy of the triangle set. + * @return error code or 0 (success) + *) + TLib3MFTriangleSet_DuplicateFunc = function(pTriangleSet: TLib3MFHandle; const pIdentifier: PAnsiChar; out pNewSet: TLib3MFHandle): TLib3MFResult; cdecl; + + (************************************************************************************************************************* Function type definitions for Object **************************************************************************************************************************) @@ -1791,6 +1924,56 @@ TLib3MFModel = class; *) TLib3MFMeshObject_SetVolumeDataFunc = function(pMeshObject: TLib3MFHandle; const pTheVolumeData: TLib3MFHandle): TLib3MFResult; cdecl; + (** + * Adds a new triangle set. + * + * @param[in] pMeshObject - MeshObject instance. + * @param[in] pIdentifier - the new identifier. MUST be unique within the mesh. MUST NOT be an empty string + * @param[in] pName - the human readable name. MUST NOT be an empty string + * @param[out] pTheTriangleSet - the new Triangle Set Instance. + * @return error code or 0 (success) + *) + TLib3MFMeshObject_AddTriangleSetFunc = function(pMeshObject: TLib3MFHandle; const pIdentifier: PAnsiChar; const pName: PAnsiChar; out pTheTriangleSet: TLib3MFHandle): TLib3MFResult; cdecl; + + (** + * Checks if a triangle set exists. + * + * @param[in] pMeshObject - MeshObject instance. + * @param[in] pIdentifier - the identifier to be found. + * @param[out] pTriangleSetExists - flag if the triangles set exists. + * @return error code or 0 (success) + *) + TLib3MFMeshObject_HasTriangleSetFunc = function(pMeshObject: TLib3MFHandle; const pIdentifier: PAnsiChar; out pTriangleSetExists: Byte): TLib3MFResult; cdecl; + + (** + * Finds a new triangle set by identifier. Fails if not existing. + * + * @param[in] pMeshObject - MeshObject instance. + * @param[in] pIdentifier - the identifier to be found. + * @param[out] pTheTriangleSet - the triangle Set Instance. + * @return error code or 0 (success) + *) + TLib3MFMeshObject_FindTriangleSetFunc = function(pMeshObject: TLib3MFHandle; const pIdentifier: PAnsiChar; out pTheTriangleSet: TLib3MFHandle): TLib3MFResult; cdecl; + + (** + * Returns number of triangle sets. + * + * @param[in] pMeshObject - MeshObject instance. + * @param[out] pCount - the number of triangle sets of this mesh. + * @return error code or 0 (success) + *) + TLib3MFMeshObject_GetTriangleSetCountFunc = function(pMeshObject: TLib3MFHandle; out pCount: Cardinal): TLib3MFResult; cdecl; + + (** + * Returns a specific triangle set by index. + * + * @param[in] pMeshObject - MeshObject instance. + * @param[in] nIndex - the index of the triangle set. + * @param[out] pTheTriangleSet - the triangle Set Instance. + * @return error code or 0 (success) + *) + TLib3MFMeshObject_GetTriangleSetFunc = function(pMeshObject: TLib3MFHandle; const nIndex: Cardinal; out pTheTriangleSet: TLib3MFHandle): TLib3MFResult; cdecl; + (************************************************************************************************************************* Function type definitions for LevelSet @@ -7427,6 +7610,30 @@ TLib3MFMetaDataGroup = class(TLib3MFBase) end; +(************************************************************************************************************************* + Class definition for TriangleSet +**************************************************************************************************************************) + + TLib3MFTriangleSet = class(TLib3MFBase) + public + constructor Create(AWrapper: TLib3MFWrapper; AHandle: TLib3MFHandle); + destructor Destroy; override; + procedure SetName(const AName: String); + function GetName(): String; + procedure SetIdentifier(const AIdentifier: String); + function GetIdentifier(): String; + procedure AddTriangle(const ATriangleIndex: Cardinal); + procedure RemoveTriangle(const ATriangleIndex: Cardinal); + procedure Clear(); + procedure SetTriangleList(const ATriangleIndices: TCardinalDynArray); + procedure GetTriangleList(out ATriangleIndices: TCardinalDynArray); + procedure AddTriangleList(const ATriangleIndices: TCardinalDynArray); + procedure Merge(const AOtherTriangleSet: TLib3MFTriangleSet; const ADeleteOther: Boolean); + procedure DeleteSet(); + function Duplicate(const AIdentifier: String): TLib3MFTriangleSet; + end; + + (************************************************************************************************************************* Class definition for Object **************************************************************************************************************************) @@ -7491,6 +7698,11 @@ TLib3MFMeshObject = class(TLib3MFObject) function BeamLattice(): TLib3MFBeamLattice; function GetVolumeData(): TLib3MFVolumeData; procedure SetVolumeData(const ATheVolumeData: TLib3MFVolumeData); + function AddTriangleSet(const AIdentifier: String; const AName: String): TLib3MFTriangleSet; + function HasTriangleSet(const AIdentifier: String): Boolean; + function FindTriangleSet(const AIdentifier: String): TLib3MFTriangleSet; + function GetTriangleSetCount(): Cardinal; + function GetTriangleSet(const AIndex: Cardinal): TLib3MFTriangleSet; end; @@ -9050,6 +9262,19 @@ TLib3MFWrapper = class(TObject) FLib3MFMetaDataGroup_RemoveMetaDataByIndexFunc: TLib3MFMetaDataGroup_RemoveMetaDataByIndexFunc; FLib3MFMetaDataGroup_RemoveMetaDataFunc: TLib3MFMetaDataGroup_RemoveMetaDataFunc; FLib3MFMetaDataGroup_AddMetaDataFunc: TLib3MFMetaDataGroup_AddMetaDataFunc; + FLib3MFTriangleSet_SetNameFunc: TLib3MFTriangleSet_SetNameFunc; + FLib3MFTriangleSet_GetNameFunc: TLib3MFTriangleSet_GetNameFunc; + FLib3MFTriangleSet_SetIdentifierFunc: TLib3MFTriangleSet_SetIdentifierFunc; + FLib3MFTriangleSet_GetIdentifierFunc: TLib3MFTriangleSet_GetIdentifierFunc; + FLib3MFTriangleSet_AddTriangleFunc: TLib3MFTriangleSet_AddTriangleFunc; + FLib3MFTriangleSet_RemoveTriangleFunc: TLib3MFTriangleSet_RemoveTriangleFunc; + FLib3MFTriangleSet_ClearFunc: TLib3MFTriangleSet_ClearFunc; + FLib3MFTriangleSet_SetTriangleListFunc: TLib3MFTriangleSet_SetTriangleListFunc; + FLib3MFTriangleSet_GetTriangleListFunc: TLib3MFTriangleSet_GetTriangleListFunc; + FLib3MFTriangleSet_AddTriangleListFunc: TLib3MFTriangleSet_AddTriangleListFunc; + FLib3MFTriangleSet_MergeFunc: TLib3MFTriangleSet_MergeFunc; + FLib3MFTriangleSet_DeleteSetFunc: TLib3MFTriangleSet_DeleteSetFunc; + FLib3MFTriangleSet_DuplicateFunc: TLib3MFTriangleSet_DuplicateFunc; FLib3MFObject_GetTypeFunc: TLib3MFObject_GetTypeFunc; FLib3MFObject_SetTypeFunc: TLib3MFObject_SetTypeFunc; FLib3MFObject_GetNameFunc: TLib3MFObject_GetNameFunc; @@ -9095,6 +9320,11 @@ TLib3MFWrapper = class(TObject) FLib3MFMeshObject_BeamLatticeFunc: TLib3MFMeshObject_BeamLatticeFunc; FLib3MFMeshObject_GetVolumeDataFunc: TLib3MFMeshObject_GetVolumeDataFunc; FLib3MFMeshObject_SetVolumeDataFunc: TLib3MFMeshObject_SetVolumeDataFunc; + FLib3MFMeshObject_AddTriangleSetFunc: TLib3MFMeshObject_AddTriangleSetFunc; + FLib3MFMeshObject_HasTriangleSetFunc: TLib3MFMeshObject_HasTriangleSetFunc; + FLib3MFMeshObject_FindTriangleSetFunc: TLib3MFMeshObject_FindTriangleSetFunc; + FLib3MFMeshObject_GetTriangleSetCountFunc: TLib3MFMeshObject_GetTriangleSetCountFunc; + FLib3MFMeshObject_GetTriangleSetFunc: TLib3MFMeshObject_GetTriangleSetFunc; FLib3MFLevelSet_GetFunctionFunc: TLib3MFLevelSet_GetFunctionFunc; FLib3MFLevelSet_SetFunctionFunc: TLib3MFLevelSet_SetFunctionFunc; FLib3MFLevelSet_GetTransformFunc: TLib3MFLevelSet_GetTransformFunc; @@ -9662,6 +9892,19 @@ TLib3MFWrapper = class(TObject) property Lib3MFMetaDataGroup_RemoveMetaDataByIndexFunc: TLib3MFMetaDataGroup_RemoveMetaDataByIndexFunc read FLib3MFMetaDataGroup_RemoveMetaDataByIndexFunc; property Lib3MFMetaDataGroup_RemoveMetaDataFunc: TLib3MFMetaDataGroup_RemoveMetaDataFunc read FLib3MFMetaDataGroup_RemoveMetaDataFunc; property Lib3MFMetaDataGroup_AddMetaDataFunc: TLib3MFMetaDataGroup_AddMetaDataFunc read FLib3MFMetaDataGroup_AddMetaDataFunc; + property Lib3MFTriangleSet_SetNameFunc: TLib3MFTriangleSet_SetNameFunc read FLib3MFTriangleSet_SetNameFunc; + property Lib3MFTriangleSet_GetNameFunc: TLib3MFTriangleSet_GetNameFunc read FLib3MFTriangleSet_GetNameFunc; + property Lib3MFTriangleSet_SetIdentifierFunc: TLib3MFTriangleSet_SetIdentifierFunc read FLib3MFTriangleSet_SetIdentifierFunc; + property Lib3MFTriangleSet_GetIdentifierFunc: TLib3MFTriangleSet_GetIdentifierFunc read FLib3MFTriangleSet_GetIdentifierFunc; + property Lib3MFTriangleSet_AddTriangleFunc: TLib3MFTriangleSet_AddTriangleFunc read FLib3MFTriangleSet_AddTriangleFunc; + property Lib3MFTriangleSet_RemoveTriangleFunc: TLib3MFTriangleSet_RemoveTriangleFunc read FLib3MFTriangleSet_RemoveTriangleFunc; + property Lib3MFTriangleSet_ClearFunc: TLib3MFTriangleSet_ClearFunc read FLib3MFTriangleSet_ClearFunc; + property Lib3MFTriangleSet_SetTriangleListFunc: TLib3MFTriangleSet_SetTriangleListFunc read FLib3MFTriangleSet_SetTriangleListFunc; + property Lib3MFTriangleSet_GetTriangleListFunc: TLib3MFTriangleSet_GetTriangleListFunc read FLib3MFTriangleSet_GetTriangleListFunc; + property Lib3MFTriangleSet_AddTriangleListFunc: TLib3MFTriangleSet_AddTriangleListFunc read FLib3MFTriangleSet_AddTriangleListFunc; + property Lib3MFTriangleSet_MergeFunc: TLib3MFTriangleSet_MergeFunc read FLib3MFTriangleSet_MergeFunc; + property Lib3MFTriangleSet_DeleteSetFunc: TLib3MFTriangleSet_DeleteSetFunc read FLib3MFTriangleSet_DeleteSetFunc; + property Lib3MFTriangleSet_DuplicateFunc: TLib3MFTriangleSet_DuplicateFunc read FLib3MFTriangleSet_DuplicateFunc; property Lib3MFObject_GetTypeFunc: TLib3MFObject_GetTypeFunc read FLib3MFObject_GetTypeFunc; property Lib3MFObject_SetTypeFunc: TLib3MFObject_SetTypeFunc read FLib3MFObject_SetTypeFunc; property Lib3MFObject_GetNameFunc: TLib3MFObject_GetNameFunc read FLib3MFObject_GetNameFunc; @@ -9707,6 +9950,11 @@ TLib3MFWrapper = class(TObject) property Lib3MFMeshObject_BeamLatticeFunc: TLib3MFMeshObject_BeamLatticeFunc read FLib3MFMeshObject_BeamLatticeFunc; property Lib3MFMeshObject_GetVolumeDataFunc: TLib3MFMeshObject_GetVolumeDataFunc read FLib3MFMeshObject_GetVolumeDataFunc; property Lib3MFMeshObject_SetVolumeDataFunc: TLib3MFMeshObject_SetVolumeDataFunc read FLib3MFMeshObject_SetVolumeDataFunc; + property Lib3MFMeshObject_AddTriangleSetFunc: TLib3MFMeshObject_AddTriangleSetFunc read FLib3MFMeshObject_AddTriangleSetFunc; + property Lib3MFMeshObject_HasTriangleSetFunc: TLib3MFMeshObject_HasTriangleSetFunc read FLib3MFMeshObject_HasTriangleSetFunc; + property Lib3MFMeshObject_FindTriangleSetFunc: TLib3MFMeshObject_FindTriangleSetFunc read FLib3MFMeshObject_FindTriangleSetFunc; + property Lib3MFMeshObject_GetTriangleSetCountFunc: TLib3MFMeshObject_GetTriangleSetCountFunc read FLib3MFMeshObject_GetTriangleSetCountFunc; + property Lib3MFMeshObject_GetTriangleSetFunc: TLib3MFMeshObject_GetTriangleSetFunc read FLib3MFMeshObject_GetTriangleSetFunc; property Lib3MFLevelSet_GetFunctionFunc: TLib3MFLevelSet_GetFunctionFunc read FLib3MFLevelSet_GetFunctionFunc; property Lib3MFLevelSet_SetFunctionFunc: TLib3MFLevelSet_SetFunctionFunc read FLib3MFLevelSet_SetFunctionFunc; property Lib3MFLevelSet_GetTransformFunc: TLib3MFLevelSet_GetTransformFunc read FLib3MFLevelSet_GetTransformFunc; @@ -10297,6 +10545,7 @@ TLib3MFPolymorphicFactory<_T:class; _B> = record function TLib3MFPolymorphicFactoryMakeLevelSetIterator(Wrapper: TLib3MFWrapper; Handle: TLib3MFHandle): TLIB3MFLevelSetIterator; function TLib3MFPolymorphicFactoryMakeMetaData(Wrapper: TLib3MFWrapper; Handle: TLib3MFHandle): TLIB3MFMetaData; function TLib3MFPolymorphicFactoryMakeMetaDataGroup(Wrapper: TLib3MFWrapper; Handle: TLib3MFHandle): TLIB3MFMetaDataGroup; + function TLib3MFPolymorphicFactoryMakeTriangleSet(Wrapper: TLib3MFWrapper; Handle: TLib3MFHandle): TLIB3MFTriangleSet; function TLib3MFPolymorphicFactoryMakeObject(Wrapper: TLib3MFWrapper; Handle: TLib3MFHandle): TLIB3MFObject; function TLib3MFPolymorphicFactoryMakeMeshObject(Wrapper: TLib3MFWrapper; Handle: TLib3MFHandle): TLIB3MFMeshObject; function TLib3MFPolymorphicFactoryMakeLevelSet(Wrapper: TLib3MFWrapper; Handle: TLib3MFHandle): TLIB3MFLevelSet; @@ -11121,6 +11370,7 @@ implementation QWord($A0C005C035D5371D): begin Obj := TLIB3MFLevelSetIterator.Create(Wrapper, Handle); if Obj.inheritsFrom(_T) then Result := Obj as _T; end; // First 64 bits of SHA1 of a string: "Lib3MF::LevelSetIterator" QWord($D17716D063DE2C22): begin Obj := TLIB3MFMetaData.Create(Wrapper, Handle); if Obj.inheritsFrom(_T) then Result := Obj as _T; end; // First 64 bits of SHA1 of a string: "Lib3MF::MetaData" QWord($0C3B85369E9B25D3): begin Obj := TLIB3MFMetaDataGroup.Create(Wrapper, Handle); if Obj.inheritsFrom(_T) then Result := Obj as _T; end; // First 64 bits of SHA1 of a string: "Lib3MF::MetaDataGroup" + QWord($5950BB3EE8A82090): begin Obj := TLIB3MFTriangleSet.Create(Wrapper, Handle); if Obj.inheritsFrom(_T) then Result := Obj as _T; end; // First 64 bits of SHA1 of a string: "Lib3MF::TriangleSet" QWord($2DA2136F577A779C): begin Obj := TLIB3MFObject.Create(Wrapper, Handle); if Obj.inheritsFrom(_T) then Result := Obj as _T; end; // First 64 bits of SHA1 of a string: "Lib3MF::Object" QWord($3B3A6DC6EC610497): begin Obj := TLIB3MFMeshObject.Create(Wrapper, Handle); if Obj.inheritsFrom(_T) then Result := Obj as _T; end; // First 64 bits of SHA1 of a string: "Lib3MF::MeshObject" QWord($E8A7D9C192EFD0E2): begin Obj := TLIB3MFLevelSet.Create(Wrapper, Handle); if Obj.inheritsFrom(_T) then Result := Obj as _T; end; // First 64 bits of SHA1 of a string: "Lib3MF::LevelSet" @@ -11302,6 +11552,10 @@ implementation begin Result := TLib3MFPolymorphicFactory.Make(Wrapper, Handle); end; + function TLib3MFPolymorphicFactoryMakeTriangleSet(Wrapper: TLib3MFWrapper; Handle: TLib3MFHandle): TLIB3MFTriangleSet; + begin + Result := TLib3MFPolymorphicFactory.Make(Wrapper, Handle); + end; function TLib3MFPolymorphicFactoryMakeObject(Wrapper: TLib3MFWrapper; Handle: TLib3MFHandle): TLIB3MFObject; begin Result := TLib3MFPolymorphicFactory.Make(Wrapper, Handle); @@ -11726,6 +11980,8 @@ implementation LIB3MF_ERROR_ELEMENTCOUNTEXCEEDSLIMIT: ADescription := 'An element buffer exceeds its spec limit'; LIB3MF_ERROR_INVALIDRESOURCE: ADescription := 'A resource is invalid'; LIB3MF_ERROR_INVALIDLEVELSET: ADescription := 'A level set is invalid'; + LIB3MF_ERROR_COULDNOTFINDTRIANGLESET: ADescription := 'Could not find triangle set'; + LIB3MF_ERROR_INVALIDTRIANGLESETINDEX: ADescription := 'Invalid triangle set index'; LIB3MF_ERROR_BEAMLATTICE_INVALID_OBJECTTYPE: ADescription := 'This object type is not valid for beamlattices'; LIB3MF_ERROR_INVALIDKEYSTORE: ADescription := 'The keystore object is invalid'; LIB3MF_ERROR_INVALIDKEYSTORECONSUMER: ADescription := 'The consumer keystore object is invalid'; @@ -12649,6 +12905,144 @@ implementation Result := TLib3MFPolymorphicFactory.Make(FWrapper, HMetaData); end; +(************************************************************************************************************************* + Class implementation for TriangleSet +**************************************************************************************************************************) + + constructor TLib3MFTriangleSet.Create(AWrapper: TLib3MFWrapper; AHandle: TLib3MFHandle); + begin + inherited Create(AWrapper, AHandle); + end; + + destructor TLib3MFTriangleSet.Destroy; + begin + inherited; + end; + + procedure TLib3MFTriangleSet.SetName(const AName: String); + begin + FWrapper.CheckError(Self, FWrapper.Lib3MFTriangleSet_SetNameFunc(FHandle, PAnsiChar(AName))); + end; + + function TLib3MFTriangleSet.GetName(): String; + var + bytesNeededName: Cardinal; + bytesWrittenName: Cardinal; + bufferName: array of Char; + begin + bytesNeededName:= 0; + bytesWrittenName:= 0; + FWrapper.CheckError(Self, FWrapper.Lib3MFTriangleSet_GetNameFunc(FHandle, 0, bytesNeededName, nil)); + SetLength(bufferName, bytesNeededName); + FWrapper.CheckError(Self, FWrapper.Lib3MFTriangleSet_GetNameFunc(FHandle, bytesNeededName, bytesWrittenName, @bufferName[0])); + Result := StrPas(@bufferName[0]); + end; + + procedure TLib3MFTriangleSet.SetIdentifier(const AIdentifier: String); + begin + FWrapper.CheckError(Self, FWrapper.Lib3MFTriangleSet_SetIdentifierFunc(FHandle, PAnsiChar(AIdentifier))); + end; + + function TLib3MFTriangleSet.GetIdentifier(): String; + var + bytesNeededIdentifier: Cardinal; + bytesWrittenIdentifier: Cardinal; + bufferIdentifier: array of Char; + begin + bytesNeededIdentifier:= 0; + bytesWrittenIdentifier:= 0; + FWrapper.CheckError(Self, FWrapper.Lib3MFTriangleSet_GetIdentifierFunc(FHandle, 0, bytesNeededIdentifier, nil)); + SetLength(bufferIdentifier, bytesNeededIdentifier); + FWrapper.CheckError(Self, FWrapper.Lib3MFTriangleSet_GetIdentifierFunc(FHandle, bytesNeededIdentifier, bytesWrittenIdentifier, @bufferIdentifier[0])); + Result := StrPas(@bufferIdentifier[0]); + end; + + procedure TLib3MFTriangleSet.AddTriangle(const ATriangleIndex: Cardinal); + begin + FWrapper.CheckError(Self, FWrapper.Lib3MFTriangleSet_AddTriangleFunc(FHandle, ATriangleIndex)); + end; + + procedure TLib3MFTriangleSet.RemoveTriangle(const ATriangleIndex: Cardinal); + begin + FWrapper.CheckError(Self, FWrapper.Lib3MFTriangleSet_RemoveTriangleFunc(FHandle, ATriangleIndex)); + end; + + procedure TLib3MFTriangleSet.Clear(); + begin + FWrapper.CheckError(Self, FWrapper.Lib3MFTriangleSet_ClearFunc(FHandle)); + end; + + procedure TLib3MFTriangleSet.SetTriangleList(const ATriangleIndices: TCardinalDynArray); + var + PtrTriangleIndices: PCardinal; + LenTriangleIndices: QWord; + begin + LenTriangleIndices := Length(ATriangleIndices); + if LenTriangleIndices > $FFFFFFFF then + raise ELib3MFException.CreateCustomMessage(LIB3MF_ERROR_INVALIDPARAM, 'array has too many entries.'); + if LenTriangleIndices > 0 then + PtrTriangleIndices := @ATriangleIndices[0] + else + PtrTriangleIndices := nil; + + FWrapper.CheckError(Self, FWrapper.Lib3MFTriangleSet_SetTriangleListFunc(FHandle, QWord(LenTriangleIndices), PtrTriangleIndices)); + end; + + procedure TLib3MFTriangleSet.GetTriangleList(out ATriangleIndices: TCardinalDynArray); + var + countNeededTriangleIndices: QWord; + countWrittenTriangleIndices: QWord; + begin + countNeededTriangleIndices:= 0; + countWrittenTriangleIndices:= 0; + FWrapper.CheckError(Self, FWrapper.Lib3MFTriangleSet_GetTriangleListFunc(FHandle, 0, countNeededTriangleIndices, nil)); + SetLength(ATriangleIndices, countNeededTriangleIndices); + FWrapper.CheckError(Self, FWrapper.Lib3MFTriangleSet_GetTriangleListFunc(FHandle, countNeededTriangleIndices, countWrittenTriangleIndices, @ATriangleIndices[0])); + end; + + procedure TLib3MFTriangleSet.AddTriangleList(const ATriangleIndices: TCardinalDynArray); + var + PtrTriangleIndices: PCardinal; + LenTriangleIndices: QWord; + begin + LenTriangleIndices := Length(ATriangleIndices); + if LenTriangleIndices > $FFFFFFFF then + raise ELib3MFException.CreateCustomMessage(LIB3MF_ERROR_INVALIDPARAM, 'array has too many entries.'); + if LenTriangleIndices > 0 then + PtrTriangleIndices := @ATriangleIndices[0] + else + PtrTriangleIndices := nil; + + FWrapper.CheckError(Self, FWrapper.Lib3MFTriangleSet_AddTriangleListFunc(FHandle, QWord(LenTriangleIndices), PtrTriangleIndices)); + end; + + procedure TLib3MFTriangleSet.Merge(const AOtherTriangleSet: TLib3MFTriangleSet; const ADeleteOther: Boolean); + var + AOtherTriangleSetHandle: TLib3MFHandle; + begin + if Assigned(AOtherTriangleSet) then + AOtherTriangleSetHandle := AOtherTriangleSet.TheHandle + else + raise ELib3MFException.CreateCustomMessage(LIB3MF_ERROR_INVALIDPARAM, 'AOtherTriangleSet is a nil value.'); + FWrapper.CheckError(Self, FWrapper.Lib3MFTriangleSet_MergeFunc(FHandle, AOtherTriangleSetHandle, Ord(ADeleteOther))); + end; + + procedure TLib3MFTriangleSet.DeleteSet(); + begin + FWrapper.CheckError(Self, FWrapper.Lib3MFTriangleSet_DeleteSetFunc(FHandle)); + end; + + function TLib3MFTriangleSet.Duplicate(const AIdentifier: String): TLib3MFTriangleSet; + var + HNewSet: TLib3MFHandle; + begin + Result := nil; + HNewSet := nil; + FWrapper.CheckError(Self, FWrapper.Lib3MFTriangleSet_DuplicateFunc(FHandle, PAnsiChar(AIdentifier), HNewSet)); + if Assigned(HNewSet) then + Result := TLib3MFPolymorphicFactory.Make(FWrapper, HNewSet); + end; + (************************************************************************************************************************* Class implementation for Object **************************************************************************************************************************) @@ -13069,6 +13463,53 @@ implementation FWrapper.CheckError(Self, FWrapper.Lib3MFMeshObject_SetVolumeDataFunc(FHandle, ATheVolumeDataHandle)); end; + function TLib3MFMeshObject.AddTriangleSet(const AIdentifier: String; const AName: String): TLib3MFTriangleSet; + var + HTheTriangleSet: TLib3MFHandle; + begin + Result := nil; + HTheTriangleSet := nil; + FWrapper.CheckError(Self, FWrapper.Lib3MFMeshObject_AddTriangleSetFunc(FHandle, PAnsiChar(AIdentifier), PAnsiChar(AName), HTheTriangleSet)); + if Assigned(HTheTriangleSet) then + Result := TLib3MFPolymorphicFactory.Make(FWrapper, HTheTriangleSet); + end; + + function TLib3MFMeshObject.HasTriangleSet(const AIdentifier: String): Boolean; + var + ResultTriangleSetExists: Byte; + begin + ResultTriangleSetExists := 0; + FWrapper.CheckError(Self, FWrapper.Lib3MFMeshObject_HasTriangleSetFunc(FHandle, PAnsiChar(AIdentifier), ResultTriangleSetExists)); + Result := (ResultTriangleSetExists <> 0); + end; + + function TLib3MFMeshObject.FindTriangleSet(const AIdentifier: String): TLib3MFTriangleSet; + var + HTheTriangleSet: TLib3MFHandle; + begin + Result := nil; + HTheTriangleSet := nil; + FWrapper.CheckError(Self, FWrapper.Lib3MFMeshObject_FindTriangleSetFunc(FHandle, PAnsiChar(AIdentifier), HTheTriangleSet)); + if Assigned(HTheTriangleSet) then + Result := TLib3MFPolymorphicFactory.Make(FWrapper, HTheTriangleSet); + end; + + function TLib3MFMeshObject.GetTriangleSetCount(): Cardinal; + begin + FWrapper.CheckError(Self, FWrapper.Lib3MFMeshObject_GetTriangleSetCountFunc(FHandle, Result)); + end; + + function TLib3MFMeshObject.GetTriangleSet(const AIndex: Cardinal): TLib3MFTriangleSet; + var + HTheTriangleSet: TLib3MFHandle; + begin + Result := nil; + HTheTriangleSet := nil; + FWrapper.CheckError(Self, FWrapper.Lib3MFMeshObject_GetTriangleSetFunc(FHandle, AIndex, HTheTriangleSet)); + if Assigned(HTheTriangleSet) then + Result := TLib3MFPolymorphicFactory.Make(FWrapper, HTheTriangleSet); + end; + (************************************************************************************************************************* Class implementation for LevelSet **************************************************************************************************************************) @@ -19007,6 +19448,19 @@ implementation FLib3MFMetaDataGroup_RemoveMetaDataByIndexFunc := LoadFunction('lib3mf_metadatagroup_removemetadatabyindex'); FLib3MFMetaDataGroup_RemoveMetaDataFunc := LoadFunction('lib3mf_metadatagroup_removemetadata'); FLib3MFMetaDataGroup_AddMetaDataFunc := LoadFunction('lib3mf_metadatagroup_addmetadata'); + FLib3MFTriangleSet_SetNameFunc := LoadFunction('lib3mf_triangleset_setname'); + FLib3MFTriangleSet_GetNameFunc := LoadFunction('lib3mf_triangleset_getname'); + FLib3MFTriangleSet_SetIdentifierFunc := LoadFunction('lib3mf_triangleset_setidentifier'); + FLib3MFTriangleSet_GetIdentifierFunc := LoadFunction('lib3mf_triangleset_getidentifier'); + FLib3MFTriangleSet_AddTriangleFunc := LoadFunction('lib3mf_triangleset_addtriangle'); + FLib3MFTriangleSet_RemoveTriangleFunc := LoadFunction('lib3mf_triangleset_removetriangle'); + FLib3MFTriangleSet_ClearFunc := LoadFunction('lib3mf_triangleset_clear'); + FLib3MFTriangleSet_SetTriangleListFunc := LoadFunction('lib3mf_triangleset_settrianglelist'); + FLib3MFTriangleSet_GetTriangleListFunc := LoadFunction('lib3mf_triangleset_gettrianglelist'); + FLib3MFTriangleSet_AddTriangleListFunc := LoadFunction('lib3mf_triangleset_addtrianglelist'); + FLib3MFTriangleSet_MergeFunc := LoadFunction('lib3mf_triangleset_merge'); + FLib3MFTriangleSet_DeleteSetFunc := LoadFunction('lib3mf_triangleset_deleteset'); + FLib3MFTriangleSet_DuplicateFunc := LoadFunction('lib3mf_triangleset_duplicate'); FLib3MFObject_GetTypeFunc := LoadFunction('lib3mf_object_gettype'); FLib3MFObject_SetTypeFunc := LoadFunction('lib3mf_object_settype'); FLib3MFObject_GetNameFunc := LoadFunction('lib3mf_object_getname'); @@ -19052,6 +19506,11 @@ implementation FLib3MFMeshObject_BeamLatticeFunc := LoadFunction('lib3mf_meshobject_beamlattice'); FLib3MFMeshObject_GetVolumeDataFunc := LoadFunction('lib3mf_meshobject_getvolumedata'); FLib3MFMeshObject_SetVolumeDataFunc := LoadFunction('lib3mf_meshobject_setvolumedata'); + FLib3MFMeshObject_AddTriangleSetFunc := LoadFunction('lib3mf_meshobject_addtriangleset'); + FLib3MFMeshObject_HasTriangleSetFunc := LoadFunction('lib3mf_meshobject_hastriangleset'); + FLib3MFMeshObject_FindTriangleSetFunc := LoadFunction('lib3mf_meshobject_findtriangleset'); + FLib3MFMeshObject_GetTriangleSetCountFunc := LoadFunction('lib3mf_meshobject_gettrianglesetcount'); + FLib3MFMeshObject_GetTriangleSetFunc := LoadFunction('lib3mf_meshobject_gettriangleset'); FLib3MFLevelSet_GetFunctionFunc := LoadFunction('lib3mf_levelset_getfunction'); FLib3MFLevelSet_SetFunctionFunc := LoadFunction('lib3mf_levelset_setfunction'); FLib3MFLevelSet_GetTransformFunc := LoadFunction('lib3mf_levelset_gettransform'); @@ -19754,6 +20213,45 @@ implementation if AResult <> LIB3MF_SUCCESS then raise ELib3MFException.CreateCustomMessage(LIB3MF_ERROR_COULDNOTLOADLIBRARY, ''); AResult := ALookupMethod(PAnsiChar('lib3mf_metadatagroup_addmetadata'), @FLib3MFMetaDataGroup_AddMetaDataFunc); + if AResult <> LIB3MF_SUCCESS then + raise ELib3MFException.CreateCustomMessage(LIB3MF_ERROR_COULDNOTLOADLIBRARY, ''); + AResult := ALookupMethod(PAnsiChar('lib3mf_triangleset_setname'), @FLib3MFTriangleSet_SetNameFunc); + if AResult <> LIB3MF_SUCCESS then + raise ELib3MFException.CreateCustomMessage(LIB3MF_ERROR_COULDNOTLOADLIBRARY, ''); + AResult := ALookupMethod(PAnsiChar('lib3mf_triangleset_getname'), @FLib3MFTriangleSet_GetNameFunc); + if AResult <> LIB3MF_SUCCESS then + raise ELib3MFException.CreateCustomMessage(LIB3MF_ERROR_COULDNOTLOADLIBRARY, ''); + AResult := ALookupMethod(PAnsiChar('lib3mf_triangleset_setidentifier'), @FLib3MFTriangleSet_SetIdentifierFunc); + if AResult <> LIB3MF_SUCCESS then + raise ELib3MFException.CreateCustomMessage(LIB3MF_ERROR_COULDNOTLOADLIBRARY, ''); + AResult := ALookupMethod(PAnsiChar('lib3mf_triangleset_getidentifier'), @FLib3MFTriangleSet_GetIdentifierFunc); + if AResult <> LIB3MF_SUCCESS then + raise ELib3MFException.CreateCustomMessage(LIB3MF_ERROR_COULDNOTLOADLIBRARY, ''); + AResult := ALookupMethod(PAnsiChar('lib3mf_triangleset_addtriangle'), @FLib3MFTriangleSet_AddTriangleFunc); + if AResult <> LIB3MF_SUCCESS then + raise ELib3MFException.CreateCustomMessage(LIB3MF_ERROR_COULDNOTLOADLIBRARY, ''); + AResult := ALookupMethod(PAnsiChar('lib3mf_triangleset_removetriangle'), @FLib3MFTriangleSet_RemoveTriangleFunc); + if AResult <> LIB3MF_SUCCESS then + raise ELib3MFException.CreateCustomMessage(LIB3MF_ERROR_COULDNOTLOADLIBRARY, ''); + AResult := ALookupMethod(PAnsiChar('lib3mf_triangleset_clear'), @FLib3MFTriangleSet_ClearFunc); + if AResult <> LIB3MF_SUCCESS then + raise ELib3MFException.CreateCustomMessage(LIB3MF_ERROR_COULDNOTLOADLIBRARY, ''); + AResult := ALookupMethod(PAnsiChar('lib3mf_triangleset_settrianglelist'), @FLib3MFTriangleSet_SetTriangleListFunc); + if AResult <> LIB3MF_SUCCESS then + raise ELib3MFException.CreateCustomMessage(LIB3MF_ERROR_COULDNOTLOADLIBRARY, ''); + AResult := ALookupMethod(PAnsiChar('lib3mf_triangleset_gettrianglelist'), @FLib3MFTriangleSet_GetTriangleListFunc); + if AResult <> LIB3MF_SUCCESS then + raise ELib3MFException.CreateCustomMessage(LIB3MF_ERROR_COULDNOTLOADLIBRARY, ''); + AResult := ALookupMethod(PAnsiChar('lib3mf_triangleset_addtrianglelist'), @FLib3MFTriangleSet_AddTriangleListFunc); + if AResult <> LIB3MF_SUCCESS then + raise ELib3MFException.CreateCustomMessage(LIB3MF_ERROR_COULDNOTLOADLIBRARY, ''); + AResult := ALookupMethod(PAnsiChar('lib3mf_triangleset_merge'), @FLib3MFTriangleSet_MergeFunc); + if AResult <> LIB3MF_SUCCESS then + raise ELib3MFException.CreateCustomMessage(LIB3MF_ERROR_COULDNOTLOADLIBRARY, ''); + AResult := ALookupMethod(PAnsiChar('lib3mf_triangleset_deleteset'), @FLib3MFTriangleSet_DeleteSetFunc); + if AResult <> LIB3MF_SUCCESS then + raise ELib3MFException.CreateCustomMessage(LIB3MF_ERROR_COULDNOTLOADLIBRARY, ''); + AResult := ALookupMethod(PAnsiChar('lib3mf_triangleset_duplicate'), @FLib3MFTriangleSet_DuplicateFunc); if AResult <> LIB3MF_SUCCESS then raise ELib3MFException.CreateCustomMessage(LIB3MF_ERROR_COULDNOTLOADLIBRARY, ''); AResult := ALookupMethod(PAnsiChar('lib3mf_object_gettype'), @FLib3MFObject_GetTypeFunc); @@ -19889,6 +20387,21 @@ implementation if AResult <> LIB3MF_SUCCESS then raise ELib3MFException.CreateCustomMessage(LIB3MF_ERROR_COULDNOTLOADLIBRARY, ''); AResult := ALookupMethod(PAnsiChar('lib3mf_meshobject_setvolumedata'), @FLib3MFMeshObject_SetVolumeDataFunc); + if AResult <> LIB3MF_SUCCESS then + raise ELib3MFException.CreateCustomMessage(LIB3MF_ERROR_COULDNOTLOADLIBRARY, ''); + AResult := ALookupMethod(PAnsiChar('lib3mf_meshobject_addtriangleset'), @FLib3MFMeshObject_AddTriangleSetFunc); + if AResult <> LIB3MF_SUCCESS then + raise ELib3MFException.CreateCustomMessage(LIB3MF_ERROR_COULDNOTLOADLIBRARY, ''); + AResult := ALookupMethod(PAnsiChar('lib3mf_meshobject_hastriangleset'), @FLib3MFMeshObject_HasTriangleSetFunc); + if AResult <> LIB3MF_SUCCESS then + raise ELib3MFException.CreateCustomMessage(LIB3MF_ERROR_COULDNOTLOADLIBRARY, ''); + AResult := ALookupMethod(PAnsiChar('lib3mf_meshobject_findtriangleset'), @FLib3MFMeshObject_FindTriangleSetFunc); + if AResult <> LIB3MF_SUCCESS then + raise ELib3MFException.CreateCustomMessage(LIB3MF_ERROR_COULDNOTLOADLIBRARY, ''); + AResult := ALookupMethod(PAnsiChar('lib3mf_meshobject_gettrianglesetcount'), @FLib3MFMeshObject_GetTriangleSetCountFunc); + if AResult <> LIB3MF_SUCCESS then + raise ELib3MFException.CreateCustomMessage(LIB3MF_ERROR_COULDNOTLOADLIBRARY, ''); + AResult := ALookupMethod(PAnsiChar('lib3mf_meshobject_gettriangleset'), @FLib3MFMeshObject_GetTriangleSetFunc); if AResult <> LIB3MF_SUCCESS then raise ELib3MFException.CreateCustomMessage(LIB3MF_ERROR_COULDNOTLOADLIBRARY, ''); AResult := ALookupMethod(PAnsiChar('lib3mf_levelset_getfunction'), @FLib3MFLevelSet_GetFunctionFunc); diff --git a/Autogenerated/Bindings/Python/Lib3MF.py b/Autogenerated/Bindings/Python/Lib3MF.py index 9469dda4..0d5d2740 100644 --- a/Autogenerated/Bindings/Python/Lib3MF.py +++ b/Autogenerated/Bindings/Python/Lib3MF.py @@ -101,6 +101,8 @@ class ErrorCodes(enum.IntEnum): ELEMENTCOUNTEXCEEDSLIMIT = 141 INVALIDRESOURCE = 142 INVALIDLEVELSET = 143 + COULDNOTFINDTRIANGLESET = 144 + INVALIDTRIANGLESETINDEX = 145 BEAMLATTICE_INVALID_OBJECTTYPE = 2000 INVALIDKEYSTORE = 3000 INVALIDKEYSTORECONSUMER = 3001 @@ -203,6 +205,19 @@ class FunctionTable: lib3mf_metadatagroup_removemetadatabyindex = None lib3mf_metadatagroup_removemetadata = None lib3mf_metadatagroup_addmetadata = None + lib3mf_triangleset_setname = None + lib3mf_triangleset_getname = None + lib3mf_triangleset_setidentifier = None + lib3mf_triangleset_getidentifier = None + lib3mf_triangleset_addtriangle = None + lib3mf_triangleset_removetriangle = None + lib3mf_triangleset_clear = None + lib3mf_triangleset_settrianglelist = None + lib3mf_triangleset_gettrianglelist = None + lib3mf_triangleset_addtrianglelist = None + lib3mf_triangleset_merge = None + lib3mf_triangleset_deleteset = None + lib3mf_triangleset_duplicate = None lib3mf_object_gettype = None lib3mf_object_settype = None lib3mf_object_getname = None @@ -248,6 +263,11 @@ class FunctionTable: lib3mf_meshobject_beamlattice = None lib3mf_meshobject_getvolumedata = None lib3mf_meshobject_setvolumedata = None + lib3mf_meshobject_addtriangleset = None + lib3mf_meshobject_hastriangleset = None + lib3mf_meshobject_findtriangleset = None + lib3mf_meshobject_gettrianglesetcount = None + lib3mf_meshobject_gettriangleset = None lib3mf_levelset_getfunction = None lib3mf_levelset_setfunction = None lib3mf_levelset_gettransform = None @@ -1650,6 +1670,84 @@ def _loadFunctionTableFromMethod(self, symbolLookupMethodAddress): methodType = ctypes.CFUNCTYPE(ctypes.c_int32, ctypes.c_void_p, ctypes.c_char_p, ctypes.c_char_p, ctypes.c_char_p, ctypes.c_char_p, ctypes.c_bool, ctypes.POINTER(ctypes.c_void_p)) self.lib.lib3mf_metadatagroup_addmetadata = methodType(int(methodAddress.value)) + err = symbolLookupMethod(ctypes.c_char_p(str.encode("lib3mf_triangleset_setname")), methodAddress) + if err != 0: + raise ELib3MFException(ErrorCodes.COULDNOTLOADLIBRARY, str(err)) + methodType = ctypes.CFUNCTYPE(ctypes.c_int32, ctypes.c_void_p, ctypes.c_char_p) + self.lib.lib3mf_triangleset_setname = methodType(int(methodAddress.value)) + + err = symbolLookupMethod(ctypes.c_char_p(str.encode("lib3mf_triangleset_getname")), methodAddress) + if err != 0: + raise ELib3MFException(ErrorCodes.COULDNOTLOADLIBRARY, str(err)) + 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_triangleset_getname = methodType(int(methodAddress.value)) + + err = symbolLookupMethod(ctypes.c_char_p(str.encode("lib3mf_triangleset_setidentifier")), methodAddress) + if err != 0: + raise ELib3MFException(ErrorCodes.COULDNOTLOADLIBRARY, str(err)) + methodType = ctypes.CFUNCTYPE(ctypes.c_int32, ctypes.c_void_p, ctypes.c_char_p) + self.lib.lib3mf_triangleset_setidentifier = methodType(int(methodAddress.value)) + + err = symbolLookupMethod(ctypes.c_char_p(str.encode("lib3mf_triangleset_getidentifier")), methodAddress) + if err != 0: + raise ELib3MFException(ErrorCodes.COULDNOTLOADLIBRARY, str(err)) + 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_triangleset_getidentifier = methodType(int(methodAddress.value)) + + err = symbolLookupMethod(ctypes.c_char_p(str.encode("lib3mf_triangleset_addtriangle")), 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_triangleset_addtriangle = methodType(int(methodAddress.value)) + + err = symbolLookupMethod(ctypes.c_char_p(str.encode("lib3mf_triangleset_removetriangle")), 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_triangleset_removetriangle = methodType(int(methodAddress.value)) + + err = symbolLookupMethod(ctypes.c_char_p(str.encode("lib3mf_triangleset_clear")), methodAddress) + if err != 0: + raise ELib3MFException(ErrorCodes.COULDNOTLOADLIBRARY, str(err)) + methodType = ctypes.CFUNCTYPE(ctypes.c_int32, ctypes.c_void_p) + self.lib.lib3mf_triangleset_clear = methodType(int(methodAddress.value)) + + err = symbolLookupMethod(ctypes.c_char_p(str.encode("lib3mf_triangleset_settrianglelist")), methodAddress) + if err != 0: + raise ELib3MFException(ErrorCodes.COULDNOTLOADLIBRARY, str(err)) + methodType = ctypes.CFUNCTYPE(ctypes.c_int32, ctypes.c_void_p, ctypes.c_uint64, ctypes.POINTER(ctypes.c_uint32)) + self.lib.lib3mf_triangleset_settrianglelist = methodType(int(methodAddress.value)) + + err = symbolLookupMethod(ctypes.c_char_p(str.encode("lib3mf_triangleset_gettrianglelist")), methodAddress) + if err != 0: + raise ELib3MFException(ErrorCodes.COULDNOTLOADLIBRARY, str(err)) + methodType = ctypes.CFUNCTYPE(ctypes.c_int32, ctypes.c_void_p, ctypes.c_uint64, ctypes.POINTER(ctypes.c_uint64), ctypes.POINTER(ctypes.c_uint32)) + self.lib.lib3mf_triangleset_gettrianglelist = methodType(int(methodAddress.value)) + + err = symbolLookupMethod(ctypes.c_char_p(str.encode("lib3mf_triangleset_addtrianglelist")), methodAddress) + if err != 0: + raise ELib3MFException(ErrorCodes.COULDNOTLOADLIBRARY, str(err)) + methodType = ctypes.CFUNCTYPE(ctypes.c_int32, ctypes.c_void_p, ctypes.c_uint64, ctypes.POINTER(ctypes.c_uint32)) + self.lib.lib3mf_triangleset_addtrianglelist = methodType(int(methodAddress.value)) + + err = symbolLookupMethod(ctypes.c_char_p(str.encode("lib3mf_triangleset_merge")), methodAddress) + if err != 0: + raise ELib3MFException(ErrorCodes.COULDNOTLOADLIBRARY, str(err)) + methodType = ctypes.CFUNCTYPE(ctypes.c_int32, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_bool) + self.lib.lib3mf_triangleset_merge = methodType(int(methodAddress.value)) + + err = symbolLookupMethod(ctypes.c_char_p(str.encode("lib3mf_triangleset_deleteset")), methodAddress) + if err != 0: + raise ELib3MFException(ErrorCodes.COULDNOTLOADLIBRARY, str(err)) + methodType = ctypes.CFUNCTYPE(ctypes.c_int32, ctypes.c_void_p) + self.lib.lib3mf_triangleset_deleteset = methodType(int(methodAddress.value)) + + err = symbolLookupMethod(ctypes.c_char_p(str.encode("lib3mf_triangleset_duplicate")), methodAddress) + if err != 0: + raise ELib3MFException(ErrorCodes.COULDNOTLOADLIBRARY, str(err)) + methodType = ctypes.CFUNCTYPE(ctypes.c_int32, ctypes.c_void_p, ctypes.c_char_p, ctypes.POINTER(ctypes.c_void_p)) + self.lib.lib3mf_triangleset_duplicate = methodType(int(methodAddress.value)) + err = symbolLookupMethod(ctypes.c_char_p(str.encode("lib3mf_object_gettype")), methodAddress) if err != 0: raise ELib3MFException(ErrorCodes.COULDNOTLOADLIBRARY, str(err)) @@ -1920,6 +2018,36 @@ def _loadFunctionTableFromMethod(self, symbolLookupMethodAddress): methodType = ctypes.CFUNCTYPE(ctypes.c_int32, ctypes.c_void_p, ctypes.c_void_p) self.lib.lib3mf_meshobject_setvolumedata = methodType(int(methodAddress.value)) + err = symbolLookupMethod(ctypes.c_char_p(str.encode("lib3mf_meshobject_addtriangleset")), methodAddress) + if err != 0: + raise ELib3MFException(ErrorCodes.COULDNOTLOADLIBRARY, str(err)) + methodType = ctypes.CFUNCTYPE(ctypes.c_int32, ctypes.c_void_p, ctypes.c_char_p, ctypes.c_char_p, ctypes.POINTER(ctypes.c_void_p)) + self.lib.lib3mf_meshobject_addtriangleset = methodType(int(methodAddress.value)) + + err = symbolLookupMethod(ctypes.c_char_p(str.encode("lib3mf_meshobject_hastriangleset")), methodAddress) + if err != 0: + raise ELib3MFException(ErrorCodes.COULDNOTLOADLIBRARY, str(err)) + methodType = ctypes.CFUNCTYPE(ctypes.c_int32, ctypes.c_void_p, ctypes.c_char_p, ctypes.POINTER(ctypes.c_bool)) + self.lib.lib3mf_meshobject_hastriangleset = methodType(int(methodAddress.value)) + + err = symbolLookupMethod(ctypes.c_char_p(str.encode("lib3mf_meshobject_findtriangleset")), methodAddress) + if err != 0: + raise ELib3MFException(ErrorCodes.COULDNOTLOADLIBRARY, str(err)) + methodType = ctypes.CFUNCTYPE(ctypes.c_int32, ctypes.c_void_p, ctypes.c_char_p, ctypes.POINTER(ctypes.c_void_p)) + self.lib.lib3mf_meshobject_findtriangleset = methodType(int(methodAddress.value)) + + err = symbolLookupMethod(ctypes.c_char_p(str.encode("lib3mf_meshobject_gettrianglesetcount")), methodAddress) + if err != 0: + raise ELib3MFException(ErrorCodes.COULDNOTLOADLIBRARY, str(err)) + methodType = ctypes.CFUNCTYPE(ctypes.c_int32, ctypes.c_void_p, ctypes.POINTER(ctypes.c_uint32)) + self.lib.lib3mf_meshobject_gettrianglesetcount = methodType(int(methodAddress.value)) + + err = symbolLookupMethod(ctypes.c_char_p(str.encode("lib3mf_meshobject_gettriangleset")), 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_void_p)) + self.lib.lib3mf_meshobject_gettriangleset = methodType(int(methodAddress.value)) + err = symbolLookupMethod(ctypes.c_char_p(str.encode("lib3mf_levelset_getfunction")), methodAddress) if err != 0: raise ELib3MFException(ErrorCodes.COULDNOTLOADLIBRARY, str(err)) @@ -5006,6 +5134,45 @@ def _loadFunctionTable(self): self.lib.lib3mf_metadatagroup_addmetadata.restype = ctypes.c_int32 self.lib.lib3mf_metadatagroup_addmetadata.argtypes = [ctypes.c_void_p, ctypes.c_char_p, ctypes.c_char_p, ctypes.c_char_p, ctypes.c_char_p, ctypes.c_bool, ctypes.POINTER(ctypes.c_void_p)] + self.lib.lib3mf_triangleset_setname.restype = ctypes.c_int32 + self.lib.lib3mf_triangleset_setname.argtypes = [ctypes.c_void_p, ctypes.c_char_p] + + self.lib.lib3mf_triangleset_getname.restype = ctypes.c_int32 + self.lib.lib3mf_triangleset_getname.argtypes = [ctypes.c_void_p, ctypes.c_uint64, ctypes.POINTER(ctypes.c_uint64), ctypes.c_char_p] + + self.lib.lib3mf_triangleset_setidentifier.restype = ctypes.c_int32 + self.lib.lib3mf_triangleset_setidentifier.argtypes = [ctypes.c_void_p, ctypes.c_char_p] + + self.lib.lib3mf_triangleset_getidentifier.restype = ctypes.c_int32 + self.lib.lib3mf_triangleset_getidentifier.argtypes = [ctypes.c_void_p, ctypes.c_uint64, ctypes.POINTER(ctypes.c_uint64), ctypes.c_char_p] + + self.lib.lib3mf_triangleset_addtriangle.restype = ctypes.c_int32 + self.lib.lib3mf_triangleset_addtriangle.argtypes = [ctypes.c_void_p, ctypes.c_uint32] + + self.lib.lib3mf_triangleset_removetriangle.restype = ctypes.c_int32 + self.lib.lib3mf_triangleset_removetriangle.argtypes = [ctypes.c_void_p, ctypes.c_uint32] + + self.lib.lib3mf_triangleset_clear.restype = ctypes.c_int32 + self.lib.lib3mf_triangleset_clear.argtypes = [ctypes.c_void_p] + + self.lib.lib3mf_triangleset_settrianglelist.restype = ctypes.c_int32 + self.lib.lib3mf_triangleset_settrianglelist.argtypes = [ctypes.c_void_p, ctypes.c_uint64, ctypes.POINTER(ctypes.c_uint32)] + + self.lib.lib3mf_triangleset_gettrianglelist.restype = ctypes.c_int32 + self.lib.lib3mf_triangleset_gettrianglelist.argtypes = [ctypes.c_void_p, ctypes.c_uint64, ctypes.POINTER(ctypes.c_uint64), ctypes.POINTER(ctypes.c_uint32)] + + self.lib.lib3mf_triangleset_addtrianglelist.restype = ctypes.c_int32 + self.lib.lib3mf_triangleset_addtrianglelist.argtypes = [ctypes.c_void_p, ctypes.c_uint64, ctypes.POINTER(ctypes.c_uint32)] + + self.lib.lib3mf_triangleset_merge.restype = ctypes.c_int32 + self.lib.lib3mf_triangleset_merge.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_bool] + + self.lib.lib3mf_triangleset_deleteset.restype = ctypes.c_int32 + self.lib.lib3mf_triangleset_deleteset.argtypes = [ctypes.c_void_p] + + self.lib.lib3mf_triangleset_duplicate.restype = ctypes.c_int32 + self.lib.lib3mf_triangleset_duplicate.argtypes = [ctypes.c_void_p, ctypes.c_char_p, ctypes.POINTER(ctypes.c_void_p)] + self.lib.lib3mf_object_gettype.restype = ctypes.c_int32 self.lib.lib3mf_object_gettype.argtypes = [ctypes.c_void_p, ctypes.POINTER(ctypes.c_int32)] @@ -5141,6 +5308,21 @@ def _loadFunctionTable(self): self.lib.lib3mf_meshobject_setvolumedata.restype = ctypes.c_int32 self.lib.lib3mf_meshobject_setvolumedata.argtypes = [ctypes.c_void_p, ctypes.c_void_p] + self.lib.lib3mf_meshobject_addtriangleset.restype = ctypes.c_int32 + self.lib.lib3mf_meshobject_addtriangleset.argtypes = [ctypes.c_void_p, ctypes.c_char_p, ctypes.c_char_p, ctypes.POINTER(ctypes.c_void_p)] + + self.lib.lib3mf_meshobject_hastriangleset.restype = ctypes.c_int32 + self.lib.lib3mf_meshobject_hastriangleset.argtypes = [ctypes.c_void_p, ctypes.c_char_p, ctypes.POINTER(ctypes.c_bool)] + + self.lib.lib3mf_meshobject_findtriangleset.restype = ctypes.c_int32 + self.lib.lib3mf_meshobject_findtriangleset.argtypes = [ctypes.c_void_p, ctypes.c_char_p, ctypes.POINTER(ctypes.c_void_p)] + + self.lib.lib3mf_meshobject_gettrianglesetcount.restype = ctypes.c_int32 + self.lib.lib3mf_meshobject_gettrianglesetcount.argtypes = [ctypes.c_void_p, ctypes.POINTER(ctypes.c_uint32)] + + self.lib.lib3mf_meshobject_gettriangleset.restype = ctypes.c_int32 + self.lib.lib3mf_meshobject_gettriangleset.argtypes = [ctypes.c_void_p, ctypes.c_uint32, ctypes.POINTER(ctypes.c_void_p)] + self.lib.lib3mf_levelset_getfunction.restype = ctypes.c_int32 self.lib.lib3mf_levelset_getfunction.argtypes = [ctypes.c_void_p, ctypes.POINTER(ctypes.c_void_p)] @@ -6799,6 +6981,8 @@ def getObjectById_D17716D063DE2C22(self, handle, wrapper): # First 64 bits of SH return MetaData(handle, wrapper) def getObjectById_0C3B85369E9B25D3(self, handle, wrapper): # First 64 bits of SHA1 of a string: "Lib3MF::MetaDataGroup" return MetaDataGroup(handle, wrapper) + def getObjectById_5950BB3EE8A82090(self, handle, wrapper): # First 64 bits of SHA1 of a string: "Lib3MF::TriangleSet" + return TriangleSet(handle, wrapper) def getObjectById_2DA2136F577A779C(self, handle, wrapper): # First 64 bits of SHA1 of a string: "Lib3MF::Object" return Object(handle, wrapper) def getObjectById_3B3A6DC6EC610497(self, handle, wrapper): # First 64 bits of SHA1 of a string: "Lib3MF::MeshObject" @@ -7678,6 +7862,107 @@ def AddMetaData(self, NameSpace, Name, Value, Type, MustPreserve): +''' Class Implementation for TriangleSet +''' +class TriangleSet(Base): + def __init__(self, handle, wrapper): + Base.__init__(self, handle, wrapper) + def SetName(self, Name): + pName = ctypes.c_char_p(str.encode(Name)) + self._wrapper.checkError(self, self._wrapper.lib.lib3mf_triangleset_setname(self._handle, pName)) + + + def GetName(self): + nNameBufferSize = ctypes.c_uint64(0) + nNameNeededChars = ctypes.c_uint64(0) + pNameBuffer = ctypes.c_char_p(None) + self._wrapper.checkError(self, self._wrapper.lib.lib3mf_triangleset_getname(self._handle, nNameBufferSize, nNameNeededChars, pNameBuffer)) + nNameBufferSize = ctypes.c_uint64(nNameNeededChars.value) + pNameBuffer = (ctypes.c_char * (nNameNeededChars.value))() + self._wrapper.checkError(self, self._wrapper.lib.lib3mf_triangleset_getname(self._handle, nNameBufferSize, nNameNeededChars, pNameBuffer)) + + return pNameBuffer.value.decode() + + def SetIdentifier(self, Identifier): + pIdentifier = ctypes.c_char_p(str.encode(Identifier)) + self._wrapper.checkError(self, self._wrapper.lib.lib3mf_triangleset_setidentifier(self._handle, pIdentifier)) + + + def GetIdentifier(self): + nIdentifierBufferSize = ctypes.c_uint64(0) + nIdentifierNeededChars = ctypes.c_uint64(0) + pIdentifierBuffer = ctypes.c_char_p(None) + self._wrapper.checkError(self, self._wrapper.lib.lib3mf_triangleset_getidentifier(self._handle, nIdentifierBufferSize, nIdentifierNeededChars, pIdentifierBuffer)) + nIdentifierBufferSize = ctypes.c_uint64(nIdentifierNeededChars.value) + pIdentifierBuffer = (ctypes.c_char * (nIdentifierNeededChars.value))() + self._wrapper.checkError(self, self._wrapper.lib.lib3mf_triangleset_getidentifier(self._handle, nIdentifierBufferSize, nIdentifierNeededChars, pIdentifierBuffer)) + + return pIdentifierBuffer.value.decode() + + def AddTriangle(self, TriangleIndex): + nTriangleIndex = ctypes.c_uint32(TriangleIndex) + self._wrapper.checkError(self, self._wrapper.lib.lib3mf_triangleset_addtriangle(self._handle, nTriangleIndex)) + + + def RemoveTriangle(self, TriangleIndex): + nTriangleIndex = ctypes.c_uint32(TriangleIndex) + self._wrapper.checkError(self, self._wrapper.lib.lib3mf_triangleset_removetriangle(self._handle, nTriangleIndex)) + + + def Clear(self): + self._wrapper.checkError(self, self._wrapper.lib.lib3mf_triangleset_clear(self._handle)) + + + def SetTriangleList(self, TriangleIndices): + nTriangleIndicesCount = ctypes.c_uint64(len(TriangleIndices)) + pTriangleIndicesBuffer = (ctypes.c_uint32*len(TriangleIndices))(*TriangleIndices) + self._wrapper.checkError(self, self._wrapper.lib.lib3mf_triangleset_settrianglelist(self._handle, nTriangleIndicesCount, pTriangleIndicesBuffer)) + + + def GetTriangleList(self): + nTriangleIndicesCount = ctypes.c_uint64(0) + nTriangleIndicesNeededCount = ctypes.c_uint64(0) + pTriangleIndicesBuffer = (ctypes.c_uint32*0)() + self._wrapper.checkError(self, self._wrapper.lib.lib3mf_triangleset_gettrianglelist(self._handle, nTriangleIndicesCount, nTriangleIndicesNeededCount, pTriangleIndicesBuffer)) + nTriangleIndicesCount = ctypes.c_uint64(nTriangleIndicesNeededCount.value) + pTriangleIndicesBuffer = (ctypes.c_uint32 * nTriangleIndicesNeededCount.value)() + self._wrapper.checkError(self, self._wrapper.lib.lib3mf_triangleset_gettrianglelist(self._handle, nTriangleIndicesCount, nTriangleIndicesNeededCount, pTriangleIndicesBuffer)) + + return [pTriangleIndicesBuffer[i] for i in range(nTriangleIndicesNeededCount.value)] + + def AddTriangleList(self, TriangleIndices): + nTriangleIndicesCount = ctypes.c_uint64(len(TriangleIndices)) + pTriangleIndicesBuffer = (ctypes.c_uint32*len(TriangleIndices))(*TriangleIndices) + self._wrapper.checkError(self, self._wrapper.lib.lib3mf_triangleset_addtrianglelist(self._handle, nTriangleIndicesCount, pTriangleIndicesBuffer)) + + + def Merge(self, OtherTriangleSetObject, DeleteOther): + OtherTriangleSetHandle = None + if OtherTriangleSetObject: + OtherTriangleSetHandle = OtherTriangleSetObject._handle + else: + raise ELib3MFException(ErrorCodes.INVALIDPARAM, 'Invalid return/output value') + bDeleteOther = ctypes.c_bool(DeleteOther) + self._wrapper.checkError(self, self._wrapper.lib.lib3mf_triangleset_merge(self._handle, OtherTriangleSetHandle, bDeleteOther)) + + + def DeleteSet(self): + self._wrapper.checkError(self, self._wrapper.lib.lib3mf_triangleset_deleteset(self._handle)) + + + def Duplicate(self, Identifier): + pIdentifier = ctypes.c_char_p(str.encode(Identifier)) + NewSetHandle = ctypes.c_void_p() + self._wrapper.checkError(self, self._wrapper.lib.lib3mf_triangleset_duplicate(self._handle, pIdentifier, NewSetHandle)) + if NewSetHandle: + NewSetObject = self._wrapper._polymorphicFactory(NewSetHandle) + else: + raise ELib3MFException(ErrorCodes.INVALIDCAST, 'Invalid return/output value') + + return NewSetObject + + + ''' Class Implementation for Object ''' class Object(Resource): @@ -8012,6 +8297,53 @@ def SetVolumeData(self, TheVolumeDataObject): self._wrapper.checkError(self, self._wrapper.lib.lib3mf_meshobject_setvolumedata(self._handle, TheVolumeDataHandle)) + def AddTriangleSet(self, Identifier, Name): + pIdentifier = ctypes.c_char_p(str.encode(Identifier)) + pName = ctypes.c_char_p(str.encode(Name)) + TheTriangleSetHandle = ctypes.c_void_p() + self._wrapper.checkError(self, self._wrapper.lib.lib3mf_meshobject_addtriangleset(self._handle, pIdentifier, pName, TheTriangleSetHandle)) + if TheTriangleSetHandle: + TheTriangleSetObject = self._wrapper._polymorphicFactory(TheTriangleSetHandle) + else: + raise ELib3MFException(ErrorCodes.INVALIDCAST, 'Invalid return/output value') + + return TheTriangleSetObject + + def HasTriangleSet(self, Identifier): + pIdentifier = ctypes.c_char_p(str.encode(Identifier)) + pTriangleSetExists = ctypes.c_bool() + self._wrapper.checkError(self, self._wrapper.lib.lib3mf_meshobject_hastriangleset(self._handle, pIdentifier, pTriangleSetExists)) + + return pTriangleSetExists.value + + def FindTriangleSet(self, Identifier): + pIdentifier = ctypes.c_char_p(str.encode(Identifier)) + TheTriangleSetHandle = ctypes.c_void_p() + self._wrapper.checkError(self, self._wrapper.lib.lib3mf_meshobject_findtriangleset(self._handle, pIdentifier, TheTriangleSetHandle)) + if TheTriangleSetHandle: + TheTriangleSetObject = self._wrapper._polymorphicFactory(TheTriangleSetHandle) + else: + raise ELib3MFException(ErrorCodes.INVALIDCAST, 'Invalid return/output value') + + return TheTriangleSetObject + + def GetTriangleSetCount(self): + pCount = ctypes.c_uint32() + self._wrapper.checkError(self, self._wrapper.lib.lib3mf_meshobject_gettrianglesetcount(self._handle, pCount)) + + return pCount.value + + def GetTriangleSet(self, Index): + nIndex = ctypes.c_uint32(Index) + TheTriangleSetHandle = ctypes.c_void_p() + self._wrapper.checkError(self, self._wrapper.lib.lib3mf_meshobject_gettriangleset(self._handle, nIndex, TheTriangleSetHandle)) + if TheTriangleSetHandle: + TheTriangleSetObject = self._wrapper._polymorphicFactory(TheTriangleSetHandle) + else: + raise ELib3MFException(ErrorCodes.INVALIDCAST, 'Invalid return/output value') + + return TheTriangleSetObject + ''' Class Implementation for LevelSet diff --git a/Autogenerated/Source/lib3mf_abi.hpp b/Autogenerated/Source/lib3mf_abi.hpp index 1e3907a6..608d1bd0 100644 --- a/Autogenerated/Source/lib3mf_abi.hpp +++ b/Autogenerated/Source/lib3mf_abi.hpp @@ -793,6 +793,135 @@ LIB3MF_DECLSPEC Lib3MFResult lib3mf_metadatagroup_removemetadata(Lib3MF_MetaData */ LIB3MF_DECLSPEC Lib3MFResult lib3mf_metadatagroup_addmetadata(Lib3MF_MetaDataGroup pMetaDataGroup, const char * pNameSpace, const char * pName, const char * pValue, const char * pType, bool bMustPreserve, Lib3MF_MetaData * pMetaData); +/************************************************************************************************************************* + Class definition for TriangleSet +**************************************************************************************************************************/ + +/** +* sets the name of the triangle set +* +* @param[in] pTriangleSet - TriangleSet instance. +* @param[in] pName - the new name +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_triangleset_setname(Lib3MF_TriangleSet pTriangleSet, const char * pName); + +/** +* returns the name of the triangle set +* +* @param[in] pTriangleSet - TriangleSet instance. +* @param[in] nNameBufferSize - size of the buffer (including trailing 0) +* @param[out] pNameNeededChars - will be filled with the count of the written bytes, or needed buffer size. +* @param[out] pNameBuffer - buffer of returns the name, may be NULL +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_triangleset_getname(Lib3MF_TriangleSet pTriangleSet, const Lib3MF_uint32 nNameBufferSize, Lib3MF_uint32* pNameNeededChars, char * pNameBuffer); + +/** +* sets the identifier of the triangle set. +* +* @param[in] pTriangleSet - TriangleSet instance. +* @param[in] pIdentifier - the new identifier. MUST be unique within the mesh. MUST NOT be an empty string +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_triangleset_setidentifier(Lib3MF_TriangleSet pTriangleSet, const char * pIdentifier); + +/** +* returns the identifier of the triangle set +* +* @param[in] pTriangleSet - TriangleSet instance. +* @param[in] nIdentifierBufferSize - size of the buffer (including trailing 0) +* @param[out] pIdentifierNeededChars - will be filled with the count of the written bytes, or needed buffer size. +* @param[out] pIdentifierBuffer - buffer of returns the identifier, may be NULL +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_triangleset_getidentifier(Lib3MF_TriangleSet pTriangleSet, const Lib3MF_uint32 nIdentifierBufferSize, Lib3MF_uint32* pIdentifierNeededChars, char * pIdentifierBuffer); + +/** +* adds a triangle to the set. Does nothing if triangle is already in the set. +* +* @param[in] pTriangleSet - TriangleSet instance. +* @param[in] nTriangleIndex - Triangle index to add. MUST be between 0 and TriangleCount - 1. +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_triangleset_addtriangle(Lib3MF_TriangleSet pTriangleSet, Lib3MF_uint32 nTriangleIndex); + +/** +* removes a triangle from the set +* +* @param[in] pTriangleSet - TriangleSet instance. +* @param[in] nTriangleIndex - Triangle index to remove. MUST be between 0 and TriangleCount - 1. +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_triangleset_removetriangle(Lib3MF_TriangleSet pTriangleSet, Lib3MF_uint32 nTriangleIndex); + +/** +* clears all triangles from the list +* +* @param[in] pTriangleSet - TriangleSet instance. +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_triangleset_clear(Lib3MF_TriangleSet pTriangleSet); + +/** +* Sets all triangles in the list, while clearing old values. Duplicates will be merged. +* +* @param[in] pTriangleSet - TriangleSet instance. +* @param[in] nTriangleIndicesBufferSize - Number of elements in buffer +* @param[in] pTriangleIndicesBuffer - uint32 buffer of Triangle indices to add. Every element MUST be between 0 and TriangleCount - 1. +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_triangleset_settrianglelist(Lib3MF_TriangleSet pTriangleSet, Lib3MF_uint64 nTriangleIndicesBufferSize, const Lib3MF_uint32 * pTriangleIndicesBuffer); + +/** +* Retrieves all the triangles in the TriangleSet +* +* @param[in] pTriangleSet - TriangleSet instance. +* @param[in] nTriangleIndicesBufferSize - Number of elements in buffer +* @param[out] pTriangleIndicesNeededCount - will be filled with the count of the written elements, or needed buffer size. +* @param[out] pTriangleIndicesBuffer - uint32 buffer of retrieves the indices of the triangles in this TriangleSet +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_triangleset_gettrianglelist(Lib3MF_TriangleSet pTriangleSet, const Lib3MF_uint64 nTriangleIndicesBufferSize, Lib3MF_uint64* pTriangleIndicesNeededCount, Lib3MF_uint32 * pTriangleIndicesBuffer); + +/** +* Adds multiple triangles in the list. Duplicates will be merged. +* +* @param[in] pTriangleSet - TriangleSet instance. +* @param[in] nTriangleIndicesBufferSize - Number of elements in buffer +* @param[in] pTriangleIndicesBuffer - uint32 buffer of Triangle indices to add. Every element MUST be between 0 and TriangleCount - 1. +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_triangleset_addtrianglelist(Lib3MF_TriangleSet pTriangleSet, Lib3MF_uint64 nTriangleIndicesBufferSize, const Lib3MF_uint32 * pTriangleIndicesBuffer); + +/** +* Merges another Triangle set. +* +* @param[in] pTriangleSet - TriangleSet instance. +* @param[in] pOtherTriangleSet - Other triangle set to merge. +* @param[in] bDeleteOther - Flag if other triangle set is getting removed. +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_triangleset_merge(Lib3MF_TriangleSet pTriangleSet, Lib3MF_TriangleSet pOtherTriangleSet, bool bDeleteOther); + +/** +* Deletes the whole set from the mesh. +* +* @param[in] pTriangleSet - TriangleSet instance. +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_triangleset_deleteset(Lib3MF_TriangleSet pTriangleSet); + +/** +* Duplicates the set in the mesh. +* +* @param[in] pTriangleSet - TriangleSet instance. +* @param[in] pIdentifier - the new identifier. MUST be unique within the mesh. MUST NOT be an empty string +* @param[out] pNewSet - Copy of the triangle set. +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_triangleset_duplicate(Lib3MF_TriangleSet pTriangleSet, const char * pIdentifier, Lib3MF_TriangleSet * pNewSet); + /************************************************************************************************************************* Class definition for Object **************************************************************************************************************************/ @@ -1232,6 +1361,56 @@ LIB3MF_DECLSPEC Lib3MFResult lib3mf_meshobject_getvolumedata(Lib3MF_MeshObject p */ LIB3MF_DECLSPEC Lib3MFResult lib3mf_meshobject_setvolumedata(Lib3MF_MeshObject pMeshObject, Lib3MF_VolumeData pTheVolumeData); +/** +* Adds a new triangle set. +* +* @param[in] pMeshObject - MeshObject instance. +* @param[in] pIdentifier - the new identifier. MUST be unique within the mesh. MUST NOT be an empty string +* @param[in] pName - the human readable name. MUST NOT be an empty string +* @param[out] pTheTriangleSet - the new Triangle Set Instance. +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_meshobject_addtriangleset(Lib3MF_MeshObject pMeshObject, const char * pIdentifier, const char * pName, Lib3MF_TriangleSet * pTheTriangleSet); + +/** +* Checks if a triangle set exists. +* +* @param[in] pMeshObject - MeshObject instance. +* @param[in] pIdentifier - the identifier to be found. +* @param[out] pTriangleSetExists - flag if the triangles set exists. +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_meshobject_hastriangleset(Lib3MF_MeshObject pMeshObject, const char * pIdentifier, bool * pTriangleSetExists); + +/** +* Finds a new triangle set by identifier. Fails if not existing. +* +* @param[in] pMeshObject - MeshObject instance. +* @param[in] pIdentifier - the identifier to be found. +* @param[out] pTheTriangleSet - the triangle Set Instance. +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_meshobject_findtriangleset(Lib3MF_MeshObject pMeshObject, const char * pIdentifier, Lib3MF_TriangleSet * pTheTriangleSet); + +/** +* Returns number of triangle sets. +* +* @param[in] pMeshObject - MeshObject instance. +* @param[out] pCount - the number of triangle sets of this mesh. +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_meshobject_gettrianglesetcount(Lib3MF_MeshObject pMeshObject, Lib3MF_uint32 * pCount); + +/** +* Returns a specific triangle set by index. +* +* @param[in] pMeshObject - MeshObject instance. +* @param[in] nIndex - the index of the triangle set. +* @param[out] pTheTriangleSet - the triangle Set Instance. +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_meshobject_gettriangleset(Lib3MF_MeshObject pMeshObject, Lib3MF_uint32 nIndex, Lib3MF_TriangleSet * pTheTriangleSet); + /************************************************************************************************************************* Class definition for LevelSet **************************************************************************************************************************/ diff --git a/Autogenerated/Source/lib3mf_interfaces.hpp b/Autogenerated/Source/lib3mf_interfaces.hpp index ac308344..ddaf53e6 100644 --- a/Autogenerated/Source/lib3mf_interfaces.hpp +++ b/Autogenerated/Source/lib3mf_interfaces.hpp @@ -72,6 +72,7 @@ class IFunctionIterator; class ILevelSetIterator; class IMetaData; class IMetaDataGroup; +class ITriangleSet; class IObject; class IMeshObject; class ILevelSet; @@ -1202,6 +1203,108 @@ class IMetaDataGroup : public virtual IBase { typedef IBaseSharedPtr PIMetaDataGroup; +/************************************************************************************************************************* + Class interface for TriangleSet +**************************************************************************************************************************/ + +class ITriangleSet : public virtual IBase { +public: + /** + * ITriangleSet::ClassTypeId - Get Class Type Id + * @return Class type as a 64 bits integer + */ + Lib3MF_uint64 ClassTypeId() override + { + return 0x5950BB3EE8A82090UL; // First 64 bits of SHA1 of a string: "Lib3MF::TriangleSet" + } + + /** + * ITriangleSet::SetName - sets the name of the triangle set + * @param[in] sName - the new name + */ + virtual void SetName(const std::string & sName) = 0; + + /** + * ITriangleSet::GetName - returns the name of the triangle set + * @return returns the name + */ + virtual std::string GetName() = 0; + + /** + * ITriangleSet::SetIdentifier - sets the identifier of the triangle set. + * @param[in] sIdentifier - the new identifier. MUST be unique within the mesh. MUST NOT be an empty string + */ + virtual void SetIdentifier(const std::string & sIdentifier) = 0; + + /** + * ITriangleSet::GetIdentifier - returns the identifier of the triangle set + * @return returns the identifier + */ + virtual std::string GetIdentifier() = 0; + + /** + * ITriangleSet::AddTriangle - adds a triangle to the set. Does nothing if triangle is already in the set. + * @param[in] nTriangleIndex - Triangle index to add. MUST be between 0 and TriangleCount - 1. + */ + virtual void AddTriangle(const Lib3MF_uint32 nTriangleIndex) = 0; + + /** + * ITriangleSet::RemoveTriangle - removes a triangle from the set + * @param[in] nTriangleIndex - Triangle index to remove. MUST be between 0 and TriangleCount - 1. + */ + virtual void RemoveTriangle(const Lib3MF_uint32 nTriangleIndex) = 0; + + /** + * ITriangleSet::Clear - clears all triangles from the list + */ + virtual void Clear() = 0; + + /** + * ITriangleSet::SetTriangleList - Sets all triangles in the list, while clearing old values. Duplicates will be merged. + * @param[in] nTriangleIndicesBufferSize - Number of elements in buffer + * @param[in] pTriangleIndicesBuffer - Triangle indices to add. Every element MUST be between 0 and TriangleCount - 1. + */ + virtual void SetTriangleList(const Lib3MF_uint64 nTriangleIndicesBufferSize, const Lib3MF_uint32 * pTriangleIndicesBuffer) = 0; + + /** + * ITriangleSet::GetTriangleList - Retrieves all the triangles in the TriangleSet + * @param[in] nTriangleIndicesBufferSize - Number of elements in buffer + * @param[out] pTriangleIndicesNeededCount - will be filled with the count of the written structs, or needed buffer size. + * @param[out] pTriangleIndicesBuffer - uint32 buffer of retrieves the indices of the triangles in this TriangleSet + */ + virtual void GetTriangleList(Lib3MF_uint64 nTriangleIndicesBufferSize, Lib3MF_uint64* pTriangleIndicesNeededCount, Lib3MF_uint32 * pTriangleIndicesBuffer) = 0; + + /** + * ITriangleSet::AddTriangleList - Adds multiple triangles in the list. Duplicates will be merged. + * @param[in] nTriangleIndicesBufferSize - Number of elements in buffer + * @param[in] pTriangleIndicesBuffer - Triangle indices to add. Every element MUST be between 0 and TriangleCount - 1. + */ + virtual void AddTriangleList(const Lib3MF_uint64 nTriangleIndicesBufferSize, const Lib3MF_uint32 * pTriangleIndicesBuffer) = 0; + + /** + * ITriangleSet::Merge - Merges another Triangle set. + * @param[in] pOtherTriangleSet - Other triangle set to merge. + * @param[in] bDeleteOther - Flag if other triangle set is getting removed. + */ + virtual void Merge(ITriangleSet* pOtherTriangleSet, const bool bDeleteOther) = 0; + + /** + * ITriangleSet::DeleteSet - Deletes the whole set from the mesh. + */ + virtual void DeleteSet() = 0; + + /** + * ITriangleSet::Duplicate - Duplicates the set in the mesh. + * @param[in] sIdentifier - the new identifier. MUST be unique within the mesh. MUST NOT be an empty string + * @return Copy of the triangle set. + */ + virtual ITriangleSet * Duplicate(const std::string & sIdentifier) = 0; + +}; + +typedef IBaseSharedPtr PITriangleSet; + + /************************************************************************************************************************* Class interface for Object **************************************************************************************************************************/ @@ -1527,6 +1630,41 @@ class IMeshObject : public virtual IObject { */ virtual void SetVolumeData(IVolumeData* pTheVolumeData) = 0; + /** + * IMeshObject::AddTriangleSet - Adds a new triangle set. + * @param[in] sIdentifier - the new identifier. MUST be unique within the mesh. MUST NOT be an empty string + * @param[in] sName - the human readable name. MUST NOT be an empty string + * @return the new Triangle Set Instance. + */ + virtual ITriangleSet * AddTriangleSet(const std::string & sIdentifier, const std::string & sName) = 0; + + /** + * IMeshObject::HasTriangleSet - Checks if a triangle set exists. + * @param[in] sIdentifier - the identifier to be found. + * @return flag if the triangles set exists. + */ + virtual bool HasTriangleSet(const std::string & sIdentifier) = 0; + + /** + * IMeshObject::FindTriangleSet - Finds a new triangle set by identifier. Fails if not existing. + * @param[in] sIdentifier - the identifier to be found. + * @return the triangle Set Instance. + */ + virtual ITriangleSet * FindTriangleSet(const std::string & sIdentifier) = 0; + + /** + * IMeshObject::GetTriangleSetCount - Returns number of triangle sets. + * @return the number of triangle sets of this mesh. + */ + virtual Lib3MF_uint32 GetTriangleSetCount() = 0; + + /** + * IMeshObject::GetTriangleSet - Returns a specific triangle set by index. + * @param[in] nIndex - the index of the triangle set. + * @return the triangle Set Instance. + */ + virtual ITriangleSet * GetTriangleSet(const Lib3MF_uint32 nIndex) = 0; + }; typedef IBaseSharedPtr PIMeshObject; diff --git a/Autogenerated/Source/lib3mf_interfacewrapper.cpp b/Autogenerated/Source/lib3mf_interfacewrapper.cpp index 183e16f8..a9807c35 100644 --- a/Autogenerated/Source/lib3mf_interfacewrapper.cpp +++ b/Autogenerated/Source/lib3mf_interfacewrapper.cpp @@ -2725,6 +2725,495 @@ Lib3MFResult lib3mf_metadatagroup_addmetadata(Lib3MF_MetaDataGroup pMetaDataGrou } +/************************************************************************************************************************* + Class implementation for TriangleSet +**************************************************************************************************************************/ +Lib3MFResult lib3mf_triangleset_setname(Lib3MF_TriangleSet pTriangleSet, const char * pName) +{ + IBase* pIBaseClass = (IBase *)pTriangleSet; + + PLib3MFInterfaceJournalEntry pJournalEntry; + try { + if (m_GlobalJournal.get() != nullptr) { + pJournalEntry = m_GlobalJournal->beginClassMethod(pTriangleSet, "TriangleSet", "SetName"); + pJournalEntry->addStringParameter("Name", pName); + } + if (pName == nullptr) + throw ELib3MFInterfaceException (LIB3MF_ERROR_INVALIDPARAM); + std::string sName(pName); + ITriangleSet* pITriangleSet = dynamic_cast(pIBaseClass); + if (!pITriangleSet) + throw ELib3MFInterfaceException(LIB3MF_ERROR_INVALIDCAST); + + pITriangleSet->SetName(sName); + + 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_triangleset_getname(Lib3MF_TriangleSet pTriangleSet, const Lib3MF_uint32 nNameBufferSize, Lib3MF_uint32* pNameNeededChars, char * pNameBuffer) +{ + IBase* pIBaseClass = (IBase *)pTriangleSet; + + PLib3MFInterfaceJournalEntry pJournalEntry; + try { + if (m_GlobalJournal.get() != nullptr) { + pJournalEntry = m_GlobalJournal->beginClassMethod(pTriangleSet, "TriangleSet", "GetName"); + } + if ( (!pNameBuffer) && !(pNameNeededChars) ) + throw ELib3MFInterfaceException (LIB3MF_ERROR_INVALIDPARAM); + std::string sName(""); + ITriangleSet* pITriangleSet = dynamic_cast(pIBaseClass); + if (!pITriangleSet) + throw ELib3MFInterfaceException(LIB3MF_ERROR_INVALIDCAST); + + bool isCacheCall = (pNameBuffer == nullptr); + if (isCacheCall) { + sName = pITriangleSet->GetName(); + + pITriangleSet->_setCache (new ParameterCache_1 (sName)); + } + else { + auto cache = dynamic_cast*> (pITriangleSet->_getCache ()); + if (cache == nullptr) + throw ELib3MFInterfaceException(LIB3MF_ERROR_INVALIDCAST); + cache->retrieveData (sName); + pITriangleSet->_setCache (nullptr); + } + + if (pNameNeededChars) + *pNameNeededChars = (Lib3MF_uint32) (sName.size()+1); + if (pNameBuffer) { + if (sName.size() >= nNameBufferSize) + throw ELib3MFInterfaceException (LIB3MF_ERROR_BUFFERTOOSMALL); + for (size_t iName = 0; iName < sName.size(); iName++) + pNameBuffer[iName] = sName[iName]; + pNameBuffer[sName.size()] = 0; + } + if (pJournalEntry.get() != nullptr) { + pJournalEntry->addStringResult("Name", sName.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_triangleset_setidentifier(Lib3MF_TriangleSet pTriangleSet, const char * pIdentifier) +{ + IBase* pIBaseClass = (IBase *)pTriangleSet; + + PLib3MFInterfaceJournalEntry pJournalEntry; + try { + if (m_GlobalJournal.get() != nullptr) { + pJournalEntry = m_GlobalJournal->beginClassMethod(pTriangleSet, "TriangleSet", "SetIdentifier"); + pJournalEntry->addStringParameter("Identifier", pIdentifier); + } + if (pIdentifier == nullptr) + throw ELib3MFInterfaceException (LIB3MF_ERROR_INVALIDPARAM); + std::string sIdentifier(pIdentifier); + ITriangleSet* pITriangleSet = dynamic_cast(pIBaseClass); + if (!pITriangleSet) + throw ELib3MFInterfaceException(LIB3MF_ERROR_INVALIDCAST); + + pITriangleSet->SetIdentifier(sIdentifier); + + 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_triangleset_getidentifier(Lib3MF_TriangleSet pTriangleSet, const Lib3MF_uint32 nIdentifierBufferSize, Lib3MF_uint32* pIdentifierNeededChars, char * pIdentifierBuffer) +{ + IBase* pIBaseClass = (IBase *)pTriangleSet; + + PLib3MFInterfaceJournalEntry pJournalEntry; + try { + if (m_GlobalJournal.get() != nullptr) { + pJournalEntry = m_GlobalJournal->beginClassMethod(pTriangleSet, "TriangleSet", "GetIdentifier"); + } + if ( (!pIdentifierBuffer) && !(pIdentifierNeededChars) ) + throw ELib3MFInterfaceException (LIB3MF_ERROR_INVALIDPARAM); + std::string sIdentifier(""); + ITriangleSet* pITriangleSet = dynamic_cast(pIBaseClass); + if (!pITriangleSet) + throw ELib3MFInterfaceException(LIB3MF_ERROR_INVALIDCAST); + + bool isCacheCall = (pIdentifierBuffer == nullptr); + if (isCacheCall) { + sIdentifier = pITriangleSet->GetIdentifier(); + + pITriangleSet->_setCache (new ParameterCache_1 (sIdentifier)); + } + else { + auto cache = dynamic_cast*> (pITriangleSet->_getCache ()); + if (cache == nullptr) + throw ELib3MFInterfaceException(LIB3MF_ERROR_INVALIDCAST); + cache->retrieveData (sIdentifier); + pITriangleSet->_setCache (nullptr); + } + + if (pIdentifierNeededChars) + *pIdentifierNeededChars = (Lib3MF_uint32) (sIdentifier.size()+1); + if (pIdentifierBuffer) { + if (sIdentifier.size() >= nIdentifierBufferSize) + throw ELib3MFInterfaceException (LIB3MF_ERROR_BUFFERTOOSMALL); + for (size_t iIdentifier = 0; iIdentifier < sIdentifier.size(); iIdentifier++) + pIdentifierBuffer[iIdentifier] = sIdentifier[iIdentifier]; + pIdentifierBuffer[sIdentifier.size()] = 0; + } + if (pJournalEntry.get() != nullptr) { + pJournalEntry->addStringResult("Identifier", sIdentifier.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_triangleset_addtriangle(Lib3MF_TriangleSet pTriangleSet, Lib3MF_uint32 nTriangleIndex) +{ + IBase* pIBaseClass = (IBase *)pTriangleSet; + + PLib3MFInterfaceJournalEntry pJournalEntry; + try { + if (m_GlobalJournal.get() != nullptr) { + pJournalEntry = m_GlobalJournal->beginClassMethod(pTriangleSet, "TriangleSet", "AddTriangle"); + pJournalEntry->addUInt32Parameter("TriangleIndex", nTriangleIndex); + } + ITriangleSet* pITriangleSet = dynamic_cast(pIBaseClass); + if (!pITriangleSet) + throw ELib3MFInterfaceException(LIB3MF_ERROR_INVALIDCAST); + + pITriangleSet->AddTriangle(nTriangleIndex); + + 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_triangleset_removetriangle(Lib3MF_TriangleSet pTriangleSet, Lib3MF_uint32 nTriangleIndex) +{ + IBase* pIBaseClass = (IBase *)pTriangleSet; + + PLib3MFInterfaceJournalEntry pJournalEntry; + try { + if (m_GlobalJournal.get() != nullptr) { + pJournalEntry = m_GlobalJournal->beginClassMethod(pTriangleSet, "TriangleSet", "RemoveTriangle"); + pJournalEntry->addUInt32Parameter("TriangleIndex", nTriangleIndex); + } + ITriangleSet* pITriangleSet = dynamic_cast(pIBaseClass); + if (!pITriangleSet) + throw ELib3MFInterfaceException(LIB3MF_ERROR_INVALIDCAST); + + pITriangleSet->RemoveTriangle(nTriangleIndex); + + 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_triangleset_clear(Lib3MF_TriangleSet pTriangleSet) +{ + IBase* pIBaseClass = (IBase *)pTriangleSet; + + PLib3MFInterfaceJournalEntry pJournalEntry; + try { + if (m_GlobalJournal.get() != nullptr) { + pJournalEntry = m_GlobalJournal->beginClassMethod(pTriangleSet, "TriangleSet", "Clear"); + } + ITriangleSet* pITriangleSet = dynamic_cast(pIBaseClass); + if (!pITriangleSet) + throw ELib3MFInterfaceException(LIB3MF_ERROR_INVALIDCAST); + + pITriangleSet->Clear(); + + 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_triangleset_settrianglelist(Lib3MF_TriangleSet pTriangleSet, Lib3MF_uint64 nTriangleIndicesBufferSize, const Lib3MF_uint32 * pTriangleIndicesBuffer) +{ + IBase* pIBaseClass = (IBase *)pTriangleSet; + + PLib3MFInterfaceJournalEntry pJournalEntry; + try { + if (m_GlobalJournal.get() != nullptr) { + pJournalEntry = m_GlobalJournal->beginClassMethod(pTriangleSet, "TriangleSet", "SetTriangleList"); + } + if ( (!pTriangleIndicesBuffer) && (nTriangleIndicesBufferSize>0)) + throw ELib3MFInterfaceException (LIB3MF_ERROR_INVALIDPARAM); + ITriangleSet* pITriangleSet = dynamic_cast(pIBaseClass); + if (!pITriangleSet) + throw ELib3MFInterfaceException(LIB3MF_ERROR_INVALIDCAST); + + pITriangleSet->SetTriangleList(nTriangleIndicesBufferSize, pTriangleIndicesBuffer); + + 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_triangleset_gettrianglelist(Lib3MF_TriangleSet pTriangleSet, const Lib3MF_uint64 nTriangleIndicesBufferSize, Lib3MF_uint64* pTriangleIndicesNeededCount, Lib3MF_uint32 * pTriangleIndicesBuffer) +{ + IBase* pIBaseClass = (IBase *)pTriangleSet; + + PLib3MFInterfaceJournalEntry pJournalEntry; + try { + if (m_GlobalJournal.get() != nullptr) { + pJournalEntry = m_GlobalJournal->beginClassMethod(pTriangleSet, "TriangleSet", "GetTriangleList"); + } + if ((!pTriangleIndicesBuffer) && !(pTriangleIndicesNeededCount)) + throw ELib3MFInterfaceException (LIB3MF_ERROR_INVALIDPARAM); + ITriangleSet* pITriangleSet = dynamic_cast(pIBaseClass); + if (!pITriangleSet) + throw ELib3MFInterfaceException(LIB3MF_ERROR_INVALIDCAST); + + pITriangleSet->GetTriangleList(nTriangleIndicesBufferSize, pTriangleIndicesNeededCount, pTriangleIndicesBuffer); + + 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_triangleset_addtrianglelist(Lib3MF_TriangleSet pTriangleSet, Lib3MF_uint64 nTriangleIndicesBufferSize, const Lib3MF_uint32 * pTriangleIndicesBuffer) +{ + IBase* pIBaseClass = (IBase *)pTriangleSet; + + PLib3MFInterfaceJournalEntry pJournalEntry; + try { + if (m_GlobalJournal.get() != nullptr) { + pJournalEntry = m_GlobalJournal->beginClassMethod(pTriangleSet, "TriangleSet", "AddTriangleList"); + } + if ( (!pTriangleIndicesBuffer) && (nTriangleIndicesBufferSize>0)) + throw ELib3MFInterfaceException (LIB3MF_ERROR_INVALIDPARAM); + ITriangleSet* pITriangleSet = dynamic_cast(pIBaseClass); + if (!pITriangleSet) + throw ELib3MFInterfaceException(LIB3MF_ERROR_INVALIDCAST); + + pITriangleSet->AddTriangleList(nTriangleIndicesBufferSize, pTriangleIndicesBuffer); + + 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_triangleset_merge(Lib3MF_TriangleSet pTriangleSet, Lib3MF_TriangleSet pOtherTriangleSet, bool bDeleteOther) +{ + IBase* pIBaseClass = (IBase *)pTriangleSet; + + PLib3MFInterfaceJournalEntry pJournalEntry; + try { + if (m_GlobalJournal.get() != nullptr) { + pJournalEntry = m_GlobalJournal->beginClassMethod(pTriangleSet, "TriangleSet", "Merge"); + pJournalEntry->addHandleParameter("OtherTriangleSet", pOtherTriangleSet); + pJournalEntry->addBooleanParameter("DeleteOther", bDeleteOther); + } + IBase* pIBaseClassOtherTriangleSet = (IBase *)pOtherTriangleSet; + ITriangleSet* pIOtherTriangleSet = dynamic_cast(pIBaseClassOtherTriangleSet); + if (!pIOtherTriangleSet) + throw ELib3MFInterfaceException (LIB3MF_ERROR_INVALIDCAST); + + ITriangleSet* pITriangleSet = dynamic_cast(pIBaseClass); + if (!pITriangleSet) + throw ELib3MFInterfaceException(LIB3MF_ERROR_INVALIDCAST); + + pITriangleSet->Merge(pIOtherTriangleSet, bDeleteOther); + + 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_triangleset_deleteset(Lib3MF_TriangleSet pTriangleSet) +{ + IBase* pIBaseClass = (IBase *)pTriangleSet; + + PLib3MFInterfaceJournalEntry pJournalEntry; + try { + if (m_GlobalJournal.get() != nullptr) { + pJournalEntry = m_GlobalJournal->beginClassMethod(pTriangleSet, "TriangleSet", "DeleteSet"); + } + ITriangleSet* pITriangleSet = dynamic_cast(pIBaseClass); + if (!pITriangleSet) + throw ELib3MFInterfaceException(LIB3MF_ERROR_INVALIDCAST); + + pITriangleSet->DeleteSet(); + + 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_triangleset_duplicate(Lib3MF_TriangleSet pTriangleSet, const char * pIdentifier, Lib3MF_TriangleSet * pNewSet) +{ + IBase* pIBaseClass = (IBase *)pTriangleSet; + + PLib3MFInterfaceJournalEntry pJournalEntry; + try { + if (m_GlobalJournal.get() != nullptr) { + pJournalEntry = m_GlobalJournal->beginClassMethod(pTriangleSet, "TriangleSet", "Duplicate"); + pJournalEntry->addStringParameter("Identifier", pIdentifier); + } + if (pIdentifier == nullptr) + throw ELib3MFInterfaceException (LIB3MF_ERROR_INVALIDPARAM); + if (pNewSet == nullptr) + throw ELib3MFInterfaceException (LIB3MF_ERROR_INVALIDPARAM); + std::string sIdentifier(pIdentifier); + IBase* pBaseNewSet(nullptr); + ITriangleSet* pITriangleSet = dynamic_cast(pIBaseClass); + if (!pITriangleSet) + throw ELib3MFInterfaceException(LIB3MF_ERROR_INVALIDCAST); + + pBaseNewSet = pITriangleSet->Duplicate(sIdentifier); + + *pNewSet = (IBase*)(pBaseNewSet); + if (pJournalEntry.get() != nullptr) { + pJournalEntry->addHandleResult("NewSet", *pNewSet); + 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 Object **************************************************************************************************************************/ @@ -4336,6 +4825,199 @@ Lib3MFResult lib3mf_meshobject_setvolumedata(Lib3MF_MeshObject pMeshObject, Lib3 } } +Lib3MFResult lib3mf_meshobject_addtriangleset(Lib3MF_MeshObject pMeshObject, const char * pIdentifier, const char * pName, Lib3MF_TriangleSet * pTheTriangleSet) +{ + IBase* pIBaseClass = (IBase *)pMeshObject; + + PLib3MFInterfaceJournalEntry pJournalEntry; + try { + if (m_GlobalJournal.get() != nullptr) { + pJournalEntry = m_GlobalJournal->beginClassMethod(pMeshObject, "MeshObject", "AddTriangleSet"); + pJournalEntry->addStringParameter("Identifier", pIdentifier); + pJournalEntry->addStringParameter("Name", pName); + } + if (pIdentifier == nullptr) + throw ELib3MFInterfaceException (LIB3MF_ERROR_INVALIDPARAM); + if (pName == nullptr) + throw ELib3MFInterfaceException (LIB3MF_ERROR_INVALIDPARAM); + if (pTheTriangleSet == nullptr) + throw ELib3MFInterfaceException (LIB3MF_ERROR_INVALIDPARAM); + std::string sIdentifier(pIdentifier); + std::string sName(pName); + IBase* pBaseTheTriangleSet(nullptr); + IMeshObject* pIMeshObject = dynamic_cast(pIBaseClass); + if (!pIMeshObject) + throw ELib3MFInterfaceException(LIB3MF_ERROR_INVALIDCAST); + + pBaseTheTriangleSet = pIMeshObject->AddTriangleSet(sIdentifier, sName); + + *pTheTriangleSet = (IBase*)(pBaseTheTriangleSet); + if (pJournalEntry.get() != nullptr) { + pJournalEntry->addHandleResult("TheTriangleSet", *pTheTriangleSet); + 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_meshobject_hastriangleset(Lib3MF_MeshObject pMeshObject, const char * pIdentifier, bool * pTriangleSetExists) +{ + IBase* pIBaseClass = (IBase *)pMeshObject; + + PLib3MFInterfaceJournalEntry pJournalEntry; + try { + if (m_GlobalJournal.get() != nullptr) { + pJournalEntry = m_GlobalJournal->beginClassMethod(pMeshObject, "MeshObject", "HasTriangleSet"); + pJournalEntry->addStringParameter("Identifier", pIdentifier); + } + if (pIdentifier == nullptr) + throw ELib3MFInterfaceException (LIB3MF_ERROR_INVALIDPARAM); + if (pTriangleSetExists == nullptr) + throw ELib3MFInterfaceException (LIB3MF_ERROR_INVALIDPARAM); + std::string sIdentifier(pIdentifier); + IMeshObject* pIMeshObject = dynamic_cast(pIBaseClass); + if (!pIMeshObject) + throw ELib3MFInterfaceException(LIB3MF_ERROR_INVALIDCAST); + + *pTriangleSetExists = pIMeshObject->HasTriangleSet(sIdentifier); + + if (pJournalEntry.get() != nullptr) { + pJournalEntry->addBooleanResult("TriangleSetExists", *pTriangleSetExists); + 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_meshobject_findtriangleset(Lib3MF_MeshObject pMeshObject, const char * pIdentifier, Lib3MF_TriangleSet * pTheTriangleSet) +{ + IBase* pIBaseClass = (IBase *)pMeshObject; + + PLib3MFInterfaceJournalEntry pJournalEntry; + try { + if (m_GlobalJournal.get() != nullptr) { + pJournalEntry = m_GlobalJournal->beginClassMethod(pMeshObject, "MeshObject", "FindTriangleSet"); + pJournalEntry->addStringParameter("Identifier", pIdentifier); + } + if (pIdentifier == nullptr) + throw ELib3MFInterfaceException (LIB3MF_ERROR_INVALIDPARAM); + if (pTheTriangleSet == nullptr) + throw ELib3MFInterfaceException (LIB3MF_ERROR_INVALIDPARAM); + std::string sIdentifier(pIdentifier); + IBase* pBaseTheTriangleSet(nullptr); + IMeshObject* pIMeshObject = dynamic_cast(pIBaseClass); + if (!pIMeshObject) + throw ELib3MFInterfaceException(LIB3MF_ERROR_INVALIDCAST); + + pBaseTheTriangleSet = pIMeshObject->FindTriangleSet(sIdentifier); + + *pTheTriangleSet = (IBase*)(pBaseTheTriangleSet); + if (pJournalEntry.get() != nullptr) { + pJournalEntry->addHandleResult("TheTriangleSet", *pTheTriangleSet); + 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_meshobject_gettrianglesetcount(Lib3MF_MeshObject pMeshObject, Lib3MF_uint32 * pCount) +{ + IBase* pIBaseClass = (IBase *)pMeshObject; + + PLib3MFInterfaceJournalEntry pJournalEntry; + try { + if (m_GlobalJournal.get() != nullptr) { + pJournalEntry = m_GlobalJournal->beginClassMethod(pMeshObject, "MeshObject", "GetTriangleSetCount"); + } + if (pCount == nullptr) + throw ELib3MFInterfaceException (LIB3MF_ERROR_INVALIDPARAM); + IMeshObject* pIMeshObject = dynamic_cast(pIBaseClass); + if (!pIMeshObject) + throw ELib3MFInterfaceException(LIB3MF_ERROR_INVALIDCAST); + + *pCount = pIMeshObject->GetTriangleSetCount(); + + if (pJournalEntry.get() != nullptr) { + pJournalEntry->addUInt32Result("Count", *pCount); + 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_meshobject_gettriangleset(Lib3MF_MeshObject pMeshObject, Lib3MF_uint32 nIndex, Lib3MF_TriangleSet * pTheTriangleSet) +{ + IBase* pIBaseClass = (IBase *)pMeshObject; + + PLib3MFInterfaceJournalEntry pJournalEntry; + try { + if (m_GlobalJournal.get() != nullptr) { + pJournalEntry = m_GlobalJournal->beginClassMethod(pMeshObject, "MeshObject", "GetTriangleSet"); + pJournalEntry->addUInt32Parameter("Index", nIndex); + } + if (pTheTriangleSet == nullptr) + throw ELib3MFInterfaceException (LIB3MF_ERROR_INVALIDPARAM); + IBase* pBaseTheTriangleSet(nullptr); + IMeshObject* pIMeshObject = dynamic_cast(pIBaseClass); + if (!pIMeshObject) + throw ELib3MFInterfaceException(LIB3MF_ERROR_INVALIDCAST); + + pBaseTheTriangleSet = pIMeshObject->GetTriangleSet(nIndex); + + *pTheTriangleSet = (IBase*)(pBaseTheTriangleSet); + if (pJournalEntry.get() != nullptr) { + pJournalEntry->addHandleResult("TheTriangleSet", *pTheTriangleSet); + 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 LevelSet @@ -22795,6 +23477,32 @@ Lib3MFResult Lib3MF::Impl::Lib3MF_GetProcAddress (const char * pProcName, void * *ppProcAddress = (void*) &lib3mf_metadatagroup_removemetadata; if (sProcName == "lib3mf_metadatagroup_addmetadata") *ppProcAddress = (void*) &lib3mf_metadatagroup_addmetadata; + if (sProcName == "lib3mf_triangleset_setname") + *ppProcAddress = (void*) &lib3mf_triangleset_setname; + if (sProcName == "lib3mf_triangleset_getname") + *ppProcAddress = (void*) &lib3mf_triangleset_getname; + if (sProcName == "lib3mf_triangleset_setidentifier") + *ppProcAddress = (void*) &lib3mf_triangleset_setidentifier; + if (sProcName == "lib3mf_triangleset_getidentifier") + *ppProcAddress = (void*) &lib3mf_triangleset_getidentifier; + if (sProcName == "lib3mf_triangleset_addtriangle") + *ppProcAddress = (void*) &lib3mf_triangleset_addtriangle; + if (sProcName == "lib3mf_triangleset_removetriangle") + *ppProcAddress = (void*) &lib3mf_triangleset_removetriangle; + if (sProcName == "lib3mf_triangleset_clear") + *ppProcAddress = (void*) &lib3mf_triangleset_clear; + if (sProcName == "lib3mf_triangleset_settrianglelist") + *ppProcAddress = (void*) &lib3mf_triangleset_settrianglelist; + if (sProcName == "lib3mf_triangleset_gettrianglelist") + *ppProcAddress = (void*) &lib3mf_triangleset_gettrianglelist; + if (sProcName == "lib3mf_triangleset_addtrianglelist") + *ppProcAddress = (void*) &lib3mf_triangleset_addtrianglelist; + if (sProcName == "lib3mf_triangleset_merge") + *ppProcAddress = (void*) &lib3mf_triangleset_merge; + if (sProcName == "lib3mf_triangleset_deleteset") + *ppProcAddress = (void*) &lib3mf_triangleset_deleteset; + if (sProcName == "lib3mf_triangleset_duplicate") + *ppProcAddress = (void*) &lib3mf_triangleset_duplicate; if (sProcName == "lib3mf_object_gettype") *ppProcAddress = (void*) &lib3mf_object_gettype; if (sProcName == "lib3mf_object_settype") @@ -22885,6 +23593,16 @@ Lib3MFResult Lib3MF::Impl::Lib3MF_GetProcAddress (const char * pProcName, void * *ppProcAddress = (void*) &lib3mf_meshobject_getvolumedata; if (sProcName == "lib3mf_meshobject_setvolumedata") *ppProcAddress = (void*) &lib3mf_meshobject_setvolumedata; + if (sProcName == "lib3mf_meshobject_addtriangleset") + *ppProcAddress = (void*) &lib3mf_meshobject_addtriangleset; + if (sProcName == "lib3mf_meshobject_hastriangleset") + *ppProcAddress = (void*) &lib3mf_meshobject_hastriangleset; + if (sProcName == "lib3mf_meshobject_findtriangleset") + *ppProcAddress = (void*) &lib3mf_meshobject_findtriangleset; + if (sProcName == "lib3mf_meshobject_gettrianglesetcount") + *ppProcAddress = (void*) &lib3mf_meshobject_gettrianglesetcount; + if (sProcName == "lib3mf_meshobject_gettriangleset") + *ppProcAddress = (void*) &lib3mf_meshobject_gettriangleset; if (sProcName == "lib3mf_levelset_getfunction") *ppProcAddress = (void*) &lib3mf_levelset_getfunction; if (sProcName == "lib3mf_levelset_setfunction") diff --git a/Autogenerated/Source/lib3mf_types.hpp b/Autogenerated/Source/lib3mf_types.hpp index 4ba95915..0d520b82 100644 --- a/Autogenerated/Source/lib3mf_types.hpp +++ b/Autogenerated/Source/lib3mf_types.hpp @@ -130,6 +130,8 @@ typedef void * Lib3MF_pvoid; #define LIB3MF_ERROR_ELEMENTCOUNTEXCEEDSLIMIT 141 /** An element buffer exceeds its spec limit */ #define LIB3MF_ERROR_INVALIDRESOURCE 142 /** A resource is invalid */ #define LIB3MF_ERROR_INVALIDLEVELSET 143 /** A level set is invalid */ +#define LIB3MF_ERROR_COULDNOTFINDTRIANGLESET 144 /** Could not find triangle set */ +#define LIB3MF_ERROR_INVALIDTRIANGLESETINDEX 145 /** Invalid triangle set index */ #define LIB3MF_ERROR_BEAMLATTICE_INVALID_OBJECTTYPE 2000 /** This object type is not valid for beamlattices */ #define LIB3MF_ERROR_INVALIDKEYSTORE 3000 /** The keystore object is invalid */ #define LIB3MF_ERROR_INVALIDKEYSTORECONSUMER 3001 /** The consumer keystore object is invalid */ @@ -186,6 +188,8 @@ inline const char * LIB3MF_GETERRORSTRING (Lib3MFResult nErrorCode) { case LIB3MF_ERROR_ELEMENTCOUNTEXCEEDSLIMIT: return "An element buffer exceeds its spec limit"; case LIB3MF_ERROR_INVALIDRESOURCE: return "A resource is invalid"; case LIB3MF_ERROR_INVALIDLEVELSET: return "A level set is invalid"; + case LIB3MF_ERROR_COULDNOTFINDTRIANGLESET: return "Could not find triangle set"; + case LIB3MF_ERROR_INVALIDTRIANGLESETINDEX: return "Invalid triangle set index"; case LIB3MF_ERROR_BEAMLATTICE_INVALID_OBJECTTYPE: return "This object type is not valid for beamlattices"; case LIB3MF_ERROR_INVALIDKEYSTORE: return "The keystore object is invalid"; case LIB3MF_ERROR_INVALIDKEYSTORECONSUMER: return "The consumer keystore object is invalid"; @@ -226,6 +230,7 @@ typedef Lib3MFHandle Lib3MF_FunctionIterator; typedef Lib3MFHandle Lib3MF_LevelSetIterator; typedef Lib3MFHandle Lib3MF_MetaData; typedef Lib3MFHandle Lib3MF_MetaDataGroup; +typedef Lib3MFHandle Lib3MF_TriangleSet; typedef Lib3MFHandle Lib3MF_Object; typedef Lib3MFHandle Lib3MF_MeshObject; typedef Lib3MFHandle Lib3MF_LevelSet; diff --git a/Source/Model/Reader/v100/NMR_ModelReaderNode100_Mesh.cpp b/Source/Model/Reader/v100/NMR_ModelReaderNode100_Mesh.cpp index 14294723..13e891d3 100644 --- a/Source/Model/Reader/v100/NMR_ModelReaderNode100_Mesh.cpp +++ b/Source/Model/Reader/v100/NMR_ModelReaderNode100_Mesh.cpp @@ -198,7 +198,7 @@ namespace NMR { if (strcmp(pNameSpace, XML_3MF_NAMESPACE_TRIANGLESETS) == 0) { if (strcmp(pChildName, XML_3MF_ELEMENT_TRIANGLESETS) == 0) { - PModelReaderNode100_TriangleSets pXMLNode = std::make_shared(m_pModel, m_pMesh, m_pWarnings); + PModelReaderNode100_TriangleSets pXMLNode = std::make_shared(m_pModel, m_pMesh->getMesh(), m_pWarnings); pXMLNode->parseXML(pXMLReader); m_pTriangleSets = pXMLNode->getTriangleSets (); diff --git a/Source/Model/Reader/v100/NMR_ModelReaderNode100_Object.cpp b/Source/Model/Reader/v100/NMR_ModelReaderNode100_Object.cpp index 2562abc2..2fca11df 100644 --- a/Source/Model/Reader/v100/NMR_ModelReaderNode100_Object.cpp +++ b/Source/Model/Reader/v100/NMR_ModelReaderNode100_Object.cpp @@ -253,7 +253,7 @@ namespace NMR { // store triangle sets in memory model auto triangleSets = pXMLNode->getTriangleSets(); for (auto triangleSet : triangleSets) - pModelMeshObject->addTriangleSet(triangleSet); + meshObject->addTriangleSet(triangleSet); // Add Object to Parent m_pModel->addResource(m_pObject);