From 83ba867d4b3f4ddca6345de0a86aa09a27a56af8 Mon Sep 17 00:00:00 2001 From: Alexander Oster Date: Mon, 28 Oct 2024 01:51:50 +0100 Subject: [PATCH] Updated Read out of Override Factors --- Autogenerated/Bindings/C/lib3mf.h | 41 ++- Autogenerated/Bindings/C/lib3mf_types.h | 5 + .../Bindings/CDynamic/lib3mf_dynamic.cc | 30 ++ .../Bindings/CDynamic/lib3mf_dynamic.h | 44 ++- .../Bindings/CDynamic/lib3mf_types.h | 5 + Autogenerated/Bindings/CSharp/Lib3MF.cs | 78 +++++ Autogenerated/Bindings/Cpp/lib3mf_abi.hpp | 41 ++- .../Bindings/Cpp/lib3mf_implicit.hpp | 51 +++- Autogenerated/Bindings/Cpp/lib3mf_types.hpp | 6 + .../Bindings/CppDynamic/lib3mf_dynamic.h | 44 ++- .../Bindings/CppDynamic/lib3mf_dynamic.hpp | 93 +++++- .../Bindings/CppDynamic/lib3mf_types.hpp | 6 + Autogenerated/Bindings/Go/lib3mf.go | 79 ++++- Autogenerated/Bindings/Go/lib3mf_dynamic.cc | 30 ++ Autogenerated/Bindings/Go/lib3mf_dynamic.h | 44 ++- Autogenerated/Bindings/Go/lib3mf_types.h | 5 + .../Bindings/NodeJS/lib3mf_dynamic.cc | 30 ++ .../Bindings/NodeJS/lib3mf_dynamic.h | 44 ++- .../Bindings/NodeJS/lib3mf_nodewrapper.cc | 156 ++++++++++ .../Bindings/NodeJS/lib3mf_nodewrapper.h | 3 + Autogenerated/Bindings/NodeJS/lib3mf_types.h | 5 + Autogenerated/Bindings/Pascal/Unit_Lib3MF.pas | 102 ++++++- Autogenerated/Bindings/Python/Lib3MF.py | 69 +++++ Autogenerated/Source/lib3mf_abi.hpp | 41 ++- Autogenerated/Source/lib3mf_interfaces.hpp | 32 +- .../Source/lib3mf_interfacewrapper.cpp | 112 +++++++ Autogenerated/Source/lib3mf_types.hpp | 6 + AutomaticComponentToolkit/lib3mf.xml | 27 +- Include/API/lib3mf_toolpathlayerreader.hpp | 7 +- .../Classes/NMR_ModelToolpathLayerReadData.h | 2 + Source/API/lib3mf_toolpathlayerreader.cpp | 280 +++++++++++++++++- .../NMR_ModelToolpathLayerReadData.cpp | 70 ++++- 32 files changed, 1559 insertions(+), 29 deletions(-) diff --git a/Autogenerated/Bindings/C/lib3mf.h b/Autogenerated/Bindings/C/lib3mf.h index f529072a..a65a719d 100644 --- a/Autogenerated/Bindings/C/lib3mf.h +++ b/Autogenerated/Bindings/C/lib3mf.h @@ -3654,11 +3654,22 @@ LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerreader_getsegmentdefaultprofile LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerreader_getprofileuuidbylocalprofileid(Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nLocalProfileID, const Lib3MF_uint32 nProfileUUIDBufferSize, Lib3MF_uint32* pProfileUUIDNeededChars, char * pProfileUUIDBuffer); /** -* Returns if the segment has a uniform profile. If it is uniform, then the default profile applies to the whole segment. If it is not uniform, the type specific retrieval functions have to be used (or the file has to be rejected). Returns false for delay and sync segments. +* Retrieves if the segment has specific override factors attached. +* +* @param[in] pToolpathLayerReader - ToolpathLayerReader instance. +* @param[in] nSegmentIndex - Segment Index. Must be between 0 and SegmentCount - 1. +* @param[in] eOverrideFactor - Which override factor value to retrieve (F, G or H). Returns an array of 0.0, if override factor type is unknown or not given. +* @param[out] pHasOverrides - Returns true, if the segment has attached any override factors of the given type, false otherwise. +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerreader_segmenthasoverridefactors(Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nSegmentIndex, eLib3MFToolpathProfileOverrideFactor eOverrideFactor, bool * pHasOverrides); + +/** +* Returns if the segment has a uniform profile. If it is uniform, then the default profile applies to the whole segment. If it is not uniform, the type specific retrieval functions have to be used (or the file has to be rejected). Returns false for delay and sync segments. The call is equivalent to SegmentHasOverrideFactors returning false with any possible type (F, G, H). * * @param[in] pToolpathLayerReader - ToolpathLayerReader instance. * @param[in] nSegmentIndex - Segment Index. Must be between 0 and Count - 1. -* @param[out] pHasUniformProfile - If true, the segment has a uniform profile ID. +* @param[out] pHasUniformProfile - If true, the segment has a uniform profile ID. * @return error code or 0 (success) */ LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerreader_segmenthasuniformprofile(Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nSegmentIndex, bool * pHasUniformProfile); @@ -3687,6 +3698,19 @@ LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerreader_getsegmentpointdatainmod */ LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerreader_getsegmentpointdatadiscrete(Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nSegmentIndex, const Lib3MF_uint64 nPointDataBufferSize, Lib3MF_uint64* pPointDataNeededCount, sLib3MFDiscretePosition2D * pPointDataBuffer); +/** +* Retrieves the assigned segment override factors. Fails if segment type is not loop or polyline. The values are per point, meaning that gradients are given through linear ramping on the polyline vectors. +* +* @param[in] pToolpathLayerReader - ToolpathLayerReader instance. +* @param[in] nSegmentIndex - Segment Index. Must be between 0 and SegmentCount - 1. +* @param[in] eOverrideFactor - Which override factor value to retrieve (F, G or H). Returns an array of 0.0, if override factor type is unknown or not given. +* @param[in] nFactorValuesBufferSize - Number of elements in buffer +* @param[out] pFactorValuesNeededCount - will be filled with the count of the written elements, or needed buffer size. +* @param[out] pFactorValuesBuffer - double buffer of An target override factor for each point of the segment. In case of Polyline, the first array value describes the override for the initial jump. In case of Loop, the first array value describes the override for the inital jump and the last closing mark movement of the polyline. +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerreader_getsegmentpointoverridefactors(Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nSegmentIndex, eLib3MFToolpathProfileOverrideFactor eOverrideFactor, const Lib3MF_uint64 nFactorValuesBufferSize, Lib3MF_uint64* pFactorValuesNeededCount, Lib3MF_double * pFactorValuesBuffer); + /** * Retrieves the assigned segment hatch list. Converts any polyline or loop into hatches. Returns an empty array for delay and sync elements. * @@ -3711,6 +3735,19 @@ LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerreader_getsegmenthatchdatainmod */ LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerreader_getsegmenthatchdatadiscrete(Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nSegmentIndex, const Lib3MF_uint64 nHatchDataBufferSize, Lib3MF_uint64* pHatchDataNeededCount, sLib3MFDiscreteHatch2D * pHatchDataBuffer); +/** +* Retrieves the assigned segment override factors. Fails if segment type is not hatch. The call will return two values per hatch, one per hatch point. +* +* @param[in] pToolpathLayerReader - ToolpathLayerReader instance. +* @param[in] nSegmentIndex - Segment Index. Must be between 0 and SegmentCount - 1. +* @param[in] eOverrideFactor - Which override factor value to retrieve (F, G or H). Returns an array of 0.0, if override factor type is unknown or not given. +* @param[in] nFactorValuesBufferSize - Number of elements in buffer +* @param[out] pFactorValuesNeededCount - will be filled with the count of the written elements, or needed buffer size. +* @param[out] pFactorValuesBuffer - Hatch2DOverrides buffer of An target override factor for each point of the segment. In case of Polyline, the first array value describes the override for the initial jump. In case of Loop, the first array value describes the override for the inital jump and the last closing mark movement of the polyline. +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerreader_getsegmenthatchoverridefactors(Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nSegmentIndex, eLib3MFToolpathProfileOverrideFactor eOverrideFactor, const Lib3MF_uint64 nFactorValuesBufferSize, Lib3MF_uint64* pFactorValuesNeededCount, sLib3MFHatch2DOverrides * pFactorValuesBuffer); + /************************************************************************************************************************* Class definition for ToolpathLayerData **************************************************************************************************************************/ diff --git a/Autogenerated/Bindings/C/lib3mf_types.h b/Autogenerated/Bindings/C/lib3mf_types.h index d53e8deb..61b4b5f6 100644 --- a/Autogenerated/Bindings/C/lib3mf_types.h +++ b/Autogenerated/Bindings/C/lib3mf_types.h @@ -601,6 +601,11 @@ typedef struct sLib3MFHatch2D { Lib3MF_int32 m_Tag; } sLib3MFHatch2D; +typedef struct sLib3MFHatch2DOverrides { + Lib3MF_double m_Point1Override; + Lib3MF_double m_Point2Override; +} sLib3MFHatch2DOverrides; + typedef struct sLib3MFDiscreteHatch2D { Lib3MF_int32 m_Point1Coordinates[2]; Lib3MF_int32 m_Point2Coordinates[2]; diff --git a/Autogenerated/Bindings/CDynamic/lib3mf_dynamic.cc b/Autogenerated/Bindings/CDynamic/lib3mf_dynamic.cc index bbd12fd0..5f4ba8d7 100644 --- a/Autogenerated/Bindings/CDynamic/lib3mf_dynamic.cc +++ b/Autogenerated/Bindings/CDynamic/lib3mf_dynamic.cc @@ -391,11 +391,14 @@ Lib3MFResult InitLib3MFWrapperTable(sLib3MFDynamicWrapperTable * pWrapperTable) pWrapperTable->m_ToolpathLayerReader_GetSegmentDefaultProfileUUID = NULL; pWrapperTable->m_ToolpathLayerReader_GetSegmentDefaultProfileID = NULL; pWrapperTable->m_ToolpathLayerReader_GetProfileUUIDByLocalProfileID = NULL; + pWrapperTable->m_ToolpathLayerReader_SegmentHasOverrideFactors = NULL; pWrapperTable->m_ToolpathLayerReader_SegmentHasUniformProfile = NULL; pWrapperTable->m_ToolpathLayerReader_GetSegmentPointDataInModelUnits = NULL; pWrapperTable->m_ToolpathLayerReader_GetSegmentPointDataDiscrete = NULL; + pWrapperTable->m_ToolpathLayerReader_GetSegmentPointOverrideFactors = NULL; pWrapperTable->m_ToolpathLayerReader_GetSegmentHatchDataInModelUnits = NULL; pWrapperTable->m_ToolpathLayerReader_GetSegmentHatchDataDiscrete = NULL; + pWrapperTable->m_ToolpathLayerReader_GetSegmentHatchOverrideFactors = NULL; pWrapperTable->m_ToolpathLayerData_GetLayerDataUUID = NULL; pWrapperTable->m_ToolpathLayerData_RegisterProfile = NULL; pWrapperTable->m_ToolpathLayerData_RegisterBuildItem = NULL; @@ -3733,6 +3736,15 @@ Lib3MFResult LoadLib3MFWrapperTable(sLib3MFDynamicWrapperTable * pWrapperTable, if (pWrapperTable->m_ToolpathLayerReader_GetProfileUUIDByLocalProfileID == NULL) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + #ifdef _WIN32 + pWrapperTable->m_ToolpathLayerReader_SegmentHasOverrideFactors = (PLib3MFToolpathLayerReader_SegmentHasOverrideFactorsPtr) GetProcAddress(hLibrary, "lib3mf_toolpathlayerreader_segmenthasoverridefactors"); + #else // _WIN32 + pWrapperTable->m_ToolpathLayerReader_SegmentHasOverrideFactors = (PLib3MFToolpathLayerReader_SegmentHasOverrideFactorsPtr) dlsym(hLibrary, "lib3mf_toolpathlayerreader_segmenthasoverridefactors"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_ToolpathLayerReader_SegmentHasOverrideFactors == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + #ifdef _WIN32 pWrapperTable->m_ToolpathLayerReader_SegmentHasUniformProfile = (PLib3MFToolpathLayerReader_SegmentHasUniformProfilePtr) GetProcAddress(hLibrary, "lib3mf_toolpathlayerreader_segmenthasuniformprofile"); #else // _WIN32 @@ -3760,6 +3772,15 @@ Lib3MFResult LoadLib3MFWrapperTable(sLib3MFDynamicWrapperTable * pWrapperTable, if (pWrapperTable->m_ToolpathLayerReader_GetSegmentPointDataDiscrete == NULL) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + #ifdef _WIN32 + pWrapperTable->m_ToolpathLayerReader_GetSegmentPointOverrideFactors = (PLib3MFToolpathLayerReader_GetSegmentPointOverrideFactorsPtr) GetProcAddress(hLibrary, "lib3mf_toolpathlayerreader_getsegmentpointoverridefactors"); + #else // _WIN32 + pWrapperTable->m_ToolpathLayerReader_GetSegmentPointOverrideFactors = (PLib3MFToolpathLayerReader_GetSegmentPointOverrideFactorsPtr) dlsym(hLibrary, "lib3mf_toolpathlayerreader_getsegmentpointoverridefactors"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_ToolpathLayerReader_GetSegmentPointOverrideFactors == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + #ifdef _WIN32 pWrapperTable->m_ToolpathLayerReader_GetSegmentHatchDataInModelUnits = (PLib3MFToolpathLayerReader_GetSegmentHatchDataInModelUnitsPtr) GetProcAddress(hLibrary, "lib3mf_toolpathlayerreader_getsegmenthatchdatainmodelunits"); #else // _WIN32 @@ -3778,6 +3799,15 @@ Lib3MFResult LoadLib3MFWrapperTable(sLib3MFDynamicWrapperTable * pWrapperTable, if (pWrapperTable->m_ToolpathLayerReader_GetSegmentHatchDataDiscrete == NULL) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + #ifdef _WIN32 + pWrapperTable->m_ToolpathLayerReader_GetSegmentHatchOverrideFactors = (PLib3MFToolpathLayerReader_GetSegmentHatchOverrideFactorsPtr) GetProcAddress(hLibrary, "lib3mf_toolpathlayerreader_getsegmenthatchoverridefactors"); + #else // _WIN32 + pWrapperTable->m_ToolpathLayerReader_GetSegmentHatchOverrideFactors = (PLib3MFToolpathLayerReader_GetSegmentHatchOverrideFactorsPtr) dlsym(hLibrary, "lib3mf_toolpathlayerreader_getsegmenthatchoverridefactors"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_ToolpathLayerReader_GetSegmentHatchOverrideFactors == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + #ifdef _WIN32 pWrapperTable->m_ToolpathLayerData_GetLayerDataUUID = (PLib3MFToolpathLayerData_GetLayerDataUUIDPtr) GetProcAddress(hLibrary, "lib3mf_toolpathlayerdata_getlayerdatauuid"); #else // _WIN32 diff --git a/Autogenerated/Bindings/CDynamic/lib3mf_dynamic.h b/Autogenerated/Bindings/CDynamic/lib3mf_dynamic.h index 226ce555..5ee38809 100644 --- a/Autogenerated/Bindings/CDynamic/lib3mf_dynamic.h +++ b/Autogenerated/Bindings/CDynamic/lib3mf_dynamic.h @@ -3641,11 +3641,22 @@ typedef Lib3MFResult (*PLib3MFToolpathLayerReader_GetSegmentDefaultProfileIDPtr) typedef Lib3MFResult (*PLib3MFToolpathLayerReader_GetProfileUUIDByLocalProfileIDPtr) (Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nLocalProfileID, const Lib3MF_uint32 nProfileUUIDBufferSize, Lib3MF_uint32* pProfileUUIDNeededChars, char * pProfileUUIDBuffer); /** -* Returns if the segment has a uniform profile. If it is uniform, then the default profile applies to the whole segment. If it is not uniform, the type specific retrieval functions have to be used (or the file has to be rejected). Returns false for delay and sync segments. +* Retrieves if the segment has specific override factors attached. +* +* @param[in] pToolpathLayerReader - ToolpathLayerReader instance. +* @param[in] nSegmentIndex - Segment Index. Must be between 0 and SegmentCount - 1. +* @param[in] eOverrideFactor - Which override factor value to retrieve (F, G or H). Returns an array of 0.0, if override factor type is unknown or not given. +* @param[out] pHasOverrides - Returns true, if the segment has attached any override factors of the given type, false otherwise. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFToolpathLayerReader_SegmentHasOverrideFactorsPtr) (Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nSegmentIndex, eLib3MFToolpathProfileOverrideFactor eOverrideFactor, bool * pHasOverrides); + +/** +* Returns if the segment has a uniform profile. If it is uniform, then the default profile applies to the whole segment. If it is not uniform, the type specific retrieval functions have to be used (or the file has to be rejected). Returns false for delay and sync segments. The call is equivalent to SegmentHasOverrideFactors returning false with any possible type (F, G, H). * * @param[in] pToolpathLayerReader - ToolpathLayerReader instance. * @param[in] nSegmentIndex - Segment Index. Must be between 0 and Count - 1. -* @param[out] pHasUniformProfile - If true, the segment has a uniform profile ID. +* @param[out] pHasUniformProfile - If true, the segment has a uniform profile ID. * @return error code or 0 (success) */ typedef Lib3MFResult (*PLib3MFToolpathLayerReader_SegmentHasUniformProfilePtr) (Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nSegmentIndex, bool * pHasUniformProfile); @@ -3674,6 +3685,19 @@ typedef Lib3MFResult (*PLib3MFToolpathLayerReader_GetSegmentPointDataInModelUnit */ typedef Lib3MFResult (*PLib3MFToolpathLayerReader_GetSegmentPointDataDiscretePtr) (Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nSegmentIndex, const Lib3MF_uint64 nPointDataBufferSize, Lib3MF_uint64* pPointDataNeededCount, sLib3MFDiscretePosition2D * pPointDataBuffer); +/** +* Retrieves the assigned segment override factors. Fails if segment type is not loop or polyline. The values are per point, meaning that gradients are given through linear ramping on the polyline vectors. +* +* @param[in] pToolpathLayerReader - ToolpathLayerReader instance. +* @param[in] nSegmentIndex - Segment Index. Must be between 0 and SegmentCount - 1. +* @param[in] eOverrideFactor - Which override factor value to retrieve (F, G or H). Returns an array of 0.0, if override factor type is unknown or not given. +* @param[in] nFactorValuesBufferSize - Number of elements in buffer +* @param[out] pFactorValuesNeededCount - will be filled with the count of the written elements, or needed buffer size. +* @param[out] pFactorValuesBuffer - double buffer of An target override factor for each point of the segment. In case of Polyline, the first array value describes the override for the initial jump. In case of Loop, the first array value describes the override for the inital jump and the last closing mark movement of the polyline. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFToolpathLayerReader_GetSegmentPointOverrideFactorsPtr) (Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nSegmentIndex, eLib3MFToolpathProfileOverrideFactor eOverrideFactor, const Lib3MF_uint64 nFactorValuesBufferSize, Lib3MF_uint64* pFactorValuesNeededCount, Lib3MF_double * pFactorValuesBuffer); + /** * Retrieves the assigned segment hatch list. Converts any polyline or loop into hatches. Returns an empty array for delay and sync elements. * @@ -3698,6 +3722,19 @@ typedef Lib3MFResult (*PLib3MFToolpathLayerReader_GetSegmentHatchDataInModelUnit */ typedef Lib3MFResult (*PLib3MFToolpathLayerReader_GetSegmentHatchDataDiscretePtr) (Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nSegmentIndex, const Lib3MF_uint64 nHatchDataBufferSize, Lib3MF_uint64* pHatchDataNeededCount, sLib3MFDiscreteHatch2D * pHatchDataBuffer); +/** +* Retrieves the assigned segment override factors. Fails if segment type is not hatch. The call will return two values per hatch, one per hatch point. +* +* @param[in] pToolpathLayerReader - ToolpathLayerReader instance. +* @param[in] nSegmentIndex - Segment Index. Must be between 0 and SegmentCount - 1. +* @param[in] eOverrideFactor - Which override factor value to retrieve (F, G or H). Returns an array of 0.0, if override factor type is unknown or not given. +* @param[in] nFactorValuesBufferSize - Number of elements in buffer +* @param[out] pFactorValuesNeededCount - will be filled with the count of the written elements, or needed buffer size. +* @param[out] pFactorValuesBuffer - Hatch2DOverrides buffer of An target override factor for each point of the segment. In case of Polyline, the first array value describes the override for the initial jump. In case of Loop, the first array value describes the override for the inital jump and the last closing mark movement of the polyline. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFToolpathLayerReader_GetSegmentHatchOverrideFactorsPtr) (Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nSegmentIndex, eLib3MFToolpathProfileOverrideFactor eOverrideFactor, const Lib3MF_uint64 nFactorValuesBufferSize, Lib3MF_uint64* pFactorValuesNeededCount, sLib3MFHatch2DOverrides * pFactorValuesBuffer); + /************************************************************************************************************************* Class definition for ToolpathLayerData **************************************************************************************************************************/ @@ -6138,11 +6175,14 @@ typedef struct { PLib3MFToolpathLayerReader_GetSegmentDefaultProfileUUIDPtr m_ToolpathLayerReader_GetSegmentDefaultProfileUUID; PLib3MFToolpathLayerReader_GetSegmentDefaultProfileIDPtr m_ToolpathLayerReader_GetSegmentDefaultProfileID; PLib3MFToolpathLayerReader_GetProfileUUIDByLocalProfileIDPtr m_ToolpathLayerReader_GetProfileUUIDByLocalProfileID; + PLib3MFToolpathLayerReader_SegmentHasOverrideFactorsPtr m_ToolpathLayerReader_SegmentHasOverrideFactors; PLib3MFToolpathLayerReader_SegmentHasUniformProfilePtr m_ToolpathLayerReader_SegmentHasUniformProfile; PLib3MFToolpathLayerReader_GetSegmentPointDataInModelUnitsPtr m_ToolpathLayerReader_GetSegmentPointDataInModelUnits; PLib3MFToolpathLayerReader_GetSegmentPointDataDiscretePtr m_ToolpathLayerReader_GetSegmentPointDataDiscrete; + PLib3MFToolpathLayerReader_GetSegmentPointOverrideFactorsPtr m_ToolpathLayerReader_GetSegmentPointOverrideFactors; PLib3MFToolpathLayerReader_GetSegmentHatchDataInModelUnitsPtr m_ToolpathLayerReader_GetSegmentHatchDataInModelUnits; PLib3MFToolpathLayerReader_GetSegmentHatchDataDiscretePtr m_ToolpathLayerReader_GetSegmentHatchDataDiscrete; + PLib3MFToolpathLayerReader_GetSegmentHatchOverrideFactorsPtr m_ToolpathLayerReader_GetSegmentHatchOverrideFactors; PLib3MFToolpathLayerData_GetLayerDataUUIDPtr m_ToolpathLayerData_GetLayerDataUUID; PLib3MFToolpathLayerData_RegisterProfilePtr m_ToolpathLayerData_RegisterProfile; PLib3MFToolpathLayerData_RegisterBuildItemPtr m_ToolpathLayerData_RegisterBuildItem; diff --git a/Autogenerated/Bindings/CDynamic/lib3mf_types.h b/Autogenerated/Bindings/CDynamic/lib3mf_types.h index d53e8deb..61b4b5f6 100644 --- a/Autogenerated/Bindings/CDynamic/lib3mf_types.h +++ b/Autogenerated/Bindings/CDynamic/lib3mf_types.h @@ -601,6 +601,11 @@ typedef struct sLib3MFHatch2D { Lib3MF_int32 m_Tag; } sLib3MFHatch2D; +typedef struct sLib3MFHatch2DOverrides { + Lib3MF_double m_Point1Override; + Lib3MF_double m_Point2Override; +} sLib3MFHatch2DOverrides; + typedef struct sLib3MFDiscreteHatch2D { Lib3MF_int32 m_Point1Coordinates[2]; Lib3MF_int32 m_Point2Coordinates[2]; diff --git a/Autogenerated/Bindings/CSharp/Lib3MF.cs b/Autogenerated/Bindings/CSharp/Lib3MF.cs index d8c9e7ff..c01fbf0e 100644 --- a/Autogenerated/Bindings/CSharp/Lib3MF.cs +++ b/Autogenerated/Bindings/CSharp/Lib3MF.cs @@ -234,6 +234,12 @@ public struct sHatch2D public Int32 Tag; } + public struct sHatch2DOverrides + { + public Double Point1Override; + public Double Point2Override; + } + public struct sDiscreteHatch2D { public Int32[] Point1Coordinates; @@ -333,6 +339,13 @@ public unsafe struct InternalHatch2D [FieldOffset(32)] public Int32 Tag; } + [StructLayout(LayoutKind.Explicit, Size=16)] + public unsafe struct InternalHatch2DOverrides + { + [FieldOffset(0)] public Double Point1Override; + [FieldOffset(8)] public Double Point2Override; + } + [StructLayout(LayoutKind.Explicit, Size=20)] public unsafe struct InternalDiscreteHatch2D { @@ -1431,6 +1444,9 @@ public class Lib3MFWrapper [DllImport("lib3mf.dll", EntryPoint = "lib3mf_toolpathlayerreader_getprofileuuidbylocalprofileid", CallingConvention=CallingConvention.Cdecl)] public unsafe extern static Int32 ToolpathLayerReader_GetProfileUUIDByLocalProfileID (IntPtr Handle, UInt32 ALocalProfileID, UInt32 sizeProfileUUID, out UInt32 neededProfileUUID, IntPtr dataProfileUUID); + [DllImport("lib3mf.dll", EntryPoint = "lib3mf_toolpathlayerreader_segmenthasoverridefactors", CallingConvention=CallingConvention.Cdecl)] + public unsafe extern static Int32 ToolpathLayerReader_SegmentHasOverrideFactors (IntPtr Handle, UInt32 ASegmentIndex, Int32 AOverrideFactor, out Byte AHasOverrides); + [DllImport("lib3mf.dll", EntryPoint = "lib3mf_toolpathlayerreader_segmenthasuniformprofile", CallingConvention=CallingConvention.Cdecl)] public unsafe extern static Int32 ToolpathLayerReader_SegmentHasUniformProfile (IntPtr Handle, UInt32 ASegmentIndex, out Byte AHasUniformProfile); @@ -1440,12 +1456,18 @@ public class Lib3MFWrapper [DllImport("lib3mf.dll", EntryPoint = "lib3mf_toolpathlayerreader_getsegmentpointdatadiscrete", CallingConvention=CallingConvention.Cdecl)] public unsafe extern static Int32 ToolpathLayerReader_GetSegmentPointDataDiscrete (IntPtr Handle, UInt32 ASegmentIndex, UInt64 sizePointData, out UInt64 neededPointData, IntPtr dataPointData); + [DllImport("lib3mf.dll", EntryPoint = "lib3mf_toolpathlayerreader_getsegmentpointoverridefactors", CallingConvention=CallingConvention.Cdecl)] + public unsafe extern static Int32 ToolpathLayerReader_GetSegmentPointOverrideFactors (IntPtr Handle, UInt32 ASegmentIndex, Int32 AOverrideFactor, UInt64 sizeFactorValues, out UInt64 neededFactorValues, IntPtr dataFactorValues); + [DllImport("lib3mf.dll", EntryPoint = "lib3mf_toolpathlayerreader_getsegmenthatchdatainmodelunits", CallingConvention=CallingConvention.Cdecl)] public unsafe extern static Int32 ToolpathLayerReader_GetSegmentHatchDataInModelUnits (IntPtr Handle, UInt32 ASegmentIndex, UInt64 sizeHatchData, out UInt64 neededHatchData, IntPtr dataHatchData); [DllImport("lib3mf.dll", EntryPoint = "lib3mf_toolpathlayerreader_getsegmenthatchdatadiscrete", CallingConvention=CallingConvention.Cdecl)] public unsafe extern static Int32 ToolpathLayerReader_GetSegmentHatchDataDiscrete (IntPtr Handle, UInt32 ASegmentIndex, UInt64 sizeHatchData, out UInt64 neededHatchData, IntPtr dataHatchData); + [DllImport("lib3mf.dll", EntryPoint = "lib3mf_toolpathlayerreader_getsegmenthatchoverridefactors", CallingConvention=CallingConvention.Cdecl)] + public unsafe extern static Int32 ToolpathLayerReader_GetSegmentHatchOverrideFactors (IntPtr Handle, UInt32 ASegmentIndex, Int32 AOverrideFactor, UInt64 sizeFactorValues, out UInt64 neededFactorValues, IntPtr dataFactorValues); + [DllImport("lib3mf.dll", EntryPoint = "lib3mf_toolpathlayerdata_getlayerdatauuid", CallingConvention=CallingConvention.Cdecl)] public unsafe extern static Int32 ToolpathLayerData_GetLayerDataUUID (IntPtr Handle, UInt32 sizeUUID, out UInt32 neededUUID, IntPtr dataUUID); @@ -2173,6 +2195,22 @@ public unsafe static InternalHatch2D convertStructToInternal_Hatch2D (sHatch2D H return intHatch2D; } + public unsafe static sHatch2DOverrides convertInternalToStruct_Hatch2DOverrides (InternalHatch2DOverrides intHatch2DOverrides) + { + sHatch2DOverrides Hatch2DOverrides; + Hatch2DOverrides.Point1Override = intHatch2DOverrides.Point1Override; + Hatch2DOverrides.Point2Override = intHatch2DOverrides.Point2Override; + return Hatch2DOverrides; + } + + public unsafe static InternalHatch2DOverrides convertStructToInternal_Hatch2DOverrides (sHatch2DOverrides Hatch2DOverrides) + { + InternalHatch2DOverrides intHatch2DOverrides; + intHatch2DOverrides.Point1Override = Hatch2DOverrides.Point1Override; + intHatch2DOverrides.Point2Override = Hatch2DOverrides.Point2Override; + return intHatch2DOverrides; + } + public unsafe static sDiscreteHatch2D convertInternalToStruct_DiscreteHatch2D (InternalDiscreteHatch2D intDiscreteHatch2D) { sDiscreteHatch2D DiscreteHatch2D; @@ -6003,6 +6041,15 @@ public String GetProfileUUIDByLocalProfileID (UInt32 ALocalProfileID) return Encoding.UTF8.GetString(bytesProfileUUID).TrimEnd(char.MinValue); } + public bool SegmentHasOverrideFactors (UInt32 ASegmentIndex, eToolpathProfileOverrideFactor AOverrideFactor) + { + Int32 enumOverrideFactor = (Int32) AOverrideFactor; + Byte resultHasOverrides = 0; + + CheckError(Internal.Lib3MFWrapper.ToolpathLayerReader_SegmentHasOverrideFactors (Handle, ASegmentIndex, enumOverrideFactor, out resultHasOverrides)); + return (resultHasOverrides != 0); + } + public bool SegmentHasUniformProfile (UInt32 ASegmentIndex) { Byte resultHasUniformProfile = 0; @@ -6043,6 +6090,20 @@ public void GetSegmentPointDataDiscrete (UInt32 ASegmentIndex, out sDiscretePosi APointData[index] = Internal.Lib3MFWrapper.convertInternalToStruct_DiscretePosition2D(arrayPointData[index]); } + public void GetSegmentPointOverrideFactors (UInt32 ASegmentIndex, eToolpathProfileOverrideFactor AOverrideFactor, out Double[] AFactorValues) + { + Int32 enumOverrideFactor = (Int32) AOverrideFactor; + UInt64 sizeFactorValues = 0; + UInt64 neededFactorValues = 0; + CheckError(Internal.Lib3MFWrapper.ToolpathLayerReader_GetSegmentPointOverrideFactors (Handle, ASegmentIndex, enumOverrideFactor, sizeFactorValues, out neededFactorValues, IntPtr.Zero)); + sizeFactorValues = neededFactorValues; + AFactorValues = new Double[sizeFactorValues]; + GCHandle dataFactorValues = GCHandle.Alloc(AFactorValues, GCHandleType.Pinned); + + CheckError(Internal.Lib3MFWrapper.ToolpathLayerReader_GetSegmentPointOverrideFactors (Handle, ASegmentIndex, enumOverrideFactor, sizeFactorValues, out neededFactorValues, dataFactorValues.AddrOfPinnedObject())); + dataFactorValues.Free(); + } + public void GetSegmentHatchDataInModelUnits (UInt32 ASegmentIndex, out sHatch2D[] AHatchData) { UInt64 sizeHatchData = 0; @@ -6075,6 +6136,23 @@ public void GetSegmentHatchDataDiscrete (UInt32 ASegmentIndex, out sDiscreteHatc AHatchData[index] = Internal.Lib3MFWrapper.convertInternalToStruct_DiscreteHatch2D(arrayHatchData[index]); } + public void GetSegmentHatchOverrideFactors (UInt32 ASegmentIndex, eToolpathProfileOverrideFactor AOverrideFactor, out sHatch2DOverrides[] AFactorValues) + { + Int32 enumOverrideFactor = (Int32) AOverrideFactor; + UInt64 sizeFactorValues = 0; + UInt64 neededFactorValues = 0; + CheckError(Internal.Lib3MFWrapper.ToolpathLayerReader_GetSegmentHatchOverrideFactors (Handle, ASegmentIndex, enumOverrideFactor, sizeFactorValues, out neededFactorValues, IntPtr.Zero)); + sizeFactorValues = neededFactorValues; + var arrayFactorValues = new Internal.InternalHatch2DOverrides[sizeFactorValues]; + GCHandle dataFactorValues = GCHandle.Alloc(arrayFactorValues, GCHandleType.Pinned); + + CheckError(Internal.Lib3MFWrapper.ToolpathLayerReader_GetSegmentHatchOverrideFactors (Handle, ASegmentIndex, enumOverrideFactor, sizeFactorValues, out neededFactorValues, dataFactorValues.AddrOfPinnedObject())); + dataFactorValues.Free(); + AFactorValues = new sHatch2DOverrides[sizeFactorValues]; + for (int index = 0; index < AFactorValues.Length; index++) + AFactorValues[index] = Internal.Lib3MFWrapper.convertInternalToStruct_Hatch2DOverrides(arrayFactorValues[index]); + } + } public class CToolpathLayerData : CBase diff --git a/Autogenerated/Bindings/Cpp/lib3mf_abi.hpp b/Autogenerated/Bindings/Cpp/lib3mf_abi.hpp index 0c94c864..6ef6769c 100644 --- a/Autogenerated/Bindings/Cpp/lib3mf_abi.hpp +++ b/Autogenerated/Bindings/Cpp/lib3mf_abi.hpp @@ -3654,11 +3654,22 @@ LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerreader_getsegmentdefaultprofile LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerreader_getprofileuuidbylocalprofileid(Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nLocalProfileID, const Lib3MF_uint32 nProfileUUIDBufferSize, Lib3MF_uint32* pProfileUUIDNeededChars, char * pProfileUUIDBuffer); /** -* Returns if the segment has a uniform profile. If it is uniform, then the default profile applies to the whole segment. If it is not uniform, the type specific retrieval functions have to be used (or the file has to be rejected). Returns false for delay and sync segments. +* Retrieves if the segment has specific override factors attached. +* +* @param[in] pToolpathLayerReader - ToolpathLayerReader instance. +* @param[in] nSegmentIndex - Segment Index. Must be between 0 and SegmentCount - 1. +* @param[in] eOverrideFactor - Which override factor value to retrieve (F, G or H). Returns an array of 0.0, if override factor type is unknown or not given. +* @param[out] pHasOverrides - Returns true, if the segment has attached any override factors of the given type, false otherwise. +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerreader_segmenthasoverridefactors(Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nSegmentIndex, Lib3MF::eToolpathProfileOverrideFactor eOverrideFactor, bool * pHasOverrides); + +/** +* Returns if the segment has a uniform profile. If it is uniform, then the default profile applies to the whole segment. If it is not uniform, the type specific retrieval functions have to be used (or the file has to be rejected). Returns false for delay and sync segments. The call is equivalent to SegmentHasOverrideFactors returning false with any possible type (F, G, H). * * @param[in] pToolpathLayerReader - ToolpathLayerReader instance. * @param[in] nSegmentIndex - Segment Index. Must be between 0 and Count - 1. -* @param[out] pHasUniformProfile - If true, the segment has a uniform profile ID. +* @param[out] pHasUniformProfile - If true, the segment has a uniform profile ID. * @return error code or 0 (success) */ LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerreader_segmenthasuniformprofile(Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nSegmentIndex, bool * pHasUniformProfile); @@ -3687,6 +3698,19 @@ LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerreader_getsegmentpointdatainmod */ LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerreader_getsegmentpointdatadiscrete(Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nSegmentIndex, const Lib3MF_uint64 nPointDataBufferSize, Lib3MF_uint64* pPointDataNeededCount, Lib3MF::sDiscretePosition2D * pPointDataBuffer); +/** +* Retrieves the assigned segment override factors. Fails if segment type is not loop or polyline. The values are per point, meaning that gradients are given through linear ramping on the polyline vectors. +* +* @param[in] pToolpathLayerReader - ToolpathLayerReader instance. +* @param[in] nSegmentIndex - Segment Index. Must be between 0 and SegmentCount - 1. +* @param[in] eOverrideFactor - Which override factor value to retrieve (F, G or H). Returns an array of 0.0, if override factor type is unknown or not given. +* @param[in] nFactorValuesBufferSize - Number of elements in buffer +* @param[out] pFactorValuesNeededCount - will be filled with the count of the written elements, or needed buffer size. +* @param[out] pFactorValuesBuffer - double buffer of An target override factor for each point of the segment. In case of Polyline, the first array value describes the override for the initial jump. In case of Loop, the first array value describes the override for the inital jump and the last closing mark movement of the polyline. +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerreader_getsegmentpointoverridefactors(Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nSegmentIndex, Lib3MF::eToolpathProfileOverrideFactor eOverrideFactor, const Lib3MF_uint64 nFactorValuesBufferSize, Lib3MF_uint64* pFactorValuesNeededCount, Lib3MF_double * pFactorValuesBuffer); + /** * Retrieves the assigned segment hatch list. Converts any polyline or loop into hatches. Returns an empty array for delay and sync elements. * @@ -3711,6 +3735,19 @@ LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerreader_getsegmenthatchdatainmod */ LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerreader_getsegmenthatchdatadiscrete(Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nSegmentIndex, const Lib3MF_uint64 nHatchDataBufferSize, Lib3MF_uint64* pHatchDataNeededCount, Lib3MF::sDiscreteHatch2D * pHatchDataBuffer); +/** +* Retrieves the assigned segment override factors. Fails if segment type is not hatch. The call will return two values per hatch, one per hatch point. +* +* @param[in] pToolpathLayerReader - ToolpathLayerReader instance. +* @param[in] nSegmentIndex - Segment Index. Must be between 0 and SegmentCount - 1. +* @param[in] eOverrideFactor - Which override factor value to retrieve (F, G or H). Returns an array of 0.0, if override factor type is unknown or not given. +* @param[in] nFactorValuesBufferSize - Number of elements in buffer +* @param[out] pFactorValuesNeededCount - will be filled with the count of the written elements, or needed buffer size. +* @param[out] pFactorValuesBuffer - Hatch2DOverrides buffer of An target override factor for each point of the segment. In case of Polyline, the first array value describes the override for the initial jump. In case of Loop, the first array value describes the override for the inital jump and the last closing mark movement of the polyline. +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerreader_getsegmenthatchoverridefactors(Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nSegmentIndex, Lib3MF::eToolpathProfileOverrideFactor eOverrideFactor, const Lib3MF_uint64 nFactorValuesBufferSize, Lib3MF_uint64* pFactorValuesNeededCount, Lib3MF::sHatch2DOverrides * pFactorValuesBuffer); + /************************************************************************************************************************* Class definition for ToolpathLayerData **************************************************************************************************************************/ diff --git a/Autogenerated/Bindings/Cpp/lib3mf_implicit.hpp b/Autogenerated/Bindings/Cpp/lib3mf_implicit.hpp index c778b57f..65504a38 100644 --- a/Autogenerated/Bindings/Cpp/lib3mf_implicit.hpp +++ b/Autogenerated/Bindings/Cpp/lib3mf_implicit.hpp @@ -1713,11 +1713,14 @@ class CToolpathLayerReader : public CBase { inline std::string GetSegmentDefaultProfileUUID(const Lib3MF_uint32 nSegmentIndex); inline Lib3MF_uint32 GetSegmentDefaultProfileID(const Lib3MF_uint32 nSegmentIndex); inline std::string GetProfileUUIDByLocalProfileID(const Lib3MF_uint32 nLocalProfileID); + inline bool SegmentHasOverrideFactors(const Lib3MF_uint32 nSegmentIndex, const eToolpathProfileOverrideFactor eOverrideFactor); inline bool SegmentHasUniformProfile(const Lib3MF_uint32 nSegmentIndex); inline void GetSegmentPointDataInModelUnits(const Lib3MF_uint32 nSegmentIndex, std::vector & PointDataBuffer); inline void GetSegmentPointDataDiscrete(const Lib3MF_uint32 nSegmentIndex, std::vector & PointDataBuffer); + inline void GetSegmentPointOverrideFactors(const Lib3MF_uint32 nSegmentIndex, const eToolpathProfileOverrideFactor eOverrideFactor, std::vector & FactorValuesBuffer); inline void GetSegmentHatchDataInModelUnits(const Lib3MF_uint32 nSegmentIndex, std::vector & HatchDataBuffer); inline void GetSegmentHatchDataDiscrete(const Lib3MF_uint32 nSegmentIndex, std::vector & HatchDataBuffer); + inline void GetSegmentHatchOverrideFactors(const Lib3MF_uint32 nSegmentIndex, const eToolpathProfileOverrideFactor eOverrideFactor, std::vector & FactorValuesBuffer); }; /************************************************************************************************************************* @@ -6878,9 +6881,23 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle) } /** - * CToolpathLayerReader::SegmentHasUniformProfile - Returns if the segment has a uniform profile. If it is uniform, then the default profile applies to the whole segment. If it is not uniform, the type specific retrieval functions have to be used (or the file has to be rejected). Returns false for delay and sync segments. + * CToolpathLayerReader::SegmentHasOverrideFactors - Retrieves if the segment has specific override factors attached. + * @param[in] nSegmentIndex - Segment Index. Must be between 0 and SegmentCount - 1. + * @param[in] eOverrideFactor - Which override factor value to retrieve (F, G or H). Returns an array of 0.0, if override factor type is unknown or not given. + * @return Returns true, if the segment has attached any override factors of the given type, false otherwise. + */ + bool CToolpathLayerReader::SegmentHasOverrideFactors(const Lib3MF_uint32 nSegmentIndex, const eToolpathProfileOverrideFactor eOverrideFactor) + { + bool resultHasOverrides = 0; + CheckError(lib3mf_toolpathlayerreader_segmenthasoverridefactors(m_pHandle, nSegmentIndex, eOverrideFactor, &resultHasOverrides)); + + return resultHasOverrides; + } + + /** + * CToolpathLayerReader::SegmentHasUniformProfile - Returns if the segment has a uniform profile. If it is uniform, then the default profile applies to the whole segment. If it is not uniform, the type specific retrieval functions have to be used (or the file has to be rejected). Returns false for delay and sync segments. The call is equivalent to SegmentHasOverrideFactors returning false with any possible type (F, G, H). * @param[in] nSegmentIndex - Segment Index. Must be between 0 and Count - 1. - * @return If true, the segment has a uniform profile ID. + * @return If true, the segment has a uniform profile ID. */ bool CToolpathLayerReader::SegmentHasUniformProfile(const Lib3MF_uint32 nSegmentIndex) { @@ -6918,6 +6935,21 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle) CheckError(lib3mf_toolpathlayerreader_getsegmentpointdatadiscrete(m_pHandle, nSegmentIndex, elementsNeededPointData, &elementsWrittenPointData, PointDataBuffer.data())); } + /** + * CToolpathLayerReader::GetSegmentPointOverrideFactors - Retrieves the assigned segment override factors. Fails if segment type is not loop or polyline. The values are per point, meaning that gradients are given through linear ramping on the polyline vectors. + * @param[in] nSegmentIndex - Segment Index. Must be between 0 and SegmentCount - 1. + * @param[in] eOverrideFactor - Which override factor value to retrieve (F, G or H). Returns an array of 0.0, if override factor type is unknown or not given. + * @param[out] FactorValuesBuffer - An target override factor for each point of the segment. In case of Polyline, the first array value describes the override for the initial jump. In case of Loop, the first array value describes the override for the inital jump and the last closing mark movement of the polyline. + */ + void CToolpathLayerReader::GetSegmentPointOverrideFactors(const Lib3MF_uint32 nSegmentIndex, const eToolpathProfileOverrideFactor eOverrideFactor, std::vector & FactorValuesBuffer) + { + Lib3MF_uint64 elementsNeededFactorValues = 0; + Lib3MF_uint64 elementsWrittenFactorValues = 0; + CheckError(lib3mf_toolpathlayerreader_getsegmentpointoverridefactors(m_pHandle, nSegmentIndex, eOverrideFactor, 0, &elementsNeededFactorValues, nullptr)); + FactorValuesBuffer.resize((size_t) elementsNeededFactorValues); + CheckError(lib3mf_toolpathlayerreader_getsegmentpointoverridefactors(m_pHandle, nSegmentIndex, eOverrideFactor, elementsNeededFactorValues, &elementsWrittenFactorValues, FactorValuesBuffer.data())); + } + /** * CToolpathLayerReader::GetSegmentHatchDataInModelUnits - Retrieves the assigned segment hatch list. Converts any polyline or loop into hatches. Returns an empty array for delay and sync elements. * @param[in] nSegmentIndex - Segment Index. Must be between 0 and Count - 1. @@ -6946,6 +6978,21 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle) CheckError(lib3mf_toolpathlayerreader_getsegmenthatchdatadiscrete(m_pHandle, nSegmentIndex, elementsNeededHatchData, &elementsWrittenHatchData, HatchDataBuffer.data())); } + /** + * CToolpathLayerReader::GetSegmentHatchOverrideFactors - Retrieves the assigned segment override factors. Fails if segment type is not hatch. The call will return two values per hatch, one per hatch point. + * @param[in] nSegmentIndex - Segment Index. Must be between 0 and SegmentCount - 1. + * @param[in] eOverrideFactor - Which override factor value to retrieve (F, G or H). Returns an array of 0.0, if override factor type is unknown or not given. + * @param[out] FactorValuesBuffer - An target override factor for each point of the segment. In case of Polyline, the first array value describes the override for the initial jump. In case of Loop, the first array value describes the override for the inital jump and the last closing mark movement of the polyline. + */ + void CToolpathLayerReader::GetSegmentHatchOverrideFactors(const Lib3MF_uint32 nSegmentIndex, const eToolpathProfileOverrideFactor eOverrideFactor, std::vector & FactorValuesBuffer) + { + Lib3MF_uint64 elementsNeededFactorValues = 0; + Lib3MF_uint64 elementsWrittenFactorValues = 0; + CheckError(lib3mf_toolpathlayerreader_getsegmenthatchoverridefactors(m_pHandle, nSegmentIndex, eOverrideFactor, 0, &elementsNeededFactorValues, nullptr)); + FactorValuesBuffer.resize((size_t) elementsNeededFactorValues); + CheckError(lib3mf_toolpathlayerreader_getsegmenthatchoverridefactors(m_pHandle, nSegmentIndex, eOverrideFactor, elementsNeededFactorValues, &elementsWrittenFactorValues, FactorValuesBuffer.data())); + } + /** * Method definitions for class CToolpathLayerData */ diff --git a/Autogenerated/Bindings/Cpp/lib3mf_types.hpp b/Autogenerated/Bindings/Cpp/lib3mf_types.hpp index ce3529af..68fa5a1d 100644 --- a/Autogenerated/Bindings/Cpp/lib3mf_types.hpp +++ b/Autogenerated/Bindings/Cpp/lib3mf_types.hpp @@ -488,6 +488,11 @@ namespace Lib3MF { Lib3MF_int32 m_Tag; } sHatch2D; + typedef struct sHatch2DOverrides { + Lib3MF_double m_Point1Override; + Lib3MF_double m_Point2Override; + } sHatch2DOverrides; + typedef struct sDiscreteHatch2D { Lib3MF_int32 m_Point1Coordinates[2]; Lib3MF_int32 m_Point2Coordinates[2]; @@ -647,6 +652,7 @@ typedef Lib3MF::sPosition sLib3MFPosition; typedef Lib3MF::sPosition2D sLib3MFPosition2D; typedef Lib3MF::sDiscretePosition2D sLib3MFDiscretePosition2D; typedef Lib3MF::sHatch2D sLib3MFHatch2D; +typedef Lib3MF::sHatch2DOverrides sLib3MFHatch2DOverrides; typedef Lib3MF::sDiscreteHatch2D sLib3MFDiscreteHatch2D; typedef Lib3MF::sCompositeConstituent sLib3MFCompositeConstituent; typedef Lib3MF::sMultiPropertyLayer sLib3MFMultiPropertyLayer; diff --git a/Autogenerated/Bindings/CppDynamic/lib3mf_dynamic.h b/Autogenerated/Bindings/CppDynamic/lib3mf_dynamic.h index de9d47ca..eb3f6e3c 100644 --- a/Autogenerated/Bindings/CppDynamic/lib3mf_dynamic.h +++ b/Autogenerated/Bindings/CppDynamic/lib3mf_dynamic.h @@ -3641,11 +3641,22 @@ typedef Lib3MFResult (*PLib3MFToolpathLayerReader_GetSegmentDefaultProfileIDPtr) typedef Lib3MFResult (*PLib3MFToolpathLayerReader_GetProfileUUIDByLocalProfileIDPtr) (Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nLocalProfileID, const Lib3MF_uint32 nProfileUUIDBufferSize, Lib3MF_uint32* pProfileUUIDNeededChars, char * pProfileUUIDBuffer); /** -* Returns if the segment has a uniform profile. If it is uniform, then the default profile applies to the whole segment. If it is not uniform, the type specific retrieval functions have to be used (or the file has to be rejected). Returns false for delay and sync segments. +* Retrieves if the segment has specific override factors attached. +* +* @param[in] pToolpathLayerReader - ToolpathLayerReader instance. +* @param[in] nSegmentIndex - Segment Index. Must be between 0 and SegmentCount - 1. +* @param[in] eOverrideFactor - Which override factor value to retrieve (F, G or H). Returns an array of 0.0, if override factor type is unknown or not given. +* @param[out] pHasOverrides - Returns true, if the segment has attached any override factors of the given type, false otherwise. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFToolpathLayerReader_SegmentHasOverrideFactorsPtr) (Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nSegmentIndex, Lib3MF::eToolpathProfileOverrideFactor eOverrideFactor, bool * pHasOverrides); + +/** +* Returns if the segment has a uniform profile. If it is uniform, then the default profile applies to the whole segment. If it is not uniform, the type specific retrieval functions have to be used (or the file has to be rejected). Returns false for delay and sync segments. The call is equivalent to SegmentHasOverrideFactors returning false with any possible type (F, G, H). * * @param[in] pToolpathLayerReader - ToolpathLayerReader instance. * @param[in] nSegmentIndex - Segment Index. Must be between 0 and Count - 1. -* @param[out] pHasUniformProfile - If true, the segment has a uniform profile ID. +* @param[out] pHasUniformProfile - If true, the segment has a uniform profile ID. * @return error code or 0 (success) */ typedef Lib3MFResult (*PLib3MFToolpathLayerReader_SegmentHasUniformProfilePtr) (Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nSegmentIndex, bool * pHasUniformProfile); @@ -3674,6 +3685,19 @@ typedef Lib3MFResult (*PLib3MFToolpathLayerReader_GetSegmentPointDataInModelUnit */ typedef Lib3MFResult (*PLib3MFToolpathLayerReader_GetSegmentPointDataDiscretePtr) (Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nSegmentIndex, const Lib3MF_uint64 nPointDataBufferSize, Lib3MF_uint64* pPointDataNeededCount, Lib3MF::sDiscretePosition2D * pPointDataBuffer); +/** +* Retrieves the assigned segment override factors. Fails if segment type is not loop or polyline. The values are per point, meaning that gradients are given through linear ramping on the polyline vectors. +* +* @param[in] pToolpathLayerReader - ToolpathLayerReader instance. +* @param[in] nSegmentIndex - Segment Index. Must be between 0 and SegmentCount - 1. +* @param[in] eOverrideFactor - Which override factor value to retrieve (F, G or H). Returns an array of 0.0, if override factor type is unknown or not given. +* @param[in] nFactorValuesBufferSize - Number of elements in buffer +* @param[out] pFactorValuesNeededCount - will be filled with the count of the written elements, or needed buffer size. +* @param[out] pFactorValuesBuffer - double buffer of An target override factor for each point of the segment. In case of Polyline, the first array value describes the override for the initial jump. In case of Loop, the first array value describes the override for the inital jump and the last closing mark movement of the polyline. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFToolpathLayerReader_GetSegmentPointOverrideFactorsPtr) (Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nSegmentIndex, Lib3MF::eToolpathProfileOverrideFactor eOverrideFactor, const Lib3MF_uint64 nFactorValuesBufferSize, Lib3MF_uint64* pFactorValuesNeededCount, Lib3MF_double * pFactorValuesBuffer); + /** * Retrieves the assigned segment hatch list. Converts any polyline or loop into hatches. Returns an empty array for delay and sync elements. * @@ -3698,6 +3722,19 @@ typedef Lib3MFResult (*PLib3MFToolpathLayerReader_GetSegmentHatchDataInModelUnit */ typedef Lib3MFResult (*PLib3MFToolpathLayerReader_GetSegmentHatchDataDiscretePtr) (Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nSegmentIndex, const Lib3MF_uint64 nHatchDataBufferSize, Lib3MF_uint64* pHatchDataNeededCount, Lib3MF::sDiscreteHatch2D * pHatchDataBuffer); +/** +* Retrieves the assigned segment override factors. Fails if segment type is not hatch. The call will return two values per hatch, one per hatch point. +* +* @param[in] pToolpathLayerReader - ToolpathLayerReader instance. +* @param[in] nSegmentIndex - Segment Index. Must be between 0 and SegmentCount - 1. +* @param[in] eOverrideFactor - Which override factor value to retrieve (F, G or H). Returns an array of 0.0, if override factor type is unknown or not given. +* @param[in] nFactorValuesBufferSize - Number of elements in buffer +* @param[out] pFactorValuesNeededCount - will be filled with the count of the written elements, or needed buffer size. +* @param[out] pFactorValuesBuffer - Hatch2DOverrides buffer of An target override factor for each point of the segment. In case of Polyline, the first array value describes the override for the initial jump. In case of Loop, the first array value describes the override for the inital jump and the last closing mark movement of the polyline. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFToolpathLayerReader_GetSegmentHatchOverrideFactorsPtr) (Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nSegmentIndex, Lib3MF::eToolpathProfileOverrideFactor eOverrideFactor, const Lib3MF_uint64 nFactorValuesBufferSize, Lib3MF_uint64* pFactorValuesNeededCount, Lib3MF::sHatch2DOverrides * pFactorValuesBuffer); + /************************************************************************************************************************* Class definition for ToolpathLayerData **************************************************************************************************************************/ @@ -6138,11 +6175,14 @@ typedef struct { PLib3MFToolpathLayerReader_GetSegmentDefaultProfileUUIDPtr m_ToolpathLayerReader_GetSegmentDefaultProfileUUID; PLib3MFToolpathLayerReader_GetSegmentDefaultProfileIDPtr m_ToolpathLayerReader_GetSegmentDefaultProfileID; PLib3MFToolpathLayerReader_GetProfileUUIDByLocalProfileIDPtr m_ToolpathLayerReader_GetProfileUUIDByLocalProfileID; + PLib3MFToolpathLayerReader_SegmentHasOverrideFactorsPtr m_ToolpathLayerReader_SegmentHasOverrideFactors; PLib3MFToolpathLayerReader_SegmentHasUniformProfilePtr m_ToolpathLayerReader_SegmentHasUniformProfile; PLib3MFToolpathLayerReader_GetSegmentPointDataInModelUnitsPtr m_ToolpathLayerReader_GetSegmentPointDataInModelUnits; PLib3MFToolpathLayerReader_GetSegmentPointDataDiscretePtr m_ToolpathLayerReader_GetSegmentPointDataDiscrete; + PLib3MFToolpathLayerReader_GetSegmentPointOverrideFactorsPtr m_ToolpathLayerReader_GetSegmentPointOverrideFactors; PLib3MFToolpathLayerReader_GetSegmentHatchDataInModelUnitsPtr m_ToolpathLayerReader_GetSegmentHatchDataInModelUnits; PLib3MFToolpathLayerReader_GetSegmentHatchDataDiscretePtr m_ToolpathLayerReader_GetSegmentHatchDataDiscrete; + PLib3MFToolpathLayerReader_GetSegmentHatchOverrideFactorsPtr m_ToolpathLayerReader_GetSegmentHatchOverrideFactors; PLib3MFToolpathLayerData_GetLayerDataUUIDPtr m_ToolpathLayerData_GetLayerDataUUID; PLib3MFToolpathLayerData_RegisterProfilePtr m_ToolpathLayerData_RegisterProfile; PLib3MFToolpathLayerData_RegisterBuildItemPtr m_ToolpathLayerData_RegisterBuildItem; diff --git a/Autogenerated/Bindings/CppDynamic/lib3mf_dynamic.hpp b/Autogenerated/Bindings/CppDynamic/lib3mf_dynamic.hpp index 1e48053f..a4f80897 100644 --- a/Autogenerated/Bindings/CppDynamic/lib3mf_dynamic.hpp +++ b/Autogenerated/Bindings/CppDynamic/lib3mf_dynamic.hpp @@ -1737,11 +1737,14 @@ class CToolpathLayerReader : public CBase { inline std::string GetSegmentDefaultProfileUUID(const Lib3MF_uint32 nSegmentIndex); inline Lib3MF_uint32 GetSegmentDefaultProfileID(const Lib3MF_uint32 nSegmentIndex); inline std::string GetProfileUUIDByLocalProfileID(const Lib3MF_uint32 nLocalProfileID); + inline bool SegmentHasOverrideFactors(const Lib3MF_uint32 nSegmentIndex, const eToolpathProfileOverrideFactor eOverrideFactor); inline bool SegmentHasUniformProfile(const Lib3MF_uint32 nSegmentIndex); inline void GetSegmentPointDataInModelUnits(const Lib3MF_uint32 nSegmentIndex, std::vector & PointDataBuffer); inline void GetSegmentPointDataDiscrete(const Lib3MF_uint32 nSegmentIndex, std::vector & PointDataBuffer); + inline void GetSegmentPointOverrideFactors(const Lib3MF_uint32 nSegmentIndex, const eToolpathProfileOverrideFactor eOverrideFactor, std::vector & FactorValuesBuffer); inline void GetSegmentHatchDataInModelUnits(const Lib3MF_uint32 nSegmentIndex, std::vector & HatchDataBuffer); inline void GetSegmentHatchDataDiscrete(const Lib3MF_uint32 nSegmentIndex, std::vector & HatchDataBuffer); + inline void GetSegmentHatchOverrideFactors(const Lib3MF_uint32 nSegmentIndex, const eToolpathProfileOverrideFactor eOverrideFactor, std::vector & FactorValuesBuffer); }; /************************************************************************************************************************* @@ -2795,11 +2798,14 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle) pWrapperTable->m_ToolpathLayerReader_GetSegmentDefaultProfileUUID = nullptr; pWrapperTable->m_ToolpathLayerReader_GetSegmentDefaultProfileID = nullptr; pWrapperTable->m_ToolpathLayerReader_GetProfileUUIDByLocalProfileID = nullptr; + pWrapperTable->m_ToolpathLayerReader_SegmentHasOverrideFactors = nullptr; pWrapperTable->m_ToolpathLayerReader_SegmentHasUniformProfile = nullptr; pWrapperTable->m_ToolpathLayerReader_GetSegmentPointDataInModelUnits = nullptr; pWrapperTable->m_ToolpathLayerReader_GetSegmentPointDataDiscrete = nullptr; + pWrapperTable->m_ToolpathLayerReader_GetSegmentPointOverrideFactors = nullptr; pWrapperTable->m_ToolpathLayerReader_GetSegmentHatchDataInModelUnits = nullptr; pWrapperTable->m_ToolpathLayerReader_GetSegmentHatchDataDiscrete = nullptr; + pWrapperTable->m_ToolpathLayerReader_GetSegmentHatchOverrideFactors = nullptr; pWrapperTable->m_ToolpathLayerData_GetLayerDataUUID = nullptr; pWrapperTable->m_ToolpathLayerData_RegisterProfile = nullptr; pWrapperTable->m_ToolpathLayerData_RegisterBuildItem = nullptr; @@ -6133,6 +6139,15 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle) if (pWrapperTable->m_ToolpathLayerReader_GetProfileUUIDByLocalProfileID == nullptr) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + #ifdef _WIN32 + pWrapperTable->m_ToolpathLayerReader_SegmentHasOverrideFactors = (PLib3MFToolpathLayerReader_SegmentHasOverrideFactorsPtr) GetProcAddress(hLibrary, "lib3mf_toolpathlayerreader_segmenthasoverridefactors"); + #else // _WIN32 + pWrapperTable->m_ToolpathLayerReader_SegmentHasOverrideFactors = (PLib3MFToolpathLayerReader_SegmentHasOverrideFactorsPtr) dlsym(hLibrary, "lib3mf_toolpathlayerreader_segmenthasoverridefactors"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_ToolpathLayerReader_SegmentHasOverrideFactors == nullptr) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + #ifdef _WIN32 pWrapperTable->m_ToolpathLayerReader_SegmentHasUniformProfile = (PLib3MFToolpathLayerReader_SegmentHasUniformProfilePtr) GetProcAddress(hLibrary, "lib3mf_toolpathlayerreader_segmenthasuniformprofile"); #else // _WIN32 @@ -6160,6 +6175,15 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle) if (pWrapperTable->m_ToolpathLayerReader_GetSegmentPointDataDiscrete == nullptr) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + #ifdef _WIN32 + pWrapperTable->m_ToolpathLayerReader_GetSegmentPointOverrideFactors = (PLib3MFToolpathLayerReader_GetSegmentPointOverrideFactorsPtr) GetProcAddress(hLibrary, "lib3mf_toolpathlayerreader_getsegmentpointoverridefactors"); + #else // _WIN32 + pWrapperTable->m_ToolpathLayerReader_GetSegmentPointOverrideFactors = (PLib3MFToolpathLayerReader_GetSegmentPointOverrideFactorsPtr) dlsym(hLibrary, "lib3mf_toolpathlayerreader_getsegmentpointoverridefactors"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_ToolpathLayerReader_GetSegmentPointOverrideFactors == nullptr) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + #ifdef _WIN32 pWrapperTable->m_ToolpathLayerReader_GetSegmentHatchDataInModelUnits = (PLib3MFToolpathLayerReader_GetSegmentHatchDataInModelUnitsPtr) GetProcAddress(hLibrary, "lib3mf_toolpathlayerreader_getsegmenthatchdatainmodelunits"); #else // _WIN32 @@ -6178,6 +6202,15 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle) if (pWrapperTable->m_ToolpathLayerReader_GetSegmentHatchDataDiscrete == nullptr) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + #ifdef _WIN32 + pWrapperTable->m_ToolpathLayerReader_GetSegmentHatchOverrideFactors = (PLib3MFToolpathLayerReader_GetSegmentHatchOverrideFactorsPtr) GetProcAddress(hLibrary, "lib3mf_toolpathlayerreader_getsegmenthatchoverridefactors"); + #else // _WIN32 + pWrapperTable->m_ToolpathLayerReader_GetSegmentHatchOverrideFactors = (PLib3MFToolpathLayerReader_GetSegmentHatchOverrideFactorsPtr) dlsym(hLibrary, "lib3mf_toolpathlayerreader_getsegmenthatchoverridefactors"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_ToolpathLayerReader_GetSegmentHatchOverrideFactors == nullptr) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + #ifdef _WIN32 pWrapperTable->m_ToolpathLayerData_GetLayerDataUUID = (PLib3MFToolpathLayerData_GetLayerDataUUIDPtr) GetProcAddress(hLibrary, "lib3mf_toolpathlayerdata_getlayerdatauuid"); #else // _WIN32 @@ -9330,6 +9363,10 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle) if ( (eLookupError != 0) || (pWrapperTable->m_ToolpathLayerReader_GetProfileUUIDByLocalProfileID == nullptr) ) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + eLookupError = (*pLookup)("lib3mf_toolpathlayerreader_segmenthasoverridefactors", (void**)&(pWrapperTable->m_ToolpathLayerReader_SegmentHasOverrideFactors)); + if ( (eLookupError != 0) || (pWrapperTable->m_ToolpathLayerReader_SegmentHasOverrideFactors == nullptr) ) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + eLookupError = (*pLookup)("lib3mf_toolpathlayerreader_segmenthasuniformprofile", (void**)&(pWrapperTable->m_ToolpathLayerReader_SegmentHasUniformProfile)); if ( (eLookupError != 0) || (pWrapperTable->m_ToolpathLayerReader_SegmentHasUniformProfile == nullptr) ) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; @@ -9342,6 +9379,10 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle) if ( (eLookupError != 0) || (pWrapperTable->m_ToolpathLayerReader_GetSegmentPointDataDiscrete == nullptr) ) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + eLookupError = (*pLookup)("lib3mf_toolpathlayerreader_getsegmentpointoverridefactors", (void**)&(pWrapperTable->m_ToolpathLayerReader_GetSegmentPointOverrideFactors)); + if ( (eLookupError != 0) || (pWrapperTable->m_ToolpathLayerReader_GetSegmentPointOverrideFactors == nullptr) ) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + eLookupError = (*pLookup)("lib3mf_toolpathlayerreader_getsegmenthatchdatainmodelunits", (void**)&(pWrapperTable->m_ToolpathLayerReader_GetSegmentHatchDataInModelUnits)); if ( (eLookupError != 0) || (pWrapperTable->m_ToolpathLayerReader_GetSegmentHatchDataInModelUnits == nullptr) ) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; @@ -9350,6 +9391,10 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle) if ( (eLookupError != 0) || (pWrapperTable->m_ToolpathLayerReader_GetSegmentHatchDataDiscrete == nullptr) ) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + eLookupError = (*pLookup)("lib3mf_toolpathlayerreader_getsegmenthatchoverridefactors", (void**)&(pWrapperTable->m_ToolpathLayerReader_GetSegmentHatchOverrideFactors)); + if ( (eLookupError != 0) || (pWrapperTable->m_ToolpathLayerReader_GetSegmentHatchOverrideFactors == nullptr) ) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + eLookupError = (*pLookup)("lib3mf_toolpathlayerdata_getlayerdatauuid", (void**)&(pWrapperTable->m_ToolpathLayerData_GetLayerDataUUID)); if ( (eLookupError != 0) || (pWrapperTable->m_ToolpathLayerData_GetLayerDataUUID == nullptr) ) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; @@ -14594,9 +14639,23 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle) } /** - * CToolpathLayerReader::SegmentHasUniformProfile - Returns if the segment has a uniform profile. If it is uniform, then the default profile applies to the whole segment. If it is not uniform, the type specific retrieval functions have to be used (or the file has to be rejected). Returns false for delay and sync segments. + * CToolpathLayerReader::SegmentHasOverrideFactors - Retrieves if the segment has specific override factors attached. + * @param[in] nSegmentIndex - Segment Index. Must be between 0 and SegmentCount - 1. + * @param[in] eOverrideFactor - Which override factor value to retrieve (F, G or H). Returns an array of 0.0, if override factor type is unknown or not given. + * @return Returns true, if the segment has attached any override factors of the given type, false otherwise. + */ + bool CToolpathLayerReader::SegmentHasOverrideFactors(const Lib3MF_uint32 nSegmentIndex, const eToolpathProfileOverrideFactor eOverrideFactor) + { + bool resultHasOverrides = 0; + CheckError(m_pWrapper->m_WrapperTable.m_ToolpathLayerReader_SegmentHasOverrideFactors(m_pHandle, nSegmentIndex, eOverrideFactor, &resultHasOverrides)); + + return resultHasOverrides; + } + + /** + * CToolpathLayerReader::SegmentHasUniformProfile - Returns if the segment has a uniform profile. If it is uniform, then the default profile applies to the whole segment. If it is not uniform, the type specific retrieval functions have to be used (or the file has to be rejected). Returns false for delay and sync segments. The call is equivalent to SegmentHasOverrideFactors returning false with any possible type (F, G, H). * @param[in] nSegmentIndex - Segment Index. Must be between 0 and Count - 1. - * @return If true, the segment has a uniform profile ID. + * @return If true, the segment has a uniform profile ID. */ bool CToolpathLayerReader::SegmentHasUniformProfile(const Lib3MF_uint32 nSegmentIndex) { @@ -14634,6 +14693,21 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle) CheckError(m_pWrapper->m_WrapperTable.m_ToolpathLayerReader_GetSegmentPointDataDiscrete(m_pHandle, nSegmentIndex, elementsNeededPointData, &elementsWrittenPointData, PointDataBuffer.data())); } + /** + * CToolpathLayerReader::GetSegmentPointOverrideFactors - Retrieves the assigned segment override factors. Fails if segment type is not loop or polyline. The values are per point, meaning that gradients are given through linear ramping on the polyline vectors. + * @param[in] nSegmentIndex - Segment Index. Must be between 0 and SegmentCount - 1. + * @param[in] eOverrideFactor - Which override factor value to retrieve (F, G or H). Returns an array of 0.0, if override factor type is unknown or not given. + * @param[out] FactorValuesBuffer - An target override factor for each point of the segment. In case of Polyline, the first array value describes the override for the initial jump. In case of Loop, the first array value describes the override for the inital jump and the last closing mark movement of the polyline. + */ + void CToolpathLayerReader::GetSegmentPointOverrideFactors(const Lib3MF_uint32 nSegmentIndex, const eToolpathProfileOverrideFactor eOverrideFactor, std::vector & FactorValuesBuffer) + { + Lib3MF_uint64 elementsNeededFactorValues = 0; + Lib3MF_uint64 elementsWrittenFactorValues = 0; + CheckError(m_pWrapper->m_WrapperTable.m_ToolpathLayerReader_GetSegmentPointOverrideFactors(m_pHandle, nSegmentIndex, eOverrideFactor, 0, &elementsNeededFactorValues, nullptr)); + FactorValuesBuffer.resize((size_t) elementsNeededFactorValues); + CheckError(m_pWrapper->m_WrapperTable.m_ToolpathLayerReader_GetSegmentPointOverrideFactors(m_pHandle, nSegmentIndex, eOverrideFactor, elementsNeededFactorValues, &elementsWrittenFactorValues, FactorValuesBuffer.data())); + } + /** * CToolpathLayerReader::GetSegmentHatchDataInModelUnits - Retrieves the assigned segment hatch list. Converts any polyline or loop into hatches. Returns an empty array for delay and sync elements. * @param[in] nSegmentIndex - Segment Index. Must be between 0 and Count - 1. @@ -14662,6 +14736,21 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle) CheckError(m_pWrapper->m_WrapperTable.m_ToolpathLayerReader_GetSegmentHatchDataDiscrete(m_pHandle, nSegmentIndex, elementsNeededHatchData, &elementsWrittenHatchData, HatchDataBuffer.data())); } + /** + * CToolpathLayerReader::GetSegmentHatchOverrideFactors - Retrieves the assigned segment override factors. Fails if segment type is not hatch. The call will return two values per hatch, one per hatch point. + * @param[in] nSegmentIndex - Segment Index. Must be between 0 and SegmentCount - 1. + * @param[in] eOverrideFactor - Which override factor value to retrieve (F, G or H). Returns an array of 0.0, if override factor type is unknown or not given. + * @param[out] FactorValuesBuffer - An target override factor for each point of the segment. In case of Polyline, the first array value describes the override for the initial jump. In case of Loop, the first array value describes the override for the inital jump and the last closing mark movement of the polyline. + */ + void CToolpathLayerReader::GetSegmentHatchOverrideFactors(const Lib3MF_uint32 nSegmentIndex, const eToolpathProfileOverrideFactor eOverrideFactor, std::vector & FactorValuesBuffer) + { + Lib3MF_uint64 elementsNeededFactorValues = 0; + Lib3MF_uint64 elementsWrittenFactorValues = 0; + CheckError(m_pWrapper->m_WrapperTable.m_ToolpathLayerReader_GetSegmentHatchOverrideFactors(m_pHandle, nSegmentIndex, eOverrideFactor, 0, &elementsNeededFactorValues, nullptr)); + FactorValuesBuffer.resize((size_t) elementsNeededFactorValues); + CheckError(m_pWrapper->m_WrapperTable.m_ToolpathLayerReader_GetSegmentHatchOverrideFactors(m_pHandle, nSegmentIndex, eOverrideFactor, elementsNeededFactorValues, &elementsWrittenFactorValues, FactorValuesBuffer.data())); + } + /** * Method definitions for class CToolpathLayerData */ diff --git a/Autogenerated/Bindings/CppDynamic/lib3mf_types.hpp b/Autogenerated/Bindings/CppDynamic/lib3mf_types.hpp index ce3529af..68fa5a1d 100644 --- a/Autogenerated/Bindings/CppDynamic/lib3mf_types.hpp +++ b/Autogenerated/Bindings/CppDynamic/lib3mf_types.hpp @@ -488,6 +488,11 @@ namespace Lib3MF { Lib3MF_int32 m_Tag; } sHatch2D; + typedef struct sHatch2DOverrides { + Lib3MF_double m_Point1Override; + Lib3MF_double m_Point2Override; + } sHatch2DOverrides; + typedef struct sDiscreteHatch2D { Lib3MF_int32 m_Point1Coordinates[2]; Lib3MF_int32 m_Point2Coordinates[2]; @@ -647,6 +652,7 @@ typedef Lib3MF::sPosition sLib3MFPosition; typedef Lib3MF::sPosition2D sLib3MFPosition2D; typedef Lib3MF::sDiscretePosition2D sLib3MFDiscretePosition2D; typedef Lib3MF::sHatch2D sLib3MFHatch2D; +typedef Lib3MF::sHatch2DOverrides sLib3MFHatch2DOverrides; typedef Lib3MF::sDiscreteHatch2D sLib3MFDiscreteHatch2D; typedef Lib3MF::sCompositeConstituent sLib3MFCompositeConstituent; typedef Lib3MF::sMultiPropertyLayer sLib3MFMultiPropertyLayer; diff --git a/Autogenerated/Bindings/Go/lib3mf.go b/Autogenerated/Bindings/Go/lib3mf.go index 46683ab9..18353a9c 100644 --- a/Autogenerated/Bindings/Go/lib3mf.go +++ b/Autogenerated/Bindings/Go/lib3mf.go @@ -3159,6 +3159,15 @@ Lib3MFResult CCall_lib3mf_toolpathlayerreader_getprofileuuidbylocalprofileid(Lib } +Lib3MFResult CCall_lib3mf_toolpathlayerreader_segmenthasoverridefactors(Lib3MFHandle libraryHandle, Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nSegmentIndex, eLib3MFToolpathProfileOverrideFactor eOverrideFactor, bool * pHasOverrides) +{ + if (libraryHandle == 0) + return LIB3MF_ERROR_INVALIDCAST; + sLib3MFDynamicWrapperTable * wrapperTable = (sLib3MFDynamicWrapperTable *) libraryHandle; + return wrapperTable->m_ToolpathLayerReader_SegmentHasOverrideFactors (pToolpathLayerReader, nSegmentIndex, eOverrideFactor, pHasOverrides); +} + + Lib3MFResult CCall_lib3mf_toolpathlayerreader_segmenthasuniformprofile(Lib3MFHandle libraryHandle, Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nSegmentIndex, bool * pHasUniformProfile) { if (libraryHandle == 0) @@ -3186,6 +3195,15 @@ Lib3MFResult CCall_lib3mf_toolpathlayerreader_getsegmentpointdatadiscrete(Lib3MF } +Lib3MFResult CCall_lib3mf_toolpathlayerreader_getsegmentpointoverridefactors(Lib3MFHandle libraryHandle, Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nSegmentIndex, eLib3MFToolpathProfileOverrideFactor eOverrideFactor, const Lib3MF_uint64 nFactorValuesBufferSize, Lib3MF_uint64* pFactorValuesNeededCount, Lib3MF_double * pFactorValuesBuffer) +{ + if (libraryHandle == 0) + return LIB3MF_ERROR_INVALIDCAST; + sLib3MFDynamicWrapperTable * wrapperTable = (sLib3MFDynamicWrapperTable *) libraryHandle; + return wrapperTable->m_ToolpathLayerReader_GetSegmentPointOverrideFactors (pToolpathLayerReader, nSegmentIndex, eOverrideFactor, nFactorValuesBufferSize, pFactorValuesNeededCount, pFactorValuesBuffer); +} + + Lib3MFResult CCall_lib3mf_toolpathlayerreader_getsegmenthatchdatainmodelunits(Lib3MFHandle libraryHandle, Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nSegmentIndex, const Lib3MF_uint64 nHatchDataBufferSize, Lib3MF_uint64* pHatchDataNeededCount, sLib3MFHatch2D * pHatchDataBuffer) { if (libraryHandle == 0) @@ -3204,6 +3222,15 @@ Lib3MFResult CCall_lib3mf_toolpathlayerreader_getsegmenthatchdatadiscrete(Lib3MF } +Lib3MFResult CCall_lib3mf_toolpathlayerreader_getsegmenthatchoverridefactors(Lib3MFHandle libraryHandle, Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nSegmentIndex, eLib3MFToolpathProfileOverrideFactor eOverrideFactor, const Lib3MF_uint64 nFactorValuesBufferSize, Lib3MF_uint64* pFactorValuesNeededCount, sLib3MFHatch2DOverrides * pFactorValuesBuffer) +{ + if (libraryHandle == 0) + return LIB3MF_ERROR_INVALIDCAST; + sLib3MFDynamicWrapperTable * wrapperTable = (sLib3MFDynamicWrapperTable *) libraryHandle; + return wrapperTable->m_ToolpathLayerReader_GetSegmentHatchOverrideFactors (pToolpathLayerReader, nSegmentIndex, eOverrideFactor, nFactorValuesBufferSize, pFactorValuesNeededCount, pFactorValuesBuffer); +} + + Lib3MFResult CCall_lib3mf_toolpathlayerdata_getlayerdatauuid(Lib3MFHandle libraryHandle, Lib3MF_ToolpathLayerData pToolpathLayerData, const Lib3MF_uint32 nUUIDBufferSize, Lib3MF_uint32* pUUIDNeededChars, char * pUUIDBuffer) { if (libraryHandle == 0) @@ -5240,6 +5267,12 @@ type Hatch2D struct { Tag int32 } +// Hatch2DOverrides represents a Lib3MF struct. +type Hatch2DOverrides struct { + Point1Override float64 + Point2Override float64 +} + // DiscreteHatch2D represents a Lib3MF struct. type DiscreteHatch2D struct { Point1Coordinates[2] int32 @@ -9855,7 +9888,17 @@ func (inst ToolpathLayerReader) GetProfileUUIDByLocalProfileID(localProfileID ui return string(bufferprofileUUID[:(filledinprofileUUID-1)]), nil } -// SegmentHasUniformProfile returns if the segment has a uniform profile. If it is uniform, then the default profile applies to the whole segment. If it is not uniform, the type specific retrieval functions have to be used (or the file has to be rejected). Returns false for delay and sync segments. +// SegmentHasOverrideFactors retrieves if the segment has specific override factors attached. +func (inst ToolpathLayerReader) SegmentHasOverrideFactors(segmentIndex uint32, overrideFactor ToolpathProfileOverrideFactor) (bool, error) { + var hasOverrides C.bool + ret := C.CCall_lib3mf_toolpathlayerreader_segmenthasoverridefactors(inst.wrapperRef.LibraryHandle, inst.Ref, C.uint32_t(segmentIndex), C.eLib3MFToolpathProfileOverrideFactor(overrideFactor), &hasOverrides) + if ret != 0 { + return false, makeError(uint32(ret)) + } + return bool(hasOverrides), nil +} + +// SegmentHasUniformProfile returns if the segment has a uniform profile. If it is uniform, then the default profile applies to the whole segment. If it is not uniform, the type specific retrieval functions have to be used (or the file has to be rejected). Returns false for delay and sync segments. The call is equivalent to SegmentHasOverrideFactors returning false with any possible type (F, G, H). func (inst ToolpathLayerReader) SegmentHasUniformProfile(segmentIndex uint32) (bool, error) { var hasUniformProfile C.bool ret := C.CCall_lib3mf_toolpathlayerreader_segmenthasuniformprofile(inst.wrapperRef.LibraryHandle, inst.Ref, C.uint32_t(segmentIndex), &hasUniformProfile) @@ -9899,6 +9942,23 @@ func (inst ToolpathLayerReader) GetSegmentPointDataDiscrete(segmentIndex uint32, return pointData[:int(neededforpointData)], nil } +// GetSegmentPointOverrideFactors retrieves the assigned segment override factors. Fails if segment type is not loop or polyline. The values are per point, meaning that gradients are given through linear ramping on the polyline vectors. +func (inst ToolpathLayerReader) GetSegmentPointOverrideFactors(segmentIndex uint32, overrideFactor ToolpathProfileOverrideFactor, factorValues []float64) ([]float64, error) { + var neededforfactorValues C.uint64_t + ret := C.CCall_lib3mf_toolpathlayerreader_getsegmentpointoverridefactors(inst.wrapperRef.LibraryHandle, inst.Ref, C.uint32_t(segmentIndex), C.eLib3MFToolpathProfileOverrideFactor(overrideFactor), 0, &neededforfactorValues, nil) + if ret != 0 { + return nil, makeError(uint32(ret)) + } + if len(factorValues) < int(neededforfactorValues) { + factorValues = append(factorValues, make([]float64, int(neededforfactorValues)-len(factorValues))...) + } + ret = C.CCall_lib3mf_toolpathlayerreader_getsegmentpointoverridefactors(inst.wrapperRef.LibraryHandle, inst.Ref, C.uint32_t(segmentIndex), C.eLib3MFToolpathProfileOverrideFactor(overrideFactor), neededforfactorValues, nil, (*C.double)(unsafe.Pointer(&factorValues[0]))) + if ret != 0 { + return nil, makeError(uint32(ret)) + } + return factorValues[:int(neededforfactorValues)], nil +} + // GetSegmentHatchDataInModelUnits retrieves the assigned segment hatch list. Converts any polyline or loop into hatches. Returns an empty array for delay and sync elements. func (inst ToolpathLayerReader) GetSegmentHatchDataInModelUnits(segmentIndex uint32, hatchData []Hatch2D) ([]Hatch2D, error) { var neededforhatchData C.uint64_t @@ -9933,6 +9993,23 @@ func (inst ToolpathLayerReader) GetSegmentHatchDataDiscrete(segmentIndex uint32, return hatchData[:int(neededforhatchData)], nil } +// GetSegmentHatchOverrideFactors retrieves the assigned segment override factors. Fails if segment type is not hatch. The call will return two values per hatch, one per hatch point. +func (inst ToolpathLayerReader) GetSegmentHatchOverrideFactors(segmentIndex uint32, overrideFactor ToolpathProfileOverrideFactor, factorValues []Hatch2DOverrides) ([]Hatch2DOverrides, error) { + var neededforfactorValues C.uint64_t + ret := C.CCall_lib3mf_toolpathlayerreader_getsegmenthatchoverridefactors(inst.wrapperRef.LibraryHandle, inst.Ref, C.uint32_t(segmentIndex), C.eLib3MFToolpathProfileOverrideFactor(overrideFactor), 0, &neededforfactorValues, nil) + if ret != 0 { + return nil, makeError(uint32(ret)) + } + if len(factorValues) < int(neededforfactorValues) { + factorValues = append(factorValues, make([]Hatch2DOverrides, int(neededforfactorValues)-len(factorValues))...) + } + ret = C.CCall_lib3mf_toolpathlayerreader_getsegmenthatchoverridefactors(inst.wrapperRef.LibraryHandle, inst.Ref, C.uint32_t(segmentIndex), C.eLib3MFToolpathProfileOverrideFactor(overrideFactor), neededforfactorValues, nil, (*C.sLib3MFHatch2DOverrides)(unsafe.Pointer(&factorValues[0]))) + if ret != 0 { + return nil, makeError(uint32(ret)) + } + return factorValues[:int(neededforfactorValues)], nil +} + // ToolpathLayerData represents a Lib3MF class. type ToolpathLayerData struct { diff --git a/Autogenerated/Bindings/Go/lib3mf_dynamic.cc b/Autogenerated/Bindings/Go/lib3mf_dynamic.cc index bbd12fd0..5f4ba8d7 100644 --- a/Autogenerated/Bindings/Go/lib3mf_dynamic.cc +++ b/Autogenerated/Bindings/Go/lib3mf_dynamic.cc @@ -391,11 +391,14 @@ Lib3MFResult InitLib3MFWrapperTable(sLib3MFDynamicWrapperTable * pWrapperTable) pWrapperTable->m_ToolpathLayerReader_GetSegmentDefaultProfileUUID = NULL; pWrapperTable->m_ToolpathLayerReader_GetSegmentDefaultProfileID = NULL; pWrapperTable->m_ToolpathLayerReader_GetProfileUUIDByLocalProfileID = NULL; + pWrapperTable->m_ToolpathLayerReader_SegmentHasOverrideFactors = NULL; pWrapperTable->m_ToolpathLayerReader_SegmentHasUniformProfile = NULL; pWrapperTable->m_ToolpathLayerReader_GetSegmentPointDataInModelUnits = NULL; pWrapperTable->m_ToolpathLayerReader_GetSegmentPointDataDiscrete = NULL; + pWrapperTable->m_ToolpathLayerReader_GetSegmentPointOverrideFactors = NULL; pWrapperTable->m_ToolpathLayerReader_GetSegmentHatchDataInModelUnits = NULL; pWrapperTable->m_ToolpathLayerReader_GetSegmentHatchDataDiscrete = NULL; + pWrapperTable->m_ToolpathLayerReader_GetSegmentHatchOverrideFactors = NULL; pWrapperTable->m_ToolpathLayerData_GetLayerDataUUID = NULL; pWrapperTable->m_ToolpathLayerData_RegisterProfile = NULL; pWrapperTable->m_ToolpathLayerData_RegisterBuildItem = NULL; @@ -3733,6 +3736,15 @@ Lib3MFResult LoadLib3MFWrapperTable(sLib3MFDynamicWrapperTable * pWrapperTable, if (pWrapperTable->m_ToolpathLayerReader_GetProfileUUIDByLocalProfileID == NULL) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + #ifdef _WIN32 + pWrapperTable->m_ToolpathLayerReader_SegmentHasOverrideFactors = (PLib3MFToolpathLayerReader_SegmentHasOverrideFactorsPtr) GetProcAddress(hLibrary, "lib3mf_toolpathlayerreader_segmenthasoverridefactors"); + #else // _WIN32 + pWrapperTable->m_ToolpathLayerReader_SegmentHasOverrideFactors = (PLib3MFToolpathLayerReader_SegmentHasOverrideFactorsPtr) dlsym(hLibrary, "lib3mf_toolpathlayerreader_segmenthasoverridefactors"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_ToolpathLayerReader_SegmentHasOverrideFactors == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + #ifdef _WIN32 pWrapperTable->m_ToolpathLayerReader_SegmentHasUniformProfile = (PLib3MFToolpathLayerReader_SegmentHasUniformProfilePtr) GetProcAddress(hLibrary, "lib3mf_toolpathlayerreader_segmenthasuniformprofile"); #else // _WIN32 @@ -3760,6 +3772,15 @@ Lib3MFResult LoadLib3MFWrapperTable(sLib3MFDynamicWrapperTable * pWrapperTable, if (pWrapperTable->m_ToolpathLayerReader_GetSegmentPointDataDiscrete == NULL) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + #ifdef _WIN32 + pWrapperTable->m_ToolpathLayerReader_GetSegmentPointOverrideFactors = (PLib3MFToolpathLayerReader_GetSegmentPointOverrideFactorsPtr) GetProcAddress(hLibrary, "lib3mf_toolpathlayerreader_getsegmentpointoverridefactors"); + #else // _WIN32 + pWrapperTable->m_ToolpathLayerReader_GetSegmentPointOverrideFactors = (PLib3MFToolpathLayerReader_GetSegmentPointOverrideFactorsPtr) dlsym(hLibrary, "lib3mf_toolpathlayerreader_getsegmentpointoverridefactors"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_ToolpathLayerReader_GetSegmentPointOverrideFactors == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + #ifdef _WIN32 pWrapperTable->m_ToolpathLayerReader_GetSegmentHatchDataInModelUnits = (PLib3MFToolpathLayerReader_GetSegmentHatchDataInModelUnitsPtr) GetProcAddress(hLibrary, "lib3mf_toolpathlayerreader_getsegmenthatchdatainmodelunits"); #else // _WIN32 @@ -3778,6 +3799,15 @@ Lib3MFResult LoadLib3MFWrapperTable(sLib3MFDynamicWrapperTable * pWrapperTable, if (pWrapperTable->m_ToolpathLayerReader_GetSegmentHatchDataDiscrete == NULL) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + #ifdef _WIN32 + pWrapperTable->m_ToolpathLayerReader_GetSegmentHatchOverrideFactors = (PLib3MFToolpathLayerReader_GetSegmentHatchOverrideFactorsPtr) GetProcAddress(hLibrary, "lib3mf_toolpathlayerreader_getsegmenthatchoverridefactors"); + #else // _WIN32 + pWrapperTable->m_ToolpathLayerReader_GetSegmentHatchOverrideFactors = (PLib3MFToolpathLayerReader_GetSegmentHatchOverrideFactorsPtr) dlsym(hLibrary, "lib3mf_toolpathlayerreader_getsegmenthatchoverridefactors"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_ToolpathLayerReader_GetSegmentHatchOverrideFactors == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + #ifdef _WIN32 pWrapperTable->m_ToolpathLayerData_GetLayerDataUUID = (PLib3MFToolpathLayerData_GetLayerDataUUIDPtr) GetProcAddress(hLibrary, "lib3mf_toolpathlayerdata_getlayerdatauuid"); #else // _WIN32 diff --git a/Autogenerated/Bindings/Go/lib3mf_dynamic.h b/Autogenerated/Bindings/Go/lib3mf_dynamic.h index 226ce555..5ee38809 100644 --- a/Autogenerated/Bindings/Go/lib3mf_dynamic.h +++ b/Autogenerated/Bindings/Go/lib3mf_dynamic.h @@ -3641,11 +3641,22 @@ typedef Lib3MFResult (*PLib3MFToolpathLayerReader_GetSegmentDefaultProfileIDPtr) typedef Lib3MFResult (*PLib3MFToolpathLayerReader_GetProfileUUIDByLocalProfileIDPtr) (Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nLocalProfileID, const Lib3MF_uint32 nProfileUUIDBufferSize, Lib3MF_uint32* pProfileUUIDNeededChars, char * pProfileUUIDBuffer); /** -* Returns if the segment has a uniform profile. If it is uniform, then the default profile applies to the whole segment. If it is not uniform, the type specific retrieval functions have to be used (or the file has to be rejected). Returns false for delay and sync segments. +* Retrieves if the segment has specific override factors attached. +* +* @param[in] pToolpathLayerReader - ToolpathLayerReader instance. +* @param[in] nSegmentIndex - Segment Index. Must be between 0 and SegmentCount - 1. +* @param[in] eOverrideFactor - Which override factor value to retrieve (F, G or H). Returns an array of 0.0, if override factor type is unknown or not given. +* @param[out] pHasOverrides - Returns true, if the segment has attached any override factors of the given type, false otherwise. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFToolpathLayerReader_SegmentHasOverrideFactorsPtr) (Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nSegmentIndex, eLib3MFToolpathProfileOverrideFactor eOverrideFactor, bool * pHasOverrides); + +/** +* Returns if the segment has a uniform profile. If it is uniform, then the default profile applies to the whole segment. If it is not uniform, the type specific retrieval functions have to be used (or the file has to be rejected). Returns false for delay and sync segments. The call is equivalent to SegmentHasOverrideFactors returning false with any possible type (F, G, H). * * @param[in] pToolpathLayerReader - ToolpathLayerReader instance. * @param[in] nSegmentIndex - Segment Index. Must be between 0 and Count - 1. -* @param[out] pHasUniformProfile - If true, the segment has a uniform profile ID. +* @param[out] pHasUniformProfile - If true, the segment has a uniform profile ID. * @return error code or 0 (success) */ typedef Lib3MFResult (*PLib3MFToolpathLayerReader_SegmentHasUniformProfilePtr) (Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nSegmentIndex, bool * pHasUniformProfile); @@ -3674,6 +3685,19 @@ typedef Lib3MFResult (*PLib3MFToolpathLayerReader_GetSegmentPointDataInModelUnit */ typedef Lib3MFResult (*PLib3MFToolpathLayerReader_GetSegmentPointDataDiscretePtr) (Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nSegmentIndex, const Lib3MF_uint64 nPointDataBufferSize, Lib3MF_uint64* pPointDataNeededCount, sLib3MFDiscretePosition2D * pPointDataBuffer); +/** +* Retrieves the assigned segment override factors. Fails if segment type is not loop or polyline. The values are per point, meaning that gradients are given through linear ramping on the polyline vectors. +* +* @param[in] pToolpathLayerReader - ToolpathLayerReader instance. +* @param[in] nSegmentIndex - Segment Index. Must be between 0 and SegmentCount - 1. +* @param[in] eOverrideFactor - Which override factor value to retrieve (F, G or H). Returns an array of 0.0, if override factor type is unknown or not given. +* @param[in] nFactorValuesBufferSize - Number of elements in buffer +* @param[out] pFactorValuesNeededCount - will be filled with the count of the written elements, or needed buffer size. +* @param[out] pFactorValuesBuffer - double buffer of An target override factor for each point of the segment. In case of Polyline, the first array value describes the override for the initial jump. In case of Loop, the first array value describes the override for the inital jump and the last closing mark movement of the polyline. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFToolpathLayerReader_GetSegmentPointOverrideFactorsPtr) (Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nSegmentIndex, eLib3MFToolpathProfileOverrideFactor eOverrideFactor, const Lib3MF_uint64 nFactorValuesBufferSize, Lib3MF_uint64* pFactorValuesNeededCount, Lib3MF_double * pFactorValuesBuffer); + /** * Retrieves the assigned segment hatch list. Converts any polyline or loop into hatches. Returns an empty array for delay and sync elements. * @@ -3698,6 +3722,19 @@ typedef Lib3MFResult (*PLib3MFToolpathLayerReader_GetSegmentHatchDataInModelUnit */ typedef Lib3MFResult (*PLib3MFToolpathLayerReader_GetSegmentHatchDataDiscretePtr) (Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nSegmentIndex, const Lib3MF_uint64 nHatchDataBufferSize, Lib3MF_uint64* pHatchDataNeededCount, sLib3MFDiscreteHatch2D * pHatchDataBuffer); +/** +* Retrieves the assigned segment override factors. Fails if segment type is not hatch. The call will return two values per hatch, one per hatch point. +* +* @param[in] pToolpathLayerReader - ToolpathLayerReader instance. +* @param[in] nSegmentIndex - Segment Index. Must be between 0 and SegmentCount - 1. +* @param[in] eOverrideFactor - Which override factor value to retrieve (F, G or H). Returns an array of 0.0, if override factor type is unknown or not given. +* @param[in] nFactorValuesBufferSize - Number of elements in buffer +* @param[out] pFactorValuesNeededCount - will be filled with the count of the written elements, or needed buffer size. +* @param[out] pFactorValuesBuffer - Hatch2DOverrides buffer of An target override factor for each point of the segment. In case of Polyline, the first array value describes the override for the initial jump. In case of Loop, the first array value describes the override for the inital jump and the last closing mark movement of the polyline. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFToolpathLayerReader_GetSegmentHatchOverrideFactorsPtr) (Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nSegmentIndex, eLib3MFToolpathProfileOverrideFactor eOverrideFactor, const Lib3MF_uint64 nFactorValuesBufferSize, Lib3MF_uint64* pFactorValuesNeededCount, sLib3MFHatch2DOverrides * pFactorValuesBuffer); + /************************************************************************************************************************* Class definition for ToolpathLayerData **************************************************************************************************************************/ @@ -6138,11 +6175,14 @@ typedef struct { PLib3MFToolpathLayerReader_GetSegmentDefaultProfileUUIDPtr m_ToolpathLayerReader_GetSegmentDefaultProfileUUID; PLib3MFToolpathLayerReader_GetSegmentDefaultProfileIDPtr m_ToolpathLayerReader_GetSegmentDefaultProfileID; PLib3MFToolpathLayerReader_GetProfileUUIDByLocalProfileIDPtr m_ToolpathLayerReader_GetProfileUUIDByLocalProfileID; + PLib3MFToolpathLayerReader_SegmentHasOverrideFactorsPtr m_ToolpathLayerReader_SegmentHasOverrideFactors; PLib3MFToolpathLayerReader_SegmentHasUniformProfilePtr m_ToolpathLayerReader_SegmentHasUniformProfile; PLib3MFToolpathLayerReader_GetSegmentPointDataInModelUnitsPtr m_ToolpathLayerReader_GetSegmentPointDataInModelUnits; PLib3MFToolpathLayerReader_GetSegmentPointDataDiscretePtr m_ToolpathLayerReader_GetSegmentPointDataDiscrete; + PLib3MFToolpathLayerReader_GetSegmentPointOverrideFactorsPtr m_ToolpathLayerReader_GetSegmentPointOverrideFactors; PLib3MFToolpathLayerReader_GetSegmentHatchDataInModelUnitsPtr m_ToolpathLayerReader_GetSegmentHatchDataInModelUnits; PLib3MFToolpathLayerReader_GetSegmentHatchDataDiscretePtr m_ToolpathLayerReader_GetSegmentHatchDataDiscrete; + PLib3MFToolpathLayerReader_GetSegmentHatchOverrideFactorsPtr m_ToolpathLayerReader_GetSegmentHatchOverrideFactors; PLib3MFToolpathLayerData_GetLayerDataUUIDPtr m_ToolpathLayerData_GetLayerDataUUID; PLib3MFToolpathLayerData_RegisterProfilePtr m_ToolpathLayerData_RegisterProfile; PLib3MFToolpathLayerData_RegisterBuildItemPtr m_ToolpathLayerData_RegisterBuildItem; diff --git a/Autogenerated/Bindings/Go/lib3mf_types.h b/Autogenerated/Bindings/Go/lib3mf_types.h index d53e8deb..61b4b5f6 100644 --- a/Autogenerated/Bindings/Go/lib3mf_types.h +++ b/Autogenerated/Bindings/Go/lib3mf_types.h @@ -601,6 +601,11 @@ typedef struct sLib3MFHatch2D { Lib3MF_int32 m_Tag; } sLib3MFHatch2D; +typedef struct sLib3MFHatch2DOverrides { + Lib3MF_double m_Point1Override; + Lib3MF_double m_Point2Override; +} sLib3MFHatch2DOverrides; + typedef struct sLib3MFDiscreteHatch2D { Lib3MF_int32 m_Point1Coordinates[2]; Lib3MF_int32 m_Point2Coordinates[2]; diff --git a/Autogenerated/Bindings/NodeJS/lib3mf_dynamic.cc b/Autogenerated/Bindings/NodeJS/lib3mf_dynamic.cc index bbd12fd0..5f4ba8d7 100644 --- a/Autogenerated/Bindings/NodeJS/lib3mf_dynamic.cc +++ b/Autogenerated/Bindings/NodeJS/lib3mf_dynamic.cc @@ -391,11 +391,14 @@ Lib3MFResult InitLib3MFWrapperTable(sLib3MFDynamicWrapperTable * pWrapperTable) pWrapperTable->m_ToolpathLayerReader_GetSegmentDefaultProfileUUID = NULL; pWrapperTable->m_ToolpathLayerReader_GetSegmentDefaultProfileID = NULL; pWrapperTable->m_ToolpathLayerReader_GetProfileUUIDByLocalProfileID = NULL; + pWrapperTable->m_ToolpathLayerReader_SegmentHasOverrideFactors = NULL; pWrapperTable->m_ToolpathLayerReader_SegmentHasUniformProfile = NULL; pWrapperTable->m_ToolpathLayerReader_GetSegmentPointDataInModelUnits = NULL; pWrapperTable->m_ToolpathLayerReader_GetSegmentPointDataDiscrete = NULL; + pWrapperTable->m_ToolpathLayerReader_GetSegmentPointOverrideFactors = NULL; pWrapperTable->m_ToolpathLayerReader_GetSegmentHatchDataInModelUnits = NULL; pWrapperTable->m_ToolpathLayerReader_GetSegmentHatchDataDiscrete = NULL; + pWrapperTable->m_ToolpathLayerReader_GetSegmentHatchOverrideFactors = NULL; pWrapperTable->m_ToolpathLayerData_GetLayerDataUUID = NULL; pWrapperTable->m_ToolpathLayerData_RegisterProfile = NULL; pWrapperTable->m_ToolpathLayerData_RegisterBuildItem = NULL; @@ -3733,6 +3736,15 @@ Lib3MFResult LoadLib3MFWrapperTable(sLib3MFDynamicWrapperTable * pWrapperTable, if (pWrapperTable->m_ToolpathLayerReader_GetProfileUUIDByLocalProfileID == NULL) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + #ifdef _WIN32 + pWrapperTable->m_ToolpathLayerReader_SegmentHasOverrideFactors = (PLib3MFToolpathLayerReader_SegmentHasOverrideFactorsPtr) GetProcAddress(hLibrary, "lib3mf_toolpathlayerreader_segmenthasoverridefactors"); + #else // _WIN32 + pWrapperTable->m_ToolpathLayerReader_SegmentHasOverrideFactors = (PLib3MFToolpathLayerReader_SegmentHasOverrideFactorsPtr) dlsym(hLibrary, "lib3mf_toolpathlayerreader_segmenthasoverridefactors"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_ToolpathLayerReader_SegmentHasOverrideFactors == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + #ifdef _WIN32 pWrapperTable->m_ToolpathLayerReader_SegmentHasUniformProfile = (PLib3MFToolpathLayerReader_SegmentHasUniformProfilePtr) GetProcAddress(hLibrary, "lib3mf_toolpathlayerreader_segmenthasuniformprofile"); #else // _WIN32 @@ -3760,6 +3772,15 @@ Lib3MFResult LoadLib3MFWrapperTable(sLib3MFDynamicWrapperTable * pWrapperTable, if (pWrapperTable->m_ToolpathLayerReader_GetSegmentPointDataDiscrete == NULL) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + #ifdef _WIN32 + pWrapperTable->m_ToolpathLayerReader_GetSegmentPointOverrideFactors = (PLib3MFToolpathLayerReader_GetSegmentPointOverrideFactorsPtr) GetProcAddress(hLibrary, "lib3mf_toolpathlayerreader_getsegmentpointoverridefactors"); + #else // _WIN32 + pWrapperTable->m_ToolpathLayerReader_GetSegmentPointOverrideFactors = (PLib3MFToolpathLayerReader_GetSegmentPointOverrideFactorsPtr) dlsym(hLibrary, "lib3mf_toolpathlayerreader_getsegmentpointoverridefactors"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_ToolpathLayerReader_GetSegmentPointOverrideFactors == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + #ifdef _WIN32 pWrapperTable->m_ToolpathLayerReader_GetSegmentHatchDataInModelUnits = (PLib3MFToolpathLayerReader_GetSegmentHatchDataInModelUnitsPtr) GetProcAddress(hLibrary, "lib3mf_toolpathlayerreader_getsegmenthatchdatainmodelunits"); #else // _WIN32 @@ -3778,6 +3799,15 @@ Lib3MFResult LoadLib3MFWrapperTable(sLib3MFDynamicWrapperTable * pWrapperTable, if (pWrapperTable->m_ToolpathLayerReader_GetSegmentHatchDataDiscrete == NULL) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + #ifdef _WIN32 + pWrapperTable->m_ToolpathLayerReader_GetSegmentHatchOverrideFactors = (PLib3MFToolpathLayerReader_GetSegmentHatchOverrideFactorsPtr) GetProcAddress(hLibrary, "lib3mf_toolpathlayerreader_getsegmenthatchoverridefactors"); + #else // _WIN32 + pWrapperTable->m_ToolpathLayerReader_GetSegmentHatchOverrideFactors = (PLib3MFToolpathLayerReader_GetSegmentHatchOverrideFactorsPtr) dlsym(hLibrary, "lib3mf_toolpathlayerreader_getsegmenthatchoverridefactors"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_ToolpathLayerReader_GetSegmentHatchOverrideFactors == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + #ifdef _WIN32 pWrapperTable->m_ToolpathLayerData_GetLayerDataUUID = (PLib3MFToolpathLayerData_GetLayerDataUUIDPtr) GetProcAddress(hLibrary, "lib3mf_toolpathlayerdata_getlayerdatauuid"); #else // _WIN32 diff --git a/Autogenerated/Bindings/NodeJS/lib3mf_dynamic.h b/Autogenerated/Bindings/NodeJS/lib3mf_dynamic.h index 226ce555..5ee38809 100644 --- a/Autogenerated/Bindings/NodeJS/lib3mf_dynamic.h +++ b/Autogenerated/Bindings/NodeJS/lib3mf_dynamic.h @@ -3641,11 +3641,22 @@ typedef Lib3MFResult (*PLib3MFToolpathLayerReader_GetSegmentDefaultProfileIDPtr) typedef Lib3MFResult (*PLib3MFToolpathLayerReader_GetProfileUUIDByLocalProfileIDPtr) (Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nLocalProfileID, const Lib3MF_uint32 nProfileUUIDBufferSize, Lib3MF_uint32* pProfileUUIDNeededChars, char * pProfileUUIDBuffer); /** -* Returns if the segment has a uniform profile. If it is uniform, then the default profile applies to the whole segment. If it is not uniform, the type specific retrieval functions have to be used (or the file has to be rejected). Returns false for delay and sync segments. +* Retrieves if the segment has specific override factors attached. +* +* @param[in] pToolpathLayerReader - ToolpathLayerReader instance. +* @param[in] nSegmentIndex - Segment Index. Must be between 0 and SegmentCount - 1. +* @param[in] eOverrideFactor - Which override factor value to retrieve (F, G or H). Returns an array of 0.0, if override factor type is unknown or not given. +* @param[out] pHasOverrides - Returns true, if the segment has attached any override factors of the given type, false otherwise. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFToolpathLayerReader_SegmentHasOverrideFactorsPtr) (Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nSegmentIndex, eLib3MFToolpathProfileOverrideFactor eOverrideFactor, bool * pHasOverrides); + +/** +* Returns if the segment has a uniform profile. If it is uniform, then the default profile applies to the whole segment. If it is not uniform, the type specific retrieval functions have to be used (or the file has to be rejected). Returns false for delay and sync segments. The call is equivalent to SegmentHasOverrideFactors returning false with any possible type (F, G, H). * * @param[in] pToolpathLayerReader - ToolpathLayerReader instance. * @param[in] nSegmentIndex - Segment Index. Must be between 0 and Count - 1. -* @param[out] pHasUniformProfile - If true, the segment has a uniform profile ID. +* @param[out] pHasUniformProfile - If true, the segment has a uniform profile ID. * @return error code or 0 (success) */ typedef Lib3MFResult (*PLib3MFToolpathLayerReader_SegmentHasUniformProfilePtr) (Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nSegmentIndex, bool * pHasUniformProfile); @@ -3674,6 +3685,19 @@ typedef Lib3MFResult (*PLib3MFToolpathLayerReader_GetSegmentPointDataInModelUnit */ typedef Lib3MFResult (*PLib3MFToolpathLayerReader_GetSegmentPointDataDiscretePtr) (Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nSegmentIndex, const Lib3MF_uint64 nPointDataBufferSize, Lib3MF_uint64* pPointDataNeededCount, sLib3MFDiscretePosition2D * pPointDataBuffer); +/** +* Retrieves the assigned segment override factors. Fails if segment type is not loop or polyline. The values are per point, meaning that gradients are given through linear ramping on the polyline vectors. +* +* @param[in] pToolpathLayerReader - ToolpathLayerReader instance. +* @param[in] nSegmentIndex - Segment Index. Must be between 0 and SegmentCount - 1. +* @param[in] eOverrideFactor - Which override factor value to retrieve (F, G or H). Returns an array of 0.0, if override factor type is unknown or not given. +* @param[in] nFactorValuesBufferSize - Number of elements in buffer +* @param[out] pFactorValuesNeededCount - will be filled with the count of the written elements, or needed buffer size. +* @param[out] pFactorValuesBuffer - double buffer of An target override factor for each point of the segment. In case of Polyline, the first array value describes the override for the initial jump. In case of Loop, the first array value describes the override for the inital jump and the last closing mark movement of the polyline. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFToolpathLayerReader_GetSegmentPointOverrideFactorsPtr) (Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nSegmentIndex, eLib3MFToolpathProfileOverrideFactor eOverrideFactor, const Lib3MF_uint64 nFactorValuesBufferSize, Lib3MF_uint64* pFactorValuesNeededCount, Lib3MF_double * pFactorValuesBuffer); + /** * Retrieves the assigned segment hatch list. Converts any polyline or loop into hatches. Returns an empty array for delay and sync elements. * @@ -3698,6 +3722,19 @@ typedef Lib3MFResult (*PLib3MFToolpathLayerReader_GetSegmentHatchDataInModelUnit */ typedef Lib3MFResult (*PLib3MFToolpathLayerReader_GetSegmentHatchDataDiscretePtr) (Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nSegmentIndex, const Lib3MF_uint64 nHatchDataBufferSize, Lib3MF_uint64* pHatchDataNeededCount, sLib3MFDiscreteHatch2D * pHatchDataBuffer); +/** +* Retrieves the assigned segment override factors. Fails if segment type is not hatch. The call will return two values per hatch, one per hatch point. +* +* @param[in] pToolpathLayerReader - ToolpathLayerReader instance. +* @param[in] nSegmentIndex - Segment Index. Must be between 0 and SegmentCount - 1. +* @param[in] eOverrideFactor - Which override factor value to retrieve (F, G or H). Returns an array of 0.0, if override factor type is unknown or not given. +* @param[in] nFactorValuesBufferSize - Number of elements in buffer +* @param[out] pFactorValuesNeededCount - will be filled with the count of the written elements, or needed buffer size. +* @param[out] pFactorValuesBuffer - Hatch2DOverrides buffer of An target override factor for each point of the segment. In case of Polyline, the first array value describes the override for the initial jump. In case of Loop, the first array value describes the override for the inital jump and the last closing mark movement of the polyline. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFToolpathLayerReader_GetSegmentHatchOverrideFactorsPtr) (Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nSegmentIndex, eLib3MFToolpathProfileOverrideFactor eOverrideFactor, const Lib3MF_uint64 nFactorValuesBufferSize, Lib3MF_uint64* pFactorValuesNeededCount, sLib3MFHatch2DOverrides * pFactorValuesBuffer); + /************************************************************************************************************************* Class definition for ToolpathLayerData **************************************************************************************************************************/ @@ -6138,11 +6175,14 @@ typedef struct { PLib3MFToolpathLayerReader_GetSegmentDefaultProfileUUIDPtr m_ToolpathLayerReader_GetSegmentDefaultProfileUUID; PLib3MFToolpathLayerReader_GetSegmentDefaultProfileIDPtr m_ToolpathLayerReader_GetSegmentDefaultProfileID; PLib3MFToolpathLayerReader_GetProfileUUIDByLocalProfileIDPtr m_ToolpathLayerReader_GetProfileUUIDByLocalProfileID; + PLib3MFToolpathLayerReader_SegmentHasOverrideFactorsPtr m_ToolpathLayerReader_SegmentHasOverrideFactors; PLib3MFToolpathLayerReader_SegmentHasUniformProfilePtr m_ToolpathLayerReader_SegmentHasUniformProfile; PLib3MFToolpathLayerReader_GetSegmentPointDataInModelUnitsPtr m_ToolpathLayerReader_GetSegmentPointDataInModelUnits; PLib3MFToolpathLayerReader_GetSegmentPointDataDiscretePtr m_ToolpathLayerReader_GetSegmentPointDataDiscrete; + PLib3MFToolpathLayerReader_GetSegmentPointOverrideFactorsPtr m_ToolpathLayerReader_GetSegmentPointOverrideFactors; PLib3MFToolpathLayerReader_GetSegmentHatchDataInModelUnitsPtr m_ToolpathLayerReader_GetSegmentHatchDataInModelUnits; PLib3MFToolpathLayerReader_GetSegmentHatchDataDiscretePtr m_ToolpathLayerReader_GetSegmentHatchDataDiscrete; + PLib3MFToolpathLayerReader_GetSegmentHatchOverrideFactorsPtr m_ToolpathLayerReader_GetSegmentHatchOverrideFactors; PLib3MFToolpathLayerData_GetLayerDataUUIDPtr m_ToolpathLayerData_GetLayerDataUUID; PLib3MFToolpathLayerData_RegisterProfilePtr m_ToolpathLayerData_RegisterProfile; PLib3MFToolpathLayerData_RegisterBuildItemPtr m_ToolpathLayerData_RegisterBuildItem; diff --git a/Autogenerated/Bindings/NodeJS/lib3mf_nodewrapper.cc b/Autogenerated/Bindings/NodeJS/lib3mf_nodewrapper.cc index b7b6aea8..30731a51 100644 --- a/Autogenerated/Bindings/NodeJS/lib3mf_nodewrapper.cc +++ b/Autogenerated/Bindings/NodeJS/lib3mf_nodewrapper.cc @@ -588,6 +588,73 @@ Local convertLib3MFHatch2DToObject(Isolate* isolate, sLib3MFHatch2D sHat return returnInstance; } +/************************************************************************************************************************* + Class sLib3MFHatch2DOverrides Conversion +**************************************************************************************************************************/ +sLib3MFHatch2DOverrides convertObjectToLib3MFHatch2DOverrides(Isolate* isolate, const Local & pParamValue) +{ + sLib3MFHatch2DOverrides sHatch2DOverrides; + Local context = isolate->GetCurrentContext(); + + sHatch2DOverrides.m_Point1Override = 0.0; + sHatch2DOverrides.m_Point2Override = 0.0; + + if (pParamValue->IsObject()) { + MaybeLocal maybeObject = pParamValue->ToObject(context); + + if (!maybeObject.IsEmpty()) { + Local obj = maybeObject.ToLocalChecked(); + + // Point1Override Member + MaybeLocal maybeValPoint1Override = obj->Get(context, String::NewFromUtf8(isolate, "Point1Override")); + if (!maybeValPoint1Override.IsEmpty()) { + Local valPoint1Override = maybeValPoint1Override.ToLocalChecked(); + if (valPoint1Override->IsNumber()) { + MaybeLocal localValPoint1Override = valPoint1Override->ToNumber(context); + sHatch2DOverrides.m_Point1Override = localValPoint1Override.ToLocalChecked()->NumberValue(isolate->GetCurrentContext()).ToChecked(); + } else { + isolate->ThrowException(Exception::TypeError(String::NewFromUtf8(isolate, "Point1Override member is not a number" ))); + } + } else { + isolate->ThrowException(Exception::TypeError(String::NewFromUtf8(isolate, "Point1Override member not found in object" ))); + } + + // Point2Override Member + MaybeLocal maybeValPoint2Override = obj->Get(context, String::NewFromUtf8(isolate, "Point2Override")); + if (!maybeValPoint2Override.IsEmpty()) { + Local valPoint2Override = maybeValPoint2Override.ToLocalChecked(); + if (valPoint2Override->IsNumber()) { + MaybeLocal localValPoint2Override = valPoint2Override->ToNumber(context); + sHatch2DOverrides.m_Point2Override = localValPoint2Override.ToLocalChecked()->NumberValue(isolate->GetCurrentContext()).ToChecked(); + } else { + isolate->ThrowException(Exception::TypeError(String::NewFromUtf8(isolate, "Point2Override member is not a number" ))); + } + } else { + isolate->ThrowException(Exception::TypeError(String::NewFromUtf8(isolate, "Point2Override member not found in object" ))); + } + + + } else { + isolate->ThrowException(Exception::TypeError(String::NewFromUtf8(isolate, "invalid object passed." ))); + } + } else { + isolate->ThrowException(Exception::TypeError(String::NewFromUtf8(isolate, "expected object parameter." ))); + } + + return sHatch2DOverrides; +} + + + +Local convertLib3MFHatch2DOverridesToObject(Isolate* isolate, sLib3MFHatch2DOverrides sHatch2DOverrides) +{ + Local returnInstance = Object::New(isolate); + returnInstance->Set(String::NewFromUtf8(isolate, "Point1Override"), Number::New (isolate, sHatch2DOverrides.m_Point1Override)); + returnInstance->Set(String::NewFromUtf8(isolate, "Point2Override"), Number::New (isolate, sHatch2DOverrides.m_Point2Override)); + + return returnInstance; +} + /************************************************************************************************************************* Class sLib3MFDiscreteHatch2D Conversion **************************************************************************************************************************/ @@ -12274,11 +12341,14 @@ void CLib3MFToolpathLayerReader::Init() NODE_SET_PROTOTYPE_METHOD(tpl, "GetSegmentDefaultProfileUUID", GetSegmentDefaultProfileUUID); NODE_SET_PROTOTYPE_METHOD(tpl, "GetSegmentDefaultProfileID", GetSegmentDefaultProfileID); NODE_SET_PROTOTYPE_METHOD(tpl, "GetProfileUUIDByLocalProfileID", GetProfileUUIDByLocalProfileID); + NODE_SET_PROTOTYPE_METHOD(tpl, "SegmentHasOverrideFactors", SegmentHasOverrideFactors); NODE_SET_PROTOTYPE_METHOD(tpl, "SegmentHasUniformProfile", SegmentHasUniformProfile); NODE_SET_PROTOTYPE_METHOD(tpl, "GetSegmentPointDataInModelUnits", GetSegmentPointDataInModelUnits); NODE_SET_PROTOTYPE_METHOD(tpl, "GetSegmentPointDataDiscrete", GetSegmentPointDataDiscrete); + NODE_SET_PROTOTYPE_METHOD(tpl, "GetSegmentPointOverrideFactors", GetSegmentPointOverrideFactors); NODE_SET_PROTOTYPE_METHOD(tpl, "GetSegmentHatchDataInModelUnits", GetSegmentHatchDataInModelUnits); NODE_SET_PROTOTYPE_METHOD(tpl, "GetSegmentHatchDataDiscrete", GetSegmentHatchDataDiscrete); + NODE_SET_PROTOTYPE_METHOD(tpl, "GetSegmentHatchOverrideFactors", GetSegmentHatchOverrideFactors); constructor.Reset(isolate, tpl->GetFunction(isolate->GetCurrentContext()).ToLocalChecked()); } @@ -13024,6 +13094,36 @@ void CLib3MFToolpathLayerReader::GetProfileUUIDByLocalProfileID(const FunctionCa } +void CLib3MFToolpathLayerReader::SegmentHasOverrideFactors(const FunctionCallbackInfo& args) +{ + Isolate* isolate = args.GetIsolate(); + HandleScope scope(isolate); + try { + if (!args[0]->IsUint32()) { + throw std::runtime_error("Expected uint32 parameter 0 (SegmentIndex)"); + } + if (!args[1]->IsUint32()) { + throw std::runtime_error("Expected enum parameter 1 (OverrideFactor)"); + } + unsigned int nSegmentIndex = (unsigned int) args[0]->IntegerValue(isolate->GetCurrentContext()).ToChecked(); + unsigned int eOverrideFactor = (unsigned int) args[1]->IntegerValue(isolate->GetCurrentContext()).ToChecked(); + bool bReturnHasOverrides = false; + sLib3MFDynamicWrapperTable * wrapperTable = CLib3MFBaseClass::getDynamicWrapperTable(args.Holder()); + if (wrapperTable == nullptr) + throw std::runtime_error("Could not get wrapper table for Lib3MF method SegmentHasOverrideFactors."); + if (wrapperTable->m_ToolpathLayerReader_SegmentHasOverrideFactors == nullptr) + throw std::runtime_error("Could not call Lib3MF method ToolpathLayerReader::SegmentHasOverrideFactors."); + Lib3MFHandle instanceHandle = CLib3MFBaseClass::getHandle(args.Holder()); + Lib3MFResult errorCode = wrapperTable->m_ToolpathLayerReader_SegmentHasOverrideFactors(instanceHandle, nSegmentIndex, (eLib3MFToolpathProfileOverrideFactor) eOverrideFactor, &bReturnHasOverrides); + CheckError(isolate, wrapperTable, instanceHandle, errorCode); + args.GetReturnValue().Set(Boolean::New(isolate, bReturnHasOverrides)); + + } catch (std::exception & E) { + RaiseError(isolate, E.what()); + } +} + + void CLib3MFToolpathLayerReader::SegmentHasUniformProfile(const FunctionCallbackInfo& args) { Isolate* isolate = args.GetIsolate(); @@ -13098,6 +13198,34 @@ void CLib3MFToolpathLayerReader::GetSegmentPointDataDiscrete(const FunctionCallb } +void CLib3MFToolpathLayerReader::GetSegmentPointOverrideFactors(const FunctionCallbackInfo& args) +{ + Isolate* isolate = args.GetIsolate(); + HandleScope scope(isolate); + try { + if (!args[0]->IsUint32()) { + throw std::runtime_error("Expected uint32 parameter 0 (SegmentIndex)"); + } + if (!args[1]->IsUint32()) { + throw std::runtime_error("Expected enum parameter 1 (OverrideFactor)"); + } + unsigned int nSegmentIndex = (unsigned int) args[0]->IntegerValue(isolate->GetCurrentContext()).ToChecked(); + unsigned int eOverrideFactor = (unsigned int) args[1]->IntegerValue(isolate->GetCurrentContext()).ToChecked(); + sLib3MFDynamicWrapperTable * wrapperTable = CLib3MFBaseClass::getDynamicWrapperTable(args.Holder()); + if (wrapperTable == nullptr) + throw std::runtime_error("Could not get wrapper table for Lib3MF method GetSegmentPointOverrideFactors."); + if (wrapperTable->m_ToolpathLayerReader_GetSegmentPointOverrideFactors == nullptr) + throw std::runtime_error("Could not call Lib3MF method ToolpathLayerReader::GetSegmentPointOverrideFactors."); + Lib3MFHandle instanceHandle = CLib3MFBaseClass::getHandle(args.Holder()); + Lib3MFResult errorCode = wrapperTable->m_ToolpathLayerReader_GetSegmentPointOverrideFactors(instanceHandle, nSegmentIndex, (eLib3MFToolpathProfileOverrideFactor) eOverrideFactor, 0, nullptr, nullptr); + CheckError(isolate, wrapperTable, instanceHandle, errorCode); + + } catch (std::exception & E) { + RaiseError(isolate, E.what()); + } +} + + void CLib3MFToolpathLayerReader::GetSegmentHatchDataInModelUnits(const FunctionCallbackInfo& args) { Isolate* isolate = args.GetIsolate(); @@ -13145,6 +13273,34 @@ void CLib3MFToolpathLayerReader::GetSegmentHatchDataDiscrete(const FunctionCallb } } + +void CLib3MFToolpathLayerReader::GetSegmentHatchOverrideFactors(const FunctionCallbackInfo& args) +{ + Isolate* isolate = args.GetIsolate(); + HandleScope scope(isolate); + try { + if (!args[0]->IsUint32()) { + throw std::runtime_error("Expected uint32 parameter 0 (SegmentIndex)"); + } + if (!args[1]->IsUint32()) { + throw std::runtime_error("Expected enum parameter 1 (OverrideFactor)"); + } + unsigned int nSegmentIndex = (unsigned int) args[0]->IntegerValue(isolate->GetCurrentContext()).ToChecked(); + unsigned int eOverrideFactor = (unsigned int) args[1]->IntegerValue(isolate->GetCurrentContext()).ToChecked(); + sLib3MFDynamicWrapperTable * wrapperTable = CLib3MFBaseClass::getDynamicWrapperTable(args.Holder()); + if (wrapperTable == nullptr) + throw std::runtime_error("Could not get wrapper table for Lib3MF method GetSegmentHatchOverrideFactors."); + if (wrapperTable->m_ToolpathLayerReader_GetSegmentHatchOverrideFactors == nullptr) + throw std::runtime_error("Could not call Lib3MF method ToolpathLayerReader::GetSegmentHatchOverrideFactors."); + Lib3MFHandle instanceHandle = CLib3MFBaseClass::getHandle(args.Holder()); + Lib3MFResult errorCode = wrapperTable->m_ToolpathLayerReader_GetSegmentHatchOverrideFactors(instanceHandle, nSegmentIndex, (eLib3MFToolpathProfileOverrideFactor) eOverrideFactor, 0, nullptr, nullptr); + CheckError(isolate, wrapperTable, instanceHandle, errorCode); + + } catch (std::exception & E) { + RaiseError(isolate, E.what()); + } +} + /************************************************************************************************************************* Class CLib3MFToolpathLayerData Implementation **************************************************************************************************************************/ diff --git a/Autogenerated/Bindings/NodeJS/lib3mf_nodewrapper.h b/Autogenerated/Bindings/NodeJS/lib3mf_nodewrapper.h index 04a988de..716d552a 100644 --- a/Autogenerated/Bindings/NodeJS/lib3mf_nodewrapper.h +++ b/Autogenerated/Bindings/NodeJS/lib3mf_nodewrapper.h @@ -1116,11 +1116,14 @@ class CLib3MFToolpathLayerReader : public CLib3MFBaseClass { static void GetSegmentDefaultProfileUUID(const v8::FunctionCallbackInfo& args); static void GetSegmentDefaultProfileID(const v8::FunctionCallbackInfo& args); static void GetProfileUUIDByLocalProfileID(const v8::FunctionCallbackInfo& args); + static void SegmentHasOverrideFactors(const v8::FunctionCallbackInfo& args); static void SegmentHasUniformProfile(const v8::FunctionCallbackInfo& args); static void GetSegmentPointDataInModelUnits(const v8::FunctionCallbackInfo& args); static void GetSegmentPointDataDiscrete(const v8::FunctionCallbackInfo& args); + static void GetSegmentPointOverrideFactors(const v8::FunctionCallbackInfo& args); static void GetSegmentHatchDataInModelUnits(const v8::FunctionCallbackInfo& args); static void GetSegmentHatchDataDiscrete(const v8::FunctionCallbackInfo& args); + static void GetSegmentHatchOverrideFactors(const v8::FunctionCallbackInfo& args); public: CLib3MFToolpathLayerReader(); diff --git a/Autogenerated/Bindings/NodeJS/lib3mf_types.h b/Autogenerated/Bindings/NodeJS/lib3mf_types.h index d53e8deb..61b4b5f6 100644 --- a/Autogenerated/Bindings/NodeJS/lib3mf_types.h +++ b/Autogenerated/Bindings/NodeJS/lib3mf_types.h @@ -601,6 +601,11 @@ typedef struct sLib3MFHatch2D { Lib3MF_int32 m_Tag; } sLib3MFHatch2D; +typedef struct sLib3MFHatch2DOverrides { + Lib3MF_double m_Point1Override; + Lib3MF_double m_Point2Override; +} sLib3MFHatch2DOverrides; + typedef struct sLib3MFDiscreteHatch2D { Lib3MF_int32 m_Point1Coordinates[2]; Lib3MF_int32 m_Point2Coordinates[2]; diff --git a/Autogenerated/Bindings/Pascal/Unit_Lib3MF.pas b/Autogenerated/Bindings/Pascal/Unit_Lib3MF.pas index e674c2ae..c00a0969 100644 --- a/Autogenerated/Bindings/Pascal/Unit_Lib3MF.pas +++ b/Autogenerated/Bindings/Pascal/Unit_Lib3MF.pas @@ -347,6 +347,12 @@ interface FTag: Integer; end; + PLib3MFHatch2DOverrides = ^TLib3MFHatch2DOverrides; + TLib3MFHatch2DOverrides = packed record + FPoint1Override: Double; + FPoint2Override: Double; + end; + PLib3MFDiscreteHatch2D = ^TLib3MFDiscreteHatch2D; TLib3MFDiscreteHatch2D = packed record FPoint1Coordinates: array [0..1] of Integer; @@ -415,6 +421,7 @@ interface ArrayOfLib3MFPosition2D = array of TLib3MFPosition2D; ArrayOfLib3MFDiscretePosition2D = array of TLib3MFDiscretePosition2D; ArrayOfLib3MFHatch2D = array of TLib3MFHatch2D; + ArrayOfLib3MFHatch2DOverrides = array of TLib3MFHatch2DOverrides; ArrayOfLib3MFDiscreteHatch2D = array of TLib3MFDiscreteHatch2D; ArrayOfLib3MFCompositeConstituent = array of TLib3MFCompositeConstituent; ArrayOfLib3MFMultiPropertyLayer = array of TLib3MFMultiPropertyLayer; @@ -4142,11 +4149,22 @@ TLib3MFModel = class; TLib3MFToolpathLayerReader_GetProfileUUIDByLocalProfileIDFunc = function(pToolpathLayerReader: TLib3MFHandle; const nLocalProfileID: Cardinal; const nProfileUUIDBufferSize: Cardinal; out pProfileUUIDNeededChars: Cardinal; pProfileUUIDBuffer: PAnsiChar): TLib3MFResult; cdecl; (** - * Returns if the segment has a uniform profile. If it is uniform, then the default profile applies to the whole segment. If it is not uniform, the type specific retrieval functions have to be used (or the file has to be rejected). Returns false for delay and sync segments. + * Retrieves if the segment has specific override factors attached. + * + * @param[in] pToolpathLayerReader - ToolpathLayerReader instance. + * @param[in] nSegmentIndex - Segment Index. Must be between 0 and SegmentCount - 1. + * @param[in] eOverrideFactor - Which override factor value to retrieve (F, G or H). Returns an array of 0.0, if override factor type is unknown or not given. + * @param[out] pHasOverrides - Returns true, if the segment has attached any override factors of the given type, false otherwise. + * @return error code or 0 (success) + *) + TLib3MFToolpathLayerReader_SegmentHasOverrideFactorsFunc = function(pToolpathLayerReader: TLib3MFHandle; const nSegmentIndex: Cardinal; const eOverrideFactor: Integer; out pHasOverrides: Byte): TLib3MFResult; cdecl; + + (** + * Returns if the segment has a uniform profile. If it is uniform, then the default profile applies to the whole segment. If it is not uniform, the type specific retrieval functions have to be used (or the file has to be rejected). Returns false for delay and sync segments. The call is equivalent to SegmentHasOverrideFactors returning false with any possible type (F, G, H). * * @param[in] pToolpathLayerReader - ToolpathLayerReader instance. * @param[in] nSegmentIndex - Segment Index. Must be between 0 and Count - 1. - * @param[out] pHasUniformProfile - If true, the segment has a uniform profile ID. + * @param[out] pHasUniformProfile - If true, the segment has a uniform profile ID. * @return error code or 0 (success) *) TLib3MFToolpathLayerReader_SegmentHasUniformProfileFunc = function(pToolpathLayerReader: TLib3MFHandle; const nSegmentIndex: Cardinal; out pHasUniformProfile: Byte): TLib3MFResult; cdecl; @@ -4175,6 +4193,19 @@ TLib3MFModel = class; *) TLib3MFToolpathLayerReader_GetSegmentPointDataDiscreteFunc = function(pToolpathLayerReader: TLib3MFHandle; const nSegmentIndex: Cardinal; const nPointDataCount: QWord; out pPointDataNeededCount: QWord; pPointDataBuffer: PLib3MFDiscretePosition2D): TLib3MFResult; cdecl; + (** + * Retrieves the assigned segment override factors. Fails if segment type is not loop or polyline. The values are per point, meaning that gradients are given through linear ramping on the polyline vectors. + * + * @param[in] pToolpathLayerReader - ToolpathLayerReader instance. + * @param[in] nSegmentIndex - Segment Index. Must be between 0 and SegmentCount - 1. + * @param[in] eOverrideFactor - Which override factor value to retrieve (F, G or H). Returns an array of 0.0, if override factor type is unknown or not given. + * @param[in] nFactorValuesCount - Number of elements in buffer + * @param[out] pFactorValuesNeededCount - will be filled with the count of the written elements, or needed buffer size. + * @param[out] pFactorValuesBuffer - double buffer of An target override factor for each point of the segment. In case of Polyline, the first array value describes the override for the initial jump. In case of Loop, the first array value describes the override for the inital jump and the last closing mark movement of the polyline. + * @return error code or 0 (success) + *) + TLib3MFToolpathLayerReader_GetSegmentPointOverrideFactorsFunc = function(pToolpathLayerReader: TLib3MFHandle; const nSegmentIndex: Cardinal; const eOverrideFactor: Integer; const nFactorValuesCount: QWord; out pFactorValuesNeededCount: QWord; pFactorValuesBuffer: PDouble): TLib3MFResult; cdecl; + (** * Retrieves the assigned segment hatch list. Converts any polyline or loop into hatches. Returns an empty array for delay and sync elements. * @@ -4199,6 +4230,19 @@ TLib3MFModel = class; *) TLib3MFToolpathLayerReader_GetSegmentHatchDataDiscreteFunc = function(pToolpathLayerReader: TLib3MFHandle; const nSegmentIndex: Cardinal; const nHatchDataCount: QWord; out pHatchDataNeededCount: QWord; pHatchDataBuffer: PLib3MFDiscreteHatch2D): TLib3MFResult; cdecl; + (** + * Retrieves the assigned segment override factors. Fails if segment type is not hatch. The call will return two values per hatch, one per hatch point. + * + * @param[in] pToolpathLayerReader - ToolpathLayerReader instance. + * @param[in] nSegmentIndex - Segment Index. Must be between 0 and SegmentCount - 1. + * @param[in] eOverrideFactor - Which override factor value to retrieve (F, G or H). Returns an array of 0.0, if override factor type is unknown or not given. + * @param[in] nFactorValuesCount - Number of elements in buffer + * @param[out] pFactorValuesNeededCount - will be filled with the count of the written elements, or needed buffer size. + * @param[out] pFactorValuesBuffer - Hatch2DOverrides buffer of An target override factor for each point of the segment. In case of Polyline, the first array value describes the override for the initial jump. In case of Loop, the first array value describes the override for the inital jump and the last closing mark movement of the polyline. + * @return error code or 0 (success) + *) + TLib3MFToolpathLayerReader_GetSegmentHatchOverrideFactorsFunc = function(pToolpathLayerReader: TLib3MFHandle; const nSegmentIndex: Cardinal; const eOverrideFactor: Integer; const nFactorValuesCount: QWord; out pFactorValuesNeededCount: QWord; pFactorValuesBuffer: PLib3MFHatch2DOverrides): TLib3MFResult; cdecl; + (************************************************************************************************************************* Function type definitions for ToolpathLayerData @@ -7129,11 +7173,14 @@ TLib3MFToolpathLayerReader = class(TLib3MFBase) function GetSegmentDefaultProfileUUID(const ASegmentIndex: Cardinal): String; function GetSegmentDefaultProfileID(const ASegmentIndex: Cardinal): Cardinal; function GetProfileUUIDByLocalProfileID(const ALocalProfileID: Cardinal): String; + function SegmentHasOverrideFactors(const ASegmentIndex: Cardinal; const AOverrideFactor: TLib3MFToolpathProfileOverrideFactor): Boolean; function SegmentHasUniformProfile(const ASegmentIndex: Cardinal): Boolean; procedure GetSegmentPointDataInModelUnits(const ASegmentIndex: Cardinal; out APointData: ArrayOfLib3MFPosition2D); procedure GetSegmentPointDataDiscrete(const ASegmentIndex: Cardinal; out APointData: ArrayOfLib3MFDiscretePosition2D); + procedure GetSegmentPointOverrideFactors(const ASegmentIndex: Cardinal; const AOverrideFactor: TLib3MFToolpathProfileOverrideFactor; out AFactorValues: TDoubleDynArray); procedure GetSegmentHatchDataInModelUnits(const ASegmentIndex: Cardinal; out AHatchData: ArrayOfLib3MFHatch2D); procedure GetSegmentHatchDataDiscrete(const ASegmentIndex: Cardinal; out AHatchData: ArrayOfLib3MFDiscreteHatch2D); + procedure GetSegmentHatchOverrideFactors(const ASegmentIndex: Cardinal; const AOverrideFactor: TLib3MFToolpathProfileOverrideFactor; out AFactorValues: ArrayOfLib3MFHatch2DOverrides); end; @@ -7784,11 +7831,14 @@ TLib3MFWrapper = class(TObject) FLib3MFToolpathLayerReader_GetSegmentDefaultProfileUUIDFunc: TLib3MFToolpathLayerReader_GetSegmentDefaultProfileUUIDFunc; FLib3MFToolpathLayerReader_GetSegmentDefaultProfileIDFunc: TLib3MFToolpathLayerReader_GetSegmentDefaultProfileIDFunc; FLib3MFToolpathLayerReader_GetProfileUUIDByLocalProfileIDFunc: TLib3MFToolpathLayerReader_GetProfileUUIDByLocalProfileIDFunc; + FLib3MFToolpathLayerReader_SegmentHasOverrideFactorsFunc: TLib3MFToolpathLayerReader_SegmentHasOverrideFactorsFunc; FLib3MFToolpathLayerReader_SegmentHasUniformProfileFunc: TLib3MFToolpathLayerReader_SegmentHasUniformProfileFunc; FLib3MFToolpathLayerReader_GetSegmentPointDataInModelUnitsFunc: TLib3MFToolpathLayerReader_GetSegmentPointDataInModelUnitsFunc; FLib3MFToolpathLayerReader_GetSegmentPointDataDiscreteFunc: TLib3MFToolpathLayerReader_GetSegmentPointDataDiscreteFunc; + FLib3MFToolpathLayerReader_GetSegmentPointOverrideFactorsFunc: TLib3MFToolpathLayerReader_GetSegmentPointOverrideFactorsFunc; FLib3MFToolpathLayerReader_GetSegmentHatchDataInModelUnitsFunc: TLib3MFToolpathLayerReader_GetSegmentHatchDataInModelUnitsFunc; FLib3MFToolpathLayerReader_GetSegmentHatchDataDiscreteFunc: TLib3MFToolpathLayerReader_GetSegmentHatchDataDiscreteFunc; + FLib3MFToolpathLayerReader_GetSegmentHatchOverrideFactorsFunc: TLib3MFToolpathLayerReader_GetSegmentHatchOverrideFactorsFunc; FLib3MFToolpathLayerData_GetLayerDataUUIDFunc: TLib3MFToolpathLayerData_GetLayerDataUUIDFunc; FLib3MFToolpathLayerData_RegisterProfileFunc: TLib3MFToolpathLayerData_RegisterProfileFunc; FLib3MFToolpathLayerData_RegisterBuildItemFunc: TLib3MFToolpathLayerData_RegisterBuildItemFunc; @@ -8338,11 +8388,14 @@ TLib3MFWrapper = class(TObject) property Lib3MFToolpathLayerReader_GetSegmentDefaultProfileUUIDFunc: TLib3MFToolpathLayerReader_GetSegmentDefaultProfileUUIDFunc read FLib3MFToolpathLayerReader_GetSegmentDefaultProfileUUIDFunc; property Lib3MFToolpathLayerReader_GetSegmentDefaultProfileIDFunc: TLib3MFToolpathLayerReader_GetSegmentDefaultProfileIDFunc read FLib3MFToolpathLayerReader_GetSegmentDefaultProfileIDFunc; property Lib3MFToolpathLayerReader_GetProfileUUIDByLocalProfileIDFunc: TLib3MFToolpathLayerReader_GetProfileUUIDByLocalProfileIDFunc read FLib3MFToolpathLayerReader_GetProfileUUIDByLocalProfileIDFunc; + property Lib3MFToolpathLayerReader_SegmentHasOverrideFactorsFunc: TLib3MFToolpathLayerReader_SegmentHasOverrideFactorsFunc read FLib3MFToolpathLayerReader_SegmentHasOverrideFactorsFunc; property Lib3MFToolpathLayerReader_SegmentHasUniformProfileFunc: TLib3MFToolpathLayerReader_SegmentHasUniformProfileFunc read FLib3MFToolpathLayerReader_SegmentHasUniformProfileFunc; property Lib3MFToolpathLayerReader_GetSegmentPointDataInModelUnitsFunc: TLib3MFToolpathLayerReader_GetSegmentPointDataInModelUnitsFunc read FLib3MFToolpathLayerReader_GetSegmentPointDataInModelUnitsFunc; property Lib3MFToolpathLayerReader_GetSegmentPointDataDiscreteFunc: TLib3MFToolpathLayerReader_GetSegmentPointDataDiscreteFunc read FLib3MFToolpathLayerReader_GetSegmentPointDataDiscreteFunc; + property Lib3MFToolpathLayerReader_GetSegmentPointOverrideFactorsFunc: TLib3MFToolpathLayerReader_GetSegmentPointOverrideFactorsFunc read FLib3MFToolpathLayerReader_GetSegmentPointOverrideFactorsFunc; property Lib3MFToolpathLayerReader_GetSegmentHatchDataInModelUnitsFunc: TLib3MFToolpathLayerReader_GetSegmentHatchDataInModelUnitsFunc read FLib3MFToolpathLayerReader_GetSegmentHatchDataInModelUnitsFunc; property Lib3MFToolpathLayerReader_GetSegmentHatchDataDiscreteFunc: TLib3MFToolpathLayerReader_GetSegmentHatchDataDiscreteFunc read FLib3MFToolpathLayerReader_GetSegmentHatchDataDiscreteFunc; + property Lib3MFToolpathLayerReader_GetSegmentHatchOverrideFactorsFunc: TLib3MFToolpathLayerReader_GetSegmentHatchOverrideFactorsFunc read FLib3MFToolpathLayerReader_GetSegmentHatchOverrideFactorsFunc; property Lib3MFToolpathLayerData_GetLayerDataUUIDFunc: TLib3MFToolpathLayerData_GetLayerDataUUIDFunc read FLib3MFToolpathLayerData_GetLayerDataUUIDFunc; property Lib3MFToolpathLayerData_RegisterProfileFunc: TLib3MFToolpathLayerData_RegisterProfileFunc read FLib3MFToolpathLayerData_RegisterProfileFunc; property Lib3MFToolpathLayerData_RegisterBuildItemFunc: TLib3MFToolpathLayerData_RegisterBuildItemFunc read FLib3MFToolpathLayerData_RegisterBuildItemFunc; @@ -13191,6 +13244,15 @@ implementation Result := StrPas(@bufferProfileUUID[0]); end; + function TLib3MFToolpathLayerReader.SegmentHasOverrideFactors(const ASegmentIndex: Cardinal; const AOverrideFactor: TLib3MFToolpathProfileOverrideFactor): Boolean; + var + ResultHasOverrides: Byte; + begin + ResultHasOverrides := 0; + FWrapper.CheckError(Self, FWrapper.Lib3MFToolpathLayerReader_SegmentHasOverrideFactorsFunc(FHandle, ASegmentIndex, convertToolpathProfileOverrideFactorToConst(AOverrideFactor), ResultHasOverrides)); + Result := (ResultHasOverrides <> 0); + end; + function TLib3MFToolpathLayerReader.SegmentHasUniformProfile(const ASegmentIndex: Cardinal): Boolean; var ResultHasUniformProfile: Byte; @@ -13224,6 +13286,18 @@ implementation FWrapper.CheckError(Self, FWrapper.Lib3MFToolpathLayerReader_GetSegmentPointDataDiscreteFunc(FHandle, ASegmentIndex, countNeededPointData, countWrittenPointData, @APointData[0])); end; + procedure TLib3MFToolpathLayerReader.GetSegmentPointOverrideFactors(const ASegmentIndex: Cardinal; const AOverrideFactor: TLib3MFToolpathProfileOverrideFactor; out AFactorValues: TDoubleDynArray); + var + countNeededFactorValues: QWord; + countWrittenFactorValues: QWord; + begin + countNeededFactorValues:= 0; + countWrittenFactorValues:= 0; + FWrapper.CheckError(Self, FWrapper.Lib3MFToolpathLayerReader_GetSegmentPointOverrideFactorsFunc(FHandle, ASegmentIndex, convertToolpathProfileOverrideFactorToConst(AOverrideFactor), 0, countNeededFactorValues, nil)); + SetLength(AFactorValues, countNeededFactorValues); + FWrapper.CheckError(Self, FWrapper.Lib3MFToolpathLayerReader_GetSegmentPointOverrideFactorsFunc(FHandle, ASegmentIndex, convertToolpathProfileOverrideFactorToConst(AOverrideFactor), countNeededFactorValues, countWrittenFactorValues, @AFactorValues[0])); + end; + procedure TLib3MFToolpathLayerReader.GetSegmentHatchDataInModelUnits(const ASegmentIndex: Cardinal; out AHatchData: ArrayOfLib3MFHatch2D); var countNeededHatchData: QWord; @@ -13248,6 +13322,18 @@ implementation FWrapper.CheckError(Self, FWrapper.Lib3MFToolpathLayerReader_GetSegmentHatchDataDiscreteFunc(FHandle, ASegmentIndex, countNeededHatchData, countWrittenHatchData, @AHatchData[0])); end; + procedure TLib3MFToolpathLayerReader.GetSegmentHatchOverrideFactors(const ASegmentIndex: Cardinal; const AOverrideFactor: TLib3MFToolpathProfileOverrideFactor; out AFactorValues: ArrayOfLib3MFHatch2DOverrides); + var + countNeededFactorValues: QWord; + countWrittenFactorValues: QWord; + begin + countNeededFactorValues:= 0; + countWrittenFactorValues:= 0; + FWrapper.CheckError(Self, FWrapper.Lib3MFToolpathLayerReader_GetSegmentHatchOverrideFactorsFunc(FHandle, ASegmentIndex, convertToolpathProfileOverrideFactorToConst(AOverrideFactor), 0, countNeededFactorValues, nil)); + SetLength(AFactorValues, countNeededFactorValues); + FWrapper.CheckError(Self, FWrapper.Lib3MFToolpathLayerReader_GetSegmentHatchOverrideFactorsFunc(FHandle, ASegmentIndex, convertToolpathProfileOverrideFactorToConst(AOverrideFactor), countNeededFactorValues, countWrittenFactorValues, @AFactorValues[0])); + end; + (************************************************************************************************************************* Class implementation for ToolpathLayerData **************************************************************************************************************************) @@ -16053,11 +16139,14 @@ implementation FLib3MFToolpathLayerReader_GetSegmentDefaultProfileUUIDFunc := LoadFunction('lib3mf_toolpathlayerreader_getsegmentdefaultprofileuuid'); FLib3MFToolpathLayerReader_GetSegmentDefaultProfileIDFunc := LoadFunction('lib3mf_toolpathlayerreader_getsegmentdefaultprofileid'); FLib3MFToolpathLayerReader_GetProfileUUIDByLocalProfileIDFunc := LoadFunction('lib3mf_toolpathlayerreader_getprofileuuidbylocalprofileid'); + FLib3MFToolpathLayerReader_SegmentHasOverrideFactorsFunc := LoadFunction('lib3mf_toolpathlayerreader_segmenthasoverridefactors'); FLib3MFToolpathLayerReader_SegmentHasUniformProfileFunc := LoadFunction('lib3mf_toolpathlayerreader_segmenthasuniformprofile'); FLib3MFToolpathLayerReader_GetSegmentPointDataInModelUnitsFunc := LoadFunction('lib3mf_toolpathlayerreader_getsegmentpointdatainmodelunits'); FLib3MFToolpathLayerReader_GetSegmentPointDataDiscreteFunc := LoadFunction('lib3mf_toolpathlayerreader_getsegmentpointdatadiscrete'); + FLib3MFToolpathLayerReader_GetSegmentPointOverrideFactorsFunc := LoadFunction('lib3mf_toolpathlayerreader_getsegmentpointoverridefactors'); FLib3MFToolpathLayerReader_GetSegmentHatchDataInModelUnitsFunc := LoadFunction('lib3mf_toolpathlayerreader_getsegmenthatchdatainmodelunits'); FLib3MFToolpathLayerReader_GetSegmentHatchDataDiscreteFunc := LoadFunction('lib3mf_toolpathlayerreader_getsegmenthatchdatadiscrete'); + FLib3MFToolpathLayerReader_GetSegmentHatchOverrideFactorsFunc := LoadFunction('lib3mf_toolpathlayerreader_getsegmenthatchoverridefactors'); FLib3MFToolpathLayerData_GetLayerDataUUIDFunc := LoadFunction('lib3mf_toolpathlayerdata_getlayerdatauuid'); FLib3MFToolpathLayerData_RegisterProfileFunc := LoadFunction('lib3mf_toolpathlayerdata_registerprofile'); FLib3MFToolpathLayerData_RegisterBuildItemFunc := LoadFunction('lib3mf_toolpathlayerdata_registerbuilditem'); @@ -17292,6 +17381,9 @@ implementation if AResult <> LIB3MF_SUCCESS then raise ELib3MFException.CreateCustomMessage(LIB3MF_ERROR_COULDNOTLOADLIBRARY, ''); AResult := ALookupMethod(PAnsiChar('lib3mf_toolpathlayerreader_getprofileuuidbylocalprofileid'), @FLib3MFToolpathLayerReader_GetProfileUUIDByLocalProfileIDFunc); + if AResult <> LIB3MF_SUCCESS then + raise ELib3MFException.CreateCustomMessage(LIB3MF_ERROR_COULDNOTLOADLIBRARY, ''); + AResult := ALookupMethod(PAnsiChar('lib3mf_toolpathlayerreader_segmenthasoverridefactors'), @FLib3MFToolpathLayerReader_SegmentHasOverrideFactorsFunc); if AResult <> LIB3MF_SUCCESS then raise ELib3MFException.CreateCustomMessage(LIB3MF_ERROR_COULDNOTLOADLIBRARY, ''); AResult := ALookupMethod(PAnsiChar('lib3mf_toolpathlayerreader_segmenthasuniformprofile'), @FLib3MFToolpathLayerReader_SegmentHasUniformProfileFunc); @@ -17301,12 +17393,18 @@ implementation if AResult <> LIB3MF_SUCCESS then raise ELib3MFException.CreateCustomMessage(LIB3MF_ERROR_COULDNOTLOADLIBRARY, ''); AResult := ALookupMethod(PAnsiChar('lib3mf_toolpathlayerreader_getsegmentpointdatadiscrete'), @FLib3MFToolpathLayerReader_GetSegmentPointDataDiscreteFunc); + if AResult <> LIB3MF_SUCCESS then + raise ELib3MFException.CreateCustomMessage(LIB3MF_ERROR_COULDNOTLOADLIBRARY, ''); + AResult := ALookupMethod(PAnsiChar('lib3mf_toolpathlayerreader_getsegmentpointoverridefactors'), @FLib3MFToolpathLayerReader_GetSegmentPointOverrideFactorsFunc); if AResult <> LIB3MF_SUCCESS then raise ELib3MFException.CreateCustomMessage(LIB3MF_ERROR_COULDNOTLOADLIBRARY, ''); AResult := ALookupMethod(PAnsiChar('lib3mf_toolpathlayerreader_getsegmenthatchdatainmodelunits'), @FLib3MFToolpathLayerReader_GetSegmentHatchDataInModelUnitsFunc); if AResult <> LIB3MF_SUCCESS then raise ELib3MFException.CreateCustomMessage(LIB3MF_ERROR_COULDNOTLOADLIBRARY, ''); AResult := ALookupMethod(PAnsiChar('lib3mf_toolpathlayerreader_getsegmenthatchdatadiscrete'), @FLib3MFToolpathLayerReader_GetSegmentHatchDataDiscreteFunc); + if AResult <> LIB3MF_SUCCESS then + raise ELib3MFException.CreateCustomMessage(LIB3MF_ERROR_COULDNOTLOADLIBRARY, ''); + AResult := ALookupMethod(PAnsiChar('lib3mf_toolpathlayerreader_getsegmenthatchoverridefactors'), @FLib3MFToolpathLayerReader_GetSegmentHatchOverrideFactorsFunc); if AResult <> LIB3MF_SUCCESS then raise ELib3MFException.CreateCustomMessage(LIB3MF_ERROR_COULDNOTLOADLIBRARY, ''); AResult := ALookupMethod(PAnsiChar('lib3mf_toolpathlayerdata_getlayerdatauuid'), @FLib3MFToolpathLayerData_GetLayerDataUUIDFunc); diff --git a/Autogenerated/Bindings/Python/Lib3MF.py b/Autogenerated/Bindings/Python/Lib3MF.py index d60e98a6..442eb809 100644 --- a/Autogenerated/Bindings/Python/Lib3MF.py +++ b/Autogenerated/Bindings/Python/Lib3MF.py @@ -492,11 +492,14 @@ class FunctionTable: lib3mf_toolpathlayerreader_getsegmentdefaultprofileuuid = None lib3mf_toolpathlayerreader_getsegmentdefaultprofileid = None lib3mf_toolpathlayerreader_getprofileuuidbylocalprofileid = None + lib3mf_toolpathlayerreader_segmenthasoverridefactors = None lib3mf_toolpathlayerreader_segmenthasuniformprofile = None lib3mf_toolpathlayerreader_getsegmentpointdatainmodelunits = None lib3mf_toolpathlayerreader_getsegmentpointdatadiscrete = None + lib3mf_toolpathlayerreader_getsegmentpointoverridefactors = None lib3mf_toolpathlayerreader_getsegmenthatchdatainmodelunits = None lib3mf_toolpathlayerreader_getsegmenthatchdatadiscrete = None + lib3mf_toolpathlayerreader_getsegmenthatchoverridefactors = None lib3mf_toolpathlayerdata_getlayerdatauuid = None lib3mf_toolpathlayerdata_registerprofile = None lib3mf_toolpathlayerdata_registerbuilditem = None @@ -894,6 +897,14 @@ class Hatch2D(ctypes.Structure): ("Point2Coordinates", ctypes.c_double * 2), ("Tag", ctypes.c_int32) ] +'''Definition of Hatch2DOverrides +''' +class Hatch2DOverrides(ctypes.Structure): + _pack_ = 1 + _fields_ = [ + ("Point1Override", ctypes.c_double), + ("Point2Override", ctypes.c_double) + ] '''Definition of DiscreteHatch2D ''' class DiscreteHatch2D(ctypes.Structure): @@ -3215,6 +3226,12 @@ def _loadFunctionTableFromMethod(self, symbolLookupMethodAddress): methodType = ctypes.CFUNCTYPE(ctypes.c_int32, ctypes.c_void_p, ctypes.c_uint32, ctypes.c_uint64, ctypes.POINTER(ctypes.c_uint64), ctypes.c_char_p) self.lib.lib3mf_toolpathlayerreader_getprofileuuidbylocalprofileid = methodType(int(methodAddress.value)) + err = symbolLookupMethod(ctypes.c_char_p(str.encode("lib3mf_toolpathlayerreader_segmenthasoverridefactors")), methodAddress) + if err != 0: + raise ELib3MFException(ErrorCodes.COULDNOTLOADLIBRARY, str(err)) + methodType = ctypes.CFUNCTYPE(ctypes.c_int32, ctypes.c_void_p, ctypes.c_uint32, ToolpathProfileOverrideFactor, ctypes.POINTER(ctypes.c_bool)) + self.lib.lib3mf_toolpathlayerreader_segmenthasoverridefactors = methodType(int(methodAddress.value)) + err = symbolLookupMethod(ctypes.c_char_p(str.encode("lib3mf_toolpathlayerreader_segmenthasuniformprofile")), methodAddress) if err != 0: raise ELib3MFException(ErrorCodes.COULDNOTLOADLIBRARY, str(err)) @@ -3233,6 +3250,12 @@ def _loadFunctionTableFromMethod(self, symbolLookupMethodAddress): methodType = ctypes.CFUNCTYPE(ctypes.c_int32, ctypes.c_void_p, ctypes.c_uint32, ctypes.c_uint64, ctypes.POINTER(ctypes.c_uint64), ctypes.POINTER(DiscretePosition2D)) self.lib.lib3mf_toolpathlayerreader_getsegmentpointdatadiscrete = methodType(int(methodAddress.value)) + err = symbolLookupMethod(ctypes.c_char_p(str.encode("lib3mf_toolpathlayerreader_getsegmentpointoverridefactors")), methodAddress) + if err != 0: + raise ELib3MFException(ErrorCodes.COULDNOTLOADLIBRARY, str(err)) + methodType = ctypes.CFUNCTYPE(ctypes.c_int32, ctypes.c_void_p, ctypes.c_uint32, ToolpathProfileOverrideFactor, ctypes.c_uint64, ctypes.POINTER(ctypes.c_uint64), ctypes.POINTER(ctypes.c_double)) + self.lib.lib3mf_toolpathlayerreader_getsegmentpointoverridefactors = methodType(int(methodAddress.value)) + err = symbolLookupMethod(ctypes.c_char_p(str.encode("lib3mf_toolpathlayerreader_getsegmenthatchdatainmodelunits")), methodAddress) if err != 0: raise ELib3MFException(ErrorCodes.COULDNOTLOADLIBRARY, str(err)) @@ -3245,6 +3268,12 @@ def _loadFunctionTableFromMethod(self, symbolLookupMethodAddress): methodType = ctypes.CFUNCTYPE(ctypes.c_int32, ctypes.c_void_p, ctypes.c_uint32, ctypes.c_uint64, ctypes.POINTER(ctypes.c_uint64), ctypes.POINTER(DiscreteHatch2D)) self.lib.lib3mf_toolpathlayerreader_getsegmenthatchdatadiscrete = methodType(int(methodAddress.value)) + err = symbolLookupMethod(ctypes.c_char_p(str.encode("lib3mf_toolpathlayerreader_getsegmenthatchoverridefactors")), methodAddress) + if err != 0: + raise ELib3MFException(ErrorCodes.COULDNOTLOADLIBRARY, str(err)) + methodType = ctypes.CFUNCTYPE(ctypes.c_int32, ctypes.c_void_p, ctypes.c_uint32, ToolpathProfileOverrideFactor, ctypes.c_uint64, ctypes.POINTER(ctypes.c_uint64), ctypes.POINTER(Hatch2DOverrides)) + self.lib.lib3mf_toolpathlayerreader_getsegmenthatchoverridefactors = methodType(int(methodAddress.value)) + err = symbolLookupMethod(ctypes.c_char_p(str.encode("lib3mf_toolpathlayerdata_getlayerdatauuid")), methodAddress) if err != 0: raise ELib3MFException(ErrorCodes.COULDNOTLOADLIBRARY, str(err)) @@ -5398,6 +5427,9 @@ def _loadFunctionTable(self): self.lib.lib3mf_toolpathlayerreader_getprofileuuidbylocalprofileid.restype = ctypes.c_int32 self.lib.lib3mf_toolpathlayerreader_getprofileuuidbylocalprofileid.argtypes = [ctypes.c_void_p, ctypes.c_uint32, ctypes.c_uint64, ctypes.POINTER(ctypes.c_uint64), ctypes.c_char_p] + self.lib.lib3mf_toolpathlayerreader_segmenthasoverridefactors.restype = ctypes.c_int32 + self.lib.lib3mf_toolpathlayerreader_segmenthasoverridefactors.argtypes = [ctypes.c_void_p, ctypes.c_uint32, ToolpathProfileOverrideFactor, ctypes.POINTER(ctypes.c_bool)] + self.lib.lib3mf_toolpathlayerreader_segmenthasuniformprofile.restype = ctypes.c_int32 self.lib.lib3mf_toolpathlayerreader_segmenthasuniformprofile.argtypes = [ctypes.c_void_p, ctypes.c_uint32, ctypes.POINTER(ctypes.c_bool)] @@ -5407,12 +5439,18 @@ def _loadFunctionTable(self): self.lib.lib3mf_toolpathlayerreader_getsegmentpointdatadiscrete.restype = ctypes.c_int32 self.lib.lib3mf_toolpathlayerreader_getsegmentpointdatadiscrete.argtypes = [ctypes.c_void_p, ctypes.c_uint32, ctypes.c_uint64, ctypes.POINTER(ctypes.c_uint64), ctypes.POINTER(DiscretePosition2D)] + self.lib.lib3mf_toolpathlayerreader_getsegmentpointoverridefactors.restype = ctypes.c_int32 + self.lib.lib3mf_toolpathlayerreader_getsegmentpointoverridefactors.argtypes = [ctypes.c_void_p, ctypes.c_uint32, ToolpathProfileOverrideFactor, ctypes.c_uint64, ctypes.POINTER(ctypes.c_uint64), ctypes.POINTER(ctypes.c_double)] + self.lib.lib3mf_toolpathlayerreader_getsegmenthatchdatainmodelunits.restype = ctypes.c_int32 self.lib.lib3mf_toolpathlayerreader_getsegmenthatchdatainmodelunits.argtypes = [ctypes.c_void_p, ctypes.c_uint32, ctypes.c_uint64, ctypes.POINTER(ctypes.c_uint64), ctypes.POINTER(Hatch2D)] self.lib.lib3mf_toolpathlayerreader_getsegmenthatchdatadiscrete.restype = ctypes.c_int32 self.lib.lib3mf_toolpathlayerreader_getsegmenthatchdatadiscrete.argtypes = [ctypes.c_void_p, ctypes.c_uint32, ctypes.c_uint64, ctypes.POINTER(ctypes.c_uint64), ctypes.POINTER(DiscreteHatch2D)] + self.lib.lib3mf_toolpathlayerreader_getsegmenthatchoverridefactors.restype = ctypes.c_int32 + self.lib.lib3mf_toolpathlayerreader_getsegmenthatchoverridefactors.argtypes = [ctypes.c_void_p, ctypes.c_uint32, ToolpathProfileOverrideFactor, ctypes.c_uint64, ctypes.POINTER(ctypes.c_uint64), ctypes.POINTER(Hatch2DOverrides)] + self.lib.lib3mf_toolpathlayerdata_getlayerdatauuid.restype = ctypes.c_int32 self.lib.lib3mf_toolpathlayerdata_getlayerdatauuid.argtypes = [ctypes.c_void_p, ctypes.c_uint64, ctypes.POINTER(ctypes.c_uint64), ctypes.c_char_p] @@ -9241,6 +9279,13 @@ def GetProfileUUIDByLocalProfileID(self, LocalProfileID): return pProfileUUIDBuffer.value.decode() + def SegmentHasOverrideFactors(self, SegmentIndex, OverrideFactor): + nSegmentIndex = ctypes.c_uint32(SegmentIndex) + pHasOverrides = ctypes.c_bool() + self._wrapper.checkError(self, self._wrapper.lib.lib3mf_toolpathlayerreader_segmenthasoverridefactors(self._handle, nSegmentIndex, OverrideFactor, pHasOverrides)) + + return pHasOverrides.value + def SegmentHasUniformProfile(self, SegmentIndex): nSegmentIndex = ctypes.c_uint32(SegmentIndex) pHasUniformProfile = ctypes.c_bool() @@ -9272,6 +9317,18 @@ def GetSegmentPointDataDiscrete(self, SegmentIndex): return [pPointDataBuffer[i] for i in range(nPointDataNeededCount.value)] + def GetSegmentPointOverrideFactors(self, SegmentIndex, OverrideFactor): + nSegmentIndex = ctypes.c_uint32(SegmentIndex) + nFactorValuesCount = ctypes.c_uint64(0) + nFactorValuesNeededCount = ctypes.c_uint64(0) + pFactorValuesBuffer = (ctypes.c_double*0)() + self._wrapper.checkError(self, self._wrapper.lib.lib3mf_toolpathlayerreader_getsegmentpointoverridefactors(self._handle, nSegmentIndex, OverrideFactor, nFactorValuesCount, nFactorValuesNeededCount, pFactorValuesBuffer)) + nFactorValuesCount = ctypes.c_uint64(nFactorValuesNeededCount.value) + pFactorValuesBuffer = (ctypes.c_double * nFactorValuesNeededCount.value)() + self._wrapper.checkError(self, self._wrapper.lib.lib3mf_toolpathlayerreader_getsegmentpointoverridefactors(self._handle, nSegmentIndex, OverrideFactor, nFactorValuesCount, nFactorValuesNeededCount, pFactorValuesBuffer)) + + return [pFactorValuesBuffer[i] for i in range(nFactorValuesNeededCount.value)] + def GetSegmentHatchDataInModelUnits(self, SegmentIndex): nSegmentIndex = ctypes.c_uint32(SegmentIndex) nHatchDataCount = ctypes.c_uint64(0) @@ -9296,6 +9353,18 @@ def GetSegmentHatchDataDiscrete(self, SegmentIndex): return [pHatchDataBuffer[i] for i in range(nHatchDataNeededCount.value)] + def GetSegmentHatchOverrideFactors(self, SegmentIndex, OverrideFactor): + nSegmentIndex = ctypes.c_uint32(SegmentIndex) + nFactorValuesCount = ctypes.c_uint64(0) + nFactorValuesNeededCount = ctypes.c_uint64(0) + pFactorValuesBuffer = (Hatch2DOverrides*0)() + self._wrapper.checkError(self, self._wrapper.lib.lib3mf_toolpathlayerreader_getsegmenthatchoverridefactors(self._handle, nSegmentIndex, OverrideFactor, nFactorValuesCount, nFactorValuesNeededCount, pFactorValuesBuffer)) + nFactorValuesCount = ctypes.c_uint64(nFactorValuesNeededCount.value) + pFactorValuesBuffer = (Hatch2DOverrides * nFactorValuesNeededCount.value)() + self._wrapper.checkError(self, self._wrapper.lib.lib3mf_toolpathlayerreader_getsegmenthatchoverridefactors(self._handle, nSegmentIndex, OverrideFactor, nFactorValuesCount, nFactorValuesNeededCount, pFactorValuesBuffer)) + + return [pFactorValuesBuffer[i] for i in range(nFactorValuesNeededCount.value)] + ''' Class Implementation for ToolpathLayerData diff --git a/Autogenerated/Source/lib3mf_abi.hpp b/Autogenerated/Source/lib3mf_abi.hpp index 0c94c864..6ef6769c 100644 --- a/Autogenerated/Source/lib3mf_abi.hpp +++ b/Autogenerated/Source/lib3mf_abi.hpp @@ -3654,11 +3654,22 @@ LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerreader_getsegmentdefaultprofile LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerreader_getprofileuuidbylocalprofileid(Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nLocalProfileID, const Lib3MF_uint32 nProfileUUIDBufferSize, Lib3MF_uint32* pProfileUUIDNeededChars, char * pProfileUUIDBuffer); /** -* Returns if the segment has a uniform profile. If it is uniform, then the default profile applies to the whole segment. If it is not uniform, the type specific retrieval functions have to be used (or the file has to be rejected). Returns false for delay and sync segments. +* Retrieves if the segment has specific override factors attached. +* +* @param[in] pToolpathLayerReader - ToolpathLayerReader instance. +* @param[in] nSegmentIndex - Segment Index. Must be between 0 and SegmentCount - 1. +* @param[in] eOverrideFactor - Which override factor value to retrieve (F, G or H). Returns an array of 0.0, if override factor type is unknown or not given. +* @param[out] pHasOverrides - Returns true, if the segment has attached any override factors of the given type, false otherwise. +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerreader_segmenthasoverridefactors(Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nSegmentIndex, Lib3MF::eToolpathProfileOverrideFactor eOverrideFactor, bool * pHasOverrides); + +/** +* Returns if the segment has a uniform profile. If it is uniform, then the default profile applies to the whole segment. If it is not uniform, the type specific retrieval functions have to be used (or the file has to be rejected). Returns false for delay and sync segments. The call is equivalent to SegmentHasOverrideFactors returning false with any possible type (F, G, H). * * @param[in] pToolpathLayerReader - ToolpathLayerReader instance. * @param[in] nSegmentIndex - Segment Index. Must be between 0 and Count - 1. -* @param[out] pHasUniformProfile - If true, the segment has a uniform profile ID. +* @param[out] pHasUniformProfile - If true, the segment has a uniform profile ID. * @return error code or 0 (success) */ LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerreader_segmenthasuniformprofile(Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nSegmentIndex, bool * pHasUniformProfile); @@ -3687,6 +3698,19 @@ LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerreader_getsegmentpointdatainmod */ LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerreader_getsegmentpointdatadiscrete(Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nSegmentIndex, const Lib3MF_uint64 nPointDataBufferSize, Lib3MF_uint64* pPointDataNeededCount, Lib3MF::sDiscretePosition2D * pPointDataBuffer); +/** +* Retrieves the assigned segment override factors. Fails if segment type is not loop or polyline. The values are per point, meaning that gradients are given through linear ramping on the polyline vectors. +* +* @param[in] pToolpathLayerReader - ToolpathLayerReader instance. +* @param[in] nSegmentIndex - Segment Index. Must be between 0 and SegmentCount - 1. +* @param[in] eOverrideFactor - Which override factor value to retrieve (F, G or H). Returns an array of 0.0, if override factor type is unknown or not given. +* @param[in] nFactorValuesBufferSize - Number of elements in buffer +* @param[out] pFactorValuesNeededCount - will be filled with the count of the written elements, or needed buffer size. +* @param[out] pFactorValuesBuffer - double buffer of An target override factor for each point of the segment. In case of Polyline, the first array value describes the override for the initial jump. In case of Loop, the first array value describes the override for the inital jump and the last closing mark movement of the polyline. +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerreader_getsegmentpointoverridefactors(Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nSegmentIndex, Lib3MF::eToolpathProfileOverrideFactor eOverrideFactor, const Lib3MF_uint64 nFactorValuesBufferSize, Lib3MF_uint64* pFactorValuesNeededCount, Lib3MF_double * pFactorValuesBuffer); + /** * Retrieves the assigned segment hatch list. Converts any polyline or loop into hatches. Returns an empty array for delay and sync elements. * @@ -3711,6 +3735,19 @@ LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerreader_getsegmenthatchdatainmod */ LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerreader_getsegmenthatchdatadiscrete(Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nSegmentIndex, const Lib3MF_uint64 nHatchDataBufferSize, Lib3MF_uint64* pHatchDataNeededCount, Lib3MF::sDiscreteHatch2D * pHatchDataBuffer); +/** +* Retrieves the assigned segment override factors. Fails if segment type is not hatch. The call will return two values per hatch, one per hatch point. +* +* @param[in] pToolpathLayerReader - ToolpathLayerReader instance. +* @param[in] nSegmentIndex - Segment Index. Must be between 0 and SegmentCount - 1. +* @param[in] eOverrideFactor - Which override factor value to retrieve (F, G or H). Returns an array of 0.0, if override factor type is unknown or not given. +* @param[in] nFactorValuesBufferSize - Number of elements in buffer +* @param[out] pFactorValuesNeededCount - will be filled with the count of the written elements, or needed buffer size. +* @param[out] pFactorValuesBuffer - Hatch2DOverrides buffer of An target override factor for each point of the segment. In case of Polyline, the first array value describes the override for the initial jump. In case of Loop, the first array value describes the override for the inital jump and the last closing mark movement of the polyline. +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerreader_getsegmenthatchoverridefactors(Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nSegmentIndex, Lib3MF::eToolpathProfileOverrideFactor eOverrideFactor, const Lib3MF_uint64 nFactorValuesBufferSize, Lib3MF_uint64* pFactorValuesNeededCount, Lib3MF::sHatch2DOverrides * pFactorValuesBuffer); + /************************************************************************************************************************* Class definition for ToolpathLayerData **************************************************************************************************************************/ diff --git a/Autogenerated/Source/lib3mf_interfaces.hpp b/Autogenerated/Source/lib3mf_interfaces.hpp index f2d0d73c..92f334f8 100644 --- a/Autogenerated/Source/lib3mf_interfaces.hpp +++ b/Autogenerated/Source/lib3mf_interfaces.hpp @@ -3431,9 +3431,17 @@ class IToolpathLayerReader : public virtual IBase { virtual std::string GetProfileUUIDByLocalProfileID(const Lib3MF_uint32 nLocalProfileID) = 0; /** - * IToolpathLayerReader::SegmentHasUniformProfile - Returns if the segment has a uniform profile. If it is uniform, then the default profile applies to the whole segment. If it is not uniform, the type specific retrieval functions have to be used (or the file has to be rejected). Returns false for delay and sync segments. + * IToolpathLayerReader::SegmentHasOverrideFactors - Retrieves if the segment has specific override factors attached. + * @param[in] nSegmentIndex - Segment Index. Must be between 0 and SegmentCount - 1. + * @param[in] eOverrideFactor - Which override factor value to retrieve (F, G or H). Returns an array of 0.0, if override factor type is unknown or not given. + * @return Returns true, if the segment has attached any override factors of the given type, false otherwise. + */ + virtual bool SegmentHasOverrideFactors(const Lib3MF_uint32 nSegmentIndex, const Lib3MF::eToolpathProfileOverrideFactor eOverrideFactor) = 0; + + /** + * IToolpathLayerReader::SegmentHasUniformProfile - Returns if the segment has a uniform profile. If it is uniform, then the default profile applies to the whole segment. If it is not uniform, the type specific retrieval functions have to be used (or the file has to be rejected). Returns false for delay and sync segments. The call is equivalent to SegmentHasOverrideFactors returning false with any possible type (F, G, H). * @param[in] nSegmentIndex - Segment Index. Must be between 0 and Count - 1. - * @return If true, the segment has a uniform profile ID. + * @return If true, the segment has a uniform profile ID. */ virtual bool SegmentHasUniformProfile(const Lib3MF_uint32 nSegmentIndex) = 0; @@ -3455,6 +3463,16 @@ class IToolpathLayerReader : public virtual IBase { */ virtual void GetSegmentPointDataDiscrete(const Lib3MF_uint32 nSegmentIndex, Lib3MF_uint64 nPointDataBufferSize, Lib3MF_uint64* pPointDataNeededCount, Lib3MF::sDiscretePosition2D * pPointDataBuffer) = 0; + /** + * IToolpathLayerReader::GetSegmentPointOverrideFactors - Retrieves the assigned segment override factors. Fails if segment type is not loop or polyline. The values are per point, meaning that gradients are given through linear ramping on the polyline vectors. + * @param[in] nSegmentIndex - Segment Index. Must be between 0 and SegmentCount - 1. + * @param[in] eOverrideFactor - Which override factor value to retrieve (F, G or H). Returns an array of 0.0, if override factor type is unknown or not given. + * @param[in] nFactorValuesBufferSize - Number of elements in buffer + * @param[out] pFactorValuesNeededCount - will be filled with the count of the written structs, or needed buffer size. + * @param[out] pFactorValuesBuffer - double buffer of An target override factor for each point of the segment. In case of Polyline, the first array value describes the override for the initial jump. In case of Loop, the first array value describes the override for the inital jump and the last closing mark movement of the polyline. + */ + virtual void GetSegmentPointOverrideFactors(const Lib3MF_uint32 nSegmentIndex, const Lib3MF::eToolpathProfileOverrideFactor eOverrideFactor, Lib3MF_uint64 nFactorValuesBufferSize, Lib3MF_uint64* pFactorValuesNeededCount, Lib3MF_double * pFactorValuesBuffer) = 0; + /** * IToolpathLayerReader::GetSegmentHatchDataInModelUnits - Retrieves the assigned segment hatch list. Converts any polyline or loop into hatches. Returns an empty array for delay and sync elements. * @param[in] nSegmentIndex - Segment Index. Must be between 0 and Count - 1. @@ -3473,6 +3491,16 @@ class IToolpathLayerReader : public virtual IBase { */ virtual void GetSegmentHatchDataDiscrete(const Lib3MF_uint32 nSegmentIndex, Lib3MF_uint64 nHatchDataBufferSize, Lib3MF_uint64* pHatchDataNeededCount, Lib3MF::sDiscreteHatch2D * pHatchDataBuffer) = 0; + /** + * IToolpathLayerReader::GetSegmentHatchOverrideFactors - Retrieves the assigned segment override factors. Fails if segment type is not hatch. The call will return two values per hatch, one per hatch point. + * @param[in] nSegmentIndex - Segment Index. Must be between 0 and SegmentCount - 1. + * @param[in] eOverrideFactor - Which override factor value to retrieve (F, G or H). Returns an array of 0.0, if override factor type is unknown or not given. + * @param[in] nFactorValuesBufferSize - Number of elements in buffer + * @param[out] pFactorValuesNeededCount - will be filled with the count of the written structs, or needed buffer size. + * @param[out] pFactorValuesBuffer - Hatch2DOverrides buffer of An target override factor for each point of the segment. In case of Polyline, the first array value describes the override for the initial jump. In case of Loop, the first array value describes the override for the inital jump and the last closing mark movement of the polyline. + */ + virtual void GetSegmentHatchOverrideFactors(const Lib3MF_uint32 nSegmentIndex, const Lib3MF::eToolpathProfileOverrideFactor eOverrideFactor, Lib3MF_uint64 nFactorValuesBufferSize, Lib3MF_uint64* pFactorValuesNeededCount, Lib3MF::sHatch2DOverrides * pFactorValuesBuffer) = 0; + }; typedef IBaseSharedPtr PIToolpathLayerReader; diff --git a/Autogenerated/Source/lib3mf_interfacewrapper.cpp b/Autogenerated/Source/lib3mf_interfacewrapper.cpp index e00f7091..e0a2eafe 100644 --- a/Autogenerated/Source/lib3mf_interfacewrapper.cpp +++ b/Autogenerated/Source/lib3mf_interfacewrapper.cpp @@ -13347,6 +13347,42 @@ Lib3MFResult lib3mf_toolpathlayerreader_getprofileuuidbylocalprofileid(Lib3MF_To } } +Lib3MFResult lib3mf_toolpathlayerreader_segmenthasoverridefactors(Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nSegmentIndex, eLib3MFToolpathProfileOverrideFactor eOverrideFactor, bool * pHasOverrides) +{ + IBase* pIBaseClass = (IBase *)pToolpathLayerReader; + + PLib3MFInterfaceJournalEntry pJournalEntry; + try { + if (m_GlobalJournal.get() != nullptr) { + pJournalEntry = m_GlobalJournal->beginClassMethod(pToolpathLayerReader, "ToolpathLayerReader", "SegmentHasOverrideFactors"); + pJournalEntry->addUInt32Parameter("SegmentIndex", nSegmentIndex); + pJournalEntry->addEnumParameter("OverrideFactor", "ToolpathProfileOverrideFactor", (Lib3MF_int32)(eOverrideFactor)); + } + if (pHasOverrides == nullptr) + throw ELib3MFInterfaceException (LIB3MF_ERROR_INVALIDPARAM); + IToolpathLayerReader* pIToolpathLayerReader = dynamic_cast(pIBaseClass); + if (!pIToolpathLayerReader) + throw ELib3MFInterfaceException(LIB3MF_ERROR_INVALIDCAST); + + *pHasOverrides = pIToolpathLayerReader->SegmentHasOverrideFactors(nSegmentIndex, eOverrideFactor); + + if (pJournalEntry.get() != nullptr) { + pJournalEntry->addBooleanResult("HasOverrides", *pHasOverrides); + pJournalEntry->writeSuccess(); + } + return LIB3MF_SUCCESS; + } + catch (ELib3MFInterfaceException & Exception) { + return handleLib3MFException(pIBaseClass, Exception, pJournalEntry.get()); + } + catch (std::exception & StdException) { + return handleStdException(pIBaseClass, StdException, pJournalEntry.get()); + } + catch (...) { + return handleUnhandledException(pIBaseClass, pJournalEntry.get()); + } +} + Lib3MFResult lib3mf_toolpathlayerreader_segmenthasuniformprofile(Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nSegmentIndex, bool * pHasUniformProfile) { IBase* pIBaseClass = (IBase *)pToolpathLayerReader; @@ -13450,6 +13486,41 @@ Lib3MFResult lib3mf_toolpathlayerreader_getsegmentpointdatadiscrete(Lib3MF_Toolp } } +Lib3MFResult lib3mf_toolpathlayerreader_getsegmentpointoverridefactors(Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nSegmentIndex, eLib3MFToolpathProfileOverrideFactor eOverrideFactor, const Lib3MF_uint64 nFactorValuesBufferSize, Lib3MF_uint64* pFactorValuesNeededCount, Lib3MF_double * pFactorValuesBuffer) +{ + IBase* pIBaseClass = (IBase *)pToolpathLayerReader; + + PLib3MFInterfaceJournalEntry pJournalEntry; + try { + if (m_GlobalJournal.get() != nullptr) { + pJournalEntry = m_GlobalJournal->beginClassMethod(pToolpathLayerReader, "ToolpathLayerReader", "GetSegmentPointOverrideFactors"); + pJournalEntry->addUInt32Parameter("SegmentIndex", nSegmentIndex); + pJournalEntry->addEnumParameter("OverrideFactor", "ToolpathProfileOverrideFactor", (Lib3MF_int32)(eOverrideFactor)); + } + if ((!pFactorValuesBuffer) && !(pFactorValuesNeededCount)) + throw ELib3MFInterfaceException (LIB3MF_ERROR_INVALIDPARAM); + IToolpathLayerReader* pIToolpathLayerReader = dynamic_cast(pIBaseClass); + if (!pIToolpathLayerReader) + throw ELib3MFInterfaceException(LIB3MF_ERROR_INVALIDCAST); + + pIToolpathLayerReader->GetSegmentPointOverrideFactors(nSegmentIndex, eOverrideFactor, nFactorValuesBufferSize, pFactorValuesNeededCount, pFactorValuesBuffer); + + if (pJournalEntry.get() != nullptr) { + pJournalEntry->writeSuccess(); + } + return LIB3MF_SUCCESS; + } + catch (ELib3MFInterfaceException & Exception) { + return handleLib3MFException(pIBaseClass, Exception, pJournalEntry.get()); + } + catch (std::exception & StdException) { + return handleStdException(pIBaseClass, StdException, pJournalEntry.get()); + } + catch (...) { + return handleUnhandledException(pIBaseClass, pJournalEntry.get()); + } +} + Lib3MFResult lib3mf_toolpathlayerreader_getsegmenthatchdatainmodelunits(Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nSegmentIndex, const Lib3MF_uint64 nHatchDataBufferSize, Lib3MF_uint64* pHatchDataNeededCount, sLib3MFHatch2D * pHatchDataBuffer) { IBase* pIBaseClass = (IBase *)pToolpathLayerReader; @@ -13518,6 +13589,41 @@ Lib3MFResult lib3mf_toolpathlayerreader_getsegmenthatchdatadiscrete(Lib3MF_Toolp } } +Lib3MFResult lib3mf_toolpathlayerreader_getsegmenthatchoverridefactors(Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nSegmentIndex, eLib3MFToolpathProfileOverrideFactor eOverrideFactor, const Lib3MF_uint64 nFactorValuesBufferSize, Lib3MF_uint64* pFactorValuesNeededCount, sLib3MFHatch2DOverrides * pFactorValuesBuffer) +{ + IBase* pIBaseClass = (IBase *)pToolpathLayerReader; + + PLib3MFInterfaceJournalEntry pJournalEntry; + try { + if (m_GlobalJournal.get() != nullptr) { + pJournalEntry = m_GlobalJournal->beginClassMethod(pToolpathLayerReader, "ToolpathLayerReader", "GetSegmentHatchOverrideFactors"); + pJournalEntry->addUInt32Parameter("SegmentIndex", nSegmentIndex); + pJournalEntry->addEnumParameter("OverrideFactor", "ToolpathProfileOverrideFactor", (Lib3MF_int32)(eOverrideFactor)); + } + if ((!pFactorValuesBuffer) && !(pFactorValuesNeededCount)) + throw ELib3MFInterfaceException (LIB3MF_ERROR_INVALIDPARAM); + IToolpathLayerReader* pIToolpathLayerReader = dynamic_cast(pIBaseClass); + if (!pIToolpathLayerReader) + throw ELib3MFInterfaceException(LIB3MF_ERROR_INVALIDCAST); + + pIToolpathLayerReader->GetSegmentHatchOverrideFactors(nSegmentIndex, eOverrideFactor, nFactorValuesBufferSize, pFactorValuesNeededCount, pFactorValuesBuffer); + + if (pJournalEntry.get() != nullptr) { + pJournalEntry->writeSuccess(); + } + return LIB3MF_SUCCESS; + } + catch (ELib3MFInterfaceException & Exception) { + return handleLib3MFException(pIBaseClass, Exception, pJournalEntry.get()); + } + catch (std::exception & StdException) { + return handleStdException(pIBaseClass, StdException, pJournalEntry.get()); + } + catch (...) { + return handleUnhandledException(pIBaseClass, pJournalEntry.get()); + } +} + /************************************************************************************************************************* Class implementation for ToolpathLayerData @@ -21089,16 +21195,22 @@ Lib3MFResult Lib3MF::Impl::Lib3MF_GetProcAddress (const char * pProcName, void * *ppProcAddress = (void*) &lib3mf_toolpathlayerreader_getsegmentdefaultprofileid; if (sProcName == "lib3mf_toolpathlayerreader_getprofileuuidbylocalprofileid") *ppProcAddress = (void*) &lib3mf_toolpathlayerreader_getprofileuuidbylocalprofileid; + if (sProcName == "lib3mf_toolpathlayerreader_segmenthasoverridefactors") + *ppProcAddress = (void*) &lib3mf_toolpathlayerreader_segmenthasoverridefactors; if (sProcName == "lib3mf_toolpathlayerreader_segmenthasuniformprofile") *ppProcAddress = (void*) &lib3mf_toolpathlayerreader_segmenthasuniformprofile; if (sProcName == "lib3mf_toolpathlayerreader_getsegmentpointdatainmodelunits") *ppProcAddress = (void*) &lib3mf_toolpathlayerreader_getsegmentpointdatainmodelunits; if (sProcName == "lib3mf_toolpathlayerreader_getsegmentpointdatadiscrete") *ppProcAddress = (void*) &lib3mf_toolpathlayerreader_getsegmentpointdatadiscrete; + if (sProcName == "lib3mf_toolpathlayerreader_getsegmentpointoverridefactors") + *ppProcAddress = (void*) &lib3mf_toolpathlayerreader_getsegmentpointoverridefactors; if (sProcName == "lib3mf_toolpathlayerreader_getsegmenthatchdatainmodelunits") *ppProcAddress = (void*) &lib3mf_toolpathlayerreader_getsegmenthatchdatainmodelunits; if (sProcName == "lib3mf_toolpathlayerreader_getsegmenthatchdatadiscrete") *ppProcAddress = (void*) &lib3mf_toolpathlayerreader_getsegmenthatchdatadiscrete; + if (sProcName == "lib3mf_toolpathlayerreader_getsegmenthatchoverridefactors") + *ppProcAddress = (void*) &lib3mf_toolpathlayerreader_getsegmenthatchoverridefactors; if (sProcName == "lib3mf_toolpathlayerdata_getlayerdatauuid") *ppProcAddress = (void*) &lib3mf_toolpathlayerdata_getlayerdatauuid; if (sProcName == "lib3mf_toolpathlayerdata_registerprofile") diff --git a/Autogenerated/Source/lib3mf_types.hpp b/Autogenerated/Source/lib3mf_types.hpp index ce3529af..68fa5a1d 100644 --- a/Autogenerated/Source/lib3mf_types.hpp +++ b/Autogenerated/Source/lib3mf_types.hpp @@ -488,6 +488,11 @@ namespace Lib3MF { Lib3MF_int32 m_Tag; } sHatch2D; + typedef struct sHatch2DOverrides { + Lib3MF_double m_Point1Override; + Lib3MF_double m_Point2Override; + } sHatch2DOverrides; + typedef struct sDiscreteHatch2D { Lib3MF_int32 m_Point1Coordinates[2]; Lib3MF_int32 m_Point2Coordinates[2]; @@ -647,6 +652,7 @@ typedef Lib3MF::sPosition sLib3MFPosition; typedef Lib3MF::sPosition2D sLib3MFPosition2D; typedef Lib3MF::sDiscretePosition2D sLib3MFDiscretePosition2D; typedef Lib3MF::sHatch2D sLib3MFHatch2D; +typedef Lib3MF::sHatch2DOverrides sLib3MFHatch2DOverrides; typedef Lib3MF::sDiscreteHatch2D sLib3MFDiscreteHatch2D; typedef Lib3MF::sCompositeConstituent sLib3MFCompositeConstituent; typedef Lib3MF::sMultiPropertyLayer sLib3MFMultiPropertyLayer; diff --git a/AutomaticComponentToolkit/lib3mf.xml b/AutomaticComponentToolkit/lib3mf.xml index 9806c929..4d6c3959 100644 --- a/AutomaticComponentToolkit/lib3mf.xml +++ b/AutomaticComponentToolkit/lib3mf.xml @@ -280,6 +280,11 @@ + + + + + @@ -1875,9 +1880,15 @@ - + + + + + + + - + @@ -1891,6 +1902,12 @@ + + + + + + @@ -1902,6 +1919,12 @@ + + + + + + diff --git a/Include/API/lib3mf_toolpathlayerreader.hpp b/Include/API/lib3mf_toolpathlayerreader.hpp index bd7d14ab..b58d508e 100644 --- a/Include/API/lib3mf_toolpathlayerreader.hpp +++ b/Include/API/lib3mf_toolpathlayerreader.hpp @@ -117,15 +117,20 @@ class CToolpathLayerReader : public virtual IToolpathLayerReader, public virtual std::string GetProfileUUIDByLocalProfileID(const Lib3MF_uint32 nLocalProfileID) override; bool SegmentHasUniformProfile(const Lib3MF_uint32 nIndex) override; - + + bool SegmentHasOverrideFactors(const Lib3MF_uint32 nSegmentIndex, const Lib3MF::eToolpathProfileOverrideFactor eOverrideFactor) override; + void GetSegmentPointDataInModelUnits(const Lib3MF_uint32 nIndex, Lib3MF_uint64 nPointDataBufferSize, Lib3MF_uint64* pPointDataNeededCount, Lib3MF::sPosition2D * pPointDataBuffer) override; void GetSegmentPointDataDiscrete(const Lib3MF_uint32 nIndex, Lib3MF_uint64 nPointDataBufferSize, Lib3MF_uint64* pPointDataNeededCount, Lib3MF::sDiscretePosition2D* pPointDataBuffer) override; + void GetSegmentPointOverrideFactors(const Lib3MF_uint32 nSegmentIndex, const Lib3MF::eToolpathProfileOverrideFactor eOverrideFactor, Lib3MF_uint64 nFactorValuesBufferSize, Lib3MF_uint64* pFactorValuesNeededCount, Lib3MF_double* pFactorValuesBuffer) override; + void GetSegmentHatchDataInModelUnits(const Lib3MF_uint32 nIndex, Lib3MF_uint64 nHatchDataBufferSize, Lib3MF_uint64* pHatchDataNeededCount, Lib3MF::sHatch2D* pHatchDataBuffer) override; void GetSegmentHatchDataDiscrete(const Lib3MF_uint32 nIndex, Lib3MF_uint64 nPointDataBufferSize, Lib3MF_uint64* pPointDataNeededCount, Lib3MF::sDiscreteHatch2D* pPointDataBuffer) override; + void GetSegmentHatchOverrideFactors(const Lib3MF_uint32 nSegmentIndex, const Lib3MF::eToolpathProfileOverrideFactor eOverrideFactor, Lib3MF_uint64 nFactorValuesBufferSize, Lib3MF_uint64* pFactorValuesNeededCount, Lib3MF::sHatch2DOverrides* pFactorValuesBuffer) override; }; diff --git a/Include/Model/Classes/NMR_ModelToolpathLayerReadData.h b/Include/Model/Classes/NMR_ModelToolpathLayerReadData.h index e76fa36e..0ab24a75 100644 --- a/Include/Model/Classes/NMR_ModelToolpathLayerReadData.h +++ b/Include/Model/Classes/NMR_ModelToolpathLayerReadData.h @@ -132,6 +132,7 @@ namespace NMR { nfUint32 getSegmentCount(); void getSegmentInfo (nfUint32 nSegmentIndex, eModelToolpathSegmentType & eType, nfUint32 & nProfileID, nfUint32 & nPartID, nfUint32 & nPointCount); + uint32_t getSegmentOverrideDenominator (nfUint32 nSegmentIndex); TOOLPATHREADPOINT & getSegmentPoint (nfUint32 nSegmentIndex, nfUint32 nPointIndex); uint32_t getPartCount(); @@ -155,6 +156,7 @@ namespace NMR { std::pair findSegmentAttribute(const std::string& sNameSpace, const std::string& sAttributeName, bool bMustExist); bool segmentHasUniformProfile(nfUint32 nSegmentIndex); + bool segmentHasOverrideFactors(nfUint32 nSegmentIndex, NMR::eModelToolpathProfileOverrideFactor overrideFactor); double getUnits(); diff --git a/Source/API/lib3mf_toolpathlayerreader.cpp b/Source/API/lib3mf_toolpathlayerreader.cpp index b5663eef..a760fa65 100644 --- a/Source/API/lib3mf_toolpathlayerreader.cpp +++ b/Source/API/lib3mf_toolpathlayerreader.cpp @@ -122,9 +122,33 @@ std::string CToolpathLayerReader::GetProfileUUIDByLocalProfileID(const Lib3MF_ui } -bool CToolpathLayerReader::SegmentHasUniformProfile(const Lib3MF_uint32 nIndex) +bool CToolpathLayerReader::SegmentHasUniformProfile(const Lib3MF_uint32 nSegmentIndex) { - return m_pReadData->segmentHasUniformProfile(nIndex); + return m_pReadData->segmentHasUniformProfile(nSegmentIndex); +} + +bool CToolpathLayerReader::SegmentHasOverrideFactors(const Lib3MF_uint32 nSegmentIndex, const Lib3MF::eToolpathProfileOverrideFactor eOverrideFactor) +{ + NMR::eModelToolpathProfileOverrideFactor internalOverrideFactor; + switch (eOverrideFactor) { + case Lib3MF::eToolpathProfileOverrideFactor::FactorF: + internalOverrideFactor = NMR::eModelToolpathProfileOverrideFactor::pfFactorF; + break; + + case Lib3MF::eToolpathProfileOverrideFactor::FactorG: + internalOverrideFactor = NMR::eModelToolpathProfileOverrideFactor::pfFactorG; + break; + + case Lib3MF::eToolpathProfileOverrideFactor::FactorH: + internalOverrideFactor = NMR::eModelToolpathProfileOverrideFactor::pfFactorH; + break; + + default: + internalOverrideFactor = NMR::eModelToolpathProfileOverrideFactor::pfNone; + + } + + return m_pReadData->segmentHasOverrideFactors(nSegmentIndex, internalOverrideFactor); } @@ -235,6 +259,105 @@ void CToolpathLayerReader::GetSegmentPointDataDiscrete(const Lib3MF_uint32 nInde } } +void CToolpathLayerReader::GetSegmentPointOverrideFactors(const Lib3MF_uint32 nSegmentIndex, const Lib3MF::eToolpathProfileOverrideFactor eOverrideFactor, Lib3MF_uint64 nFactorValuesBufferSize, Lib3MF_uint64* pFactorValuesNeededCount, Lib3MF_double* pFactorValuesBuffer) +{ + NMR::eModelToolpathSegmentType eNMRType; + uint32_t nProfileID; + uint32_t nPartID; + uint32_t nPointCount; + m_pReadData->getSegmentInfo(nSegmentIndex, eNMRType, nProfileID, nPartID, nPointCount); + + if (pFactorValuesNeededCount != nullptr) { + *pFactorValuesNeededCount = nPointCount; + } + + if (pFactorValuesBuffer != nullptr) { + if (nFactorValuesBufferSize < nPointCount) + throw ELib3MFInterfaceException(LIB3MF_ERROR_BUFFERTOOSMALL); + + bool bFillWithZeros = false; + + uint32_t nDenominator = m_pReadData->getSegmentOverrideDenominator(nSegmentIndex); + if (nDenominator > 0) { + double * pTarget = pFactorValuesBuffer; + + switch (eOverrideFactor) { + case Lib3MF::eToolpathProfileOverrideFactor::FactorF: + for (uint32_t nPointIndex = 0; nPointIndex < nPointCount; nPointIndex++) { + + NMR::TOOLPATHREADPOINT& point = m_pReadData->getSegmentPoint(nSegmentIndex, nPointIndex); + if (point.m_nFactorF < 0) { + *pTarget = 0.0; + } + else if ((uint32_t)point.m_nFactorF >= nDenominator) { + *pTarget = 1.0; + } + else { + *pTarget = (double)point.m_nFactorF / (double)nDenominator; + } + + pTarget++; + + } + break; + + case Lib3MF::eToolpathProfileOverrideFactor::FactorG: + for (uint32_t nPointIndex = 0; nPointIndex < nPointCount; nPointIndex++) { + + NMR::TOOLPATHREADPOINT& point = m_pReadData->getSegmentPoint(nSegmentIndex, nPointIndex); + if (point.m_nFactorG < 0) { + *pTarget = 0.0; + } + else if ((uint32_t)point.m_nFactorG >= nDenominator) { + *pTarget = 1.0; + } + else { + *pTarget = (double)point.m_nFactorG / (double)nDenominator; + } + + pTarget++; + + } + break; + + case Lib3MF::eToolpathProfileOverrideFactor::FactorH: + for (uint32_t nPointIndex = 0; nPointIndex < nPointCount; nPointIndex++) { + + NMR::TOOLPATHREADPOINT& point = m_pReadData->getSegmentPoint(nSegmentIndex, nPointIndex); + if (point.m_nFactorH < 0) { + *pTarget = 0.0; + } + else if ((uint32_t)point.m_nFactorH >= nDenominator) { + *pTarget = 1.0; + } + else { + *pTarget = (double)point.m_nFactorH / (double)nDenominator; + } + + pTarget++; + + } + break; + + default: + bFillWithZeros = true; + + } + + } + else { + bFillWithZeros = true; + } + + if (bFillWithZeros) { + for (uint32_t nPointIndex = 0; nPointIndex < nPointCount; nPointIndex++) + pFactorValuesBuffer[nPointIndex] = 0.0; + } + + } +} + + void CToolpathLayerReader::GetSegmentHatchDataInModelUnits(const Lib3MF_uint32 nIndex, Lib3MF_uint64 nHatchDataBufferSize, Lib3MF_uint64* pHatchDataNeededCount, Lib3MF::sHatch2D* pHatchDataBuffer) { NMR::eModelToolpathSegmentType eNMRType; @@ -329,6 +452,157 @@ void CToolpathLayerReader::GetSegmentHatchDataDiscrete(const Lib3MF_uint32 nInde } + +void CToolpathLayerReader::GetSegmentHatchOverrideFactors(const Lib3MF_uint32 nSegmentIndex, const Lib3MF::eToolpathProfileOverrideFactor eOverrideFactor, Lib3MF_uint64 nFactorValuesBufferSize, Lib3MF_uint64* pFactorValuesNeededCount, Lib3MF::sHatch2DOverrides* pFactorValuesBuffer) +{ + NMR::eModelToolpathSegmentType eNMRType; + uint32_t nProfileID; + uint32_t nPartID; + uint32_t nDoubleHatchCount; + m_pReadData->getSegmentInfo(nSegmentIndex, eNMRType, nProfileID, nPartID, nDoubleHatchCount); + + if (eNMRType == NMR::eModelToolpathSegmentType::HatchSegment) { + uint32_t nHatchCount = nDoubleHatchCount / 2; + + bool bFillWithZeros = false; + + if (pFactorValuesNeededCount != nullptr) { + *pFactorValuesNeededCount = nHatchCount; + } + + if ((pFactorValuesBuffer != nullptr) && (nHatchCount > 0)) { + if (nFactorValuesBufferSize < nHatchCount) + throw ELib3MFInterfaceException(LIB3MF_ERROR_BUFFERTOOSMALL); + + + uint32_t nDenominator = m_pReadData->getSegmentOverrideDenominator(nSegmentIndex); + if (nDenominator > 0) { + Lib3MF::sHatch2DOverrides* pTarget = pFactorValuesBuffer; + + switch (eOverrideFactor) { + case Lib3MF::eToolpathProfileOverrideFactor::FactorF: + for (uint32_t nHatchIndex = 0; nHatchIndex < nHatchCount; nHatchIndex++) { + + NMR::TOOLPATHREADPOINT& point1 = m_pReadData->getSegmentPoint(nSegmentIndex, nHatchIndex * 2); + if (point1.m_nFactorF < 0) { + pTarget->m_Point1Override = 0.0; + } + else if ((uint32_t)point1.m_nFactorF >= nDenominator) { + pTarget->m_Point1Override = 1.0; + } + else { + pTarget->m_Point1Override = (double)point1.m_nFactorF / (double)nDenominator; + } + + NMR::TOOLPATHREADPOINT& point2 = m_pReadData->getSegmentPoint(nSegmentIndex, nHatchIndex * 2 + 1); + if (point2.m_nFactorF < 0) { + pTarget->m_Point2Override = 0.0; + } + else if ((uint32_t)point2.m_nFactorF >= nDenominator) { + pTarget->m_Point2Override = 1.0; + } + else { + pTarget->m_Point2Override = (double)point2.m_nFactorF / (double)nDenominator; + } + + pTarget++; + + } + break; + + case Lib3MF::eToolpathProfileOverrideFactor::FactorG: + for (uint32_t nHatchIndex = 0; nHatchIndex < nHatchCount; nHatchIndex++) { + + NMR::TOOLPATHREADPOINT& point1 = m_pReadData->getSegmentPoint(nSegmentIndex, nHatchIndex * 2); + if (point1.m_nFactorG < 0) { + pTarget->m_Point1Override = 0.0; + } + else if ((uint32_t)point1.m_nFactorG >= nDenominator) { + pTarget->m_Point1Override = 1.0; + } + else { + pTarget->m_Point1Override = (double)point1.m_nFactorG / (double)nDenominator; + } + + NMR::TOOLPATHREADPOINT& point2 = m_pReadData->getSegmentPoint(nSegmentIndex, nHatchIndex * 2 + 1); + if (point2.m_nFactorG < 0) { + pTarget->m_Point2Override = 0.0; + } + else if ((uint32_t)point2.m_nFactorG >= nDenominator) { + pTarget->m_Point2Override = 1.0; + } + else { + pTarget->m_Point2Override = (double)point2.m_nFactorG / (double)nDenominator; + } + + pTarget++; + + } + break; + + + case Lib3MF::eToolpathProfileOverrideFactor::FactorH: + for (uint32_t nHatchIndex = 0; nHatchIndex < nHatchCount; nHatchIndex++) { + + NMR::TOOLPATHREADPOINT& point1 = m_pReadData->getSegmentPoint(nSegmentIndex, nHatchIndex * 2); + if (point1.m_nFactorH < 0) { + pTarget->m_Point1Override = 0.0; + } + else if ((uint32_t)point1.m_nFactorH >= nDenominator) { + pTarget->m_Point1Override = 1.0; + } + else { + pTarget->m_Point1Override = (double)point1.m_nFactorH / (double)nDenominator; + } + + NMR::TOOLPATHREADPOINT& point2 = m_pReadData->getSegmentPoint(nSegmentIndex, nHatchIndex * 2 + 1); + if (point2.m_nFactorH < 0) { + pTarget->m_Point2Override = 0.0; + } + else if ((uint32_t)point2.m_nFactorH >= nDenominator) { + pTarget->m_Point2Override = 1.0; + } + else { + pTarget->m_Point2Override = (double)point2.m_nFactorH / (double)nDenominator; + } + + pTarget++; + + } + break; + + default: + bFillWithZeros = true; + + } + + } + else { + bFillWithZeros = true; + } + + if (bFillWithZeros) { + for (uint32_t nHatchIndex = 0; nHatchIndex < nHatchCount; nHatchIndex++) { + pFactorValuesBuffer[nHatchIndex].m_Point1Override = 0.0; + pFactorValuesBuffer[nHatchIndex].m_Point2Override = 0.0; + } + } + + } + + } + else { + + if (pFactorValuesNeededCount != nullptr) + *pFactorValuesNeededCount = 0; + + } + + + +} + + Lib3MF_uint32 CToolpathLayerReader::GetCustomDataCount() { return m_pReadData->getCustomXMLDataCount(); @@ -439,3 +713,5 @@ IBuildItem* CToolpathLayerReader::GetPartBuildItem(const Lib3MF_uint32 nPartInde return new CBuildItem(pBuildItemInstance); } + + diff --git a/Source/Model/Classes/NMR_ModelToolpathLayerReadData.cpp b/Source/Model/Classes/NMR_ModelToolpathLayerReadData.cpp index da8736ce..8150ad26 100644 --- a/Source/Model/Classes/NMR_ModelToolpathLayerReadData.cpp +++ b/Source/Model/Classes/NMR_ModelToolpathLayerReadData.cpp @@ -127,6 +127,14 @@ namespace NMR { nPointCount = pSegment->m_nPointCount; } + uint32_t CModelToolpathLayerReadData::getSegmentOverrideDenominator(nfUint32 nSegmentIndex) + { + TOOLPATHREADSEGMENT* pSegment = m_Segments.getData(nSegmentIndex); + __NMRASSERT(pSegment != nullptr); + return pSegment->m_nOverrideFraction; + } + + TOOLPATHREADPOINT& CModelToolpathLayerReadData::getSegmentPoint(nfUint32 nSegmentIndex, nfUint32 nPointIndex) { TOOLPATHREADSEGMENT * pSegment = m_Segments.getData(nSegmentIndex); @@ -346,10 +354,70 @@ namespace NMR { TOOLPATHREADSEGMENT* pSegment = m_Segments.getData(nSegmentIndex); __NMRASSERT(pSegment != nullptr); - + if ((pSegment->m_eType == NMR::eModelToolpathSegmentType::LoopSegment) || + (pSegment->m_eType == NMR::eModelToolpathSegmentType::PolylineSegment) || + (pSegment->m_eType == NMR::eModelToolpathSegmentType::HatchSegment)) { + + for (uint32_t nPointIndex = 0; nPointIndex < pSegment->m_nPointCount; nPointIndex++) { + auto & point = m_Points.getDataRef(pSegment->m_nStartPoint + nPointIndex); + if (point.m_nFactorF != 0) + return false; + if (point.m_nFactorG != 0) + return false; + if (point.m_nFactorH != 0) + return false; + } + + } + return true; + } + bool CModelToolpathLayerReadData::segmentHasOverrideFactors(nfUint32 nSegmentIndex, NMR::eModelToolpathProfileOverrideFactor overrideFactor) + { + TOOLPATHREADSEGMENT* pSegment = m_Segments.getData(nSegmentIndex); + __NMRASSERT(pSegment != nullptr); + + if ((pSegment->m_eType == NMR::eModelToolpathSegmentType::LoopSegment) || + (pSegment->m_eType == NMR::eModelToolpathSegmentType::PolylineSegment) || + (pSegment->m_eType == NMR::eModelToolpathSegmentType::HatchSegment)) { + + switch (overrideFactor) { + + case NMR::eModelToolpathProfileOverrideFactor::pfFactorF: + for (uint32_t nPointIndex = 0; nPointIndex < pSegment->m_nPointCount; nPointIndex++) { + auto& point = m_Points.getDataRef(pSegment->m_nStartPoint + nPointIndex); + if (point.m_nFactorF != 0) + return true; + } + return false; + + case NMR::eModelToolpathProfileOverrideFactor::pfFactorG: + for (uint32_t nPointIndex = 0; nPointIndex < pSegment->m_nPointCount; nPointIndex++) { + auto& point = m_Points.getDataRef(pSegment->m_nStartPoint + nPointIndex); + if (point.m_nFactorG != 0) + return true; + } + return false; + + case NMR::eModelToolpathProfileOverrideFactor::pfFactorH: + for (uint32_t nPointIndex = 0; nPointIndex < pSegment->m_nPointCount; nPointIndex++) { + auto& point = m_Points.getDataRef(pSegment->m_nStartPoint + nPointIndex); + if (point.m_nFactorH != 0) + return true; + } + return false; + + } + + } + + return false; + + } + + uint32_t CModelToolpathLayerReadData::getPartCount() { if (m_PartIDs.size() > UINT32_MAX)