diff --git a/Autogenerated/Bindings/C/lib3mf.h b/Autogenerated/Bindings/C/lib3mf.h index d6ba8b780..a05945db1 100644 --- a/Autogenerated/Bindings/C/lib3mf.h +++ b/Autogenerated/Bindings/C/lib3mf.h @@ -601,6 +601,19 @@ LIB3MF_DECLSPEC Lib3MFResult lib3mf_image3diterator_getcurrentimage3d(Lib3MF_Ima */ LIB3MF_DECLSPEC Lib3MFResult lib3mf_functioniterator_getcurrentfunction(Lib3MF_FunctionIterator pFunctionIterator, Lib3MF_Function * pResource); +/************************************************************************************************************************* + Class definition for BoundaryShapeIterator +**************************************************************************************************************************/ + +/** +* Returns the BoundaryShape the iterator points at. +* +* @param[in] pBoundaryShapeIterator - BoundaryShapeIterator instance. +* @param[out] pResource - returns the MeshObject instance. +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_boundaryshapeiterator_getcurrentboundaryshape(Lib3MF_BoundaryShapeIterator pBoundaryShapeIterator, Lib3MF_BoundaryShape * pResource); + /************************************************************************************************************************* Class definition for MetaData **************************************************************************************************************************/ @@ -6199,6 +6212,15 @@ LIB3MF_DECLSPEC Lib3MFResult lib3mf_model_addvolumedata(Lib3MF_Model pModel, Lib */ LIB3MF_DECLSPEC Lib3MFResult lib3mf_model_addboundaryshape(Lib3MF_Model pModel, Lib3MF_BoundaryShape * pBoundaryShapeInstance); +/** +* creates a resource iterator instance with all boundary shape resources. +* +* @param[in] pModel - Model instance. +* @param[out] pResourceIterator - returns the iterator instance. +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_model_getboundaryshapes(Lib3MF_Model pModel, Lib3MF_BoundaryShapeIterator * pResourceIterator); + /************************************************************************************************************************* Global functions **************************************************************************************************************************/ diff --git a/Autogenerated/Bindings/C/lib3mf_types.h b/Autogenerated/Bindings/C/lib3mf_types.h index 4477cae87..924d2a66f 100644 --- a/Autogenerated/Bindings/C/lib3mf_types.h +++ b/Autogenerated/Bindings/C/lib3mf_types.h @@ -222,6 +222,7 @@ typedef Lib3MFHandle Lib3MF_CompositeMaterialsIterator; typedef Lib3MFHandle Lib3MF_MultiPropertyGroupIterator; typedef Lib3MFHandle Lib3MF_Image3DIterator; typedef Lib3MFHandle Lib3MF_FunctionIterator; +typedef Lib3MFHandle Lib3MF_BoundaryShapeIterator; typedef Lib3MFHandle Lib3MF_MetaData; typedef Lib3MFHandle Lib3MF_MetaDataGroup; typedef Lib3MFHandle Lib3MF_Object; diff --git a/Autogenerated/Bindings/CDynamic/lib3mf_dynamic.cc b/Autogenerated/Bindings/CDynamic/lib3mf_dynamic.cc index 7ff9853e5..ee1146da6 100644 --- a/Autogenerated/Bindings/CDynamic/lib3mf_dynamic.cc +++ b/Autogenerated/Bindings/CDynamic/lib3mf_dynamic.cc @@ -98,6 +98,7 @@ Lib3MFResult InitLib3MFWrapperTable(sLib3MFDynamicWrapperTable * pWrapperTable) pWrapperTable->m_MultiPropertyGroupIterator_GetCurrentMultiPropertyGroup = NULL; pWrapperTable->m_Image3DIterator_GetCurrentImage3D = NULL; pWrapperTable->m_FunctionIterator_GetCurrentFunction = NULL; + pWrapperTable->m_BoundaryShapeIterator_GetCurrentBoundaryShape = NULL; pWrapperTable->m_MetaData_GetNameSpace = NULL; pWrapperTable->m_MetaData_SetNameSpace = NULL; pWrapperTable->m_MetaData_GetName = NULL; @@ -626,6 +627,7 @@ Lib3MFResult InitLib3MFWrapperTable(sLib3MFDynamicWrapperTable * pWrapperTable) pWrapperTable->m_Model_AddFunctionFromImage3D = NULL; pWrapperTable->m_Model_AddVolumeData = NULL; pWrapperTable->m_Model_AddBoundaryShape = NULL; + pWrapperTable->m_Model_GetBoundaryShapes = NULL; pWrapperTable->m_GetLibraryVersion = NULL; pWrapperTable->m_GetPrereleaseInformation = NULL; pWrapperTable->m_GetBuildInformation = NULL; @@ -1149,6 +1151,15 @@ Lib3MFResult LoadLib3MFWrapperTable(sLib3MFDynamicWrapperTable * pWrapperTable, if (pWrapperTable->m_FunctionIterator_GetCurrentFunction == NULL) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + #ifdef _WIN32 + pWrapperTable->m_BoundaryShapeIterator_GetCurrentBoundaryShape = (PLib3MFBoundaryShapeIterator_GetCurrentBoundaryShapePtr) GetProcAddress(hLibrary, "lib3mf_boundaryshapeiterator_getcurrentboundaryshape"); + #else // _WIN32 + pWrapperTable->m_BoundaryShapeIterator_GetCurrentBoundaryShape = (PLib3MFBoundaryShapeIterator_GetCurrentBoundaryShapePtr) dlsym(hLibrary, "lib3mf_boundaryshapeiterator_getcurrentboundaryshape"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_BoundaryShapeIterator_GetCurrentBoundaryShape == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + #ifdef _WIN32 pWrapperTable->m_MetaData_GetNameSpace = (PLib3MFMetaData_GetNameSpacePtr) GetProcAddress(hLibrary, "lib3mf_metadata_getnamespace"); #else // _WIN32 @@ -5901,6 +5912,15 @@ Lib3MFResult LoadLib3MFWrapperTable(sLib3MFDynamicWrapperTable * pWrapperTable, if (pWrapperTable->m_Model_AddBoundaryShape == NULL) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + #ifdef _WIN32 + pWrapperTable->m_Model_GetBoundaryShapes = (PLib3MFModel_GetBoundaryShapesPtr) GetProcAddress(hLibrary, "lib3mf_model_getboundaryshapes"); + #else // _WIN32 + pWrapperTable->m_Model_GetBoundaryShapes = (PLib3MFModel_GetBoundaryShapesPtr) dlsym(hLibrary, "lib3mf_model_getboundaryshapes"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_Model_GetBoundaryShapes == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + #ifdef _WIN32 pWrapperTable->m_GetLibraryVersion = (PLib3MFGetLibraryVersionPtr) GetProcAddress(hLibrary, "lib3mf_getlibraryversion"); #else // _WIN32 diff --git a/Autogenerated/Bindings/CDynamic/lib3mf_dynamic.h b/Autogenerated/Bindings/CDynamic/lib3mf_dynamic.h index 098f6dda2..797106a2a 100644 --- a/Autogenerated/Bindings/CDynamic/lib3mf_dynamic.h +++ b/Autogenerated/Bindings/CDynamic/lib3mf_dynamic.h @@ -588,6 +588,19 @@ typedef Lib3MFResult (*PLib3MFImage3DIterator_GetCurrentImage3DPtr) (Lib3MF_Imag */ typedef Lib3MFResult (*PLib3MFFunctionIterator_GetCurrentFunctionPtr) (Lib3MF_FunctionIterator pFunctionIterator, Lib3MF_Function * pResource); +/************************************************************************************************************************* + Class definition for BoundaryShapeIterator +**************************************************************************************************************************/ + +/** +* Returns the BoundaryShape the iterator points at. +* +* @param[in] pBoundaryShapeIterator - BoundaryShapeIterator instance. +* @param[out] pResource - returns the MeshObject instance. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFBoundaryShapeIterator_GetCurrentBoundaryShapePtr) (Lib3MF_BoundaryShapeIterator pBoundaryShapeIterator, Lib3MF_BoundaryShape * pResource); + /************************************************************************************************************************* Class definition for MetaData **************************************************************************************************************************/ @@ -6186,6 +6199,15 @@ typedef Lib3MFResult (*PLib3MFModel_AddVolumeDataPtr) (Lib3MF_Model pModel, Lib3 */ typedef Lib3MFResult (*PLib3MFModel_AddBoundaryShapePtr) (Lib3MF_Model pModel, Lib3MF_BoundaryShape * pBoundaryShapeInstance); +/** +* creates a resource iterator instance with all boundary shape resources. +* +* @param[in] pModel - Model instance. +* @param[out] pResourceIterator - returns the iterator instance. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFModel_GetBoundaryShapesPtr) (Lib3MF_Model pModel, Lib3MF_BoundaryShapeIterator * pResourceIterator); + /************************************************************************************************************************* Global functions **************************************************************************************************************************/ @@ -6440,6 +6462,7 @@ typedef struct { PLib3MFMultiPropertyGroupIterator_GetCurrentMultiPropertyGroupPtr m_MultiPropertyGroupIterator_GetCurrentMultiPropertyGroup; PLib3MFImage3DIterator_GetCurrentImage3DPtr m_Image3DIterator_GetCurrentImage3D; PLib3MFFunctionIterator_GetCurrentFunctionPtr m_FunctionIterator_GetCurrentFunction; + PLib3MFBoundaryShapeIterator_GetCurrentBoundaryShapePtr m_BoundaryShapeIterator_GetCurrentBoundaryShape; PLib3MFMetaData_GetNameSpacePtr m_MetaData_GetNameSpace; PLib3MFMetaData_SetNameSpacePtr m_MetaData_SetNameSpace; PLib3MFMetaData_GetNamePtr m_MetaData_GetName; @@ -6968,6 +6991,7 @@ typedef struct { PLib3MFModel_AddFunctionFromImage3DPtr m_Model_AddFunctionFromImage3D; PLib3MFModel_AddVolumeDataPtr m_Model_AddVolumeData; PLib3MFModel_AddBoundaryShapePtr m_Model_AddBoundaryShape; + PLib3MFModel_GetBoundaryShapesPtr m_Model_GetBoundaryShapes; PLib3MFGetLibraryVersionPtr m_GetLibraryVersion; PLib3MFGetPrereleaseInformationPtr m_GetPrereleaseInformation; PLib3MFGetBuildInformationPtr m_GetBuildInformation; diff --git a/Autogenerated/Bindings/CDynamic/lib3mf_types.h b/Autogenerated/Bindings/CDynamic/lib3mf_types.h index 4477cae87..924d2a66f 100644 --- a/Autogenerated/Bindings/CDynamic/lib3mf_types.h +++ b/Autogenerated/Bindings/CDynamic/lib3mf_types.h @@ -222,6 +222,7 @@ typedef Lib3MFHandle Lib3MF_CompositeMaterialsIterator; typedef Lib3MFHandle Lib3MF_MultiPropertyGroupIterator; typedef Lib3MFHandle Lib3MF_Image3DIterator; typedef Lib3MFHandle Lib3MF_FunctionIterator; +typedef Lib3MFHandle Lib3MF_BoundaryShapeIterator; typedef Lib3MFHandle Lib3MF_MetaData; typedef Lib3MFHandle Lib3MF_MetaDataGroup; typedef Lib3MFHandle Lib3MF_Object; diff --git a/Autogenerated/Bindings/CSharp/Lib3MF.cs b/Autogenerated/Bindings/CSharp/Lib3MF.cs index 9f51a5e6f..6b32cb95b 100644 --- a/Autogenerated/Bindings/CSharp/Lib3MF.cs +++ b/Autogenerated/Bindings/CSharp/Lib3MF.cs @@ -584,6 +584,9 @@ public class Lib3MFWrapper [DllImport("lib3mf.dll", EntryPoint = "lib3mf_functioniterator_getcurrentfunction", CallingConvention=CallingConvention.Cdecl)] public unsafe extern static Int32 FunctionIterator_GetCurrentFunction (IntPtr Handle, out IntPtr AResource); + [DllImport("lib3mf.dll", EntryPoint = "lib3mf_boundaryshapeiterator_getcurrentboundaryshape", CallingConvention=CallingConvention.Cdecl)] + public unsafe extern static Int32 BoundaryShapeIterator_GetCurrentBoundaryShape (IntPtr Handle, out IntPtr AResource); + [DllImport("lib3mf.dll", EntryPoint = "lib3mf_metadata_getnamespace", CallingConvention=CallingConvention.Cdecl)] public unsafe extern static Int32 MetaData_GetNameSpace (IntPtr Handle, UInt32 sizeNameSpace, out UInt32 neededNameSpace, IntPtr dataNameSpace); @@ -2168,6 +2171,9 @@ public class Lib3MFWrapper [DllImport("lib3mf.dll", EntryPoint = "lib3mf_model_addboundaryshape", CallingConvention=CallingConvention.Cdecl)] public unsafe extern static Int32 Model_AddBoundaryShape (IntPtr Handle, out IntPtr ABoundaryShapeInstance); + [DllImport("lib3mf.dll", EntryPoint = "lib3mf_model_getboundaryshapes", CallingConvention=CallingConvention.Cdecl)] + public unsafe extern static Int32 Model_GetBoundaryShapes (IntPtr Handle, out IntPtr AResourceIterator); + [DllImport("lib3mf.dll", EntryPoint = "lib3mf_getlibraryversion", CharSet = CharSet.Ansi, CallingConvention=CallingConvention.Cdecl)] public extern static Int32 GetLibraryVersion (out UInt32 AMajor, out UInt32 AMinor, out UInt32 AMicro); @@ -2598,6 +2604,7 @@ public static T PolymorphicFactory(IntPtr Handle) where T : class case 0xC2BDF5D8CBBDB1F0: Object = new CMultiPropertyGroupIterator(Handle) as T; break; // First 64 bits of SHA1 of a string: "Lib3MF::MultiPropertyGroupIterator" case 0xC4B8EC00A82BF336: Object = new CImage3DIterator(Handle) as T; break; // First 64 bits of SHA1 of a string: "Lib3MF::Image3DIterator" case 0x40E9035363ACE65E: Object = new CFunctionIterator(Handle) as T; break; // First 64 bits of SHA1 of a string: "Lib3MF::FunctionIterator" + case 0x9FBC898CF30CDEF3: Object = new CBoundaryShapeIterator(Handle) as T; break; // First 64 bits of SHA1 of a string: "Lib3MF::BoundaryShapeIterator" 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 0x2DA2136F577A779C: Object = new CObject(Handle) as T; break; // First 64 bits of SHA1 of a string: "Lib3MF::Object" @@ -3282,6 +3289,22 @@ public CFunction GetCurrentFunction () } + public class CBoundaryShapeIterator : CResourceIterator + { + public CBoundaryShapeIterator (IntPtr NewHandle) : base (NewHandle) + { + } + + public CBoundaryShape GetCurrentBoundaryShape () + { + IntPtr newResource = IntPtr.Zero; + + CheckError(Internal.Lib3MFWrapper.BoundaryShapeIterator_GetCurrentBoundaryShape (Handle, out newResource)); + return Internal.Lib3MFWrapper.PolymorphicFactory(newResource); + } + + } + public class CMetaData : CBase { public CMetaData (IntPtr NewHandle) : base (NewHandle) @@ -8844,6 +8867,14 @@ public CBoundaryShape AddBoundaryShape () return Internal.Lib3MFWrapper.PolymorphicFactory(newBoundaryShapeInstance); } + public CBoundaryShapeIterator GetBoundaryShapes () + { + IntPtr newResourceIterator = IntPtr.Zero; + + CheckError(Internal.Lib3MFWrapper.Model_GetBoundaryShapes (Handle, out newResourceIterator)); + return Internal.Lib3MFWrapper.PolymorphicFactory(newResourceIterator); + } + } class Wrapper diff --git a/Autogenerated/Bindings/Cpp/lib3mf_abi.hpp b/Autogenerated/Bindings/Cpp/lib3mf_abi.hpp index 25d59d58f..d0e6cb422 100644 --- a/Autogenerated/Bindings/Cpp/lib3mf_abi.hpp +++ b/Autogenerated/Bindings/Cpp/lib3mf_abi.hpp @@ -601,6 +601,19 @@ LIB3MF_DECLSPEC Lib3MFResult lib3mf_image3diterator_getcurrentimage3d(Lib3MF_Ima */ LIB3MF_DECLSPEC Lib3MFResult lib3mf_functioniterator_getcurrentfunction(Lib3MF_FunctionIterator pFunctionIterator, Lib3MF_Function * pResource); +/************************************************************************************************************************* + Class definition for BoundaryShapeIterator +**************************************************************************************************************************/ + +/** +* Returns the BoundaryShape the iterator points at. +* +* @param[in] pBoundaryShapeIterator - BoundaryShapeIterator instance. +* @param[out] pResource - returns the MeshObject instance. +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_boundaryshapeiterator_getcurrentboundaryshape(Lib3MF_BoundaryShapeIterator pBoundaryShapeIterator, Lib3MF_BoundaryShape * pResource); + /************************************************************************************************************************* Class definition for MetaData **************************************************************************************************************************/ @@ -6199,6 +6212,15 @@ LIB3MF_DECLSPEC Lib3MFResult lib3mf_model_addvolumedata(Lib3MF_Model pModel, Lib */ LIB3MF_DECLSPEC Lib3MFResult lib3mf_model_addboundaryshape(Lib3MF_Model pModel, Lib3MF_BoundaryShape * pBoundaryShapeInstance); +/** +* creates a resource iterator instance with all boundary shape resources. +* +* @param[in] pModel - Model instance. +* @param[out] pResourceIterator - returns the iterator instance. +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_model_getboundaryshapes(Lib3MF_Model pModel, Lib3MF_BoundaryShapeIterator * pResourceIterator); + /************************************************************************************************************************* Global functions **************************************************************************************************************************/ diff --git a/Autogenerated/Bindings/Cpp/lib3mf_implicit.hpp b/Autogenerated/Bindings/Cpp/lib3mf_implicit.hpp index 2b45259f2..b8020c083 100644 --- a/Autogenerated/Bindings/Cpp/lib3mf_implicit.hpp +++ b/Autogenerated/Bindings/Cpp/lib3mf_implicit.hpp @@ -75,6 +75,7 @@ class CCompositeMaterialsIterator; class CMultiPropertyGroupIterator; class CImage3DIterator; class CFunctionIterator; +class CBoundaryShapeIterator; class CMetaData; class CMetaDataGroup; class CObject; @@ -193,6 +194,7 @@ typedef CCompositeMaterialsIterator CLib3MFCompositeMaterialsIterator; typedef CMultiPropertyGroupIterator CLib3MFMultiPropertyGroupIterator; typedef CImage3DIterator CLib3MFImage3DIterator; typedef CFunctionIterator CLib3MFFunctionIterator; +typedef CBoundaryShapeIterator CLib3MFBoundaryShapeIterator; typedef CMetaData CLib3MFMetaData; typedef CMetaDataGroup CLib3MFMetaDataGroup; typedef CObject CLib3MFObject; @@ -311,6 +313,7 @@ typedef std::shared_ptr PCompositeMaterialsIterator typedef std::shared_ptr PMultiPropertyGroupIterator; typedef std::shared_ptr PImage3DIterator; typedef std::shared_ptr PFunctionIterator; +typedef std::shared_ptr PBoundaryShapeIterator; typedef std::shared_ptr PMetaData; typedef std::shared_ptr PMetaDataGroup; typedef std::shared_ptr PObject; @@ -429,6 +432,7 @@ typedef PCompositeMaterialsIterator PLib3MFCompositeMaterialsIterator; typedef PMultiPropertyGroupIterator PLib3MFMultiPropertyGroupIterator; typedef PImage3DIterator PLib3MFImage3DIterator; typedef PFunctionIterator PLib3MFFunctionIterator; +typedef PBoundaryShapeIterator PLib3MFBoundaryShapeIterator; typedef PMetaData PLib3MFMetaData; typedef PMetaDataGroup PLib3MFMetaDataGroup; typedef PObject PLib3MFObject; @@ -831,6 +835,7 @@ class CWrapper { friend class CMultiPropertyGroupIterator; friend class CImage3DIterator; friend class CFunctionIterator; + friend class CBoundaryShapeIterator; friend class CMetaData; friend class CMetaDataGroup; friend class CObject; @@ -1308,6 +1313,23 @@ class CFunctionIterator : public CResourceIterator { inline PFunction GetCurrentFunction(); }; +/************************************************************************************************************************* + Class CBoundaryShapeIterator +**************************************************************************************************************************/ +class CBoundaryShapeIterator : public CResourceIterator { +public: + + /** + * CBoundaryShapeIterator::CBoundaryShapeIterator - Constructor for BoundaryShapeIterator class. + */ + CBoundaryShapeIterator(CWrapper* pWrapper, Lib3MFHandle pHandle) + : CResourceIterator(pWrapper, pHandle) + { + } + + inline PBoundaryShape GetCurrentBoundaryShape(); +}; + /************************************************************************************************************************* Class CMetaData **************************************************************************************************************************/ @@ -3354,6 +3376,7 @@ class CModel : public CBase { inline PFunctionFromImage3D AddFunctionFromImage3D(classParam pImage3DInstance); inline PVolumeData AddVolumeData(); inline PBoundaryShape AddBoundaryShape(); + inline PBoundaryShapeIterator GetBoundaryShapes(); }; /************************************************************************************************************************* @@ -3390,6 +3413,7 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle) case 0xC2BDF5D8CBBDB1F0UL: return new CMultiPropertyGroupIterator(this, pHandle); break; // First 64 bits of SHA1 of a string: "Lib3MF::MultiPropertyGroupIterator" case 0xC4B8EC00A82BF336UL: return new CImage3DIterator(this, pHandle); break; // First 64 bits of SHA1 of a string: "Lib3MF::Image3DIterator" case 0x40E9035363ACE65EUL: return new CFunctionIterator(this, pHandle); break; // First 64 bits of SHA1 of a string: "Lib3MF::FunctionIterator" + case 0x9FBC898CF30CDEF3UL: return new CBoundaryShapeIterator(this, pHandle); break; // First 64 bits of SHA1 of a string: "Lib3MF::BoundaryShapeIterator" 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 0x2DA2136F577A779CUL: return new CObject(this, pHandle); break; // First 64 bits of SHA1 of a string: "Lib3MF::Object" @@ -4457,6 +4481,25 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle) return std::shared_ptr(dynamic_cast(m_pWrapper->polymorphicFactory(hResource))); } + /** + * Method definitions for class CBoundaryShapeIterator + */ + + /** + * CBoundaryShapeIterator::GetCurrentBoundaryShape - Returns the BoundaryShape the iterator points at. + * @return returns the MeshObject instance. + */ + PBoundaryShape CBoundaryShapeIterator::GetCurrentBoundaryShape() + { + Lib3MFHandle hResource = nullptr; + CheckError(lib3mf_boundaryshapeiterator_getcurrentboundaryshape(m_pHandle, &hResource)); + + if (!hResource) { + CheckError(LIB3MF_ERROR_INVALIDPARAM); + } + return std::shared_ptr(dynamic_cast(m_pWrapper->polymorphicFactory(hResource))); + } + /** * Method definitions for class CMetaData */ @@ -11962,6 +12005,21 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle) } return std::shared_ptr(dynamic_cast(m_pWrapper->polymorphicFactory(hBoundaryShapeInstance))); } + + /** + * CModel::GetBoundaryShapes - creates a resource iterator instance with all boundary shape resources. + * @return returns the iterator instance. + */ + PBoundaryShapeIterator CModel::GetBoundaryShapes() + { + Lib3MFHandle hResourceIterator = nullptr; + CheckError(lib3mf_model_getboundaryshapes(m_pHandle, &hResourceIterator)); + + if (!hResourceIterator) { + CheckError(LIB3MF_ERROR_INVALIDPARAM); + } + return std::shared_ptr(dynamic_cast(m_pWrapper->polymorphicFactory(hResourceIterator))); + } } // namespace Lib3MF diff --git a/Autogenerated/Bindings/Cpp/lib3mf_types.hpp b/Autogenerated/Bindings/Cpp/lib3mf_types.hpp index 2b3aa5aa6..3860a5709 100644 --- a/Autogenerated/Bindings/Cpp/lib3mf_types.hpp +++ b/Autogenerated/Bindings/Cpp/lib3mf_types.hpp @@ -221,6 +221,7 @@ typedef Lib3MFHandle Lib3MF_CompositeMaterialsIterator; typedef Lib3MFHandle Lib3MF_MultiPropertyGroupIterator; typedef Lib3MFHandle Lib3MF_Image3DIterator; typedef Lib3MFHandle Lib3MF_FunctionIterator; +typedef Lib3MFHandle Lib3MF_BoundaryShapeIterator; typedef Lib3MFHandle Lib3MF_MetaData; typedef Lib3MFHandle Lib3MF_MetaDataGroup; typedef Lib3MFHandle Lib3MF_Object; diff --git a/Autogenerated/Bindings/CppDynamic/lib3mf_dynamic.h b/Autogenerated/Bindings/CppDynamic/lib3mf_dynamic.h index bb9ddd401..7695b6191 100644 --- a/Autogenerated/Bindings/CppDynamic/lib3mf_dynamic.h +++ b/Autogenerated/Bindings/CppDynamic/lib3mf_dynamic.h @@ -588,6 +588,19 @@ typedef Lib3MFResult (*PLib3MFImage3DIterator_GetCurrentImage3DPtr) (Lib3MF_Imag */ typedef Lib3MFResult (*PLib3MFFunctionIterator_GetCurrentFunctionPtr) (Lib3MF_FunctionIterator pFunctionIterator, Lib3MF_Function * pResource); +/************************************************************************************************************************* + Class definition for BoundaryShapeIterator +**************************************************************************************************************************/ + +/** +* Returns the BoundaryShape the iterator points at. +* +* @param[in] pBoundaryShapeIterator - BoundaryShapeIterator instance. +* @param[out] pResource - returns the MeshObject instance. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFBoundaryShapeIterator_GetCurrentBoundaryShapePtr) (Lib3MF_BoundaryShapeIterator pBoundaryShapeIterator, Lib3MF_BoundaryShape * pResource); + /************************************************************************************************************************* Class definition for MetaData **************************************************************************************************************************/ @@ -6186,6 +6199,15 @@ typedef Lib3MFResult (*PLib3MFModel_AddVolumeDataPtr) (Lib3MF_Model pModel, Lib3 */ typedef Lib3MFResult (*PLib3MFModel_AddBoundaryShapePtr) (Lib3MF_Model pModel, Lib3MF_BoundaryShape * pBoundaryShapeInstance); +/** +* creates a resource iterator instance with all boundary shape resources. +* +* @param[in] pModel - Model instance. +* @param[out] pResourceIterator - returns the iterator instance. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFModel_GetBoundaryShapesPtr) (Lib3MF_Model pModel, Lib3MF_BoundaryShapeIterator * pResourceIterator); + /************************************************************************************************************************* Global functions **************************************************************************************************************************/ @@ -6440,6 +6462,7 @@ typedef struct { PLib3MFMultiPropertyGroupIterator_GetCurrentMultiPropertyGroupPtr m_MultiPropertyGroupIterator_GetCurrentMultiPropertyGroup; PLib3MFImage3DIterator_GetCurrentImage3DPtr m_Image3DIterator_GetCurrentImage3D; PLib3MFFunctionIterator_GetCurrentFunctionPtr m_FunctionIterator_GetCurrentFunction; + PLib3MFBoundaryShapeIterator_GetCurrentBoundaryShapePtr m_BoundaryShapeIterator_GetCurrentBoundaryShape; PLib3MFMetaData_GetNameSpacePtr m_MetaData_GetNameSpace; PLib3MFMetaData_SetNameSpacePtr m_MetaData_SetNameSpace; PLib3MFMetaData_GetNamePtr m_MetaData_GetName; @@ -6968,6 +6991,7 @@ typedef struct { PLib3MFModel_AddFunctionFromImage3DPtr m_Model_AddFunctionFromImage3D; PLib3MFModel_AddVolumeDataPtr m_Model_AddVolumeData; PLib3MFModel_AddBoundaryShapePtr m_Model_AddBoundaryShape; + PLib3MFModel_GetBoundaryShapesPtr m_Model_GetBoundaryShapes; PLib3MFGetLibraryVersionPtr m_GetLibraryVersion; PLib3MFGetPrereleaseInformationPtr m_GetPrereleaseInformation; PLib3MFGetBuildInformationPtr m_GetBuildInformation; diff --git a/Autogenerated/Bindings/CppDynamic/lib3mf_dynamic.hpp b/Autogenerated/Bindings/CppDynamic/lib3mf_dynamic.hpp index 43ca3bc6f..f99388d32 100644 --- a/Autogenerated/Bindings/CppDynamic/lib3mf_dynamic.hpp +++ b/Autogenerated/Bindings/CppDynamic/lib3mf_dynamic.hpp @@ -75,6 +75,7 @@ class CCompositeMaterialsIterator; class CMultiPropertyGroupIterator; class CImage3DIterator; class CFunctionIterator; +class CBoundaryShapeIterator; class CMetaData; class CMetaDataGroup; class CObject; @@ -193,6 +194,7 @@ typedef CCompositeMaterialsIterator CLib3MFCompositeMaterialsIterator; typedef CMultiPropertyGroupIterator CLib3MFMultiPropertyGroupIterator; typedef CImage3DIterator CLib3MFImage3DIterator; typedef CFunctionIterator CLib3MFFunctionIterator; +typedef CBoundaryShapeIterator CLib3MFBoundaryShapeIterator; typedef CMetaData CLib3MFMetaData; typedef CMetaDataGroup CLib3MFMetaDataGroup; typedef CObject CLib3MFObject; @@ -311,6 +313,7 @@ typedef std::shared_ptr PCompositeMaterialsIterator typedef std::shared_ptr PMultiPropertyGroupIterator; typedef std::shared_ptr PImage3DIterator; typedef std::shared_ptr PFunctionIterator; +typedef std::shared_ptr PBoundaryShapeIterator; typedef std::shared_ptr PMetaData; typedef std::shared_ptr PMetaDataGroup; typedef std::shared_ptr PObject; @@ -429,6 +432,7 @@ typedef PCompositeMaterialsIterator PLib3MFCompositeMaterialsIterator; typedef PMultiPropertyGroupIterator PLib3MFMultiPropertyGroupIterator; typedef PImage3DIterator PLib3MFImage3DIterator; typedef PFunctionIterator PLib3MFFunctionIterator; +typedef PBoundaryShapeIterator PLib3MFBoundaryShapeIterator; typedef PMetaData PLib3MFMetaData; typedef PMetaDataGroup PLib3MFMetaDataGroup; typedef PObject PLib3MFObject; @@ -855,6 +859,7 @@ class CWrapper { friend class CMultiPropertyGroupIterator; friend class CImage3DIterator; friend class CFunctionIterator; + friend class CBoundaryShapeIterator; friend class CMetaData; friend class CMetaDataGroup; friend class CObject; @@ -1332,6 +1337,23 @@ class CFunctionIterator : public CResourceIterator { inline PFunction GetCurrentFunction(); }; +/************************************************************************************************************************* + Class CBoundaryShapeIterator +**************************************************************************************************************************/ +class CBoundaryShapeIterator : public CResourceIterator { +public: + + /** + * CBoundaryShapeIterator::CBoundaryShapeIterator - Constructor for BoundaryShapeIterator class. + */ + CBoundaryShapeIterator(CWrapper* pWrapper, Lib3MFHandle pHandle) + : CResourceIterator(pWrapper, pHandle) + { + } + + inline PBoundaryShape GetCurrentBoundaryShape(); +}; + /************************************************************************************************************************* Class CMetaData **************************************************************************************************************************/ @@ -3378,6 +3400,7 @@ class CModel : public CBase { inline PFunctionFromImage3D AddFunctionFromImage3D(classParam pImage3DInstance); inline PVolumeData AddVolumeData(); inline PBoundaryShape AddBoundaryShape(); + inline PBoundaryShapeIterator GetBoundaryShapes(); }; /************************************************************************************************************************* @@ -3414,6 +3437,7 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle) case 0xC2BDF5D8CBBDB1F0UL: return new CMultiPropertyGroupIterator(this, pHandle); break; // First 64 bits of SHA1 of a string: "Lib3MF::MultiPropertyGroupIterator" case 0xC4B8EC00A82BF336UL: return new CImage3DIterator(this, pHandle); break; // First 64 bits of SHA1 of a string: "Lib3MF::Image3DIterator" case 0x40E9035363ACE65EUL: return new CFunctionIterator(this, pHandle); break; // First 64 bits of SHA1 of a string: "Lib3MF::FunctionIterator" + case 0x9FBC898CF30CDEF3UL: return new CBoundaryShapeIterator(this, pHandle); break; // First 64 bits of SHA1 of a string: "Lib3MF::BoundaryShapeIterator" 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 0x2DA2136F577A779CUL: return new CObject(this, pHandle); break; // First 64 bits of SHA1 of a string: "Lib3MF::Object" @@ -3845,6 +3869,7 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle) pWrapperTable->m_MultiPropertyGroupIterator_GetCurrentMultiPropertyGroup = nullptr; pWrapperTable->m_Image3DIterator_GetCurrentImage3D = nullptr; pWrapperTable->m_FunctionIterator_GetCurrentFunction = nullptr; + pWrapperTable->m_BoundaryShapeIterator_GetCurrentBoundaryShape = nullptr; pWrapperTable->m_MetaData_GetNameSpace = nullptr; pWrapperTable->m_MetaData_SetNameSpace = nullptr; pWrapperTable->m_MetaData_GetName = nullptr; @@ -4373,6 +4398,7 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle) pWrapperTable->m_Model_AddFunctionFromImage3D = nullptr; pWrapperTable->m_Model_AddVolumeData = nullptr; pWrapperTable->m_Model_AddBoundaryShape = nullptr; + pWrapperTable->m_Model_GetBoundaryShapes = nullptr; pWrapperTable->m_GetLibraryVersion = nullptr; pWrapperTable->m_GetPrereleaseInformation = nullptr; pWrapperTable->m_GetBuildInformation = nullptr; @@ -4892,6 +4918,15 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle) if (pWrapperTable->m_FunctionIterator_GetCurrentFunction == nullptr) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + #ifdef _WIN32 + pWrapperTable->m_BoundaryShapeIterator_GetCurrentBoundaryShape = (PLib3MFBoundaryShapeIterator_GetCurrentBoundaryShapePtr) GetProcAddress(hLibrary, "lib3mf_boundaryshapeiterator_getcurrentboundaryshape"); + #else // _WIN32 + pWrapperTable->m_BoundaryShapeIterator_GetCurrentBoundaryShape = (PLib3MFBoundaryShapeIterator_GetCurrentBoundaryShapePtr) dlsym(hLibrary, "lib3mf_boundaryshapeiterator_getcurrentboundaryshape"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_BoundaryShapeIterator_GetCurrentBoundaryShape == nullptr) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + #ifdef _WIN32 pWrapperTable->m_MetaData_GetNameSpace = (PLib3MFMetaData_GetNameSpacePtr) GetProcAddress(hLibrary, "lib3mf_metadata_getnamespace"); #else // _WIN32 @@ -9644,6 +9679,15 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle) if (pWrapperTable->m_Model_AddBoundaryShape == nullptr) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + #ifdef _WIN32 + pWrapperTable->m_Model_GetBoundaryShapes = (PLib3MFModel_GetBoundaryShapesPtr) GetProcAddress(hLibrary, "lib3mf_model_getboundaryshapes"); + #else // _WIN32 + pWrapperTable->m_Model_GetBoundaryShapes = (PLib3MFModel_GetBoundaryShapesPtr) dlsym(hLibrary, "lib3mf_model_getboundaryshapes"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_Model_GetBoundaryShapes == nullptr) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + #ifdef _WIN32 pWrapperTable->m_GetLibraryVersion = (PLib3MFGetLibraryVersionPtr) GetProcAddress(hLibrary, "lib3mf_getlibraryversion"); #else // _WIN32 @@ -10031,6 +10075,10 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle) if ( (eLookupError != 0) || (pWrapperTable->m_FunctionIterator_GetCurrentFunction == nullptr) ) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + eLookupError = (*pLookup)("lib3mf_boundaryshapeiterator_getcurrentboundaryshape", (void**)&(pWrapperTable->m_BoundaryShapeIterator_GetCurrentBoundaryShape)); + if ( (eLookupError != 0) || (pWrapperTable->m_BoundaryShapeIterator_GetCurrentBoundaryShape == nullptr) ) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + eLookupError = (*pLookup)("lib3mf_metadata_getnamespace", (void**)&(pWrapperTable->m_MetaData_GetNameSpace)); if ( (eLookupError != 0) || (pWrapperTable->m_MetaData_GetNameSpace == nullptr) ) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; @@ -12143,6 +12191,10 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle) if ( (eLookupError != 0) || (pWrapperTable->m_Model_AddBoundaryShape == nullptr) ) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + eLookupError = (*pLookup)("lib3mf_model_getboundaryshapes", (void**)&(pWrapperTable->m_Model_GetBoundaryShapes)); + if ( (eLookupError != 0) || (pWrapperTable->m_Model_GetBoundaryShapes == nullptr) ) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + eLookupError = (*pLookup)("lib3mf_getlibraryversion", (void**)&(pWrapperTable->m_GetLibraryVersion)); if ( (eLookupError != 0) || (pWrapperTable->m_GetLibraryVersion == nullptr) ) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; @@ -12915,6 +12967,25 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle) return std::shared_ptr(dynamic_cast(m_pWrapper->polymorphicFactory(hResource))); } + /** + * Method definitions for class CBoundaryShapeIterator + */ + + /** + * CBoundaryShapeIterator::GetCurrentBoundaryShape - Returns the BoundaryShape the iterator points at. + * @return returns the MeshObject instance. + */ + PBoundaryShape CBoundaryShapeIterator::GetCurrentBoundaryShape() + { + Lib3MFHandle hResource = nullptr; + CheckError(m_pWrapper->m_WrapperTable.m_BoundaryShapeIterator_GetCurrentBoundaryShape(m_pHandle, &hResource)); + + if (!hResource) { + CheckError(LIB3MF_ERROR_INVALIDPARAM); + } + return std::shared_ptr(dynamic_cast(m_pWrapper->polymorphicFactory(hResource))); + } + /** * Method definitions for class CMetaData */ @@ -20420,6 +20491,21 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle) } return std::shared_ptr(dynamic_cast(m_pWrapper->polymorphicFactory(hBoundaryShapeInstance))); } + + /** + * CModel::GetBoundaryShapes - creates a resource iterator instance with all boundary shape resources. + * @return returns the iterator instance. + */ + PBoundaryShapeIterator CModel::GetBoundaryShapes() + { + Lib3MFHandle hResourceIterator = nullptr; + CheckError(m_pWrapper->m_WrapperTable.m_Model_GetBoundaryShapes(m_pHandle, &hResourceIterator)); + + if (!hResourceIterator) { + CheckError(LIB3MF_ERROR_INVALIDPARAM); + } + return std::shared_ptr(dynamic_cast(m_pWrapper->polymorphicFactory(hResourceIterator))); + } } // namespace Lib3MF diff --git a/Autogenerated/Bindings/CppDynamic/lib3mf_types.hpp b/Autogenerated/Bindings/CppDynamic/lib3mf_types.hpp index 2b3aa5aa6..3860a5709 100644 --- a/Autogenerated/Bindings/CppDynamic/lib3mf_types.hpp +++ b/Autogenerated/Bindings/CppDynamic/lib3mf_types.hpp @@ -221,6 +221,7 @@ typedef Lib3MFHandle Lib3MF_CompositeMaterialsIterator; typedef Lib3MFHandle Lib3MF_MultiPropertyGroupIterator; typedef Lib3MFHandle Lib3MF_Image3DIterator; typedef Lib3MFHandle Lib3MF_FunctionIterator; +typedef Lib3MFHandle Lib3MF_BoundaryShapeIterator; typedef Lib3MFHandle Lib3MF_MetaData; typedef Lib3MFHandle Lib3MF_MetaDataGroup; typedef Lib3MFHandle Lib3MF_Object; diff --git a/Autogenerated/Bindings/Go/lib3mf.go b/Autogenerated/Bindings/Go/lib3mf.go index 548549563..83e33abe3 100644 --- a/Autogenerated/Bindings/Go/lib3mf.go +++ b/Autogenerated/Bindings/Go/lib3mf.go @@ -522,6 +522,15 @@ Lib3MFResult CCall_lib3mf_functioniterator_getcurrentfunction(Lib3MFHandle libra } +Lib3MFResult CCall_lib3mf_boundaryshapeiterator_getcurrentboundaryshape(Lib3MFHandle libraryHandle, Lib3MF_BoundaryShapeIterator pBoundaryShapeIterator, Lib3MF_BoundaryShape * pResource) +{ + if (libraryHandle == 0) + return LIB3MF_ERROR_INVALIDCAST; + sLib3MFDynamicWrapperTable * wrapperTable = (sLib3MFDynamicWrapperTable *) libraryHandle; + return wrapperTable->m_BoundaryShapeIterator_GetCurrentBoundaryShape (pBoundaryShapeIterator, pResource); +} + + Lib3MFResult CCall_lib3mf_metadata_getnamespace(Lib3MFHandle libraryHandle, Lib3MF_MetaData pMetaData, const Lib3MF_uint32 nNameSpaceBufferSize, Lib3MF_uint32* pNameSpaceNeededChars, char * pNameSpaceBuffer) { if (libraryHandle == 0) @@ -5274,6 +5283,15 @@ Lib3MFResult CCall_lib3mf_model_addboundaryshape(Lib3MFHandle libraryHandle, Lib } +Lib3MFResult CCall_lib3mf_model_getboundaryshapes(Lib3MFHandle libraryHandle, Lib3MF_Model pModel, Lib3MF_BoundaryShapeIterator * pResourceIterator) +{ + if (libraryHandle == 0) + return LIB3MF_ERROR_INVALIDCAST; + sLib3MFDynamicWrapperTable * wrapperTable = (sLib3MFDynamicWrapperTable *) libraryHandle; + return wrapperTable->m_Model_GetBoundaryShapes (pModel, pResourceIterator); +} + + Lib3MFResult CCall_lib3mf_getlibraryversion(Lib3MFHandle libraryHandle, Lib3MF_uint32 * pMajor, Lib3MF_uint32 * pMinor, Lib3MF_uint32 * pMicro) { if (libraryHandle == 0) @@ -6802,6 +6820,26 @@ func (inst FunctionIterator) GetCurrentFunction() (Function, error) { } +// BoundaryShapeIterator represents a Lib3MF class. +type BoundaryShapeIterator struct { + ResourceIterator +} + +func (wrapper Wrapper) NewBoundaryShapeIterator(r ref) BoundaryShapeIterator { + return BoundaryShapeIterator{wrapper.NewResourceIterator(r)} +} + +// GetCurrentBoundaryShape returns the BoundaryShape the iterator points at. +func (inst BoundaryShapeIterator) GetCurrentBoundaryShape() (BoundaryShape, error) { + var resource ref + ret := C.CCall_lib3mf_boundaryshapeiterator_getcurrentboundaryshape(inst.wrapperRef.LibraryHandle, inst.Ref, &resource) + if ret != 0 { + return BoundaryShape{}, makeError(uint32(ret)) + } + return inst.wrapperRef.NewBoundaryShape(resource), nil +} + + // MetaData represents a Lib3MF class. type MetaData struct { Base @@ -13400,6 +13438,16 @@ func (inst Model) AddBoundaryShape() (BoundaryShape, error) { return inst.wrapperRef.NewBoundaryShape(boundaryShapeInstance), nil } +// GetBoundaryShapes creates a resource iterator instance with all boundary shape resources. +func (inst Model) GetBoundaryShapes() (BoundaryShapeIterator, error) { + var resourceIterator ref + ret := C.CCall_lib3mf_model_getboundaryshapes(inst.wrapperRef.LibraryHandle, inst.Ref, &resourceIterator) + if ret != 0 { + return BoundaryShapeIterator{}, makeError(uint32(ret)) + } + return inst.wrapperRef.NewBoundaryShapeIterator(resourceIterator), nil +} + // GetLibraryVersion retrieves the binary version of this library. func (wrapper Wrapper) GetLibraryVersion() (uint32, uint32, uint32, error) { diff --git a/Autogenerated/Bindings/Go/lib3mf_dynamic.cc b/Autogenerated/Bindings/Go/lib3mf_dynamic.cc index 7ff9853e5..ee1146da6 100644 --- a/Autogenerated/Bindings/Go/lib3mf_dynamic.cc +++ b/Autogenerated/Bindings/Go/lib3mf_dynamic.cc @@ -98,6 +98,7 @@ Lib3MFResult InitLib3MFWrapperTable(sLib3MFDynamicWrapperTable * pWrapperTable) pWrapperTable->m_MultiPropertyGroupIterator_GetCurrentMultiPropertyGroup = NULL; pWrapperTable->m_Image3DIterator_GetCurrentImage3D = NULL; pWrapperTable->m_FunctionIterator_GetCurrentFunction = NULL; + pWrapperTable->m_BoundaryShapeIterator_GetCurrentBoundaryShape = NULL; pWrapperTable->m_MetaData_GetNameSpace = NULL; pWrapperTable->m_MetaData_SetNameSpace = NULL; pWrapperTable->m_MetaData_GetName = NULL; @@ -626,6 +627,7 @@ Lib3MFResult InitLib3MFWrapperTable(sLib3MFDynamicWrapperTable * pWrapperTable) pWrapperTable->m_Model_AddFunctionFromImage3D = NULL; pWrapperTable->m_Model_AddVolumeData = NULL; pWrapperTable->m_Model_AddBoundaryShape = NULL; + pWrapperTable->m_Model_GetBoundaryShapes = NULL; pWrapperTable->m_GetLibraryVersion = NULL; pWrapperTable->m_GetPrereleaseInformation = NULL; pWrapperTable->m_GetBuildInformation = NULL; @@ -1149,6 +1151,15 @@ Lib3MFResult LoadLib3MFWrapperTable(sLib3MFDynamicWrapperTable * pWrapperTable, if (pWrapperTable->m_FunctionIterator_GetCurrentFunction == NULL) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + #ifdef _WIN32 + pWrapperTable->m_BoundaryShapeIterator_GetCurrentBoundaryShape = (PLib3MFBoundaryShapeIterator_GetCurrentBoundaryShapePtr) GetProcAddress(hLibrary, "lib3mf_boundaryshapeiterator_getcurrentboundaryshape"); + #else // _WIN32 + pWrapperTable->m_BoundaryShapeIterator_GetCurrentBoundaryShape = (PLib3MFBoundaryShapeIterator_GetCurrentBoundaryShapePtr) dlsym(hLibrary, "lib3mf_boundaryshapeiterator_getcurrentboundaryshape"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_BoundaryShapeIterator_GetCurrentBoundaryShape == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + #ifdef _WIN32 pWrapperTable->m_MetaData_GetNameSpace = (PLib3MFMetaData_GetNameSpacePtr) GetProcAddress(hLibrary, "lib3mf_metadata_getnamespace"); #else // _WIN32 @@ -5901,6 +5912,15 @@ Lib3MFResult LoadLib3MFWrapperTable(sLib3MFDynamicWrapperTable * pWrapperTable, if (pWrapperTable->m_Model_AddBoundaryShape == NULL) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + #ifdef _WIN32 + pWrapperTable->m_Model_GetBoundaryShapes = (PLib3MFModel_GetBoundaryShapesPtr) GetProcAddress(hLibrary, "lib3mf_model_getboundaryshapes"); + #else // _WIN32 + pWrapperTable->m_Model_GetBoundaryShapes = (PLib3MFModel_GetBoundaryShapesPtr) dlsym(hLibrary, "lib3mf_model_getboundaryshapes"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_Model_GetBoundaryShapes == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + #ifdef _WIN32 pWrapperTable->m_GetLibraryVersion = (PLib3MFGetLibraryVersionPtr) GetProcAddress(hLibrary, "lib3mf_getlibraryversion"); #else // _WIN32 diff --git a/Autogenerated/Bindings/Go/lib3mf_dynamic.h b/Autogenerated/Bindings/Go/lib3mf_dynamic.h index 098f6dda2..797106a2a 100644 --- a/Autogenerated/Bindings/Go/lib3mf_dynamic.h +++ b/Autogenerated/Bindings/Go/lib3mf_dynamic.h @@ -588,6 +588,19 @@ typedef Lib3MFResult (*PLib3MFImage3DIterator_GetCurrentImage3DPtr) (Lib3MF_Imag */ typedef Lib3MFResult (*PLib3MFFunctionIterator_GetCurrentFunctionPtr) (Lib3MF_FunctionIterator pFunctionIterator, Lib3MF_Function * pResource); +/************************************************************************************************************************* + Class definition for BoundaryShapeIterator +**************************************************************************************************************************/ + +/** +* Returns the BoundaryShape the iterator points at. +* +* @param[in] pBoundaryShapeIterator - BoundaryShapeIterator instance. +* @param[out] pResource - returns the MeshObject instance. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFBoundaryShapeIterator_GetCurrentBoundaryShapePtr) (Lib3MF_BoundaryShapeIterator pBoundaryShapeIterator, Lib3MF_BoundaryShape * pResource); + /************************************************************************************************************************* Class definition for MetaData **************************************************************************************************************************/ @@ -6186,6 +6199,15 @@ typedef Lib3MFResult (*PLib3MFModel_AddVolumeDataPtr) (Lib3MF_Model pModel, Lib3 */ typedef Lib3MFResult (*PLib3MFModel_AddBoundaryShapePtr) (Lib3MF_Model pModel, Lib3MF_BoundaryShape * pBoundaryShapeInstance); +/** +* creates a resource iterator instance with all boundary shape resources. +* +* @param[in] pModel - Model instance. +* @param[out] pResourceIterator - returns the iterator instance. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFModel_GetBoundaryShapesPtr) (Lib3MF_Model pModel, Lib3MF_BoundaryShapeIterator * pResourceIterator); + /************************************************************************************************************************* Global functions **************************************************************************************************************************/ @@ -6440,6 +6462,7 @@ typedef struct { PLib3MFMultiPropertyGroupIterator_GetCurrentMultiPropertyGroupPtr m_MultiPropertyGroupIterator_GetCurrentMultiPropertyGroup; PLib3MFImage3DIterator_GetCurrentImage3DPtr m_Image3DIterator_GetCurrentImage3D; PLib3MFFunctionIterator_GetCurrentFunctionPtr m_FunctionIterator_GetCurrentFunction; + PLib3MFBoundaryShapeIterator_GetCurrentBoundaryShapePtr m_BoundaryShapeIterator_GetCurrentBoundaryShape; PLib3MFMetaData_GetNameSpacePtr m_MetaData_GetNameSpace; PLib3MFMetaData_SetNameSpacePtr m_MetaData_SetNameSpace; PLib3MFMetaData_GetNamePtr m_MetaData_GetName; @@ -6968,6 +6991,7 @@ typedef struct { PLib3MFModel_AddFunctionFromImage3DPtr m_Model_AddFunctionFromImage3D; PLib3MFModel_AddVolumeDataPtr m_Model_AddVolumeData; PLib3MFModel_AddBoundaryShapePtr m_Model_AddBoundaryShape; + PLib3MFModel_GetBoundaryShapesPtr m_Model_GetBoundaryShapes; PLib3MFGetLibraryVersionPtr m_GetLibraryVersion; PLib3MFGetPrereleaseInformationPtr m_GetPrereleaseInformation; PLib3MFGetBuildInformationPtr m_GetBuildInformation; diff --git a/Autogenerated/Bindings/Go/lib3mf_types.h b/Autogenerated/Bindings/Go/lib3mf_types.h index 4477cae87..924d2a66f 100644 --- a/Autogenerated/Bindings/Go/lib3mf_types.h +++ b/Autogenerated/Bindings/Go/lib3mf_types.h @@ -222,6 +222,7 @@ typedef Lib3MFHandle Lib3MF_CompositeMaterialsIterator; typedef Lib3MFHandle Lib3MF_MultiPropertyGroupIterator; typedef Lib3MFHandle Lib3MF_Image3DIterator; typedef Lib3MFHandle Lib3MF_FunctionIterator; +typedef Lib3MFHandle Lib3MF_BoundaryShapeIterator; typedef Lib3MFHandle Lib3MF_MetaData; typedef Lib3MFHandle Lib3MF_MetaDataGroup; typedef Lib3MFHandle Lib3MF_Object; diff --git a/Autogenerated/Bindings/NodeJS/lib3mf_dynamic.cc b/Autogenerated/Bindings/NodeJS/lib3mf_dynamic.cc index 7ff9853e5..ee1146da6 100644 --- a/Autogenerated/Bindings/NodeJS/lib3mf_dynamic.cc +++ b/Autogenerated/Bindings/NodeJS/lib3mf_dynamic.cc @@ -98,6 +98,7 @@ Lib3MFResult InitLib3MFWrapperTable(sLib3MFDynamicWrapperTable * pWrapperTable) pWrapperTable->m_MultiPropertyGroupIterator_GetCurrentMultiPropertyGroup = NULL; pWrapperTable->m_Image3DIterator_GetCurrentImage3D = NULL; pWrapperTable->m_FunctionIterator_GetCurrentFunction = NULL; + pWrapperTable->m_BoundaryShapeIterator_GetCurrentBoundaryShape = NULL; pWrapperTable->m_MetaData_GetNameSpace = NULL; pWrapperTable->m_MetaData_SetNameSpace = NULL; pWrapperTable->m_MetaData_GetName = NULL; @@ -626,6 +627,7 @@ Lib3MFResult InitLib3MFWrapperTable(sLib3MFDynamicWrapperTable * pWrapperTable) pWrapperTable->m_Model_AddFunctionFromImage3D = NULL; pWrapperTable->m_Model_AddVolumeData = NULL; pWrapperTable->m_Model_AddBoundaryShape = NULL; + pWrapperTable->m_Model_GetBoundaryShapes = NULL; pWrapperTable->m_GetLibraryVersion = NULL; pWrapperTable->m_GetPrereleaseInformation = NULL; pWrapperTable->m_GetBuildInformation = NULL; @@ -1149,6 +1151,15 @@ Lib3MFResult LoadLib3MFWrapperTable(sLib3MFDynamicWrapperTable * pWrapperTable, if (pWrapperTable->m_FunctionIterator_GetCurrentFunction == NULL) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + #ifdef _WIN32 + pWrapperTable->m_BoundaryShapeIterator_GetCurrentBoundaryShape = (PLib3MFBoundaryShapeIterator_GetCurrentBoundaryShapePtr) GetProcAddress(hLibrary, "lib3mf_boundaryshapeiterator_getcurrentboundaryshape"); + #else // _WIN32 + pWrapperTable->m_BoundaryShapeIterator_GetCurrentBoundaryShape = (PLib3MFBoundaryShapeIterator_GetCurrentBoundaryShapePtr) dlsym(hLibrary, "lib3mf_boundaryshapeiterator_getcurrentboundaryshape"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_BoundaryShapeIterator_GetCurrentBoundaryShape == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + #ifdef _WIN32 pWrapperTable->m_MetaData_GetNameSpace = (PLib3MFMetaData_GetNameSpacePtr) GetProcAddress(hLibrary, "lib3mf_metadata_getnamespace"); #else // _WIN32 @@ -5901,6 +5912,15 @@ Lib3MFResult LoadLib3MFWrapperTable(sLib3MFDynamicWrapperTable * pWrapperTable, if (pWrapperTable->m_Model_AddBoundaryShape == NULL) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + #ifdef _WIN32 + pWrapperTable->m_Model_GetBoundaryShapes = (PLib3MFModel_GetBoundaryShapesPtr) GetProcAddress(hLibrary, "lib3mf_model_getboundaryshapes"); + #else // _WIN32 + pWrapperTable->m_Model_GetBoundaryShapes = (PLib3MFModel_GetBoundaryShapesPtr) dlsym(hLibrary, "lib3mf_model_getboundaryshapes"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_Model_GetBoundaryShapes == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + #ifdef _WIN32 pWrapperTable->m_GetLibraryVersion = (PLib3MFGetLibraryVersionPtr) GetProcAddress(hLibrary, "lib3mf_getlibraryversion"); #else // _WIN32 diff --git a/Autogenerated/Bindings/NodeJS/lib3mf_dynamic.h b/Autogenerated/Bindings/NodeJS/lib3mf_dynamic.h index 098f6dda2..797106a2a 100644 --- a/Autogenerated/Bindings/NodeJS/lib3mf_dynamic.h +++ b/Autogenerated/Bindings/NodeJS/lib3mf_dynamic.h @@ -588,6 +588,19 @@ typedef Lib3MFResult (*PLib3MFImage3DIterator_GetCurrentImage3DPtr) (Lib3MF_Imag */ typedef Lib3MFResult (*PLib3MFFunctionIterator_GetCurrentFunctionPtr) (Lib3MF_FunctionIterator pFunctionIterator, Lib3MF_Function * pResource); +/************************************************************************************************************************* + Class definition for BoundaryShapeIterator +**************************************************************************************************************************/ + +/** +* Returns the BoundaryShape the iterator points at. +* +* @param[in] pBoundaryShapeIterator - BoundaryShapeIterator instance. +* @param[out] pResource - returns the MeshObject instance. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFBoundaryShapeIterator_GetCurrentBoundaryShapePtr) (Lib3MF_BoundaryShapeIterator pBoundaryShapeIterator, Lib3MF_BoundaryShape * pResource); + /************************************************************************************************************************* Class definition for MetaData **************************************************************************************************************************/ @@ -6186,6 +6199,15 @@ typedef Lib3MFResult (*PLib3MFModel_AddVolumeDataPtr) (Lib3MF_Model pModel, Lib3 */ typedef Lib3MFResult (*PLib3MFModel_AddBoundaryShapePtr) (Lib3MF_Model pModel, Lib3MF_BoundaryShape * pBoundaryShapeInstance); +/** +* creates a resource iterator instance with all boundary shape resources. +* +* @param[in] pModel - Model instance. +* @param[out] pResourceIterator - returns the iterator instance. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFModel_GetBoundaryShapesPtr) (Lib3MF_Model pModel, Lib3MF_BoundaryShapeIterator * pResourceIterator); + /************************************************************************************************************************* Global functions **************************************************************************************************************************/ @@ -6440,6 +6462,7 @@ typedef struct { PLib3MFMultiPropertyGroupIterator_GetCurrentMultiPropertyGroupPtr m_MultiPropertyGroupIterator_GetCurrentMultiPropertyGroup; PLib3MFImage3DIterator_GetCurrentImage3DPtr m_Image3DIterator_GetCurrentImage3D; PLib3MFFunctionIterator_GetCurrentFunctionPtr m_FunctionIterator_GetCurrentFunction; + PLib3MFBoundaryShapeIterator_GetCurrentBoundaryShapePtr m_BoundaryShapeIterator_GetCurrentBoundaryShape; PLib3MFMetaData_GetNameSpacePtr m_MetaData_GetNameSpace; PLib3MFMetaData_SetNameSpacePtr m_MetaData_SetNameSpace; PLib3MFMetaData_GetNamePtr m_MetaData_GetName; @@ -6968,6 +6991,7 @@ typedef struct { PLib3MFModel_AddFunctionFromImage3DPtr m_Model_AddFunctionFromImage3D; PLib3MFModel_AddVolumeDataPtr m_Model_AddVolumeData; PLib3MFModel_AddBoundaryShapePtr m_Model_AddBoundaryShape; + PLib3MFModel_GetBoundaryShapesPtr m_Model_GetBoundaryShapes; PLib3MFGetLibraryVersionPtr m_GetLibraryVersion; PLib3MFGetPrereleaseInformationPtr m_GetPrereleaseInformation; PLib3MFGetBuildInformationPtr m_GetBuildInformation; diff --git a/Autogenerated/Bindings/NodeJS/lib3mf_nodeaddon.cc b/Autogenerated/Bindings/NodeJS/lib3mf_nodeaddon.cc index 9b2061009..b6024b400 100644 --- a/Autogenerated/Bindings/NodeJS/lib3mf_nodeaddon.cc +++ b/Autogenerated/Bindings/NodeJS/lib3mf_nodeaddon.cc @@ -66,6 +66,7 @@ void InitAll(v8::Local exports, v8::Local module) CLib3MFMultiPropertyGroupIterator::Init(); CLib3MFImage3DIterator::Init(); CLib3MFFunctionIterator::Init(); + CLib3MFBoundaryShapeIterator::Init(); CLib3MFMetaData::Init(); CLib3MFMetaDataGroup::Init(); CLib3MFObject::Init(); diff --git a/Autogenerated/Bindings/NodeJS/lib3mf_nodewrapper.cc b/Autogenerated/Bindings/NodeJS/lib3mf_nodewrapper.cc index 3943243e9..cff1b7823 100644 --- a/Autogenerated/Bindings/NodeJS/lib3mf_nodewrapper.cc +++ b/Autogenerated/Bindings/NodeJS/lib3mf_nodewrapper.cc @@ -59,6 +59,7 @@ Persistent CLib3MFCompositeMaterialsIterator::constructor; Persistent CLib3MFMultiPropertyGroupIterator::constructor; Persistent CLib3MFImage3DIterator::constructor; Persistent CLib3MFFunctionIterator::constructor; +Persistent CLib3MFBoundaryShapeIterator::constructor; Persistent CLib3MFMetaData::constructor; Persistent CLib3MFMetaDataGroup::constructor; Persistent CLib3MFObject::constructor; @@ -3637,6 +3638,85 @@ void CLib3MFFunctionIterator::GetCurrentFunction(const FunctionCallbackInfo tpl = FunctionTemplate::New(isolate, New); + tpl->SetClassName(String::NewFromUtf8(isolate, "Lib3MFBoundaryShapeIterator")); + tpl->InstanceTemplate()->SetInternalFieldCount(NODEWRAPPER_FIELDCOUNT); + + // Prototype + NODE_SET_PROTOTYPE_METHOD(tpl, "GetCurrentBoundaryShape", GetCurrentBoundaryShape); + constructor.Reset(isolate, tpl->GetFunction(isolate->GetCurrentContext()).ToLocalChecked()); + +} + +void CLib3MFBoundaryShapeIterator::New(const FunctionCallbackInfo& args) +{ + Isolate* isolate = args.GetIsolate(); + HandleScope scope(isolate); + + if (args.IsConstructCall()) { + CLib3MFBaseClass * holderObj = ObjectWrap::Unwrap(args.Holder()); + CLib3MFBoundaryShapeIterator * boundaryshapeiteratorInstance = new CLib3MFBoundaryShapeIterator(); + boundaryshapeiteratorInstance->Wrap(args.This()); + args.GetReturnValue().Set(args.This()); + } else { + RaiseError(isolate, "Lib3MFBoundaryShapeIterator: Invalid call to Constructor"); + } +} + +Local CLib3MFBoundaryShapeIterator::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 CLib3MFBoundaryShapeIterator::GetCurrentBoundaryShape(const FunctionCallbackInfo& args) +{ + Isolate* isolate = args.GetIsolate(); + HandleScope scope(isolate); + try { + Lib3MFHandle hReturnResource = nullptr; + sLib3MFDynamicWrapperTable * wrapperTable = CLib3MFBaseClass::getDynamicWrapperTable(args.Holder()); + if (wrapperTable == nullptr) + throw std::runtime_error("Could not get wrapper table for Lib3MF method GetCurrentBoundaryShape."); + if (wrapperTable->m_BoundaryShapeIterator_GetCurrentBoundaryShape == nullptr) + throw std::runtime_error("Could not call Lib3MF method BoundaryShapeIterator::GetCurrentBoundaryShape."); + Lib3MFHandle instanceHandle = CLib3MFBaseClass::getHandle(args.Holder()); + Lib3MFResult errorCode = wrapperTable->m_BoundaryShapeIterator_GetCurrentBoundaryShape(instanceHandle, &hReturnResource); + CheckError(isolate, wrapperTable, instanceHandle, errorCode); + Local instanceObjResource = CLib3MFBoundaryShape::NewInstance(args.Holder(), hReturnResource); + args.GetReturnValue().Set(instanceObjResource); + + } catch (std::exception & E) { + RaiseError(isolate, E.what()); + } +} + /************************************************************************************************************************* Class CLib3MFMetaData Implementation **************************************************************************************************************************/ @@ -21475,6 +21555,7 @@ void CLib3MFModel::Init() NODE_SET_PROTOTYPE_METHOD(tpl, "AddFunctionFromImage3D", AddFunctionFromImage3D); NODE_SET_PROTOTYPE_METHOD(tpl, "AddVolumeData", AddVolumeData); NODE_SET_PROTOTYPE_METHOD(tpl, "AddBoundaryShape", AddBoundaryShape); + NODE_SET_PROTOTYPE_METHOD(tpl, "GetBoundaryShapes", GetBoundaryShapes); constructor.Reset(isolate, tpl->GetFunction(isolate->GetCurrentContext()).ToLocalChecked()); } @@ -23272,6 +23353,29 @@ void CLib3MFModel::AddBoundaryShape(const FunctionCallbackInfo& args) } } + +void CLib3MFModel::GetBoundaryShapes(const FunctionCallbackInfo& args) +{ + Isolate* isolate = args.GetIsolate(); + HandleScope scope(isolate); + try { + Lib3MFHandle hReturnResourceIterator = nullptr; + sLib3MFDynamicWrapperTable * wrapperTable = CLib3MFBaseClass::getDynamicWrapperTable(args.Holder()); + if (wrapperTable == nullptr) + throw std::runtime_error("Could not get wrapper table for Lib3MF method GetBoundaryShapes."); + if (wrapperTable->m_Model_GetBoundaryShapes == nullptr) + throw std::runtime_error("Could not call Lib3MF method Model::GetBoundaryShapes."); + Lib3MFHandle instanceHandle = CLib3MFBaseClass::getHandle(args.Holder()); + Lib3MFResult errorCode = wrapperTable->m_Model_GetBoundaryShapes(instanceHandle, &hReturnResourceIterator); + CheckError(isolate, wrapperTable, instanceHandle, errorCode); + Local instanceObjResourceIterator = CLib3MFBoundaryShapeIterator::NewInstance(args.Holder(), hReturnResourceIterator); + args.GetReturnValue().Set(instanceObjResourceIterator); + + } catch (std::exception & E) { + RaiseError(isolate, E.what()); + } +} + /************************************************************************************************************************* Class CLib3MFWrapper Implementation **************************************************************************************************************************/ diff --git a/Autogenerated/Bindings/NodeJS/lib3mf_nodewrapper.h b/Autogenerated/Bindings/NodeJS/lib3mf_nodewrapper.h index c434ce2c6..e8e1de31b 100644 --- a/Autogenerated/Bindings/NodeJS/lib3mf_nodewrapper.h +++ b/Autogenerated/Bindings/NodeJS/lib3mf_nodewrapper.h @@ -425,6 +425,24 @@ class CLib3MFFunctionIterator : public CLib3MFBaseClass { }; +/************************************************************************************************************************* + Class CLib3MFBoundaryShapeIterator +**************************************************************************************************************************/ +class CLib3MFBoundaryShapeIterator : public CLib3MFBaseClass { +private: + static void New(const v8::FunctionCallbackInfo& args); + static v8::Persistent constructor; + static void GetCurrentBoundaryShape(const v8::FunctionCallbackInfo& args); + +public: + CLib3MFBoundaryShapeIterator(); + ~CLib3MFBoundaryShapeIterator(); + + static void Init(); + static v8::Local NewInstance(v8::Local, Lib3MFHandle pHandle); + +}; + /************************************************************************************************************************* Class CLib3MFMetaData **************************************************************************************************************************/ @@ -2558,6 +2576,7 @@ class CLib3MFModel : public CLib3MFBaseClass { static void AddFunctionFromImage3D(const v8::FunctionCallbackInfo& args); static void AddVolumeData(const v8::FunctionCallbackInfo& args); static void AddBoundaryShape(const v8::FunctionCallbackInfo& args); + static void GetBoundaryShapes(const v8::FunctionCallbackInfo& args); public: CLib3MFModel(); diff --git a/Autogenerated/Bindings/NodeJS/lib3mf_types.h b/Autogenerated/Bindings/NodeJS/lib3mf_types.h index 4477cae87..924d2a66f 100644 --- a/Autogenerated/Bindings/NodeJS/lib3mf_types.h +++ b/Autogenerated/Bindings/NodeJS/lib3mf_types.h @@ -222,6 +222,7 @@ typedef Lib3MFHandle Lib3MF_CompositeMaterialsIterator; typedef Lib3MFHandle Lib3MF_MultiPropertyGroupIterator; typedef Lib3MFHandle Lib3MF_Image3DIterator; typedef Lib3MFHandle Lib3MF_FunctionIterator; +typedef Lib3MFHandle Lib3MF_BoundaryShapeIterator; typedef Lib3MFHandle Lib3MF_MetaData; typedef Lib3MFHandle Lib3MF_MetaDataGroup; typedef Lib3MFHandle Lib3MF_Object; diff --git a/Autogenerated/Bindings/Pascal/Unit_Lib3MF.pas b/Autogenerated/Bindings/Pascal/Unit_Lib3MF.pas index dccfce9fa..be9c275a2 100644 --- a/Autogenerated/Bindings/Pascal/Unit_Lib3MF.pas +++ b/Autogenerated/Bindings/Pascal/Unit_Lib3MF.pas @@ -489,6 +489,7 @@ TLib3MFCompositeMaterialsIterator = class; TLib3MFMultiPropertyGroupIterator = class; TLib3MFImage3DIterator = class; TLib3MFFunctionIterator = class; + TLib3MFBoundaryShapeIterator = class; TLib3MFMetaData = class; TLib3MFMetaDataGroup = class; TLib3MFObject = class; @@ -1152,6 +1153,20 @@ TLib3MFModel = class; TLib3MFFunctionIterator_GetCurrentFunctionFunc = function(pFunctionIterator: TLib3MFHandle; out pResource: TLib3MFHandle): TLib3MFResult; cdecl; +(************************************************************************************************************************* + Function type definitions for BoundaryShapeIterator +**************************************************************************************************************************) + + (** + * Returns the BoundaryShape the iterator points at. + * + * @param[in] pBoundaryShapeIterator - BoundaryShapeIterator instance. + * @param[out] pResource - returns the MeshObject instance. + * @return error code or 0 (success) + *) + TLib3MFBoundaryShapeIterator_GetCurrentBoundaryShapeFunc = function(pBoundaryShapeIterator: TLib3MFHandle; out pResource: TLib3MFHandle): TLib3MFResult; cdecl; + + (************************************************************************************************************************* Function type definitions for MetaData **************************************************************************************************************************) @@ -6844,6 +6859,15 @@ TLib3MFModel = class; *) TLib3MFModel_AddBoundaryShapeFunc = function(pModel: TLib3MFHandle; out pBoundaryShapeInstance: TLib3MFHandle): TLib3MFResult; cdecl; + (** + * creates a resource iterator instance with all boundary shape resources. + * + * @param[in] pModel - Model instance. + * @param[out] pResourceIterator - returns the iterator instance. + * @return error code or 0 (success) + *) + TLib3MFModel_GetBoundaryShapesFunc = function(pModel: TLib3MFHandle; out pResourceIterator: TLib3MFHandle): TLib3MFResult; cdecl; + (************************************************************************************************************************* Global function definitions **************************************************************************************************************************) @@ -7316,6 +7340,18 @@ TLib3MFFunctionIterator = class(TLib3MFResourceIterator) end; +(************************************************************************************************************************* + Class definition for BoundaryShapeIterator +**************************************************************************************************************************) + + TLib3MFBoundaryShapeIterator = class(TLib3MFResourceIterator) + public + constructor Create(AWrapper: TLib3MFWrapper; AHandle: TLib3MFHandle); + destructor Destroy; override; + function GetCurrentBoundaryShape(): TLib3MFBoundaryShape; + end; + + (************************************************************************************************************************* Class definition for MetaData **************************************************************************************************************************) @@ -8886,6 +8922,7 @@ TLib3MFModel = class(TLib3MFBase) function AddFunctionFromImage3D(const AImage3DInstance: TLib3MFImage3D): TLib3MFFunctionFromImage3D; function AddVolumeData(): TLib3MFVolumeData; function AddBoundaryShape(): TLib3MFBoundaryShape; + function GetBoundaryShapes(): TLib3MFBoundaryShapeIterator; end; (************************************************************************************************************************* @@ -8945,6 +8982,7 @@ TLib3MFWrapper = class(TObject) FLib3MFMultiPropertyGroupIterator_GetCurrentMultiPropertyGroupFunc: TLib3MFMultiPropertyGroupIterator_GetCurrentMultiPropertyGroupFunc; FLib3MFImage3DIterator_GetCurrentImage3DFunc: TLib3MFImage3DIterator_GetCurrentImage3DFunc; FLib3MFFunctionIterator_GetCurrentFunctionFunc: TLib3MFFunctionIterator_GetCurrentFunctionFunc; + FLib3MFBoundaryShapeIterator_GetCurrentBoundaryShapeFunc: TLib3MFBoundaryShapeIterator_GetCurrentBoundaryShapeFunc; FLib3MFMetaData_GetNameSpaceFunc: TLib3MFMetaData_GetNameSpaceFunc; FLib3MFMetaData_SetNameSpaceFunc: TLib3MFMetaData_SetNameSpaceFunc; FLib3MFMetaData_GetNameFunc: TLib3MFMetaData_GetNameFunc; @@ -9473,6 +9511,7 @@ TLib3MFWrapper = class(TObject) FLib3MFModel_AddFunctionFromImage3DFunc: TLib3MFModel_AddFunctionFromImage3DFunc; FLib3MFModel_AddVolumeDataFunc: TLib3MFModel_AddVolumeDataFunc; FLib3MFModel_AddBoundaryShapeFunc: TLib3MFModel_AddBoundaryShapeFunc; + FLib3MFModel_GetBoundaryShapesFunc: TLib3MFModel_GetBoundaryShapesFunc; FLib3MFGetLibraryVersionFunc: TLib3MFGetLibraryVersionFunc; FLib3MFGetPrereleaseInformationFunc: TLib3MFGetPrereleaseInformationFunc; FLib3MFGetBuildInformationFunc: TLib3MFGetBuildInformationFunc; @@ -9552,6 +9591,7 @@ TLib3MFWrapper = class(TObject) property Lib3MFMultiPropertyGroupIterator_GetCurrentMultiPropertyGroupFunc: TLib3MFMultiPropertyGroupIterator_GetCurrentMultiPropertyGroupFunc read FLib3MFMultiPropertyGroupIterator_GetCurrentMultiPropertyGroupFunc; property Lib3MFImage3DIterator_GetCurrentImage3DFunc: TLib3MFImage3DIterator_GetCurrentImage3DFunc read FLib3MFImage3DIterator_GetCurrentImage3DFunc; property Lib3MFFunctionIterator_GetCurrentFunctionFunc: TLib3MFFunctionIterator_GetCurrentFunctionFunc read FLib3MFFunctionIterator_GetCurrentFunctionFunc; + property Lib3MFBoundaryShapeIterator_GetCurrentBoundaryShapeFunc: TLib3MFBoundaryShapeIterator_GetCurrentBoundaryShapeFunc read FLib3MFBoundaryShapeIterator_GetCurrentBoundaryShapeFunc; property Lib3MFMetaData_GetNameSpaceFunc: TLib3MFMetaData_GetNameSpaceFunc read FLib3MFMetaData_GetNameSpaceFunc; property Lib3MFMetaData_SetNameSpaceFunc: TLib3MFMetaData_SetNameSpaceFunc read FLib3MFMetaData_SetNameSpaceFunc; property Lib3MFMetaData_GetNameFunc: TLib3MFMetaData_GetNameFunc read FLib3MFMetaData_GetNameFunc; @@ -10080,6 +10120,7 @@ TLib3MFWrapper = class(TObject) property Lib3MFModel_AddFunctionFromImage3DFunc: TLib3MFModel_AddFunctionFromImage3DFunc read FLib3MFModel_AddFunctionFromImage3DFunc; property Lib3MFModel_AddVolumeDataFunc: TLib3MFModel_AddVolumeDataFunc read FLib3MFModel_AddVolumeDataFunc; property Lib3MFModel_AddBoundaryShapeFunc: TLib3MFModel_AddBoundaryShapeFunc read FLib3MFModel_AddBoundaryShapeFunc; + property Lib3MFModel_GetBoundaryShapesFunc: TLib3MFModel_GetBoundaryShapesFunc read FLib3MFModel_GetBoundaryShapesFunc; property Lib3MFGetLibraryVersionFunc: TLib3MFGetLibraryVersionFunc read FLib3MFGetLibraryVersionFunc; property Lib3MFGetPrereleaseInformationFunc: TLib3MFGetPrereleaseInformationFunc read FLib3MFGetPrereleaseInformationFunc; property Lib3MFGetBuildInformationFunc: TLib3MFGetBuildInformationFunc read FLib3MFGetBuildInformationFunc; @@ -10197,6 +10238,7 @@ TLib3MFPolymorphicFactory<_T:class; _B> = record function TLib3MFPolymorphicFactoryMakeMultiPropertyGroupIterator(Wrapper: TLib3MFWrapper; Handle: TLib3MFHandle): TLIB3MFMultiPropertyGroupIterator; function TLib3MFPolymorphicFactoryMakeImage3DIterator(Wrapper: TLib3MFWrapper; Handle: TLib3MFHandle): TLIB3MFImage3DIterator; function TLib3MFPolymorphicFactoryMakeFunctionIterator(Wrapper: TLib3MFWrapper; Handle: TLib3MFHandle): TLIB3MFFunctionIterator; + function TLib3MFPolymorphicFactoryMakeBoundaryShapeIterator(Wrapper: TLib3MFWrapper; Handle: TLib3MFHandle): TLIB3MFBoundaryShapeIterator; function TLib3MFPolymorphicFactoryMakeMetaData(Wrapper: TLib3MFWrapper; Handle: TLib3MFHandle): TLIB3MFMetaData; function TLib3MFPolymorphicFactoryMakeMetaDataGroup(Wrapper: TLib3MFWrapper; Handle: TLib3MFHandle): TLIB3MFMetaDataGroup; function TLib3MFPolymorphicFactoryMakeObject(Wrapper: TLib3MFWrapper; Handle: TLib3MFHandle): TLIB3MFObject; @@ -11017,6 +11059,7 @@ implementation QWord($C2BDF5D8CBBDB1F0): begin Obj := TLIB3MFMultiPropertyGroupIterator.Create(Wrapper, Handle); if Obj.inheritsFrom(_T) then Result := Obj as _T; end; // First 64 bits of SHA1 of a string: "Lib3MF::MultiPropertyGroupIterator" QWord($C4B8EC00A82BF336): begin Obj := TLIB3MFImage3DIterator.Create(Wrapper, Handle); if Obj.inheritsFrom(_T) then Result := Obj as _T; end; // First 64 bits of SHA1 of a string: "Lib3MF::Image3DIterator" QWord($40E9035363ACE65E): begin Obj := TLIB3MFFunctionIterator.Create(Wrapper, Handle); if Obj.inheritsFrom(_T) then Result := Obj as _T; end; // First 64 bits of SHA1 of a string: "Lib3MF::FunctionIterator" + QWord($9FBC898CF30CDEF3): begin Obj := TLIB3MFBoundaryShapeIterator.Create(Wrapper, Handle); if Obj.inheritsFrom(_T) then Result := Obj as _T; end; // First 64 bits of SHA1 of a string: "Lib3MF::BoundaryShapeIterator" 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($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" @@ -11187,6 +11230,10 @@ implementation begin Result := TLib3MFPolymorphicFactory.Make(Wrapper, Handle); end; + function TLib3MFPolymorphicFactoryMakeBoundaryShapeIterator(Wrapper: TLib3MFWrapper; Handle: TLib3MFHandle): TLIB3MFBoundaryShapeIterator; + begin + Result := TLib3MFPolymorphicFactory.Make(Wrapper, Handle); + end; function TLib3MFPolymorphicFactoryMakeMetaData(Wrapper: TLib3MFWrapper; Handle: TLib3MFHandle): TLIB3MFMetaData; begin Result := TLib3MFPolymorphicFactory.Make(Wrapper, Handle); @@ -12326,6 +12373,31 @@ implementation Result := TLib3MFPolymorphicFactory.Make(FWrapper, HResource); end; +(************************************************************************************************************************* + Class implementation for BoundaryShapeIterator +**************************************************************************************************************************) + + constructor TLib3MFBoundaryShapeIterator.Create(AWrapper: TLib3MFWrapper; AHandle: TLib3MFHandle); + begin + inherited Create(AWrapper, AHandle); + end; + + destructor TLib3MFBoundaryShapeIterator.Destroy; + begin + inherited; + end; + + function TLib3MFBoundaryShapeIterator.GetCurrentBoundaryShape(): TLib3MFBoundaryShape; + var + HResource: TLib3MFHandle; + begin + Result := nil; + HResource := nil; + FWrapper.CheckError(Self, FWrapper.Lib3MFBoundaryShapeIterator_GetCurrentBoundaryShapeFunc(FHandle, HResource)); + if Assigned(HResource) then + Result := TLib3MFPolymorphicFactory.Make(FWrapper, HResource); + end; + (************************************************************************************************************************* Class implementation for MetaData **************************************************************************************************************************) @@ -18724,6 +18796,17 @@ implementation Result := TLib3MFPolymorphicFactory.Make(FWrapper, HBoundaryShapeInstance); end; + function TLib3MFModel.GetBoundaryShapes(): TLib3MFBoundaryShapeIterator; + var + HResourceIterator: TLib3MFHandle; + begin + Result := nil; + HResourceIterator := nil; + FWrapper.CheckError(Self, FWrapper.Lib3MFModel_GetBoundaryShapesFunc(FHandle, HResourceIterator)); + if Assigned(HResourceIterator) then + Result := TLib3MFPolymorphicFactory.Make(FWrapper, HResourceIterator); + end; + (************************************************************************************************************************* Wrapper class implementation **************************************************************************************************************************) @@ -18796,6 +18879,7 @@ implementation FLib3MFMultiPropertyGroupIterator_GetCurrentMultiPropertyGroupFunc := LoadFunction('lib3mf_multipropertygroupiterator_getcurrentmultipropertygroup'); FLib3MFImage3DIterator_GetCurrentImage3DFunc := LoadFunction('lib3mf_image3diterator_getcurrentimage3d'); FLib3MFFunctionIterator_GetCurrentFunctionFunc := LoadFunction('lib3mf_functioniterator_getcurrentfunction'); + FLib3MFBoundaryShapeIterator_GetCurrentBoundaryShapeFunc := LoadFunction('lib3mf_boundaryshapeiterator_getcurrentboundaryshape'); FLib3MFMetaData_GetNameSpaceFunc := LoadFunction('lib3mf_metadata_getnamespace'); FLib3MFMetaData_SetNameSpaceFunc := LoadFunction('lib3mf_metadata_setnamespace'); FLib3MFMetaData_GetNameFunc := LoadFunction('lib3mf_metadata_getname'); @@ -19324,6 +19408,7 @@ implementation FLib3MFModel_AddFunctionFromImage3DFunc := LoadFunction('lib3mf_model_addfunctionfromimage3d'); FLib3MFModel_AddVolumeDataFunc := LoadFunction('lib3mf_model_addvolumedata'); FLib3MFModel_AddBoundaryShapeFunc := LoadFunction('lib3mf_model_addboundaryshape'); + FLib3MFModel_GetBoundaryShapesFunc := LoadFunction('lib3mf_model_getboundaryshapes'); FLib3MFGetLibraryVersionFunc := LoadFunction('lib3mf_getlibraryversion'); FLib3MFGetPrereleaseInformationFunc := LoadFunction('lib3mf_getprereleaseinformation'); FLib3MFGetBuildInformationFunc := LoadFunction('lib3mf_getbuildinformation'); @@ -19502,6 +19587,9 @@ implementation if AResult <> LIB3MF_SUCCESS then raise ELib3MFException.CreateCustomMessage(LIB3MF_ERROR_COULDNOTLOADLIBRARY, ''); AResult := ALookupMethod(PAnsiChar('lib3mf_functioniterator_getcurrentfunction'), @FLib3MFFunctionIterator_GetCurrentFunctionFunc); + if AResult <> LIB3MF_SUCCESS then + raise ELib3MFException.CreateCustomMessage(LIB3MF_ERROR_COULDNOTLOADLIBRARY, ''); + AResult := ALookupMethod(PAnsiChar('lib3mf_boundaryshapeiterator_getcurrentboundaryshape'), @FLib3MFBoundaryShapeIterator_GetCurrentBoundaryShapeFunc); if AResult <> LIB3MF_SUCCESS then raise ELib3MFException.CreateCustomMessage(LIB3MF_ERROR_COULDNOTLOADLIBRARY, ''); AResult := ALookupMethod(PAnsiChar('lib3mf_metadata_getnamespace'), @FLib3MFMetaData_GetNameSpaceFunc); @@ -21086,6 +21174,9 @@ implementation if AResult <> LIB3MF_SUCCESS then raise ELib3MFException.CreateCustomMessage(LIB3MF_ERROR_COULDNOTLOADLIBRARY, ''); AResult := ALookupMethod(PAnsiChar('lib3mf_model_addboundaryshape'), @FLib3MFModel_AddBoundaryShapeFunc); + if AResult <> LIB3MF_SUCCESS then + raise ELib3MFException.CreateCustomMessage(LIB3MF_ERROR_COULDNOTLOADLIBRARY, ''); + AResult := ALookupMethod(PAnsiChar('lib3mf_model_getboundaryshapes'), @FLib3MFModel_GetBoundaryShapesFunc); if AResult <> LIB3MF_SUCCESS then raise ELib3MFException.CreateCustomMessage(LIB3MF_ERROR_COULDNOTLOADLIBRARY, ''); AResult := ALookupMethod(PAnsiChar('lib3mf_getlibraryversion'), @FLib3MFGetLibraryVersionFunc); diff --git a/Autogenerated/Bindings/Python/Lib3MF.py b/Autogenerated/Bindings/Python/Lib3MF.py index 86fd4c929..4a9efb5b3 100644 --- a/Autogenerated/Bindings/Python/Lib3MF.py +++ b/Autogenerated/Bindings/Python/Lib3MF.py @@ -184,6 +184,7 @@ class FunctionTable: lib3mf_multipropertygroupiterator_getcurrentmultipropertygroup = None lib3mf_image3diterator_getcurrentimage3d = None lib3mf_functioniterator_getcurrentfunction = None + lib3mf_boundaryshapeiterator_getcurrentboundaryshape = None lib3mf_metadata_getnamespace = None lib3mf_metadata_setnamespace = None lib3mf_metadata_getname = None @@ -712,6 +713,7 @@ class FunctionTable: lib3mf_model_addfunctionfromimage3d = None lib3mf_model_addvolumedata = None lib3mf_model_addboundaryshape = None + lib3mf_model_getboundaryshapes = None '''Definition of Enumerations ''' @@ -1535,6 +1537,12 @@ def _loadFunctionTableFromMethod(self, symbolLookupMethodAddress): methodType = ctypes.CFUNCTYPE(ctypes.c_int32, ctypes.c_void_p, ctypes.POINTER(ctypes.c_void_p)) self.lib.lib3mf_functioniterator_getcurrentfunction = methodType(int(methodAddress.value)) + err = symbolLookupMethod(ctypes.c_char_p(str.encode("lib3mf_boundaryshapeiterator_getcurrentboundaryshape")), methodAddress) + if err != 0: + raise ELib3MFException(ErrorCodes.COULDNOTLOADLIBRARY, str(err)) + methodType = ctypes.CFUNCTYPE(ctypes.c_int32, ctypes.c_void_p, ctypes.POINTER(ctypes.c_void_p)) + self.lib.lib3mf_boundaryshapeiterator_getcurrentboundaryshape = methodType(int(methodAddress.value)) + err = symbolLookupMethod(ctypes.c_char_p(str.encode("lib3mf_metadata_getnamespace")), methodAddress) if err != 0: raise ELib3MFException(ErrorCodes.COULDNOTLOADLIBRARY, str(err)) @@ -4703,6 +4711,12 @@ def _loadFunctionTableFromMethod(self, symbolLookupMethodAddress): methodType = ctypes.CFUNCTYPE(ctypes.c_int32, ctypes.c_void_p, ctypes.POINTER(ctypes.c_void_p)) self.lib.lib3mf_model_addboundaryshape = methodType(int(methodAddress.value)) + err = symbolLookupMethod(ctypes.c_char_p(str.encode("lib3mf_model_getboundaryshapes")), methodAddress) + if err != 0: + raise ELib3MFException(ErrorCodes.COULDNOTLOADLIBRARY, str(err)) + methodType = ctypes.CFUNCTYPE(ctypes.c_int32, ctypes.c_void_p, ctypes.POINTER(ctypes.c_void_p)) + self.lib.lib3mf_model_getboundaryshapes = methodType(int(methodAddress.value)) + except AttributeError as ae: raise ELib3MFException(ErrorCodes.COULDNOTFINDLIBRARYEXPORT, ae.args[0]) @@ -4915,6 +4929,9 @@ def _loadFunctionTable(self): self.lib.lib3mf_functioniterator_getcurrentfunction.restype = ctypes.c_int32 self.lib.lib3mf_functioniterator_getcurrentfunction.argtypes = [ctypes.c_void_p, ctypes.POINTER(ctypes.c_void_p)] + self.lib.lib3mf_boundaryshapeiterator_getcurrentboundaryshape.restype = ctypes.c_int32 + self.lib.lib3mf_boundaryshapeiterator_getcurrentboundaryshape.argtypes = [ctypes.c_void_p, ctypes.POINTER(ctypes.c_void_p)] + self.lib.lib3mf_metadata_getnamespace.restype = ctypes.c_int32 self.lib.lib3mf_metadata_getnamespace.argtypes = [ctypes.c_void_p, ctypes.c_uint64, ctypes.POINTER(ctypes.c_uint64), ctypes.c_char_p] @@ -6499,6 +6516,9 @@ def _loadFunctionTable(self): self.lib.lib3mf_model_addboundaryshape.restype = ctypes.c_int32 self.lib.lib3mf_model_addboundaryshape.argtypes = [ctypes.c_void_p, ctypes.POINTER(ctypes.c_void_p)] + self.lib.lib3mf_model_getboundaryshapes.restype = ctypes.c_int32 + self.lib.lib3mf_model_getboundaryshapes.argtypes = [ctypes.c_void_p, ctypes.POINTER(ctypes.c_void_p)] + except AttributeError as ae: raise ELib3MFException(ErrorCodes.COULDNOTFINDLIBRARYEXPORT, ae.args[0]) @@ -6741,6 +6761,8 @@ def getObjectById_C4B8EC00A82BF336(self, handle, wrapper): # First 64 bits of SH return Image3DIterator(handle, wrapper) def getObjectById_40E9035363ACE65E(self, handle, wrapper): # First 64 bits of SHA1 of a string: "Lib3MF::FunctionIterator" return FunctionIterator(handle, wrapper) + def getObjectById_9FBC898CF30CDEF3(self, handle, wrapper): # First 64 bits of SHA1 of a string: "Lib3MF::BoundaryShapeIterator" + return BoundaryShapeIterator(handle, wrapper) def getObjectById_D17716D063DE2C22(self, handle, wrapper): # First 64 bits of SHA1 of a string: "Lib3MF::MetaData" return MetaData(handle, wrapper) def getObjectById_0C3B85369E9B25D3(self, handle, wrapper): # First 64 bits of SHA1 of a string: "Lib3MF::MetaDataGroup" @@ -7447,6 +7469,23 @@ def GetCurrentFunction(self): +''' Class Implementation for BoundaryShapeIterator +''' +class BoundaryShapeIterator(ResourceIterator): + def __init__(self, handle, wrapper): + ResourceIterator.__init__(self, handle, wrapper) + def GetCurrentBoundaryShape(self): + ResourceHandle = ctypes.c_void_p() + self._wrapper.checkError(self, self._wrapper.lib.lib3mf_boundaryshapeiterator_getcurrentboundaryshape(self._handle, ResourceHandle)) + if ResourceHandle: + ResourceObject = self._wrapper._polymorphicFactory(ResourceHandle) + else: + raise ELib3MFException(ErrorCodes.INVALIDCAST, 'Invalid return/output value') + + return ResourceObject + + + ''' Class Implementation for MetaData ''' class MetaData(Base): @@ -12770,4 +12809,14 @@ def AddBoundaryShape(self): return BoundaryShapeInstanceObject + def GetBoundaryShapes(self): + ResourceIteratorHandle = ctypes.c_void_p() + self._wrapper.checkError(self, self._wrapper.lib.lib3mf_model_getboundaryshapes(self._handle, ResourceIteratorHandle)) + if ResourceIteratorHandle: + ResourceIteratorObject = self._wrapper._polymorphicFactory(ResourceIteratorHandle) + else: + raise ELib3MFException(ErrorCodes.INVALIDCAST, 'Invalid return/output value') + + return ResourceIteratorObject + diff --git a/Autogenerated/Source/lib3mf_abi.hpp b/Autogenerated/Source/lib3mf_abi.hpp index 25d59d58f..d0e6cb422 100644 --- a/Autogenerated/Source/lib3mf_abi.hpp +++ b/Autogenerated/Source/lib3mf_abi.hpp @@ -601,6 +601,19 @@ LIB3MF_DECLSPEC Lib3MFResult lib3mf_image3diterator_getcurrentimage3d(Lib3MF_Ima */ LIB3MF_DECLSPEC Lib3MFResult lib3mf_functioniterator_getcurrentfunction(Lib3MF_FunctionIterator pFunctionIterator, Lib3MF_Function * pResource); +/************************************************************************************************************************* + Class definition for BoundaryShapeIterator +**************************************************************************************************************************/ + +/** +* Returns the BoundaryShape the iterator points at. +* +* @param[in] pBoundaryShapeIterator - BoundaryShapeIterator instance. +* @param[out] pResource - returns the MeshObject instance. +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_boundaryshapeiterator_getcurrentboundaryshape(Lib3MF_BoundaryShapeIterator pBoundaryShapeIterator, Lib3MF_BoundaryShape * pResource); + /************************************************************************************************************************* Class definition for MetaData **************************************************************************************************************************/ @@ -6199,6 +6212,15 @@ LIB3MF_DECLSPEC Lib3MFResult lib3mf_model_addvolumedata(Lib3MF_Model pModel, Lib */ LIB3MF_DECLSPEC Lib3MFResult lib3mf_model_addboundaryshape(Lib3MF_Model pModel, Lib3MF_BoundaryShape * pBoundaryShapeInstance); +/** +* creates a resource iterator instance with all boundary shape resources. +* +* @param[in] pModel - Model instance. +* @param[out] pResourceIterator - returns the iterator instance. +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_model_getboundaryshapes(Lib3MF_Model pModel, Lib3MF_BoundaryShapeIterator * pResourceIterator); + /************************************************************************************************************************* Global functions **************************************************************************************************************************/ diff --git a/Autogenerated/Source/lib3mf_interfaces.hpp b/Autogenerated/Source/lib3mf_interfaces.hpp index 8063abb6c..31be0fdda 100644 --- a/Autogenerated/Source/lib3mf_interfaces.hpp +++ b/Autogenerated/Source/lib3mf_interfaces.hpp @@ -69,6 +69,7 @@ class ICompositeMaterialsIterator; class IMultiPropertyGroupIterator; class IImage3DIterator; class IFunctionIterator; +class IBoundaryShapeIterator; class IMetaData; class IMetaDataGroup; class IObject; @@ -1024,6 +1025,32 @@ class IFunctionIterator : public virtual IResourceIterator { typedef IBaseSharedPtr PIFunctionIterator; +/************************************************************************************************************************* + Class interface for BoundaryShapeIterator +**************************************************************************************************************************/ + +class IBoundaryShapeIterator : public virtual IResourceIterator { +public: + /** + * IBoundaryShapeIterator::ClassTypeId - Get Class Type Id + * @return Class type as a 64 bits integer + */ + Lib3MF_uint64 ClassTypeId() override + { + return 0x9FBC898CF30CDEF3UL; // First 64 bits of SHA1 of a string: "Lib3MF::BoundaryShapeIterator" + } + + /** + * IBoundaryShapeIterator::GetCurrentBoundaryShape - Returns the BoundaryShape the iterator points at. + * @return returns the MeshObject instance. + */ + virtual IBoundaryShape * GetCurrentBoundaryShape() = 0; + +}; + +typedef IBaseSharedPtr PIBoundaryShapeIterator; + + /************************************************************************************************************************* Class interface for MetaData **************************************************************************************************************************/ @@ -6479,6 +6506,12 @@ class IModel : public virtual IBase { */ virtual IBoundaryShape * AddBoundaryShape() = 0; + /** + * IModel::GetBoundaryShapes - creates a resource iterator instance with all boundary shape resources. + * @return returns the iterator instance. + */ + virtual IBoundaryShapeIterator * GetBoundaryShapes() = 0; + }; typedef IBaseSharedPtr PIModel; diff --git a/Autogenerated/Source/lib3mf_interfacewrapper.cpp b/Autogenerated/Source/lib3mf_interfacewrapper.cpp index d4731306b..1d7104463 100644 --- a/Autogenerated/Source/lib3mf_interfacewrapper.cpp +++ b/Autogenerated/Source/lib3mf_interfacewrapper.cpp @@ -1954,6 +1954,46 @@ Lib3MFResult lib3mf_functioniterator_getcurrentfunction(Lib3MF_FunctionIterator } +/************************************************************************************************************************* + Class implementation for BoundaryShapeIterator +**************************************************************************************************************************/ +Lib3MFResult lib3mf_boundaryshapeiterator_getcurrentboundaryshape(Lib3MF_BoundaryShapeIterator pBoundaryShapeIterator, Lib3MF_BoundaryShape * pResource) +{ + IBase* pIBaseClass = (IBase *)pBoundaryShapeIterator; + + PLib3MFInterfaceJournalEntry pJournalEntry; + try { + if (m_GlobalJournal.get() != nullptr) { + pJournalEntry = m_GlobalJournal->beginClassMethod(pBoundaryShapeIterator, "BoundaryShapeIterator", "GetCurrentBoundaryShape"); + } + if (pResource == nullptr) + throw ELib3MFInterfaceException (LIB3MF_ERROR_INVALIDPARAM); + IBase* pBaseResource(nullptr); + IBoundaryShapeIterator* pIBoundaryShapeIterator = dynamic_cast(pIBaseClass); + if (!pIBoundaryShapeIterator) + throw ELib3MFInterfaceException(LIB3MF_ERROR_INVALIDCAST); + + pBaseResource = pIBoundaryShapeIterator->GetCurrentBoundaryShape(); + + *pResource = (IBase*)(pBaseResource); + if (pJournalEntry.get() != nullptr) { + pJournalEntry->addHandleResult("Resource", *pResource); + 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 MetaData **************************************************************************************************************************/ @@ -22456,6 +22496,42 @@ Lib3MFResult lib3mf_model_addboundaryshape(Lib3MF_Model pModel, Lib3MF_BoundaryS } } +Lib3MFResult lib3mf_model_getboundaryshapes(Lib3MF_Model pModel, Lib3MF_BoundaryShapeIterator * pResourceIterator) +{ + IBase* pIBaseClass = (IBase *)pModel; + + PLib3MFInterfaceJournalEntry pJournalEntry; + try { + if (m_GlobalJournal.get() != nullptr) { + pJournalEntry = m_GlobalJournal->beginClassMethod(pModel, "Model", "GetBoundaryShapes"); + } + if (pResourceIterator == nullptr) + throw ELib3MFInterfaceException (LIB3MF_ERROR_INVALIDPARAM); + IBase* pBaseResourceIterator(nullptr); + IModel* pIModel = dynamic_cast(pIBaseClass); + if (!pIModel) + throw ELib3MFInterfaceException(LIB3MF_ERROR_INVALIDCAST); + + pBaseResourceIterator = pIModel->GetBoundaryShapes(); + + *pResourceIterator = (IBase*)(pBaseResourceIterator); + if (pJournalEntry.get() != nullptr) { + pJournalEntry->addHandleResult("ResourceIterator", *pResourceIterator); + 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()); + } +} + /************************************************************************************************************************* @@ -22571,6 +22647,8 @@ Lib3MFResult Lib3MF::Impl::Lib3MF_GetProcAddress (const char * pProcName, void * *ppProcAddress = (void*) &lib3mf_image3diterator_getcurrentimage3d; if (sProcName == "lib3mf_functioniterator_getcurrentfunction") *ppProcAddress = (void*) &lib3mf_functioniterator_getcurrentfunction; + if (sProcName == "lib3mf_boundaryshapeiterator_getcurrentboundaryshape") + *ppProcAddress = (void*) &lib3mf_boundaryshapeiterator_getcurrentboundaryshape; if (sProcName == "lib3mf_metadata_getnamespace") *ppProcAddress = (void*) &lib3mf_metadata_getnamespace; if (sProcName == "lib3mf_metadata_setnamespace") @@ -23627,6 +23705,8 @@ Lib3MFResult Lib3MF::Impl::Lib3MF_GetProcAddress (const char * pProcName, void * *ppProcAddress = (void*) &lib3mf_model_addvolumedata; if (sProcName == "lib3mf_model_addboundaryshape") *ppProcAddress = (void*) &lib3mf_model_addboundaryshape; + if (sProcName == "lib3mf_model_getboundaryshapes") + *ppProcAddress = (void*) &lib3mf_model_getboundaryshapes; if (sProcName == "lib3mf_getlibraryversion") *ppProcAddress = (void*) &lib3mf_getlibraryversion; if (sProcName == "lib3mf_getprereleaseinformation") diff --git a/Autogenerated/Source/lib3mf_types.hpp b/Autogenerated/Source/lib3mf_types.hpp index 2b3aa5aa6..3860a5709 100644 --- a/Autogenerated/Source/lib3mf_types.hpp +++ b/Autogenerated/Source/lib3mf_types.hpp @@ -221,6 +221,7 @@ typedef Lib3MFHandle Lib3MF_CompositeMaterialsIterator; typedef Lib3MFHandle Lib3MF_MultiPropertyGroupIterator; typedef Lib3MFHandle Lib3MF_Image3DIterator; typedef Lib3MFHandle Lib3MF_FunctionIterator; +typedef Lib3MFHandle Lib3MF_BoundaryShapeIterator; typedef Lib3MFHandle Lib3MF_MetaData; typedef Lib3MFHandle Lib3MF_MetaDataGroup; typedef Lib3MFHandle Lib3MF_Object; diff --git a/AutomaticComponentToolkit/lib3mf.xml b/AutomaticComponentToolkit/lib3mf.xml index a1a3d9de4..b9d8fe9fb 100644 --- a/AutomaticComponentToolkit/lib3mf.xml +++ b/AutomaticComponentToolkit/lib3mf.xml @@ -666,6 +666,14 @@ + + + + + + + + + + PModelVolumeData; + class BoundaryShapeObject; + typedef std::shared_ptr PBoundaryShapeObject; + // The Model class implements the unification of all model-file in a 3MF package // It should be understood as a "MultiModel" class CModel { @@ -168,6 +171,7 @@ namespace NMR { std::vector m_Image3DLookup; std::vector m_FunctionLookup; // for implicit models std::vector m_VolumeDataLookup; + std::vector m_boundaryShapeObjectLookup; // The KeyStore reference PKeyStore m_pKeyStore; @@ -321,6 +325,7 @@ namespace NMR { nfUint32 getVolumeDataCount(); PModelResource getVolumeDataResource(_In_ nfUint32 nIndex); CModelVolumeData* getVolumeData(_In_ nfUint32 nIndex); + // Clear all build items and Resources void clearAll (); diff --git a/Include/Model/Reader/Volumetric2201/NMR_ModelReaderNode_BoundaryShape.h b/Include/Model/Reader/Volumetric2201/NMR_ModelReaderNode_BoundaryShape.h index d03b189c9..9d2d369ec 100644 --- a/Include/Model/Reader/Volumetric2201/NMR_ModelReaderNode_BoundaryShape.h +++ b/Include/Model/Reader/Volumetric2201/NMR_ModelReaderNode_BoundaryShape.h @@ -38,7 +38,7 @@ Reader for boundary shape objects namespace NMR { - class CModelReaderNode_BoundaryShape : public CModelReaderNode100_Object + class CModelReaderNode_BoundaryShape : public CModelReaderNode { private: PModelBoundaryShapeObject m_pBoundaryShape; @@ -70,7 +70,7 @@ namespace NMR public: CModelReaderNode_BoundaryShape() = delete; - CModelReaderNode_BoundaryShape(CModel* pModel, PModelWarnings pWarnings, + CModelReaderNode_BoundaryShape(CModel* pModel, PModelBoundaryShapeObject boundaryShape, PModelWarnings pWarnings, PProgressMonitor pProgressMonitor); void parseXML(_In_ CXmlReader* pXMLReader) override; diff --git a/Include/Model/Writer/NMR_ModelWriterNode_BoundaryShape.h b/Include/Model/Writer/NMR_ModelWriterNode_BoundaryShape.h index c5d66925e..c1b6bc054 100644 --- a/Include/Model/Writer/NMR_ModelWriterNode_BoundaryShape.h +++ b/Include/Model/Writer/NMR_ModelWriterNode_BoundaryShape.h @@ -54,6 +54,7 @@ namespace NMR public: CModelWriterNode_BoundaryShape() = delete; CModelWriterNode_BoundaryShape(CModel * pModel, + CModelBoundaryShapeObject * pBoundaryShape, CXmlWriter * pXMLWriter, PProgressMonitor pProgressMonitor); @@ -63,6 +64,7 @@ namespace NMR void writeBoundaryShapeResources(); void writeBoundaryShapeResource(CModelBoundaryShapeObject& boundaryShape); + CModelBoundaryShapeObject * m_pBoundaryShape = nullptr; }; } diff --git a/Source/API/lib3mf_boundaryshape.cpp b/Source/API/lib3mf_boundaryshape.cpp index 3ed3bf861..f71c88d95 100644 --- a/Source/API/lib3mf_boundaryshape.cpp +++ b/Source/API/lib3mf_boundaryshape.cpp @@ -34,6 +34,7 @@ Abstract: This is a stub class definition of CBoundaryShape // Include custom headers here. #include "lib3mf_meshobject.hpp" #include "lib3mf_utils.hpp" +#include "lib3mf_function.hpp" #include "Model/Classes/NMR_ModelBoundaryShapeObject.h" #include "Model/Classes/NMR_ModelFunction.h" #include "Model/Classes/NMR_ModelMeshObject.h" @@ -45,9 +46,34 @@ using namespace Lib3MF::Impl; Class definition of CBoundaryShape **************************************************************************************************************************/ + +IBoundaryShape* CBoundaryShape::fnCreateBoundaryShapeFromModelResource(NMR::PModelResource pResource, bool bFailIfUnkownClass) { + + if (!pResource.get()) + throw ELib3MFInterfaceException(LIB3MF_ERROR_INVALIDPARAM); + + NMR::CModelBoundaryShapeObject * BoundaryShapeObject = dynamic_cast (pResource.get()); + if (BoundaryShapeObject) { + return new CBoundaryShape(pResource); + } + + if (bFailIfUnkownClass) + throw ELib3MFInterfaceException(NMR_ERROR_UNKNOWNMODELRESOURCE); + + return nullptr; +} + + + IFunction * CBoundaryShape::GetFunction() { - throw ELib3MFInterfaceException(LIB3MF_ERROR_NOTIMPLEMENTED); + auto boundaryShape = boundaryShapeObject(); + auto function = boundaryShape->getFunction(); + if (!function) + { + return nullptr; + } + return new CFunction(function); } NMR::PModelBoundaryShapeObject diff --git a/Source/API/lib3mf_boundaryshapeiterator.cpp b/Source/API/lib3mf_boundaryshapeiterator.cpp new file mode 100644 index 000000000..7121cfe67 --- /dev/null +++ b/Source/API/lib3mf_boundaryshapeiterator.cpp @@ -0,0 +1,48 @@ +/*++ + +Copyright (C) 2024 3MF Consortium (Original Author) + +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this +list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation +and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR +ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +Abstract: This is a stub class definition of CBoundaryShapeIterator + +*/ + +#include "lib3mf_boundaryshapeiterator.hpp" +#include "lib3mf_interfaceexception.hpp" + +// Include custom headers here. +#include "lib3mf_boundaryshape.hpp" + + +using namespace Lib3MF::Impl; + +/************************************************************************************************************************* + Class definition of CBoundaryShapeIterator +**************************************************************************************************************************/ + +IBoundaryShape * CBoundaryShapeIterator::GetCurrentBoundaryShape() +{ + return CBoundaryShape::fnCreateBoundaryShapeFromModelResource(GetCurrentResource(), true); +} + diff --git a/Source/API/lib3mf_meshobject.cpp b/Source/API/lib3mf_meshobject.cpp index 95b42e7f6..cebef9773 100644 --- a/Source/API/lib3mf_meshobject.cpp +++ b/Source/API/lib3mf_meshobject.cpp @@ -399,5 +399,16 @@ IVolumeData * CMeshObject::GetVolumeData() void CMeshObject::SetVolumeData(IVolumeData* pTheVolumeData) { - throw ELib3MFInterfaceException(LIB3MF_ERROR_NOTIMPLEMENTED); + NMR::CModel * pModel = meshObject()->getModel(); + if (pModel == nullptr) + throw ELib3MFInterfaceException(LIB3MF_ERROR_INVALIDOBJECT); + + NMR::PModelResource pResource = pModel->findResource(pTheVolumeData->GetResourceID()); + + NMR::PModelVolumeData pVolumeData = std::dynamic_pointer_cast(pResource); + + if (pVolumeData == nullptr) + throw ELib3MFInterfaceException(LIB3MF_ERROR_INVALIDOBJECT); + + meshObject()->setVolumeData(pVolumeData); } \ No newline at end of file diff --git a/Source/API/lib3mf_model.cpp b/Source/API/lib3mf_model.cpp index d7c3f07cf..fb481743b 100644 --- a/Source/API/lib3mf_model.cpp +++ b/Source/API/lib3mf_model.cpp @@ -68,6 +68,7 @@ Abstract: This is a stub class definition of CModel #include "lib3mf_functionfromimage3d.hpp" #include "lib3mf_volumedata.hpp" #include "lib3mf_boundaryshape.hpp" +#include "lib3mf_boundaryshapeiterator.hpp" // Include custom headers here. #include "Model/Classes/NMR_ModelMeshObject.h" @@ -175,6 +176,14 @@ IResource* CModel::createIResourceFromModelResource(NMR::PModelResource pResourc { return new CFunctionFromImage3D(p); } + + if (auto p = std::dynamic_pointer_cast(pResource)) { + return new CVolumeData(p); + } + + if (auto p = std::dynamic_pointer_cast(pResource)) { + return new CBoundaryShape(p); + } if (bFailIfUnkownClass) throw ELib3MFInterfaceException(NMR_ERROR_UNKNOWNMODELRESOURCE); @@ -906,3 +915,16 @@ IBoundaryShape* CModel::AddBoundaryShape() return new CBoundaryShape(pNewResource); } +IBoundaryShapeIterator * CModel::GetBoundaryShapes() +{ + auto pResult = std::unique_ptr(new CBoundaryShapeIterator()); + Lib3MF_uint32 nObjectsCount = model().getObjectCount(); + + for (Lib3MF_uint32 nIdx = 0; nIdx < nObjectsCount; nIdx++) { + auto resource = model().getObjectResource(nIdx); + if (dynamic_cast(resource.get())) + pResult->addResource(resource); + } + return pResult.release(); +} + diff --git a/Source/API/lib3mf_volumedata.cpp b/Source/API/lib3mf_volumedata.cpp index 1c6b3c2c7..adac4da5c 100644 --- a/Source/API/lib3mf_volumedata.cpp +++ b/Source/API/lib3mf_volumedata.cpp @@ -46,15 +46,16 @@ using namespace Lib3MF::Impl; Class definition of CVolumeData **************************************************************************************************************************/ -// CVolumeData::CVolumeData(NMR::PModelMeshObject pMeshObject, NMR::PModelVolumeData pVolumeData) -// : m_pMeshObject(pMeshObject) , m_pVolumeData(pVolumeData) -// { -// } CVolumeData::CVolumeData(NMR::PModelResource pResource) : CResource(pResource) { + if (!pResource.get()) + throw ELib3MFInterfaceException(LIB3MF_ERROR_INVALIDPARAM); + m_pVolumeData = std::dynamic_pointer_cast(pResource); + if (!m_pVolumeData) + throw ELib3MFInterfaceException(LIB3MF_ERROR_INVALIDCAST); } @@ -121,7 +122,7 @@ void CVolumeData::RemoveProperty(const Lib3MF_uint32 nIndex) IVolumeDataColor* Lib3MF::Impl::CVolumeData::CreateNewColor( IFunction* pTheFunction) { - NMR::CModel* pModel = m_pMeshObject->getModel(); + NMR::CModel* pModel = m_pVolumeData->getModel(); NMR::PModelResource pResource = pModel->findResource(pTheFunction->GetUniqueResourceID()); NMR::PModelFunction pFunction = std::dynamic_pointer_cast(pResource); @@ -141,7 +142,7 @@ IVolumeDataColor* Lib3MF::Impl::CVolumeData::CreateNewColor( IVolumeDataProperty * Lib3MF::Impl::CVolumeData::AddPropertyFromFunction(const std::string & sName, IFunction * pTheFunction) { - NMR::CModel* pModel = m_pMeshObject->getModel(); + NMR::CModel* pModel = m_pVolumeData->getModel(); NMR::PModelResource pResource = pModel->findResource(pTheFunction->GetUniqueResourceID()); NMR::PModelFunction pFunction = std::dynamic_pointer_cast(pResource); diff --git a/Source/Model/Classes/NMR_Model.cpp b/Source/Model/Classes/NMR_Model.cpp index 98951c208..ce4ed48f2 100644 --- a/Source/Model/Classes/NMR_Model.cpp +++ b/Source/Model/Classes/NMR_Model.cpp @@ -1622,6 +1622,5 @@ namespace NMR { return dynamic_cast(pResource.get()); } - } // namespace NMR diff --git a/Source/Model/Classes/NMR_ModelBoundaryShapeObject.cpp b/Source/Model/Classes/NMR_ModelBoundaryShapeObject.cpp index cbb783e25..12c2305d9 100644 --- a/Source/Model/Classes/NMR_ModelBoundaryShapeObject.cpp +++ b/Source/Model/Classes/NMR_ModelBoundaryShapeObject.cpp @@ -47,7 +47,6 @@ namespace NMR const ModelResourceID sID, CModel* pModel) : CModelObject(sID, pModel) { - m_pVolumeData = std::make_shared( sID, pModel); } CModelBoundaryShapeObject::~CModelBoundaryShapeObject() {} diff --git a/Source/Model/Classes/NMR_ModelMeshObject.cpp b/Source/Model/Classes/NMR_ModelMeshObject.cpp index afb1cad50..337fd0520 100644 --- a/Source/Model/Classes/NMR_ModelMeshObject.cpp +++ b/Source/Model/Classes/NMR_ModelMeshObject.cpp @@ -43,7 +43,6 @@ namespace NMR { { m_pMesh = std::make_shared(); m_pBeamLatticeAttributes = std::make_shared(); - m_pVolumeData = std::make_shared(sID, pModel); } CModelMeshObject::CModelMeshObject(_In_ const ModelResourceID sID, _In_ CModel * pModel, _In_ PMesh pMesh) @@ -53,7 +52,6 @@ namespace NMR { if (m_pMesh.get() == nullptr) m_pMesh = std::make_shared(); m_pBeamLatticeAttributes = std::make_shared(); - m_pVolumeData = std::make_shared(sID, pModel); } CModelMeshObject::~CModelMeshObject() diff --git a/Source/Model/Reader/Volumetric2201/NMR_ModelReaderNode_BoundaryShape.cpp b/Source/Model/Reader/Volumetric2201/NMR_ModelReaderNode_BoundaryShape.cpp index 487b38029..6a3fa34c0 100644 --- a/Source/Model/Reader/Volumetric2201/NMR_ModelReaderNode_BoundaryShape.cpp +++ b/Source/Model/Reader/Volumetric2201/NMR_ModelReaderNode_BoundaryShape.cpp @@ -43,8 +43,9 @@ namespace NMR { NMR::CModelReaderNode_BoundaryShape::CModelReaderNode_BoundaryShape( - CModel * pModel, PModelWarnings pWarnings, PProgressMonitor pProgressMonitor) - : CModelReaderNode100_Object(pModel, pWarnings, pProgressMonitor), m_parentModel(pModel) + CModel * pModel, PModelBoundaryShapeObject boundaryShape, + PModelWarnings pWarnings, PProgressMonitor pProgressMonitor) + : CModelReaderNode(pWarnings, pProgressMonitor), m_parentModel(pModel), m_pBoundaryShape(std::move(boundaryShape)) { } @@ -52,18 +53,12 @@ namespace NMR void CModelReaderNode_BoundaryShape::parseXML(CXmlReader* pXMLReader) { __NMRASSERT(pXMLReader); - CModelReaderNode100_Object::parseXML(pXMLReader); - // Parse name parseName(pXMLReader); // Parse Attributes parseAttributes(pXMLReader); - // Create BoundaryShape - m_pBoundaryShape = - std::make_shared(m_resID, m_parentModel); - // Parse Content parseContent(pXMLReader); @@ -147,14 +142,11 @@ namespace NMR m_pBoundaryShape->setVolumeData(pVolumeData); } - - - m_parentModel->addResource(m_pBoundaryShape); } void CModelReaderNode_BoundaryShape::OnAttribute( const nfChar* pAttributeName, const nfChar* pAttributeValue) - { + { if (strcmp(pAttributeName, XML_3MF_ATTRIBUTE_BOUNDARY_SHAPE_ID) == 0) { m_resID = fnStringToUint32(pAttributeValue); diff --git a/Source/Model/Reader/v100/NMR_ModelReaderNode100_Object.cpp b/Source/Model/Reader/v100/NMR_ModelReaderNode100_Object.cpp index 3ccd2dd9e..562ca6062 100644 --- a/Source/Model/Reader/v100/NMR_ModelReaderNode100_Object.cpp +++ b/Source/Model/Reader/v100/NMR_ModelReaderNode100_Object.cpp @@ -36,6 +36,7 @@ Stream. #include "Model/Reader/v100/NMR_ModelReaderNode100_Mesh.h" #include "Model/Reader/v100/NMR_ModelReaderNode100_MetaDataGroup.h" #include "Model/Reader/v100/NMR_ModelReaderNode100_Components.h" +#include "Model/Reader/Volumetric2201/NMR_ModelReaderNode_BoundaryShape.h" #include "Model/Classes/NMR_ModelConstants.h" #include "Model/Classes/NMR_ModelMeshObject.h" @@ -316,7 +317,28 @@ namespace NMR { } - } + if(strcmp(pNameSpace, XML_3MF_NAMESPACE_VOLUMETRICSPEC) == 0) //Seems really wiered that object types defined by extensions have to be handled here + { + if(strcmp(pChildName, XML_3MF_ELEMENT_BOUNDARY_SHAPE) == 0) + { + auto boundaryShape = std::make_shared(m_nID, m_pModel); + + PModelReaderNode pXMLNode = + std::make_shared( + m_pModel, boundaryShape, m_pWarnings, m_pProgressMonitor); + pXMLNode->parseXML(pXMLReader); + m_pObject = boundaryShape; + m_pModel->addResource(m_pObject); + + } + else + { + m_pWarnings->addException( + CNMRException(NMR_ERROR_NAMESPACE_INVALID_ELEMENT), + mrwInvalidOptionalValue); + } + } + } // Create the object-level property from m_nObjectLevelPropertyID, if defined void CModelReaderNode100_Object::createDefaultProperties() diff --git a/Source/Model/Reader/v100/NMR_ModelReaderNode100_Resources.cpp b/Source/Model/Reader/v100/NMR_ModelReaderNode100_Resources.cpp index 74760a48c..43609791c 100644 --- a/Source/Model/Reader/v100/NMR_ModelReaderNode100_Resources.cpp +++ b/Source/Model/Reader/v100/NMR_ModelReaderNode100_Resources.cpp @@ -43,6 +43,8 @@ XML Model Stream. #include "Model/Reader/Volumetric2201/NMR_ModelReaderNode_Volumetric2201_Image3D.h" #include "Model/Reader/Volumetric2201/NMR_ModelReaderNode_Implicit_Function.h" #include "Model/Reader/Volumetric2201/NMR_ModelReaderNode_FunctionFromImage3D.h" +#include "Model/Reader/Volumetric2201/NMR_ModelReaderNode_BoundaryShape.h" +#include "Model/Reader/Volumetric2201/NMR_ModelReaderNode_Volumetric2201_VolumeData.h" #include "Model/Classes/NMR_ModelConstants.h" #include "Common/NMR_StringUtils.h" @@ -146,7 +148,6 @@ namespace NMR { if (strcmp(pNameSpace, XML_3MF_NAMESPACE_VOLUMETRICSPEC) == 0) { if (strcmp(pChildName, XML_3MF_ELEMENT_IMAGE3D) == 0) { - PModelReaderNode pXMLNode = std::make_shared( m_pModel, m_pWarnings); pXMLNode->parseXML(pXMLReader); diff --git a/Source/Model/Writer/NMR_ModelWriterNode_BoundaryShape.cpp b/Source/Model/Writer/NMR_ModelWriterNode_BoundaryShape.cpp index c3e36d4b7..fd971ea3f 100644 --- a/Source/Model/Writer/NMR_ModelWriterNode_BoundaryShape.cpp +++ b/Source/Model/Writer/NMR_ModelWriterNode_BoundaryShape.cpp @@ -41,9 +41,11 @@ Writer node for BoundaryShape resources namespace NMR { CModelWriterNode_BoundaryShape::CModelWriterNode_BoundaryShape( - CModel* pModel, CXmlWriter* pXMLWriter, + CModel* pModel, + CModelBoundaryShapeObject * pBoundaryShape, + CXmlWriter* pXMLWriter, PProgressMonitor pProgressMonitor) - : CModelWriterNode_ModelBase(pModel, pXMLWriter, pProgressMonitor) + : CModelWriterNode_ModelBase(pModel, pXMLWriter, pProgressMonitor), m_pBoundaryShape(pBoundaryShape) { } @@ -68,11 +70,7 @@ namespace NMR void CModelWriterNode_BoundaryShape::writeBoundaryShapeResource( CModelBoundaryShapeObject& boundaryShape) { - writeStartElementWithPrefix(XML_3MF_NAMESPACEPREFIX_VOLUMETRIC, - XML_3MF_ELEMENT_BOUNDARY_SHAPE); - - writeStartElementWithPrefix(XML_3MF_ELEMENT_VOLUMETRIC_BOUNDARY, - XML_3MF_NAMESPACEPREFIX_VOLUMETRIC); + writeStartElementWithPrefix(XML_3MF_ELEMENT_BOUNDARY_SHAPE, XML_3MF_NAMESPACEPREFIX_VOLUMETRIC); auto function = boundaryShape.getFunction(); if(!function) @@ -134,12 +132,15 @@ namespace NMR float(boundaryShape.getFallBackValue())); } - writeEndElement(); + // writeEndElement(); writeFullEndElement(); } void CModelWriterNode_BoundaryShape::writeToXML() { - writeBoundaryShapeResources(); + if (m_pBoundaryShape) + { + writeBoundaryShapeResource(*m_pBoundaryShape); + } } } // namespace NMR diff --git a/Source/Model/Writer/v100/NMR_ModelWriterNode100_Mesh.cpp b/Source/Model/Writer/v100/NMR_ModelWriterNode100_Mesh.cpp index e093b1630..df8198c0e 100644 --- a/Source/Model/Writer/v100/NMR_ModelWriterNode100_Mesh.cpp +++ b/Source/Model/Writer/v100/NMR_ModelWriterNode100_Mesh.cpp @@ -368,9 +368,7 @@ namespace NMR { if (m_bWriteVolumetricExtension) { - // TODO: different logic - if (m_pModelMeshObject->getVolumeData()->getPropertyCount() || - m_pModelMeshObject->getVolumeData()->hasColor()) + if (m_pModelMeshObject->getVolumeData()) { writeStartElementWithPrefix(XML_3MF_ELEMENT_VOLUMEDATA, XML_3MF_NAMESPACEPREFIX_VOLUMETRIC); diff --git a/Source/Model/Writer/v100/NMR_ModelWriterNode100_Model.cpp b/Source/Model/Writer/v100/NMR_ModelWriterNode100_Model.cpp index 3ae5f689d..d971c6e8c 100644 --- a/Source/Model/Writer/v100/NMR_ModelWriterNode100_Model.cpp +++ b/Source/Model/Writer/v100/NMR_ModelWriterNode100_Model.cpp @@ -55,7 +55,11 @@ This is the class for exporting the 3mf model stream root node. #include "Common/MeshInformation/NMR_MeshInformation_Properties.h" #include "Model/Classes/NMR_ModelConstants_Slices.h" #include "Model/Classes/NMR_ModelImplicitFunction.h" +#include "Model/Classes/NMR_ModelBoundaryShapeObject.h" +#include "Model/Classes/NMR_ModelVolumeData.h" #include "Model/Writer/NMR_ModelWriterNode_Implicit.h" +#include "Model/Writer/NMR_ModelWriterNode_BoundaryShape.h" +#include "Model/Writer/NMR_ModelWriterNode_VolumeData.h" #include "Common/3MF_ProgressMonitor.h" @@ -508,6 +512,12 @@ namespace NMR { writeComponentsObject(pComponentObject); } + CModelBoundaryShapeObject * pBoundaryShape = dynamic_cast (pObject); + if (pBoundaryShape) { + CModelWriterNode_BoundaryShape ModelWriter_BoundaryShape(m_pModel, pBoundaryShape, m_pXMLWriter, m_pProgressMonitor); + ModelWriter_BoundaryShape.writeToXML(); + } + writeFullEndElement(); } diff --git a/Tests/CPP_Bindings/Include/UnitTest_Utilities.h b/Tests/CPP_Bindings/Include/UnitTest_Utilities.h index 4e9adba45..db5902838 100644 --- a/Tests/CPP_Bindings/Include/UnitTest_Utilities.h +++ b/Tests/CPP_Bindings/Include/UnitTest_Utilities.h @@ -129,6 +129,8 @@ namespace Lib3MF */ Lib3MF::sTransform ComputeTransformFromMeshCoordinatesToUVW(Lib3MF::PMeshObject mesh); + Lib3MF::PBoundaryShape getFirstBoundaryShape(Lib3MF::PModel model); + } // namespace helper } // namespace Lib3MF diff --git a/Tests/CPP_Bindings/Source/UnitTest_Utilities.cpp b/Tests/CPP_Bindings/Source/UnitTest_Utilities.cpp index f174da7ee..b2f8b1997 100644 --- a/Tests/CPP_Bindings/Source/UnitTest_Utilities.cpp +++ b/Tests/CPP_Bindings/Source/UnitTest_Utilities.cpp @@ -340,6 +340,18 @@ namespace Lib3MF return transform; } + + Lib3MF::PBoundaryShape getFirstBoundaryShape(Lib3MF::PModel model) + { + auto iterator = model->GetBoundaryShapes(); + if(iterator->MoveNext()) + { + return iterator->GetCurrentBoundaryShape(); + } + return {}; + } + + } // namespace helper } // namespace Lib3MF diff --git a/Tests/CPP_Bindings/Source/Volumetric.cpp b/Tests/CPP_Bindings/Source/Volumetric.cpp index 0ed7a7d7e..57587a742 100644 --- a/Tests/CPP_Bindings/Source/Volumetric.cpp +++ b/Tests/CPP_Bindings/Source/Volumetric.cpp @@ -391,6 +391,7 @@ namespace Lib3MF // auto theBoundary = volumeData->CreateNewBoundary(newFunction.get()); auto theBoundary = model->AddBoundaryShape(); theBoundary->SetMesh(theMesh); + theBoundary->SetFunction(newFunction.get()); // Write to file writer3MF->WriteToFile(Volumetric::OutFolder + @@ -477,6 +478,7 @@ namespace Lib3MF auto theMesh = GetMesh(); auto theBoundary = model->AddBoundaryShape(); theBoundary->SetMesh(theMesh); + theBoundary->SetFunction(newFunction.get()); theBoundary->SetFallBackValue(-1.2345); // Write to file @@ -503,8 +505,7 @@ namespace Lib3MF meshesFromWrittenFile->GetCurrentMeshObject(); // Check the fallback value - auto volumeDataFromWrittenFile = meshFromWrittenFile->GetVolumeData(); - auto boundaryFromWrittenFile = volumeDataFromWrittenFile->GetBoundary(); + auto boundaryFromWrittenFile = helper::getFirstBoundaryShape(ioModel); EXPECT_EQ(boundaryFromWrittenFile->GetFallBackValue(), -1.2345); // Compare the functions @@ -518,6 +519,7 @@ namespace Lib3MF auto theMesh = GetMesh(); auto theBoundary = model->AddBoundaryShape(); + theBoundary->SetFunction(newFunction.get()); theBoundary->SetMesh(theMesh); // write to file @@ -599,6 +601,7 @@ namespace Lib3MF auto theMesh = GetMesh(); auto theBoundary = model->AddBoundaryShape(); theBoundary->SetMesh(theMesh); + theBoundary->SetFunction(std::dynamic_pointer_cast(newFunction)); theBoundary->SetMinFeatureSize(0.1); theBoundary->SetChannelName("shape"); @@ -742,6 +745,7 @@ namespace Lib3MF auto theMesh = GetMesh(); auto theBoundary = model->AddBoundaryShape(); theBoundary->SetMesh(theMesh); + theBoundary->SetFunction(newFunction.get()); theBoundary->SetMinFeatureSize(0.1); theBoundary->SetChannelName("shape"); @@ -952,9 +956,9 @@ namespace Lib3MF functionFromFile); // Check the boundary - auto boundaryFromFile = volumeData->GetBoundary(); + auto boundaryFromFile = helper::getFirstBoundaryShape(ioModel); ASSERT_TRUE(boundaryFromFile); - EXPECT_EQ(boundaryFromFile->GetFunctionResourceID(), funcImg3dId); + EXPECT_EQ(boundaryFromFile->GetFunction()->GetModelResourceID(), funcImg3dId); helper::CompareTransforms(boundary->GetTransform(), boundaryFromFile->GetTransform()); EXPECT_EQ(boundary->GetChannelName(),