diff --git a/Autogenerated/Bindings/C/lib3mf.h b/Autogenerated/Bindings/C/lib3mf.h index d1c1e9903..3aa21ad63 100644 --- a/Autogenerated/Bindings/C/lib3mf.h +++ b/Autogenerated/Bindings/C/lib3mf.h @@ -3363,10 +3363,22 @@ LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerreader_getpartuuidbylocalpartid * @param[in] nIndex - Index. Must be between 0 and Count - 1. * @param[in] nPointDataBufferSize - Number of elements in buffer * @param[out] pPointDataNeededCount - will be filled with the count of the written elements, or needed buffer size. -* @param[out] pPointDataBuffer - Position2D buffer of The point data array +* @param[out] pPointDataBuffer - Position2D buffer of The point data array. The point coordinates are in model units. * @return error code or 0 (success) */ -LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerreader_getsegmentpointdata(Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nIndex, const Lib3MF_uint64 nPointDataBufferSize, Lib3MF_uint64* pPointDataNeededCount, sLib3MFPosition2D * pPointDataBuffer); +LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerreader_getsegmentpointdatainmodelunits(Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nIndex, const Lib3MF_uint64 nPointDataBufferSize, Lib3MF_uint64* pPointDataNeededCount, sLib3MFPosition2D * pPointDataBuffer); + +/** +* Retrieves the assigned segment point list in units. For type hatch, the points are taken pairwise. +* +* @param[in] pToolpathLayerReader - ToolpathLayerReader instance. +* @param[in] nIndex - Index. Must be between 0 and Count - 1. +* @param[in] nPointDataBufferSize - Number of elements in buffer +* @param[out] pPointDataNeededCount - will be filled with the count of the written elements, or needed buffer size. +* @param[out] pPointDataBuffer - DiscretePosition2D buffer of The point data array. The point coordinates are in toolpath units. +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerreader_getsegmentpointdatadiscrete(Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nIndex, const Lib3MF_uint64 nPointDataBufferSize, Lib3MF_uint64* pPointDataNeededCount, sLib3MFDiscretePosition2D * pPointDataBuffer); /** * Retrieves a segment attribute Information by Attribute Name. Will fail if Attribute does not exist. @@ -3537,28 +3549,76 @@ LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerdata_setsegmentattribute(Lib3MF LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerdata_clearsegmentattributes(Lib3MF_ToolpathLayerData pToolpathLayerData); /** -* writes hatch data to the layer. +* Stores custom line attributes for the next WriteLoop, WritePolyline or WriteHatchData call. +* +* @param[in] pToolpathLayerData - ToolpathLayerData instance. +* @param[in] pNameSpace - The namespace of the attribute to register. +* @param[in] pAttributeName - The name of the attribute to register. +* @param[in] nValuesBufferSize - Number of elements in buffer +* @param[in] pValuesBuffer - int32 buffer of Custom Values to store on segment lines. Array MUST NOT be empty. If custom attributes had been already defined, the error cardinality MUST match, or an error will be thrown. +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerdata_addcustomlineattributes(Lib3MF_ToolpathLayerData pToolpathLayerData, const char * pNameSpace, const char * pAttributeName, Lib3MF_uint64 nValuesBufferSize, const Lib3MF_int32 * pValuesBuffer); + +/** +* Clears all custom line attributes. Any call to WriteLoop, WritePolyline or WriteHatchData will do this implicitely. +* +* @param[in] pToolpathLayerData - ToolpathLayerData instance. +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerdata_clearcustomlineattributes(Lib3MF_ToolpathLayerData pToolpathLayerData); + +/** +* writes hatch data to the layer in model units. +* +* @param[in] pToolpathLayerData - ToolpathLayerData instance. +* @param[in] nProfileID - The toolpath profile to use +* @param[in] nPartID - The toolpath part to use +* @param[in] bWriteCustomLineAttributes - If true, custom line attributes are written. The cardinality of each custom attribute MUST be equal to the number of hatches in the hatchdata array. In any case, stored custom attributes will be cleared after the call. +* @param[in] nHatchDataBufferSize - Number of elements in buffer +* @param[in] pHatchDataBuffer - Hatch2D buffer of The hatch data in model units. Array MUST NOT be empty. +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerdata_writehatchdatainmodelunits(Lib3MF_ToolpathLayerData pToolpathLayerData, Lib3MF_uint32 nProfileID, Lib3MF_uint32 nPartID, bool bWriteCustomLineAttributes, Lib3MF_uint64 nHatchDataBufferSize, const sLib3MFHatch2D * pHatchDataBuffer); + +/** +* writes hatch data to the layer in toolpath units. +* +* @param[in] pToolpathLayerData - ToolpathLayerData instance. +* @param[in] nProfileID - The toolpath profile to use +* @param[in] nPartID - The toolpath part to use +* @param[in] bWriteCustomLineAttributes - If true, custom line attributes are written. The cardinality of each custom attribute MUST be equal to the number of hatches in the hatchdata array. In any case, stored custom attributes will be cleared after the call. +* @param[in] nHatchDataBufferSize - Number of elements in buffer +* @param[in] pHatchDataBuffer - DiscreteHatch2D buffer of The hatch data in toolpath units. Array MUST NOT be empty. +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerdata_writehatchdatadiscrete(Lib3MF_ToolpathLayerData pToolpathLayerData, Lib3MF_uint32 nProfileID, Lib3MF_uint32 nPartID, bool bWriteCustomLineAttributes, Lib3MF_uint64 nHatchDataBufferSize, const sLib3MFDiscreteHatch2D * pHatchDataBuffer); + +/** +* writes loop data to the layer in model units. * * @param[in] pToolpathLayerData - ToolpathLayerData instance. * @param[in] nProfileID - The toolpath profile to use * @param[in] nPartID - The toolpath part to use +* @param[in] bWriteCustomLineAttributes - If true, custom line attributes are written. The cardinality of each custom attribute MUST be equal to the number of points in the pointdata array. In any case, stored custom attributes will be cleared after the call. * @param[in] nPointDataBufferSize - Number of elements in buffer -* @param[in] pPointDataBuffer - Position2D buffer of The point data +* @param[in] pPointDataBuffer - Position2D buffer of The point data in model units. Array MUST NOT be empty. * @return error code or 0 (success) */ -LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerdata_writehatchdata(Lib3MF_ToolpathLayerData pToolpathLayerData, Lib3MF_uint32 nProfileID, Lib3MF_uint32 nPartID, Lib3MF_uint64 nPointDataBufferSize, const sLib3MFPosition2D * pPointDataBuffer); +LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerdata_writeloopinmodelunits(Lib3MF_ToolpathLayerData pToolpathLayerData, Lib3MF_uint32 nProfileID, Lib3MF_uint32 nPartID, bool bWriteCustomLineAttributes, Lib3MF_uint64 nPointDataBufferSize, const sLib3MFPosition2D * pPointDataBuffer); /** -* writes loop data to the layer. +* writes loop data to the layer in toolpath units. * * @param[in] pToolpathLayerData - ToolpathLayerData instance. * @param[in] nProfileID - The toolpath profile to use * @param[in] nPartID - The toolpath part to use +* @param[in] bWriteCustomLineAttributes - If true, custom line attributes are written. The cardinality of each custom attribute MUST be equal to the number of points in the pointdata array. In any case, stored custom attributes will be cleared after the call. * @param[in] nPointDataBufferSize - Number of elements in buffer -* @param[in] pPointDataBuffer - Position2D buffer of The point data +* @param[in] pPointDataBuffer - DiscretePosition2D buffer of The point data in toolpath units. Array MUST NOT be empty. * @return error code or 0 (success) */ -LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerdata_writeloop(Lib3MF_ToolpathLayerData pToolpathLayerData, Lib3MF_uint32 nProfileID, Lib3MF_uint32 nPartID, Lib3MF_uint64 nPointDataBufferSize, const sLib3MFPosition2D * pPointDataBuffer); +LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerdata_writeloopdiscrete(Lib3MF_ToolpathLayerData pToolpathLayerData, Lib3MF_uint32 nProfileID, Lib3MF_uint32 nPartID, bool bWriteCustomLineAttributes, Lib3MF_uint64 nPointDataBufferSize, const sLib3MFDiscretePosition2D * pPointDataBuffer); /** * writes polyline data to the layer. @@ -3566,11 +3626,25 @@ LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerdata_writeloop(Lib3MF_ToolpathL * @param[in] pToolpathLayerData - ToolpathLayerData instance. * @param[in] nProfileID - The toolpath profile to use * @param[in] nPartID - The toolpath part to use +* @param[in] bWriteCustomLineAttributes - If true, custom line attributes are written. The cardinality of each custom attribute MUST be equal to the number of points in the pointdata array. In any case, stored custom attributes will be cleared after the call. * @param[in] nPointDataBufferSize - Number of elements in buffer -* @param[in] pPointDataBuffer - Position2D buffer of The point data +* @param[in] pPointDataBuffer - Position2D buffer of The point data in model units. Array MUST NOT be empty. * @return error code or 0 (success) */ -LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerdata_writepolyline(Lib3MF_ToolpathLayerData pToolpathLayerData, Lib3MF_uint32 nProfileID, Lib3MF_uint32 nPartID, Lib3MF_uint64 nPointDataBufferSize, const sLib3MFPosition2D * pPointDataBuffer); +LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerdata_writepolylineinmodelunits(Lib3MF_ToolpathLayerData pToolpathLayerData, Lib3MF_uint32 nProfileID, Lib3MF_uint32 nPartID, bool bWriteCustomLineAttributes, Lib3MF_uint64 nPointDataBufferSize, const sLib3MFPosition2D * pPointDataBuffer); + +/** +* writes polyline data to the layer. +* +* @param[in] pToolpathLayerData - ToolpathLayerData instance. +* @param[in] nProfileID - The toolpath profile to use +* @param[in] nPartID - The toolpath part to use +* @param[in] bWriteCustomLineAttributes - If true, custom line attributes are written. The cardinality of each custom attribute MUST be equal to the number of points in the pointdata array. In any case, stored custom attributes will be cleared after the call. +* @param[in] nPointDataBufferSize - Number of elements in buffer +* @param[in] pPointDataBuffer - DiscretePosition2D buffer of The point data in toolpath units. Array MUST NOT be empty. +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerdata_writepolylinediscrete(Lib3MF_ToolpathLayerData pToolpathLayerData, Lib3MF_uint32 nProfileID, Lib3MF_uint32 nPartID, bool bWriteCustomLineAttributes, Lib3MF_uint64 nPointDataBufferSize, const sLib3MFDiscretePosition2D * pPointDataBuffer); /** * Adds a custom data DOM tree to the layer. Layer MUST not be finished when changing the DOM tree. @@ -3596,7 +3670,29 @@ LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerdata_finish(Lib3MF_ToolpathLaye **************************************************************************************************************************/ /** -* Retrieves the unit factor +* Retrieves the UUID of the toolpath +* +* @param[in] pToolpath - Toolpath instance. +* @param[in] nUUIDBufferSize - size of the buffer (including trailing 0) +* @param[out] pUUIDNeededChars - will be filled with the count of the written bytes, or needed buffer size. +* @param[out] pUUIDBuffer - buffer of UUID Value., may be NULL +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpath_getuuid(Lib3MF_Toolpath pToolpath, const Lib3MF_uint32 nUUIDBufferSize, Lib3MF_uint32* pUUIDNeededChars, char * pUUIDBuffer); + +/** +* Generates a new unique identifier for this toolpath and sets its value. +* +* @param[in] pToolpath - Toolpath instance. +* @param[in] nNewUUIDBufferSize - size of the buffer (including trailing 0) +* @param[out] pNewUUIDNeededChars - will be filled with the count of the written bytes, or needed buffer size. +* @param[out] pNewUUIDBuffer - buffer of Newly created UUID Value., may be NULL +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpath_resetuuid(Lib3MF_Toolpath pToolpath, const Lib3MF_uint32 nNewUUIDBufferSize, Lib3MF_uint32* pNewUUIDNeededChars, char * pNewUUIDBuffer); + +/** +* Retrieves the unit factor, i.e. how many model units are one toolpath unit. * * @param[in] pToolpath - Toolpath instance. * @param[out] pUnits - Returns the unit factor. @@ -3626,7 +3722,7 @@ LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpath_getprofilecount(Lib3MF_Toolpath pTo * Adds a new toolpath layer * * @param[in] pToolpath - Toolpath instance. -* @param[in] nZMax - ZMax value of the layer. MUST be larger than the last layer added, as well as larger as BottomZ. +* @param[in] nZMax - ZMax value of the layer in toolpath units. MUST be larger than the last layer added, as well as larger as BottomZ. * @param[in] pPath - Package Path * @param[in] pModelWriter - The model writer that writes out the 3MF. * @param[out] pLayerData - Returns the layerdata object to write the layer content into. @@ -3638,7 +3734,7 @@ LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpath_addlayer(Lib3MF_Toolpath pToolpath, * Returns the bottom Z Value of the toolpath. * * @param[in] pToolpath - Toolpath instance. -* @param[out] pBottomZ - BottomZ value +* @param[out] pBottomZ - BottomZ value in Toolpath units * @return error code or 0 (success) */ LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpath_getbottomz(Lib3MF_Toolpath pToolpath, Lib3MF_uint32 * pBottomZ); @@ -3647,13 +3743,13 @@ LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpath_getbottomz(Lib3MF_Toolpath pToolpat * Sets the bottom Z Value of the toolpath. Will fail if a layer is already existing. * * @param[in] pToolpath - Toolpath instance. -* @param[in] nBottomZ - BottomZ value +* @param[in] nBottomZ - BottomZ value in Toolpath units * @return error code or 0 (success) */ LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpath_setbottomz(Lib3MF_Toolpath pToolpath, Lib3MF_uint32 nBottomZ); /** -* Retrieves the Attachment of a layer +* Retrieves the Attachment that contains the layer data. * * @param[in] pToolpath - Toolpath instance. * @param[in] nIndex - Layer Index @@ -3689,20 +3785,39 @@ LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpath_getlayerpath(Lib3MF_Toolpath pToolp * * @param[in] pToolpath - Toolpath instance. * @param[in] nIndex - Layer Index -* @param[out] pZMax - ZMax value +* @param[out] pZMax - ZMax value in toolpath units * @return error code or 0 (success) */ LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpath_getlayerzmax(Lib3MF_Toolpath pToolpath, Lib3MF_uint32 nIndex, Lib3MF_uint32 * pZMax); /** -* Return the z value of a layer in units. +* Retrieves the Minimum Z of a layer +* +* @param[in] pToolpath - Toolpath instance. +* @param[in] nIndex - Layer Index +* @param[out] pZMin - ZMin value in toolpath units +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpath_getlayerzmin(Lib3MF_Toolpath pToolpath, Lib3MF_uint32 nIndex, Lib3MF_uint32 * pZMin); + +/** +* Retrieves the Thickness of a layer +* +* @param[in] pToolpath - Toolpath instance. +* @param[in] nIndex - Layer Index +* @param[out] pZThickness - Thickness value in toolpath units +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpath_getlayerthickness(Lib3MF_Toolpath pToolpath, Lib3MF_uint32 nIndex, Lib3MF_uint32 * pZThickness); + +/** +* Checks if the toolpath has a uniform thickness value, i.e. each layer has the same thickness. * * @param[in] pToolpath - Toolpath instance. -* @param[in] nLayerIndex - Layer Index. -* @param[out] pZValue - Z Value in Units. +* @param[out] pUniformThickness - Returns true if the layer thicknesses are uniform, returns false otherwise. * @return error code or 0 (success) */ -LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpath_getlayerz(Lib3MF_Toolpath pToolpath, Lib3MF_uint32 nLayerIndex, Lib3MF_uint32 * pZValue); +LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpath_hasuniformthickness(Lib3MF_Toolpath pToolpath, bool * pUniformThickness); /** * Adds a new profile to the toolpath. @@ -3838,7 +3953,7 @@ LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpath_deletecustomdata(Lib3MF_Toolpath pT * @param[in] pAttributeName - Attribute name. MUST not be empty. * @return error code or 0 (success) */ -LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpath_registercustomintegerattribute(Lib3MF_Toolpath pToolpath, const char * pNameSpace, const char * pAttributeName); +LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpath_registercustomintegersegmentattribute(Lib3MF_Toolpath pToolpath, const char * pNameSpace, const char * pAttributeName); /** * Registers a Double Attribute that each segment holds. Registering only applies to reader or writer objects created after the call. @@ -3848,7 +3963,7 @@ LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpath_registercustomintegerattribute(Lib3 * @param[in] pAttributeName - Attribute name. MUST not be empty. * @return error code or 0 (success) */ -LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpath_registercustomdoubleattribute(Lib3MF_Toolpath pToolpath, const char * pNameSpace, const char * pAttributeName); +LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpath_registercustomdoublesegmentattribute(Lib3MF_Toolpath pToolpath, const char * pNameSpace, const char * pAttributeName); /************************************************************************************************************************* Class definition for ToolpathIterator diff --git a/Autogenerated/Bindings/C/lib3mf_types.h b/Autogenerated/Bindings/C/lib3mf_types.h index ed4941824..e4a331e83 100644 --- a/Autogenerated/Bindings/C/lib3mf_types.h +++ b/Autogenerated/Bindings/C/lib3mf_types.h @@ -151,6 +151,9 @@ typedef void * Lib3MF_pvoid; #define LIB3MF_ERROR_EMPTYNAMESPACE 4007 /** Empty namespace. */ #define LIB3MF_ERROR_INVALIDNAMESPACEPREFIX 4008 /** Invalid namespace prefix. */ #define LIB3MF_ERROR_WRITERDOESNOTSUPPORTNAMESPACES 4009 /** Writer does not support namespaces. */ +#define LIB3MF_ERROR_TOOLPATH_INVALIDHATCHCOORDINATE 4010 /** Invalid hatch coordinate. */ +#define LIB3MF_ERROR_TOOLPATH_INVALIDPOINTCOORDINATE 4011 /** Invalid point coordinate. */ +#define LIB3MF_ERROR_TOOLPATH_INVALIDHATCHCOUNT 4012 /** Invalid hatch count */ /************************************************************************************************************************* Error strings for Lib3MF @@ -216,6 +219,9 @@ inline const char * LIB3MF_GETERRORSTRING (Lib3MFResult nErrorCode) { case LIB3MF_ERROR_EMPTYNAMESPACE: return "Empty namespace."; case LIB3MF_ERROR_INVALIDNAMESPACEPREFIX: return "Invalid namespace prefix."; case LIB3MF_ERROR_WRITERDOESNOTSUPPORTNAMESPACES: return "Writer does not support namespaces."; + case LIB3MF_ERROR_TOOLPATH_INVALIDHATCHCOORDINATE: return "Invalid hatch coordinate."; + case LIB3MF_ERROR_TOOLPATH_INVALIDPOINTCOORDINATE: return "Invalid point coordinate."; + case LIB3MF_ERROR_TOOLPATH_INVALIDHATCHCOUNT: return "Invalid hatch count"; default: return "unknown error"; } } @@ -565,6 +571,20 @@ typedef struct sLib3MFPosition2D { Lib3MF_single m_Coordinates[2]; } sLib3MFPosition2D; +typedef struct sLib3MFDiscretePosition2D { + Lib3MF_int32 m_Coordinates[2]; +} sLib3MFDiscretePosition2D; + +typedef struct sLib3MFHatch2D { + Lib3MF_single m_Point1Coordinates[2]; + Lib3MF_single m_Point2Coordinates[2]; +} sLib3MFHatch2D; + +typedef struct sLib3MFDiscreteHatch2D { + Lib3MF_int32 m_Point1Coordinates[2]; + Lib3MF_int32 m_Point2Coordinates[2]; +} sLib3MFDiscreteHatch2D; + typedef struct sLib3MFCompositeConstituent { Lib3MF_uint32 m_PropertyID; Lib3MF_double m_MixingRatio; diff --git a/Autogenerated/Bindings/CDynamic/lib3mf_dynamic.cc b/Autogenerated/Bindings/CDynamic/lib3mf_dynamic.cc index f7823f878..170c13f27 100644 --- a/Autogenerated/Bindings/CDynamic/lib3mf_dynamic.cc +++ b/Autogenerated/Bindings/CDynamic/lib3mf_dynamic.cc @@ -365,7 +365,8 @@ Lib3MFResult InitLib3MFWrapperTable(sLib3MFDynamicWrapperTable * pWrapperTable) pWrapperTable->m_ToolpathLayerReader_GetSegmentPartUUID = NULL; pWrapperTable->m_ToolpathLayerReader_GetSegmentLocalPartID = NULL; pWrapperTable->m_ToolpathLayerReader_GetPartUUIDByLocalPartID = NULL; - pWrapperTable->m_ToolpathLayerReader_GetSegmentPointData = NULL; + pWrapperTable->m_ToolpathLayerReader_GetSegmentPointDataInModelUnits = NULL; + pWrapperTable->m_ToolpathLayerReader_GetSegmentPointDataDiscrete = NULL; pWrapperTable->m_ToolpathLayerReader_FindAttributeInfoByName = NULL; pWrapperTable->m_ToolpathLayerReader_FindAttributeIDByName = NULL; pWrapperTable->m_ToolpathLayerReader_FindAttributeValueByName = NULL; @@ -381,11 +382,18 @@ Lib3MFResult InitLib3MFWrapperTable(sLib3MFDynamicWrapperTable * pWrapperTable) pWrapperTable->m_ToolpathLayerData_RegisterBuildItem = NULL; pWrapperTable->m_ToolpathLayerData_SetSegmentAttribute = NULL; pWrapperTable->m_ToolpathLayerData_ClearSegmentAttributes = NULL; - pWrapperTable->m_ToolpathLayerData_WriteHatchData = NULL; - pWrapperTable->m_ToolpathLayerData_WriteLoop = NULL; - pWrapperTable->m_ToolpathLayerData_WritePolyline = NULL; + pWrapperTable->m_ToolpathLayerData_AddCustomLineAttributes = NULL; + pWrapperTable->m_ToolpathLayerData_ClearCustomLineAttributes = NULL; + pWrapperTable->m_ToolpathLayerData_WriteHatchDataInModelUnits = NULL; + pWrapperTable->m_ToolpathLayerData_WriteHatchDataDiscrete = NULL; + pWrapperTable->m_ToolpathLayerData_WriteLoopInModelUnits = NULL; + pWrapperTable->m_ToolpathLayerData_WriteLoopDiscrete = NULL; + pWrapperTable->m_ToolpathLayerData_WritePolylineInModelUnits = NULL; + pWrapperTable->m_ToolpathLayerData_WritePolylineDiscrete = NULL; pWrapperTable->m_ToolpathLayerData_AddCustomData = NULL; pWrapperTable->m_ToolpathLayerData_Finish = NULL; + pWrapperTable->m_Toolpath_GetUUID = NULL; + pWrapperTable->m_Toolpath_ResetUUID = NULL; pWrapperTable->m_Toolpath_GetUnits = NULL; pWrapperTable->m_Toolpath_GetLayerCount = NULL; pWrapperTable->m_Toolpath_GetProfileCount = NULL; @@ -396,7 +404,9 @@ Lib3MFResult InitLib3MFWrapperTable(sLib3MFDynamicWrapperTable * pWrapperTable) pWrapperTable->m_Toolpath_ReadLayerData = NULL; pWrapperTable->m_Toolpath_GetLayerPath = NULL; pWrapperTable->m_Toolpath_GetLayerZMax = NULL; - pWrapperTable->m_Toolpath_GetLayerZ = NULL; + pWrapperTable->m_Toolpath_GetLayerZMin = NULL; + pWrapperTable->m_Toolpath_GetLayerThickness = NULL; + pWrapperTable->m_Toolpath_HasUniformThickness = NULL; pWrapperTable->m_Toolpath_AddProfile = NULL; pWrapperTable->m_Toolpath_GetProfile = NULL; pWrapperTable->m_Toolpath_GetProfileUUID = NULL; @@ -409,8 +419,8 @@ Lib3MFResult InitLib3MFWrapperTable(sLib3MFDynamicWrapperTable * pWrapperTable) pWrapperTable->m_Toolpath_AddCustomData = NULL; pWrapperTable->m_Toolpath_ClearCustomData = NULL; pWrapperTable->m_Toolpath_DeleteCustomData = NULL; - pWrapperTable->m_Toolpath_RegisterCustomIntegerAttribute = NULL; - pWrapperTable->m_Toolpath_RegisterCustomDoubleAttribute = NULL; + pWrapperTable->m_Toolpath_RegisterCustomIntegerSegmentAttribute = NULL; + pWrapperTable->m_Toolpath_RegisterCustomDoubleSegmentAttribute = NULL; pWrapperTable->m_ToolpathIterator_GetCurrentToolpath = NULL; pWrapperTable->m_SliceStack_GetBottomZ = NULL; pWrapperTable->m_SliceStack_GetSliceCount = NULL; @@ -3455,12 +3465,21 @@ Lib3MFResult LoadLib3MFWrapperTable(sLib3MFDynamicWrapperTable * pWrapperTable, return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; #ifdef _WIN32 - pWrapperTable->m_ToolpathLayerReader_GetSegmentPointData = (PLib3MFToolpathLayerReader_GetSegmentPointDataPtr) GetProcAddress(hLibrary, "lib3mf_toolpathlayerreader_getsegmentpointdata"); + pWrapperTable->m_ToolpathLayerReader_GetSegmentPointDataInModelUnits = (PLib3MFToolpathLayerReader_GetSegmentPointDataInModelUnitsPtr) GetProcAddress(hLibrary, "lib3mf_toolpathlayerreader_getsegmentpointdatainmodelunits"); #else // _WIN32 - pWrapperTable->m_ToolpathLayerReader_GetSegmentPointData = (PLib3MFToolpathLayerReader_GetSegmentPointDataPtr) dlsym(hLibrary, "lib3mf_toolpathlayerreader_getsegmentpointdata"); + pWrapperTable->m_ToolpathLayerReader_GetSegmentPointDataInModelUnits = (PLib3MFToolpathLayerReader_GetSegmentPointDataInModelUnitsPtr) dlsym(hLibrary, "lib3mf_toolpathlayerreader_getsegmentpointdatainmodelunits"); dlerror(); #endif // _WIN32 - if (pWrapperTable->m_ToolpathLayerReader_GetSegmentPointData == NULL) + if (pWrapperTable->m_ToolpathLayerReader_GetSegmentPointDataInModelUnits == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_ToolpathLayerReader_GetSegmentPointDataDiscrete = (PLib3MFToolpathLayerReader_GetSegmentPointDataDiscretePtr) GetProcAddress(hLibrary, "lib3mf_toolpathlayerreader_getsegmentpointdatadiscrete"); + #else // _WIN32 + pWrapperTable->m_ToolpathLayerReader_GetSegmentPointDataDiscrete = (PLib3MFToolpathLayerReader_GetSegmentPointDataDiscretePtr) dlsym(hLibrary, "lib3mf_toolpathlayerreader_getsegmentpointdatadiscrete"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_ToolpathLayerReader_GetSegmentPointDataDiscrete == NULL) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; #ifdef _WIN32 @@ -3599,30 +3618,75 @@ Lib3MFResult LoadLib3MFWrapperTable(sLib3MFDynamicWrapperTable * pWrapperTable, return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; #ifdef _WIN32 - pWrapperTable->m_ToolpathLayerData_WriteHatchData = (PLib3MFToolpathLayerData_WriteHatchDataPtr) GetProcAddress(hLibrary, "lib3mf_toolpathlayerdata_writehatchdata"); + pWrapperTable->m_ToolpathLayerData_AddCustomLineAttributes = (PLib3MFToolpathLayerData_AddCustomLineAttributesPtr) GetProcAddress(hLibrary, "lib3mf_toolpathlayerdata_addcustomlineattributes"); + #else // _WIN32 + pWrapperTable->m_ToolpathLayerData_AddCustomLineAttributes = (PLib3MFToolpathLayerData_AddCustomLineAttributesPtr) dlsym(hLibrary, "lib3mf_toolpathlayerdata_addcustomlineattributes"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_ToolpathLayerData_AddCustomLineAttributes == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_ToolpathLayerData_ClearCustomLineAttributes = (PLib3MFToolpathLayerData_ClearCustomLineAttributesPtr) GetProcAddress(hLibrary, "lib3mf_toolpathlayerdata_clearcustomlineattributes"); + #else // _WIN32 + pWrapperTable->m_ToolpathLayerData_ClearCustomLineAttributes = (PLib3MFToolpathLayerData_ClearCustomLineAttributesPtr) dlsym(hLibrary, "lib3mf_toolpathlayerdata_clearcustomlineattributes"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_ToolpathLayerData_ClearCustomLineAttributes == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_ToolpathLayerData_WriteHatchDataInModelUnits = (PLib3MFToolpathLayerData_WriteHatchDataInModelUnitsPtr) GetProcAddress(hLibrary, "lib3mf_toolpathlayerdata_writehatchdatainmodelunits"); + #else // _WIN32 + pWrapperTable->m_ToolpathLayerData_WriteHatchDataInModelUnits = (PLib3MFToolpathLayerData_WriteHatchDataInModelUnitsPtr) dlsym(hLibrary, "lib3mf_toolpathlayerdata_writehatchdatainmodelunits"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_ToolpathLayerData_WriteHatchDataInModelUnits == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_ToolpathLayerData_WriteHatchDataDiscrete = (PLib3MFToolpathLayerData_WriteHatchDataDiscretePtr) GetProcAddress(hLibrary, "lib3mf_toolpathlayerdata_writehatchdatadiscrete"); + #else // _WIN32 + pWrapperTable->m_ToolpathLayerData_WriteHatchDataDiscrete = (PLib3MFToolpathLayerData_WriteHatchDataDiscretePtr) dlsym(hLibrary, "lib3mf_toolpathlayerdata_writehatchdatadiscrete"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_ToolpathLayerData_WriteHatchDataDiscrete == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_ToolpathLayerData_WriteLoopInModelUnits = (PLib3MFToolpathLayerData_WriteLoopInModelUnitsPtr) GetProcAddress(hLibrary, "lib3mf_toolpathlayerdata_writeloopinmodelunits"); #else // _WIN32 - pWrapperTable->m_ToolpathLayerData_WriteHatchData = (PLib3MFToolpathLayerData_WriteHatchDataPtr) dlsym(hLibrary, "lib3mf_toolpathlayerdata_writehatchdata"); + pWrapperTable->m_ToolpathLayerData_WriteLoopInModelUnits = (PLib3MFToolpathLayerData_WriteLoopInModelUnitsPtr) dlsym(hLibrary, "lib3mf_toolpathlayerdata_writeloopinmodelunits"); dlerror(); #endif // _WIN32 - if (pWrapperTable->m_ToolpathLayerData_WriteHatchData == NULL) + if (pWrapperTable->m_ToolpathLayerData_WriteLoopInModelUnits == NULL) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; #ifdef _WIN32 - pWrapperTable->m_ToolpathLayerData_WriteLoop = (PLib3MFToolpathLayerData_WriteLoopPtr) GetProcAddress(hLibrary, "lib3mf_toolpathlayerdata_writeloop"); + pWrapperTable->m_ToolpathLayerData_WriteLoopDiscrete = (PLib3MFToolpathLayerData_WriteLoopDiscretePtr) GetProcAddress(hLibrary, "lib3mf_toolpathlayerdata_writeloopdiscrete"); #else // _WIN32 - pWrapperTable->m_ToolpathLayerData_WriteLoop = (PLib3MFToolpathLayerData_WriteLoopPtr) dlsym(hLibrary, "lib3mf_toolpathlayerdata_writeloop"); + pWrapperTable->m_ToolpathLayerData_WriteLoopDiscrete = (PLib3MFToolpathLayerData_WriteLoopDiscretePtr) dlsym(hLibrary, "lib3mf_toolpathlayerdata_writeloopdiscrete"); dlerror(); #endif // _WIN32 - if (pWrapperTable->m_ToolpathLayerData_WriteLoop == NULL) + if (pWrapperTable->m_ToolpathLayerData_WriteLoopDiscrete == NULL) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; #ifdef _WIN32 - pWrapperTable->m_ToolpathLayerData_WritePolyline = (PLib3MFToolpathLayerData_WritePolylinePtr) GetProcAddress(hLibrary, "lib3mf_toolpathlayerdata_writepolyline"); + pWrapperTable->m_ToolpathLayerData_WritePolylineInModelUnits = (PLib3MFToolpathLayerData_WritePolylineInModelUnitsPtr) GetProcAddress(hLibrary, "lib3mf_toolpathlayerdata_writepolylineinmodelunits"); #else // _WIN32 - pWrapperTable->m_ToolpathLayerData_WritePolyline = (PLib3MFToolpathLayerData_WritePolylinePtr) dlsym(hLibrary, "lib3mf_toolpathlayerdata_writepolyline"); + pWrapperTable->m_ToolpathLayerData_WritePolylineInModelUnits = (PLib3MFToolpathLayerData_WritePolylineInModelUnitsPtr) dlsym(hLibrary, "lib3mf_toolpathlayerdata_writepolylineinmodelunits"); dlerror(); #endif // _WIN32 - if (pWrapperTable->m_ToolpathLayerData_WritePolyline == NULL) + if (pWrapperTable->m_ToolpathLayerData_WritePolylineInModelUnits == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_ToolpathLayerData_WritePolylineDiscrete = (PLib3MFToolpathLayerData_WritePolylineDiscretePtr) GetProcAddress(hLibrary, "lib3mf_toolpathlayerdata_writepolylinediscrete"); + #else // _WIN32 + pWrapperTable->m_ToolpathLayerData_WritePolylineDiscrete = (PLib3MFToolpathLayerData_WritePolylineDiscretePtr) dlsym(hLibrary, "lib3mf_toolpathlayerdata_writepolylinediscrete"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_ToolpathLayerData_WritePolylineDiscrete == NULL) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; #ifdef _WIN32 @@ -3643,6 +3707,24 @@ Lib3MFResult LoadLib3MFWrapperTable(sLib3MFDynamicWrapperTable * pWrapperTable, if (pWrapperTable->m_ToolpathLayerData_Finish == NULL) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + #ifdef _WIN32 + pWrapperTable->m_Toolpath_GetUUID = (PLib3MFToolpath_GetUUIDPtr) GetProcAddress(hLibrary, "lib3mf_toolpath_getuuid"); + #else // _WIN32 + pWrapperTable->m_Toolpath_GetUUID = (PLib3MFToolpath_GetUUIDPtr) dlsym(hLibrary, "lib3mf_toolpath_getuuid"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_Toolpath_GetUUID == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_Toolpath_ResetUUID = (PLib3MFToolpath_ResetUUIDPtr) GetProcAddress(hLibrary, "lib3mf_toolpath_resetuuid"); + #else // _WIN32 + pWrapperTable->m_Toolpath_ResetUUID = (PLib3MFToolpath_ResetUUIDPtr) dlsym(hLibrary, "lib3mf_toolpath_resetuuid"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_Toolpath_ResetUUID == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + #ifdef _WIN32 pWrapperTable->m_Toolpath_GetUnits = (PLib3MFToolpath_GetUnitsPtr) GetProcAddress(hLibrary, "lib3mf_toolpath_getunits"); #else // _WIN32 @@ -3734,12 +3816,30 @@ Lib3MFResult LoadLib3MFWrapperTable(sLib3MFDynamicWrapperTable * pWrapperTable, return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; #ifdef _WIN32 - pWrapperTable->m_Toolpath_GetLayerZ = (PLib3MFToolpath_GetLayerZPtr) GetProcAddress(hLibrary, "lib3mf_toolpath_getlayerz"); + pWrapperTable->m_Toolpath_GetLayerZMin = (PLib3MFToolpath_GetLayerZMinPtr) GetProcAddress(hLibrary, "lib3mf_toolpath_getlayerzmin"); + #else // _WIN32 + pWrapperTable->m_Toolpath_GetLayerZMin = (PLib3MFToolpath_GetLayerZMinPtr) dlsym(hLibrary, "lib3mf_toolpath_getlayerzmin"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_Toolpath_GetLayerZMin == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_Toolpath_GetLayerThickness = (PLib3MFToolpath_GetLayerThicknessPtr) GetProcAddress(hLibrary, "lib3mf_toolpath_getlayerthickness"); + #else // _WIN32 + pWrapperTable->m_Toolpath_GetLayerThickness = (PLib3MFToolpath_GetLayerThicknessPtr) dlsym(hLibrary, "lib3mf_toolpath_getlayerthickness"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_Toolpath_GetLayerThickness == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_Toolpath_HasUniformThickness = (PLib3MFToolpath_HasUniformThicknessPtr) GetProcAddress(hLibrary, "lib3mf_toolpath_hasuniformthickness"); #else // _WIN32 - pWrapperTable->m_Toolpath_GetLayerZ = (PLib3MFToolpath_GetLayerZPtr) dlsym(hLibrary, "lib3mf_toolpath_getlayerz"); + pWrapperTable->m_Toolpath_HasUniformThickness = (PLib3MFToolpath_HasUniformThicknessPtr) dlsym(hLibrary, "lib3mf_toolpath_hasuniformthickness"); dlerror(); #endif // _WIN32 - if (pWrapperTable->m_Toolpath_GetLayerZ == NULL) + if (pWrapperTable->m_Toolpath_HasUniformThickness == NULL) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; #ifdef _WIN32 @@ -3851,21 +3951,21 @@ Lib3MFResult LoadLib3MFWrapperTable(sLib3MFDynamicWrapperTable * pWrapperTable, return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; #ifdef _WIN32 - pWrapperTable->m_Toolpath_RegisterCustomIntegerAttribute = (PLib3MFToolpath_RegisterCustomIntegerAttributePtr) GetProcAddress(hLibrary, "lib3mf_toolpath_registercustomintegerattribute"); + pWrapperTable->m_Toolpath_RegisterCustomIntegerSegmentAttribute = (PLib3MFToolpath_RegisterCustomIntegerSegmentAttributePtr) GetProcAddress(hLibrary, "lib3mf_toolpath_registercustomintegersegmentattribute"); #else // _WIN32 - pWrapperTable->m_Toolpath_RegisterCustomIntegerAttribute = (PLib3MFToolpath_RegisterCustomIntegerAttributePtr) dlsym(hLibrary, "lib3mf_toolpath_registercustomintegerattribute"); + pWrapperTable->m_Toolpath_RegisterCustomIntegerSegmentAttribute = (PLib3MFToolpath_RegisterCustomIntegerSegmentAttributePtr) dlsym(hLibrary, "lib3mf_toolpath_registercustomintegersegmentattribute"); dlerror(); #endif // _WIN32 - if (pWrapperTable->m_Toolpath_RegisterCustomIntegerAttribute == NULL) + if (pWrapperTable->m_Toolpath_RegisterCustomIntegerSegmentAttribute == NULL) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; #ifdef _WIN32 - pWrapperTable->m_Toolpath_RegisterCustomDoubleAttribute = (PLib3MFToolpath_RegisterCustomDoubleAttributePtr) GetProcAddress(hLibrary, "lib3mf_toolpath_registercustomdoubleattribute"); + pWrapperTable->m_Toolpath_RegisterCustomDoubleSegmentAttribute = (PLib3MFToolpath_RegisterCustomDoubleSegmentAttributePtr) GetProcAddress(hLibrary, "lib3mf_toolpath_registercustomdoublesegmentattribute"); #else // _WIN32 - pWrapperTable->m_Toolpath_RegisterCustomDoubleAttribute = (PLib3MFToolpath_RegisterCustomDoubleAttributePtr) dlsym(hLibrary, "lib3mf_toolpath_registercustomdoubleattribute"); + pWrapperTable->m_Toolpath_RegisterCustomDoubleSegmentAttribute = (PLib3MFToolpath_RegisterCustomDoubleSegmentAttributePtr) dlsym(hLibrary, "lib3mf_toolpath_registercustomdoublesegmentattribute"); dlerror(); #endif // _WIN32 - if (pWrapperTable->m_Toolpath_RegisterCustomDoubleAttribute == NULL) + if (pWrapperTable->m_Toolpath_RegisterCustomDoubleSegmentAttribute == NULL) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; #ifdef _WIN32 diff --git a/Autogenerated/Bindings/CDynamic/lib3mf_dynamic.h b/Autogenerated/Bindings/CDynamic/lib3mf_dynamic.h index 7a7807dd7..99768a151 100644 --- a/Autogenerated/Bindings/CDynamic/lib3mf_dynamic.h +++ b/Autogenerated/Bindings/CDynamic/lib3mf_dynamic.h @@ -3350,10 +3350,22 @@ typedef Lib3MFResult (*PLib3MFToolpathLayerReader_GetPartUUIDByLocalPartIDPtr) ( * @param[in] nIndex - Index. Must be between 0 and Count - 1. * @param[in] nPointDataBufferSize - Number of elements in buffer * @param[out] pPointDataNeededCount - will be filled with the count of the written elements, or needed buffer size. -* @param[out] pPointDataBuffer - Position2D buffer of The point data array +* @param[out] pPointDataBuffer - Position2D buffer of The point data array. The point coordinates are in model units. * @return error code or 0 (success) */ -typedef Lib3MFResult (*PLib3MFToolpathLayerReader_GetSegmentPointDataPtr) (Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nIndex, const Lib3MF_uint64 nPointDataBufferSize, Lib3MF_uint64* pPointDataNeededCount, sLib3MFPosition2D * pPointDataBuffer); +typedef Lib3MFResult (*PLib3MFToolpathLayerReader_GetSegmentPointDataInModelUnitsPtr) (Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nIndex, const Lib3MF_uint64 nPointDataBufferSize, Lib3MF_uint64* pPointDataNeededCount, sLib3MFPosition2D * pPointDataBuffer); + +/** +* Retrieves the assigned segment point list in units. For type hatch, the points are taken pairwise. +* +* @param[in] pToolpathLayerReader - ToolpathLayerReader instance. +* @param[in] nIndex - Index. Must be between 0 and Count - 1. +* @param[in] nPointDataBufferSize - Number of elements in buffer +* @param[out] pPointDataNeededCount - will be filled with the count of the written elements, or needed buffer size. +* @param[out] pPointDataBuffer - DiscretePosition2D buffer of The point data array. The point coordinates are in toolpath units. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFToolpathLayerReader_GetSegmentPointDataDiscretePtr) (Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nIndex, const Lib3MF_uint64 nPointDataBufferSize, Lib3MF_uint64* pPointDataNeededCount, sLib3MFDiscretePosition2D * pPointDataBuffer); /** * Retrieves a segment attribute Information by Attribute Name. Will fail if Attribute does not exist. @@ -3524,28 +3536,76 @@ typedef Lib3MFResult (*PLib3MFToolpathLayerData_SetSegmentAttributePtr) (Lib3MF_ typedef Lib3MFResult (*PLib3MFToolpathLayerData_ClearSegmentAttributesPtr) (Lib3MF_ToolpathLayerData pToolpathLayerData); /** -* writes hatch data to the layer. +* Stores custom line attributes for the next WriteLoop, WritePolyline or WriteHatchData call. +* +* @param[in] pToolpathLayerData - ToolpathLayerData instance. +* @param[in] pNameSpace - The namespace of the attribute to register. +* @param[in] pAttributeName - The name of the attribute to register. +* @param[in] nValuesBufferSize - Number of elements in buffer +* @param[in] pValuesBuffer - int32 buffer of Custom Values to store on segment lines. Array MUST NOT be empty. If custom attributes had been already defined, the error cardinality MUST match, or an error will be thrown. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFToolpathLayerData_AddCustomLineAttributesPtr) (Lib3MF_ToolpathLayerData pToolpathLayerData, const char * pNameSpace, const char * pAttributeName, Lib3MF_uint64 nValuesBufferSize, const Lib3MF_int32 * pValuesBuffer); + +/** +* Clears all custom line attributes. Any call to WriteLoop, WritePolyline or WriteHatchData will do this implicitely. +* +* @param[in] pToolpathLayerData - ToolpathLayerData instance. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFToolpathLayerData_ClearCustomLineAttributesPtr) (Lib3MF_ToolpathLayerData pToolpathLayerData); + +/** +* writes hatch data to the layer in model units. +* +* @param[in] pToolpathLayerData - ToolpathLayerData instance. +* @param[in] nProfileID - The toolpath profile to use +* @param[in] nPartID - The toolpath part to use +* @param[in] bWriteCustomLineAttributes - If true, custom line attributes are written. The cardinality of each custom attribute MUST be equal to the number of hatches in the hatchdata array. In any case, stored custom attributes will be cleared after the call. +* @param[in] nHatchDataBufferSize - Number of elements in buffer +* @param[in] pHatchDataBuffer - Hatch2D buffer of The hatch data in model units. Array MUST NOT be empty. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFToolpathLayerData_WriteHatchDataInModelUnitsPtr) (Lib3MF_ToolpathLayerData pToolpathLayerData, Lib3MF_uint32 nProfileID, Lib3MF_uint32 nPartID, bool bWriteCustomLineAttributes, Lib3MF_uint64 nHatchDataBufferSize, const sLib3MFHatch2D * pHatchDataBuffer); + +/** +* writes hatch data to the layer in toolpath units. +* +* @param[in] pToolpathLayerData - ToolpathLayerData instance. +* @param[in] nProfileID - The toolpath profile to use +* @param[in] nPartID - The toolpath part to use +* @param[in] bWriteCustomLineAttributes - If true, custom line attributes are written. The cardinality of each custom attribute MUST be equal to the number of hatches in the hatchdata array. In any case, stored custom attributes will be cleared after the call. +* @param[in] nHatchDataBufferSize - Number of elements in buffer +* @param[in] pHatchDataBuffer - DiscreteHatch2D buffer of The hatch data in toolpath units. Array MUST NOT be empty. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFToolpathLayerData_WriteHatchDataDiscretePtr) (Lib3MF_ToolpathLayerData pToolpathLayerData, Lib3MF_uint32 nProfileID, Lib3MF_uint32 nPartID, bool bWriteCustomLineAttributes, Lib3MF_uint64 nHatchDataBufferSize, const sLib3MFDiscreteHatch2D * pHatchDataBuffer); + +/** +* writes loop data to the layer in model units. * * @param[in] pToolpathLayerData - ToolpathLayerData instance. * @param[in] nProfileID - The toolpath profile to use * @param[in] nPartID - The toolpath part to use +* @param[in] bWriteCustomLineAttributes - If true, custom line attributes are written. The cardinality of each custom attribute MUST be equal to the number of points in the pointdata array. In any case, stored custom attributes will be cleared after the call. * @param[in] nPointDataBufferSize - Number of elements in buffer -* @param[in] pPointDataBuffer - Position2D buffer of The point data +* @param[in] pPointDataBuffer - Position2D buffer of The point data in model units. Array MUST NOT be empty. * @return error code or 0 (success) */ -typedef Lib3MFResult (*PLib3MFToolpathLayerData_WriteHatchDataPtr) (Lib3MF_ToolpathLayerData pToolpathLayerData, Lib3MF_uint32 nProfileID, Lib3MF_uint32 nPartID, Lib3MF_uint64 nPointDataBufferSize, const sLib3MFPosition2D * pPointDataBuffer); +typedef Lib3MFResult (*PLib3MFToolpathLayerData_WriteLoopInModelUnitsPtr) (Lib3MF_ToolpathLayerData pToolpathLayerData, Lib3MF_uint32 nProfileID, Lib3MF_uint32 nPartID, bool bWriteCustomLineAttributes, Lib3MF_uint64 nPointDataBufferSize, const sLib3MFPosition2D * pPointDataBuffer); /** -* writes loop data to the layer. +* writes loop data to the layer in toolpath units. * * @param[in] pToolpathLayerData - ToolpathLayerData instance. * @param[in] nProfileID - The toolpath profile to use * @param[in] nPartID - The toolpath part to use +* @param[in] bWriteCustomLineAttributes - If true, custom line attributes are written. The cardinality of each custom attribute MUST be equal to the number of points in the pointdata array. In any case, stored custom attributes will be cleared after the call. * @param[in] nPointDataBufferSize - Number of elements in buffer -* @param[in] pPointDataBuffer - Position2D buffer of The point data +* @param[in] pPointDataBuffer - DiscretePosition2D buffer of The point data in toolpath units. Array MUST NOT be empty. * @return error code or 0 (success) */ -typedef Lib3MFResult (*PLib3MFToolpathLayerData_WriteLoopPtr) (Lib3MF_ToolpathLayerData pToolpathLayerData, Lib3MF_uint32 nProfileID, Lib3MF_uint32 nPartID, Lib3MF_uint64 nPointDataBufferSize, const sLib3MFPosition2D * pPointDataBuffer); +typedef Lib3MFResult (*PLib3MFToolpathLayerData_WriteLoopDiscretePtr) (Lib3MF_ToolpathLayerData pToolpathLayerData, Lib3MF_uint32 nProfileID, Lib3MF_uint32 nPartID, bool bWriteCustomLineAttributes, Lib3MF_uint64 nPointDataBufferSize, const sLib3MFDiscretePosition2D * pPointDataBuffer); /** * writes polyline data to the layer. @@ -3553,11 +3613,25 @@ typedef Lib3MFResult (*PLib3MFToolpathLayerData_WriteLoopPtr) (Lib3MF_ToolpathLa * @param[in] pToolpathLayerData - ToolpathLayerData instance. * @param[in] nProfileID - The toolpath profile to use * @param[in] nPartID - The toolpath part to use +* @param[in] bWriteCustomLineAttributes - If true, custom line attributes are written. The cardinality of each custom attribute MUST be equal to the number of points in the pointdata array. In any case, stored custom attributes will be cleared after the call. * @param[in] nPointDataBufferSize - Number of elements in buffer -* @param[in] pPointDataBuffer - Position2D buffer of The point data +* @param[in] pPointDataBuffer - Position2D buffer of The point data in model units. Array MUST NOT be empty. * @return error code or 0 (success) */ -typedef Lib3MFResult (*PLib3MFToolpathLayerData_WritePolylinePtr) (Lib3MF_ToolpathLayerData pToolpathLayerData, Lib3MF_uint32 nProfileID, Lib3MF_uint32 nPartID, Lib3MF_uint64 nPointDataBufferSize, const sLib3MFPosition2D * pPointDataBuffer); +typedef Lib3MFResult (*PLib3MFToolpathLayerData_WritePolylineInModelUnitsPtr) (Lib3MF_ToolpathLayerData pToolpathLayerData, Lib3MF_uint32 nProfileID, Lib3MF_uint32 nPartID, bool bWriteCustomLineAttributes, Lib3MF_uint64 nPointDataBufferSize, const sLib3MFPosition2D * pPointDataBuffer); + +/** +* writes polyline data to the layer. +* +* @param[in] pToolpathLayerData - ToolpathLayerData instance. +* @param[in] nProfileID - The toolpath profile to use +* @param[in] nPartID - The toolpath part to use +* @param[in] bWriteCustomLineAttributes - If true, custom line attributes are written. The cardinality of each custom attribute MUST be equal to the number of points in the pointdata array. In any case, stored custom attributes will be cleared after the call. +* @param[in] nPointDataBufferSize - Number of elements in buffer +* @param[in] pPointDataBuffer - DiscretePosition2D buffer of The point data in toolpath units. Array MUST NOT be empty. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFToolpathLayerData_WritePolylineDiscretePtr) (Lib3MF_ToolpathLayerData pToolpathLayerData, Lib3MF_uint32 nProfileID, Lib3MF_uint32 nPartID, bool bWriteCustomLineAttributes, Lib3MF_uint64 nPointDataBufferSize, const sLib3MFDiscretePosition2D * pPointDataBuffer); /** * Adds a custom data DOM tree to the layer. Layer MUST not be finished when changing the DOM tree. @@ -3583,7 +3657,29 @@ typedef Lib3MFResult (*PLib3MFToolpathLayerData_FinishPtr) (Lib3MF_ToolpathLayer **************************************************************************************************************************/ /** -* Retrieves the unit factor +* Retrieves the UUID of the toolpath +* +* @param[in] pToolpath - Toolpath instance. +* @param[in] nUUIDBufferSize - size of the buffer (including trailing 0) +* @param[out] pUUIDNeededChars - will be filled with the count of the written bytes, or needed buffer size. +* @param[out] pUUIDBuffer - buffer of UUID Value., may be NULL +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFToolpath_GetUUIDPtr) (Lib3MF_Toolpath pToolpath, const Lib3MF_uint32 nUUIDBufferSize, Lib3MF_uint32* pUUIDNeededChars, char * pUUIDBuffer); + +/** +* Generates a new unique identifier for this toolpath and sets its value. +* +* @param[in] pToolpath - Toolpath instance. +* @param[in] nNewUUIDBufferSize - size of the buffer (including trailing 0) +* @param[out] pNewUUIDNeededChars - will be filled with the count of the written bytes, or needed buffer size. +* @param[out] pNewUUIDBuffer - buffer of Newly created UUID Value., may be NULL +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFToolpath_ResetUUIDPtr) (Lib3MF_Toolpath pToolpath, const Lib3MF_uint32 nNewUUIDBufferSize, Lib3MF_uint32* pNewUUIDNeededChars, char * pNewUUIDBuffer); + +/** +* Retrieves the unit factor, i.e. how many model units are one toolpath unit. * * @param[in] pToolpath - Toolpath instance. * @param[out] pUnits - Returns the unit factor. @@ -3613,7 +3709,7 @@ typedef Lib3MFResult (*PLib3MFToolpath_GetProfileCountPtr) (Lib3MF_Toolpath pToo * Adds a new toolpath layer * * @param[in] pToolpath - Toolpath instance. -* @param[in] nZMax - ZMax value of the layer. MUST be larger than the last layer added, as well as larger as BottomZ. +* @param[in] nZMax - ZMax value of the layer in toolpath units. MUST be larger than the last layer added, as well as larger as BottomZ. * @param[in] pPath - Package Path * @param[in] pModelWriter - The model writer that writes out the 3MF. * @param[out] pLayerData - Returns the layerdata object to write the layer content into. @@ -3625,7 +3721,7 @@ typedef Lib3MFResult (*PLib3MFToolpath_AddLayerPtr) (Lib3MF_Toolpath pToolpath, * Returns the bottom Z Value of the toolpath. * * @param[in] pToolpath - Toolpath instance. -* @param[out] pBottomZ - BottomZ value +* @param[out] pBottomZ - BottomZ value in Toolpath units * @return error code or 0 (success) */ typedef Lib3MFResult (*PLib3MFToolpath_GetBottomZPtr) (Lib3MF_Toolpath pToolpath, Lib3MF_uint32 * pBottomZ); @@ -3634,13 +3730,13 @@ typedef Lib3MFResult (*PLib3MFToolpath_GetBottomZPtr) (Lib3MF_Toolpath pToolpath * Sets the bottom Z Value of the toolpath. Will fail if a layer is already existing. * * @param[in] pToolpath - Toolpath instance. -* @param[in] nBottomZ - BottomZ value +* @param[in] nBottomZ - BottomZ value in Toolpath units * @return error code or 0 (success) */ typedef Lib3MFResult (*PLib3MFToolpath_SetBottomZPtr) (Lib3MF_Toolpath pToolpath, Lib3MF_uint32 nBottomZ); /** -* Retrieves the Attachment of a layer +* Retrieves the Attachment that contains the layer data. * * @param[in] pToolpath - Toolpath instance. * @param[in] nIndex - Layer Index @@ -3676,20 +3772,39 @@ typedef Lib3MFResult (*PLib3MFToolpath_GetLayerPathPtr) (Lib3MF_Toolpath pToolpa * * @param[in] pToolpath - Toolpath instance. * @param[in] nIndex - Layer Index -* @param[out] pZMax - ZMax value +* @param[out] pZMax - ZMax value in toolpath units * @return error code or 0 (success) */ typedef Lib3MFResult (*PLib3MFToolpath_GetLayerZMaxPtr) (Lib3MF_Toolpath pToolpath, Lib3MF_uint32 nIndex, Lib3MF_uint32 * pZMax); /** -* Return the z value of a layer in units. +* Retrieves the Minimum Z of a layer +* +* @param[in] pToolpath - Toolpath instance. +* @param[in] nIndex - Layer Index +* @param[out] pZMin - ZMin value in toolpath units +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFToolpath_GetLayerZMinPtr) (Lib3MF_Toolpath pToolpath, Lib3MF_uint32 nIndex, Lib3MF_uint32 * pZMin); + +/** +* Retrieves the Thickness of a layer +* +* @param[in] pToolpath - Toolpath instance. +* @param[in] nIndex - Layer Index +* @param[out] pZThickness - Thickness value in toolpath units +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFToolpath_GetLayerThicknessPtr) (Lib3MF_Toolpath pToolpath, Lib3MF_uint32 nIndex, Lib3MF_uint32 * pZThickness); + +/** +* Checks if the toolpath has a uniform thickness value, i.e. each layer has the same thickness. * * @param[in] pToolpath - Toolpath instance. -* @param[in] nLayerIndex - Layer Index. -* @param[out] pZValue - Z Value in Units. +* @param[out] pUniformThickness - Returns true if the layer thicknesses are uniform, returns false otherwise. * @return error code or 0 (success) */ -typedef Lib3MFResult (*PLib3MFToolpath_GetLayerZPtr) (Lib3MF_Toolpath pToolpath, Lib3MF_uint32 nLayerIndex, Lib3MF_uint32 * pZValue); +typedef Lib3MFResult (*PLib3MFToolpath_HasUniformThicknessPtr) (Lib3MF_Toolpath pToolpath, bool * pUniformThickness); /** * Adds a new profile to the toolpath. @@ -3825,7 +3940,7 @@ typedef Lib3MFResult (*PLib3MFToolpath_DeleteCustomDataPtr) (Lib3MF_Toolpath pTo * @param[in] pAttributeName - Attribute name. MUST not be empty. * @return error code or 0 (success) */ -typedef Lib3MFResult (*PLib3MFToolpath_RegisterCustomIntegerAttributePtr) (Lib3MF_Toolpath pToolpath, const char * pNameSpace, const char * pAttributeName); +typedef Lib3MFResult (*PLib3MFToolpath_RegisterCustomIntegerSegmentAttributePtr) (Lib3MF_Toolpath pToolpath, const char * pNameSpace, const char * pAttributeName); /** * Registers a Double Attribute that each segment holds. Registering only applies to reader or writer objects created after the call. @@ -3835,7 +3950,7 @@ typedef Lib3MFResult (*PLib3MFToolpath_RegisterCustomIntegerAttributePtr) (Lib3M * @param[in] pAttributeName - Attribute name. MUST not be empty. * @return error code or 0 (success) */ -typedef Lib3MFResult (*PLib3MFToolpath_RegisterCustomDoubleAttributePtr) (Lib3MF_Toolpath pToolpath, const char * pNameSpace, const char * pAttributeName); +typedef Lib3MFResult (*PLib3MFToolpath_RegisterCustomDoubleSegmentAttributePtr) (Lib3MF_Toolpath pToolpath, const char * pNameSpace, const char * pAttributeName); /************************************************************************************************************************* Class definition for ToolpathIterator @@ -5535,7 +5650,8 @@ typedef struct { PLib3MFToolpathLayerReader_GetSegmentPartUUIDPtr m_ToolpathLayerReader_GetSegmentPartUUID; PLib3MFToolpathLayerReader_GetSegmentLocalPartIDPtr m_ToolpathLayerReader_GetSegmentLocalPartID; PLib3MFToolpathLayerReader_GetPartUUIDByLocalPartIDPtr m_ToolpathLayerReader_GetPartUUIDByLocalPartID; - PLib3MFToolpathLayerReader_GetSegmentPointDataPtr m_ToolpathLayerReader_GetSegmentPointData; + PLib3MFToolpathLayerReader_GetSegmentPointDataInModelUnitsPtr m_ToolpathLayerReader_GetSegmentPointDataInModelUnits; + PLib3MFToolpathLayerReader_GetSegmentPointDataDiscretePtr m_ToolpathLayerReader_GetSegmentPointDataDiscrete; PLib3MFToolpathLayerReader_FindAttributeInfoByNamePtr m_ToolpathLayerReader_FindAttributeInfoByName; PLib3MFToolpathLayerReader_FindAttributeIDByNamePtr m_ToolpathLayerReader_FindAttributeIDByName; PLib3MFToolpathLayerReader_FindAttributeValueByNamePtr m_ToolpathLayerReader_FindAttributeValueByName; @@ -5551,11 +5667,18 @@ typedef struct { PLib3MFToolpathLayerData_RegisterBuildItemPtr m_ToolpathLayerData_RegisterBuildItem; PLib3MFToolpathLayerData_SetSegmentAttributePtr m_ToolpathLayerData_SetSegmentAttribute; PLib3MFToolpathLayerData_ClearSegmentAttributesPtr m_ToolpathLayerData_ClearSegmentAttributes; - PLib3MFToolpathLayerData_WriteHatchDataPtr m_ToolpathLayerData_WriteHatchData; - PLib3MFToolpathLayerData_WriteLoopPtr m_ToolpathLayerData_WriteLoop; - PLib3MFToolpathLayerData_WritePolylinePtr m_ToolpathLayerData_WritePolyline; + PLib3MFToolpathLayerData_AddCustomLineAttributesPtr m_ToolpathLayerData_AddCustomLineAttributes; + PLib3MFToolpathLayerData_ClearCustomLineAttributesPtr m_ToolpathLayerData_ClearCustomLineAttributes; + PLib3MFToolpathLayerData_WriteHatchDataInModelUnitsPtr m_ToolpathLayerData_WriteHatchDataInModelUnits; + PLib3MFToolpathLayerData_WriteHatchDataDiscretePtr m_ToolpathLayerData_WriteHatchDataDiscrete; + PLib3MFToolpathLayerData_WriteLoopInModelUnitsPtr m_ToolpathLayerData_WriteLoopInModelUnits; + PLib3MFToolpathLayerData_WriteLoopDiscretePtr m_ToolpathLayerData_WriteLoopDiscrete; + PLib3MFToolpathLayerData_WritePolylineInModelUnitsPtr m_ToolpathLayerData_WritePolylineInModelUnits; + PLib3MFToolpathLayerData_WritePolylineDiscretePtr m_ToolpathLayerData_WritePolylineDiscrete; PLib3MFToolpathLayerData_AddCustomDataPtr m_ToolpathLayerData_AddCustomData; PLib3MFToolpathLayerData_FinishPtr m_ToolpathLayerData_Finish; + PLib3MFToolpath_GetUUIDPtr m_Toolpath_GetUUID; + PLib3MFToolpath_ResetUUIDPtr m_Toolpath_ResetUUID; PLib3MFToolpath_GetUnitsPtr m_Toolpath_GetUnits; PLib3MFToolpath_GetLayerCountPtr m_Toolpath_GetLayerCount; PLib3MFToolpath_GetProfileCountPtr m_Toolpath_GetProfileCount; @@ -5566,7 +5689,9 @@ typedef struct { PLib3MFToolpath_ReadLayerDataPtr m_Toolpath_ReadLayerData; PLib3MFToolpath_GetLayerPathPtr m_Toolpath_GetLayerPath; PLib3MFToolpath_GetLayerZMaxPtr m_Toolpath_GetLayerZMax; - PLib3MFToolpath_GetLayerZPtr m_Toolpath_GetLayerZ; + PLib3MFToolpath_GetLayerZMinPtr m_Toolpath_GetLayerZMin; + PLib3MFToolpath_GetLayerThicknessPtr m_Toolpath_GetLayerThickness; + PLib3MFToolpath_HasUniformThicknessPtr m_Toolpath_HasUniformThickness; PLib3MFToolpath_AddProfilePtr m_Toolpath_AddProfile; PLib3MFToolpath_GetProfilePtr m_Toolpath_GetProfile; PLib3MFToolpath_GetProfileUUIDPtr m_Toolpath_GetProfileUUID; @@ -5579,8 +5704,8 @@ typedef struct { PLib3MFToolpath_AddCustomDataPtr m_Toolpath_AddCustomData; PLib3MFToolpath_ClearCustomDataPtr m_Toolpath_ClearCustomData; PLib3MFToolpath_DeleteCustomDataPtr m_Toolpath_DeleteCustomData; - PLib3MFToolpath_RegisterCustomIntegerAttributePtr m_Toolpath_RegisterCustomIntegerAttribute; - PLib3MFToolpath_RegisterCustomDoubleAttributePtr m_Toolpath_RegisterCustomDoubleAttribute; + PLib3MFToolpath_RegisterCustomIntegerSegmentAttributePtr m_Toolpath_RegisterCustomIntegerSegmentAttribute; + PLib3MFToolpath_RegisterCustomDoubleSegmentAttributePtr m_Toolpath_RegisterCustomDoubleSegmentAttribute; PLib3MFToolpathIterator_GetCurrentToolpathPtr m_ToolpathIterator_GetCurrentToolpath; PLib3MFSliceStack_GetBottomZPtr m_SliceStack_GetBottomZ; PLib3MFSliceStack_GetSliceCountPtr m_SliceStack_GetSliceCount; diff --git a/Autogenerated/Bindings/CDynamic/lib3mf_types.h b/Autogenerated/Bindings/CDynamic/lib3mf_types.h index ed4941824..e4a331e83 100644 --- a/Autogenerated/Bindings/CDynamic/lib3mf_types.h +++ b/Autogenerated/Bindings/CDynamic/lib3mf_types.h @@ -151,6 +151,9 @@ typedef void * Lib3MF_pvoid; #define LIB3MF_ERROR_EMPTYNAMESPACE 4007 /** Empty namespace. */ #define LIB3MF_ERROR_INVALIDNAMESPACEPREFIX 4008 /** Invalid namespace prefix. */ #define LIB3MF_ERROR_WRITERDOESNOTSUPPORTNAMESPACES 4009 /** Writer does not support namespaces. */ +#define LIB3MF_ERROR_TOOLPATH_INVALIDHATCHCOORDINATE 4010 /** Invalid hatch coordinate. */ +#define LIB3MF_ERROR_TOOLPATH_INVALIDPOINTCOORDINATE 4011 /** Invalid point coordinate. */ +#define LIB3MF_ERROR_TOOLPATH_INVALIDHATCHCOUNT 4012 /** Invalid hatch count */ /************************************************************************************************************************* Error strings for Lib3MF @@ -216,6 +219,9 @@ inline const char * LIB3MF_GETERRORSTRING (Lib3MFResult nErrorCode) { case LIB3MF_ERROR_EMPTYNAMESPACE: return "Empty namespace."; case LIB3MF_ERROR_INVALIDNAMESPACEPREFIX: return "Invalid namespace prefix."; case LIB3MF_ERROR_WRITERDOESNOTSUPPORTNAMESPACES: return "Writer does not support namespaces."; + case LIB3MF_ERROR_TOOLPATH_INVALIDHATCHCOORDINATE: return "Invalid hatch coordinate."; + case LIB3MF_ERROR_TOOLPATH_INVALIDPOINTCOORDINATE: return "Invalid point coordinate."; + case LIB3MF_ERROR_TOOLPATH_INVALIDHATCHCOUNT: return "Invalid hatch count"; default: return "unknown error"; } } @@ -565,6 +571,20 @@ typedef struct sLib3MFPosition2D { Lib3MF_single m_Coordinates[2]; } sLib3MFPosition2D; +typedef struct sLib3MFDiscretePosition2D { + Lib3MF_int32 m_Coordinates[2]; +} sLib3MFDiscretePosition2D; + +typedef struct sLib3MFHatch2D { + Lib3MF_single m_Point1Coordinates[2]; + Lib3MF_single m_Point2Coordinates[2]; +} sLib3MFHatch2D; + +typedef struct sLib3MFDiscreteHatch2D { + Lib3MF_int32 m_Point1Coordinates[2]; + Lib3MF_int32 m_Point2Coordinates[2]; +} sLib3MFDiscreteHatch2D; + typedef struct sLib3MFCompositeConstituent { Lib3MF_uint32 m_PropertyID; Lib3MF_double m_MixingRatio; diff --git a/Autogenerated/Bindings/CSharp/Lib3MF.cs b/Autogenerated/Bindings/CSharp/Lib3MF.cs index 129a6e28f..cdb0cc5e1 100644 --- a/Autogenerated/Bindings/CSharp/Lib3MF.cs +++ b/Autogenerated/Bindings/CSharp/Lib3MF.cs @@ -211,6 +211,23 @@ public struct sPosition2D public Single[] Coordinates; } + public struct sDiscretePosition2D + { + public Int32[] Coordinates; + } + + public struct sHatch2D + { + public Single[] Point1Coordinates; + public Single[] Point2Coordinates; + } + + public struct sDiscreteHatch2D + { + public Int32[] Point1Coordinates; + public Int32[] Point2Coordinates; + } + public struct sCompositeConstituent { public UInt32 PropertyID; @@ -289,6 +306,26 @@ public unsafe struct InternalPosition2D [FieldOffset(0)] public fixed Single Coordinates[2]; } + [StructLayout(LayoutKind.Explicit, Size=8)] + public unsafe struct InternalDiscretePosition2D + { + [FieldOffset(0)] public fixed Int32 Coordinates[2]; + } + + [StructLayout(LayoutKind.Explicit, Size=16)] + public unsafe struct InternalHatch2D + { + [FieldOffset(0)] public fixed Single Point1Coordinates[2]; + [FieldOffset(8)] public fixed Single Point2Coordinates[2]; + } + + [StructLayout(LayoutKind.Explicit, Size=16)] + public unsafe struct InternalDiscreteHatch2D + { + [FieldOffset(0)] public fixed Int32 Point1Coordinates[2]; + [FieldOffset(8)] public fixed Int32 Point2Coordinates[2]; + } + [StructLayout(LayoutKind.Explicit, Size=12)] public unsafe struct InternalCompositeConstituent { @@ -1301,8 +1338,11 @@ public class Lib3MFWrapper [DllImport("lib3mf.dll", EntryPoint = "lib3mf_toolpathlayerreader_getpartuuidbylocalpartid", CallingConvention=CallingConvention.Cdecl)] public unsafe extern static Int32 ToolpathLayerReader_GetPartUUIDByLocalPartID (IntPtr Handle, UInt32 ALocalPartID, UInt32 sizePartUUID, out UInt32 neededPartUUID, IntPtr dataPartUUID); - [DllImport("lib3mf.dll", EntryPoint = "lib3mf_toolpathlayerreader_getsegmentpointdata", CallingConvention=CallingConvention.Cdecl)] - public unsafe extern static Int32 ToolpathLayerReader_GetSegmentPointData (IntPtr Handle, UInt32 AIndex, UInt64 sizePointData, out UInt64 neededPointData, IntPtr dataPointData); + [DllImport("lib3mf.dll", EntryPoint = "lib3mf_toolpathlayerreader_getsegmentpointdatainmodelunits", CallingConvention=CallingConvention.Cdecl)] + public unsafe extern static Int32 ToolpathLayerReader_GetSegmentPointDataInModelUnits (IntPtr Handle, UInt32 AIndex, UInt64 sizePointData, out UInt64 neededPointData, IntPtr dataPointData); + + [DllImport("lib3mf.dll", EntryPoint = "lib3mf_toolpathlayerreader_getsegmentpointdatadiscrete", CallingConvention=CallingConvention.Cdecl)] + public unsafe extern static Int32 ToolpathLayerReader_GetSegmentPointDataDiscrete (IntPtr Handle, UInt32 AIndex, UInt64 sizePointData, out UInt64 neededPointData, IntPtr dataPointData); [DllImport("lib3mf.dll", EntryPoint = "lib3mf_toolpathlayerreader_findattributeinfobyname", CallingConvention=CallingConvention.Cdecl)] public unsafe extern static Int32 ToolpathLayerReader_FindAttributeInfoByName (IntPtr Handle, byte[] ANameSpace, byte[] AAttributeName, out UInt32 AID, out Int32 AAttributeType); @@ -1349,14 +1389,29 @@ public class Lib3MFWrapper [DllImport("lib3mf.dll", EntryPoint = "lib3mf_toolpathlayerdata_clearsegmentattributes", CallingConvention=CallingConvention.Cdecl)] public unsafe extern static Int32 ToolpathLayerData_ClearSegmentAttributes (IntPtr Handle); - [DllImport("lib3mf.dll", EntryPoint = "lib3mf_toolpathlayerdata_writehatchdata", CallingConvention=CallingConvention.Cdecl)] - public unsafe extern static Int32 ToolpathLayerData_WriteHatchData (IntPtr Handle, UInt32 AProfileID, UInt32 APartID, UInt64 sizePointData, IntPtr dataPointData); + [DllImport("lib3mf.dll", EntryPoint = "lib3mf_toolpathlayerdata_addcustomlineattributes", CallingConvention=CallingConvention.Cdecl)] + public unsafe extern static Int32 ToolpathLayerData_AddCustomLineAttributes (IntPtr Handle, byte[] ANameSpace, byte[] AAttributeName, UInt64 sizeValues, IntPtr dataValues); + + [DllImport("lib3mf.dll", EntryPoint = "lib3mf_toolpathlayerdata_clearcustomlineattributes", CallingConvention=CallingConvention.Cdecl)] + public unsafe extern static Int32 ToolpathLayerData_ClearCustomLineAttributes (IntPtr Handle); + + [DllImport("lib3mf.dll", EntryPoint = "lib3mf_toolpathlayerdata_writehatchdatainmodelunits", CallingConvention=CallingConvention.Cdecl)] + public unsafe extern static Int32 ToolpathLayerData_WriteHatchDataInModelUnits (IntPtr Handle, UInt32 AProfileID, UInt32 APartID, Byte AWriteCustomLineAttributes, UInt64 sizeHatchData, IntPtr dataHatchData); + + [DllImport("lib3mf.dll", EntryPoint = "lib3mf_toolpathlayerdata_writehatchdatadiscrete", CallingConvention=CallingConvention.Cdecl)] + public unsafe extern static Int32 ToolpathLayerData_WriteHatchDataDiscrete (IntPtr Handle, UInt32 AProfileID, UInt32 APartID, Byte AWriteCustomLineAttributes, UInt64 sizeHatchData, IntPtr dataHatchData); + + [DllImport("lib3mf.dll", EntryPoint = "lib3mf_toolpathlayerdata_writeloopinmodelunits", CallingConvention=CallingConvention.Cdecl)] + public unsafe extern static Int32 ToolpathLayerData_WriteLoopInModelUnits (IntPtr Handle, UInt32 AProfileID, UInt32 APartID, Byte AWriteCustomLineAttributes, UInt64 sizePointData, IntPtr dataPointData); + + [DllImport("lib3mf.dll", EntryPoint = "lib3mf_toolpathlayerdata_writeloopdiscrete", CallingConvention=CallingConvention.Cdecl)] + public unsafe extern static Int32 ToolpathLayerData_WriteLoopDiscrete (IntPtr Handle, UInt32 AProfileID, UInt32 APartID, Byte AWriteCustomLineAttributes, UInt64 sizePointData, IntPtr dataPointData); - [DllImport("lib3mf.dll", EntryPoint = "lib3mf_toolpathlayerdata_writeloop", CallingConvention=CallingConvention.Cdecl)] - public unsafe extern static Int32 ToolpathLayerData_WriteLoop (IntPtr Handle, UInt32 AProfileID, UInt32 APartID, UInt64 sizePointData, IntPtr dataPointData); + [DllImport("lib3mf.dll", EntryPoint = "lib3mf_toolpathlayerdata_writepolylineinmodelunits", CallingConvention=CallingConvention.Cdecl)] + public unsafe extern static Int32 ToolpathLayerData_WritePolylineInModelUnits (IntPtr Handle, UInt32 AProfileID, UInt32 APartID, Byte AWriteCustomLineAttributes, UInt64 sizePointData, IntPtr dataPointData); - [DllImport("lib3mf.dll", EntryPoint = "lib3mf_toolpathlayerdata_writepolyline", CallingConvention=CallingConvention.Cdecl)] - public unsafe extern static Int32 ToolpathLayerData_WritePolyline (IntPtr Handle, UInt32 AProfileID, UInt32 APartID, UInt64 sizePointData, IntPtr dataPointData); + [DllImport("lib3mf.dll", EntryPoint = "lib3mf_toolpathlayerdata_writepolylinediscrete", CallingConvention=CallingConvention.Cdecl)] + public unsafe extern static Int32 ToolpathLayerData_WritePolylineDiscrete (IntPtr Handle, UInt32 AProfileID, UInt32 APartID, Byte AWriteCustomLineAttributes, UInt64 sizePointData, IntPtr dataPointData); [DllImport("lib3mf.dll", EntryPoint = "lib3mf_toolpathlayerdata_addcustomdata", CallingConvention=CallingConvention.Cdecl)] public unsafe extern static Int32 ToolpathLayerData_AddCustomData (IntPtr Handle, byte[] ANameSpace, byte[] ADataName, out IntPtr AData); @@ -1364,6 +1419,12 @@ public class Lib3MFWrapper [DllImport("lib3mf.dll", EntryPoint = "lib3mf_toolpathlayerdata_finish", CallingConvention=CallingConvention.Cdecl)] public unsafe extern static Int32 ToolpathLayerData_Finish (IntPtr Handle); + [DllImport("lib3mf.dll", EntryPoint = "lib3mf_toolpath_getuuid", CallingConvention=CallingConvention.Cdecl)] + public unsafe extern static Int32 Toolpath_GetUUID (IntPtr Handle, UInt32 sizeUUID, out UInt32 neededUUID, IntPtr dataUUID); + + [DllImport("lib3mf.dll", EntryPoint = "lib3mf_toolpath_resetuuid", CallingConvention=CallingConvention.Cdecl)] + public unsafe extern static Int32 Toolpath_ResetUUID (IntPtr Handle, UInt32 sizeNewUUID, out UInt32 neededNewUUID, IntPtr dataNewUUID); + [DllImport("lib3mf.dll", EntryPoint = "lib3mf_toolpath_getunits", CallingConvention=CallingConvention.Cdecl)] public unsafe extern static Int32 Toolpath_GetUnits (IntPtr Handle, out Double AUnits); @@ -1394,8 +1455,14 @@ public class Lib3MFWrapper [DllImport("lib3mf.dll", EntryPoint = "lib3mf_toolpath_getlayerzmax", CallingConvention=CallingConvention.Cdecl)] public unsafe extern static Int32 Toolpath_GetLayerZMax (IntPtr Handle, UInt32 AIndex, out UInt32 AZMax); - [DllImport("lib3mf.dll", EntryPoint = "lib3mf_toolpath_getlayerz", CallingConvention=CallingConvention.Cdecl)] - public unsafe extern static Int32 Toolpath_GetLayerZ (IntPtr Handle, UInt32 ALayerIndex, out UInt32 AZValue); + [DllImport("lib3mf.dll", EntryPoint = "lib3mf_toolpath_getlayerzmin", CallingConvention=CallingConvention.Cdecl)] + public unsafe extern static Int32 Toolpath_GetLayerZMin (IntPtr Handle, UInt32 AIndex, out UInt32 AZMin); + + [DllImport("lib3mf.dll", EntryPoint = "lib3mf_toolpath_getlayerthickness", CallingConvention=CallingConvention.Cdecl)] + public unsafe extern static Int32 Toolpath_GetLayerThickness (IntPtr Handle, UInt32 AIndex, out UInt32 AZThickness); + + [DllImport("lib3mf.dll", EntryPoint = "lib3mf_toolpath_hasuniformthickness", CallingConvention=CallingConvention.Cdecl)] + public unsafe extern static Int32 Toolpath_HasUniformThickness (IntPtr Handle, out Byte AUniformThickness); [DllImport("lib3mf.dll", EntryPoint = "lib3mf_toolpath_addprofile", CallingConvention=CallingConvention.Cdecl)] public unsafe extern static Int32 Toolpath_AddProfile (IntPtr Handle, byte[] AName, out IntPtr AProfile); @@ -1433,11 +1500,11 @@ public class Lib3MFWrapper [DllImport("lib3mf.dll", EntryPoint = "lib3mf_toolpath_deletecustomdata", CallingConvention=CallingConvention.Cdecl)] public unsafe extern static Int32 Toolpath_DeleteCustomData (IntPtr Handle, IntPtr AData, out Byte ASuccess); - [DllImport("lib3mf.dll", EntryPoint = "lib3mf_toolpath_registercustomintegerattribute", CallingConvention=CallingConvention.Cdecl)] - public unsafe extern static Int32 Toolpath_RegisterCustomIntegerAttribute (IntPtr Handle, byte[] ANameSpace, byte[] AAttributeName); + [DllImport("lib3mf.dll", EntryPoint = "lib3mf_toolpath_registercustomintegersegmentattribute", CallingConvention=CallingConvention.Cdecl)] + public unsafe extern static Int32 Toolpath_RegisterCustomIntegerSegmentAttribute (IntPtr Handle, byte[] ANameSpace, byte[] AAttributeName); - [DllImport("lib3mf.dll", EntryPoint = "lib3mf_toolpath_registercustomdoubleattribute", CallingConvention=CallingConvention.Cdecl)] - public unsafe extern static Int32 Toolpath_RegisterCustomDoubleAttribute (IntPtr Handle, byte[] ANameSpace, byte[] AAttributeName); + [DllImport("lib3mf.dll", EntryPoint = "lib3mf_toolpath_registercustomdoublesegmentattribute", CallingConvention=CallingConvention.Cdecl)] + public unsafe extern static Int32 Toolpath_RegisterCustomDoubleSegmentAttribute (IntPtr Handle, byte[] ANameSpace, byte[] AAttributeName); [DllImport("lib3mf.dll", EntryPoint = "lib3mf_toolpathiterator_getcurrenttoolpath", CallingConvention=CallingConvention.Cdecl)] public unsafe extern static Int32 ToolpathIterator_GetCurrentToolpath (IntPtr Handle, out IntPtr AResource); @@ -1933,6 +2000,87 @@ public unsafe static InternalPosition2D convertStructToInternal_Position2D (sPos return intPosition2D; } + public unsafe static sDiscretePosition2D convertInternalToStruct_DiscretePosition2D (InternalDiscretePosition2D intDiscretePosition2D) + { + sDiscretePosition2D DiscretePosition2D; + DiscretePosition2D.Coordinates = new Int32[2]; + for (int rowIndex = 0; rowIndex < 2; rowIndex++) { + DiscretePosition2D.Coordinates[rowIndex] = intDiscretePosition2D.Coordinates[rowIndex]; + } + + return DiscretePosition2D; + } + + public unsafe static InternalDiscretePosition2D convertStructToInternal_DiscretePosition2D (sDiscretePosition2D DiscretePosition2D) + { + InternalDiscretePosition2D intDiscretePosition2D; + for (int rowIndex = 0; rowIndex < 2; rowIndex++) { + intDiscretePosition2D.Coordinates[rowIndex] = DiscretePosition2D.Coordinates[rowIndex]; + } + + return intDiscretePosition2D; + } + + public unsafe static sHatch2D convertInternalToStruct_Hatch2D (InternalHatch2D intHatch2D) + { + sHatch2D Hatch2D; + Hatch2D.Point1Coordinates = new Single[2]; + for (int rowIndex = 0; rowIndex < 2; rowIndex++) { + Hatch2D.Point1Coordinates[rowIndex] = intHatch2D.Point1Coordinates[rowIndex]; + } + + Hatch2D.Point2Coordinates = new Single[2]; + for (int rowIndex = 0; rowIndex < 2; rowIndex++) { + Hatch2D.Point2Coordinates[rowIndex] = intHatch2D.Point2Coordinates[rowIndex]; + } + + return Hatch2D; + } + + public unsafe static InternalHatch2D convertStructToInternal_Hatch2D (sHatch2D Hatch2D) + { + InternalHatch2D intHatch2D; + for (int rowIndex = 0; rowIndex < 2; rowIndex++) { + intHatch2D.Point1Coordinates[rowIndex] = Hatch2D.Point1Coordinates[rowIndex]; + } + + for (int rowIndex = 0; rowIndex < 2; rowIndex++) { + intHatch2D.Point2Coordinates[rowIndex] = Hatch2D.Point2Coordinates[rowIndex]; + } + + return intHatch2D; + } + + public unsafe static sDiscreteHatch2D convertInternalToStruct_DiscreteHatch2D (InternalDiscreteHatch2D intDiscreteHatch2D) + { + sDiscreteHatch2D DiscreteHatch2D; + DiscreteHatch2D.Point1Coordinates = new Int32[2]; + for (int rowIndex = 0; rowIndex < 2; rowIndex++) { + DiscreteHatch2D.Point1Coordinates[rowIndex] = intDiscreteHatch2D.Point1Coordinates[rowIndex]; + } + + DiscreteHatch2D.Point2Coordinates = new Int32[2]; + for (int rowIndex = 0; rowIndex < 2; rowIndex++) { + DiscreteHatch2D.Point2Coordinates[rowIndex] = intDiscreteHatch2D.Point2Coordinates[rowIndex]; + } + + return DiscreteHatch2D; + } + + public unsafe static InternalDiscreteHatch2D convertStructToInternal_DiscreteHatch2D (sDiscreteHatch2D DiscreteHatch2D) + { + InternalDiscreteHatch2D intDiscreteHatch2D; + for (int rowIndex = 0; rowIndex < 2; rowIndex++) { + intDiscreteHatch2D.Point1Coordinates[rowIndex] = DiscreteHatch2D.Point1Coordinates[rowIndex]; + } + + for (int rowIndex = 0; rowIndex < 2; rowIndex++) { + intDiscreteHatch2D.Point2Coordinates[rowIndex] = DiscreteHatch2D.Point2Coordinates[rowIndex]; + } + + return intDiscreteHatch2D; + } + public unsafe static sCompositeConstituent convertInternalToStruct_CompositeConstituent (InternalCompositeConstituent intCompositeConstituent) { sCompositeConstituent CompositeConstituent; @@ -5456,22 +5604,38 @@ public String GetPartUUIDByLocalPartID (UInt32 ALocalPartID) return Encoding.UTF8.GetString(bytesPartUUID).TrimEnd(char.MinValue); } - public void GetSegmentPointData (UInt32 AIndex, out sPosition2D[] APointData) + public void GetSegmentPointDataInModelUnits (UInt32 AIndex, out sPosition2D[] APointData) { UInt64 sizePointData = 0; UInt64 neededPointData = 0; - CheckError(Internal.Lib3MFWrapper.ToolpathLayerReader_GetSegmentPointData (Handle, AIndex, sizePointData, out neededPointData, IntPtr.Zero)); + CheckError(Internal.Lib3MFWrapper.ToolpathLayerReader_GetSegmentPointDataInModelUnits (Handle, AIndex, sizePointData, out neededPointData, IntPtr.Zero)); sizePointData = neededPointData; var arrayPointData = new Internal.InternalPosition2D[sizePointData]; GCHandle dataPointData = GCHandle.Alloc(arrayPointData, GCHandleType.Pinned); - CheckError(Internal.Lib3MFWrapper.ToolpathLayerReader_GetSegmentPointData (Handle, AIndex, sizePointData, out neededPointData, dataPointData.AddrOfPinnedObject())); + CheckError(Internal.Lib3MFWrapper.ToolpathLayerReader_GetSegmentPointDataInModelUnits (Handle, AIndex, sizePointData, out neededPointData, dataPointData.AddrOfPinnedObject())); dataPointData.Free(); APointData = new sPosition2D[sizePointData]; for (int index = 0; index < APointData.Length; index++) APointData[index] = Internal.Lib3MFWrapper.convertInternalToStruct_Position2D(arrayPointData[index]); } + public void GetSegmentPointDataDiscrete (UInt32 AIndex, out sDiscretePosition2D[] APointData) + { + UInt64 sizePointData = 0; + UInt64 neededPointData = 0; + CheckError(Internal.Lib3MFWrapper.ToolpathLayerReader_GetSegmentPointDataDiscrete (Handle, AIndex, sizePointData, out neededPointData, IntPtr.Zero)); + sizePointData = neededPointData; + var arrayPointData = new Internal.InternalDiscretePosition2D[sizePointData]; + GCHandle dataPointData = GCHandle.Alloc(arrayPointData, GCHandleType.Pinned); + + CheckError(Internal.Lib3MFWrapper.ToolpathLayerReader_GetSegmentPointDataDiscrete (Handle, AIndex, sizePointData, out neededPointData, dataPointData.AddrOfPinnedObject())); + dataPointData.Free(); + APointData = new sDiscretePosition2D[sizePointData]; + for (int index = 0; index < APointData.Length; index++) + APointData[index] = Internal.Lib3MFWrapper.convertInternalToStruct_DiscretePosition2D(arrayPointData[index]); + } + public void FindAttributeInfoByName (String ANameSpace, String AAttributeName, out UInt32 AID, out eToolpathAttributeType AAttributeType) { byte[] byteNameSpace = Encoding.UTF8.GetBytes(ANameSpace + char.MinValue); @@ -5634,36 +5798,85 @@ public void ClearSegmentAttributes () CheckError(Internal.Lib3MFWrapper.ToolpathLayerData_ClearSegmentAttributes (Handle)); } - public void WriteHatchData (UInt32 AProfileID, UInt32 APartID, sPosition2D[] APointData) + public void AddCustomLineAttributes (String ANameSpace, String AAttributeName, Int32[] AValues) + { + byte[] byteNameSpace = Encoding.UTF8.GetBytes(ANameSpace + char.MinValue); + byte[] byteAttributeName = Encoding.UTF8.GetBytes(AAttributeName + char.MinValue); + GCHandle dataValues = GCHandle.Alloc(AValues, GCHandleType.Pinned); + + CheckError(Internal.Lib3MFWrapper.ToolpathLayerData_AddCustomLineAttributes (Handle, byteNameSpace, byteAttributeName, (UInt64) AValues.Length, dataValues.AddrOfPinnedObject())); + dataValues.Free (); + } + + public void ClearCustomLineAttributes () + { + + CheckError(Internal.Lib3MFWrapper.ToolpathLayerData_ClearCustomLineAttributes (Handle)); + } + + public void WriteHatchDataInModelUnits (UInt32 AProfileID, UInt32 APartID, bool AWriteCustomLineAttributes, sHatch2D[] AHatchData) + { + Internal.InternalHatch2D[] intdataHatchData = new Internal.InternalHatch2D[AHatchData.Length]; + for (int index = 0; index < AHatchData.Length; index++) + intdataHatchData[index] = Internal.Lib3MFWrapper.convertStructToInternal_Hatch2D(AHatchData[index]); + GCHandle dataHatchData = GCHandle.Alloc(intdataHatchData, GCHandleType.Pinned); + + CheckError(Internal.Lib3MFWrapper.ToolpathLayerData_WriteHatchDataInModelUnits (Handle, AProfileID, APartID, (Byte)( AWriteCustomLineAttributes ? 1 : 0 ), (UInt64) AHatchData.Length, dataHatchData.AddrOfPinnedObject())); + dataHatchData.Free (); + } + + public void WriteHatchDataDiscrete (UInt32 AProfileID, UInt32 APartID, bool AWriteCustomLineAttributes, sDiscreteHatch2D[] AHatchData) + { + Internal.InternalDiscreteHatch2D[] intdataHatchData = new Internal.InternalDiscreteHatch2D[AHatchData.Length]; + for (int index = 0; index < AHatchData.Length; index++) + intdataHatchData[index] = Internal.Lib3MFWrapper.convertStructToInternal_DiscreteHatch2D(AHatchData[index]); + GCHandle dataHatchData = GCHandle.Alloc(intdataHatchData, GCHandleType.Pinned); + + CheckError(Internal.Lib3MFWrapper.ToolpathLayerData_WriteHatchDataDiscrete (Handle, AProfileID, APartID, (Byte)( AWriteCustomLineAttributes ? 1 : 0 ), (UInt64) AHatchData.Length, dataHatchData.AddrOfPinnedObject())); + dataHatchData.Free (); + } + + public void WriteLoopInModelUnits (UInt32 AProfileID, UInt32 APartID, bool AWriteCustomLineAttributes, sPosition2D[] APointData) { Internal.InternalPosition2D[] intdataPointData = new Internal.InternalPosition2D[APointData.Length]; for (int index = 0; index < APointData.Length; index++) intdataPointData[index] = Internal.Lib3MFWrapper.convertStructToInternal_Position2D(APointData[index]); GCHandle dataPointData = GCHandle.Alloc(intdataPointData, GCHandleType.Pinned); - CheckError(Internal.Lib3MFWrapper.ToolpathLayerData_WriteHatchData (Handle, AProfileID, APartID, (UInt64) APointData.Length, dataPointData.AddrOfPinnedObject())); + CheckError(Internal.Lib3MFWrapper.ToolpathLayerData_WriteLoopInModelUnits (Handle, AProfileID, APartID, (Byte)( AWriteCustomLineAttributes ? 1 : 0 ), (UInt64) APointData.Length, dataPointData.AddrOfPinnedObject())); dataPointData.Free (); } - public void WriteLoop (UInt32 AProfileID, UInt32 APartID, sPosition2D[] APointData) + public void WriteLoopDiscrete (UInt32 AProfileID, UInt32 APartID, bool AWriteCustomLineAttributes, sDiscretePosition2D[] APointData) { - Internal.InternalPosition2D[] intdataPointData = new Internal.InternalPosition2D[APointData.Length]; + Internal.InternalDiscretePosition2D[] intdataPointData = new Internal.InternalDiscretePosition2D[APointData.Length]; for (int index = 0; index < APointData.Length; index++) - intdataPointData[index] = Internal.Lib3MFWrapper.convertStructToInternal_Position2D(APointData[index]); + intdataPointData[index] = Internal.Lib3MFWrapper.convertStructToInternal_DiscretePosition2D(APointData[index]); GCHandle dataPointData = GCHandle.Alloc(intdataPointData, GCHandleType.Pinned); - CheckError(Internal.Lib3MFWrapper.ToolpathLayerData_WriteLoop (Handle, AProfileID, APartID, (UInt64) APointData.Length, dataPointData.AddrOfPinnedObject())); + CheckError(Internal.Lib3MFWrapper.ToolpathLayerData_WriteLoopDiscrete (Handle, AProfileID, APartID, (Byte)( AWriteCustomLineAttributes ? 1 : 0 ), (UInt64) APointData.Length, dataPointData.AddrOfPinnedObject())); dataPointData.Free (); } - public void WritePolyline (UInt32 AProfileID, UInt32 APartID, sPosition2D[] APointData) + public void WritePolylineInModelUnits (UInt32 AProfileID, UInt32 APartID, bool AWriteCustomLineAttributes, sPosition2D[] APointData) { Internal.InternalPosition2D[] intdataPointData = new Internal.InternalPosition2D[APointData.Length]; for (int index = 0; index < APointData.Length; index++) intdataPointData[index] = Internal.Lib3MFWrapper.convertStructToInternal_Position2D(APointData[index]); GCHandle dataPointData = GCHandle.Alloc(intdataPointData, GCHandleType.Pinned); - CheckError(Internal.Lib3MFWrapper.ToolpathLayerData_WritePolyline (Handle, AProfileID, APartID, (UInt64) APointData.Length, dataPointData.AddrOfPinnedObject())); + CheckError(Internal.Lib3MFWrapper.ToolpathLayerData_WritePolylineInModelUnits (Handle, AProfileID, APartID, (Byte)( AWriteCustomLineAttributes ? 1 : 0 ), (UInt64) APointData.Length, dataPointData.AddrOfPinnedObject())); + dataPointData.Free (); + } + + public void WritePolylineDiscrete (UInt32 AProfileID, UInt32 APartID, bool AWriteCustomLineAttributes, sDiscretePosition2D[] APointData) + { + Internal.InternalDiscretePosition2D[] intdataPointData = new Internal.InternalDiscretePosition2D[APointData.Length]; + for (int index = 0; index < APointData.Length; index++) + intdataPointData[index] = Internal.Lib3MFWrapper.convertStructToInternal_DiscretePosition2D(APointData[index]); + GCHandle dataPointData = GCHandle.Alloc(intdataPointData, GCHandleType.Pinned); + + CheckError(Internal.Lib3MFWrapper.ToolpathLayerData_WritePolylineDiscrete (Handle, AProfileID, APartID, (Byte)( AWriteCustomLineAttributes ? 1 : 0 ), (UInt64) APointData.Length, dataPointData.AddrOfPinnedObject())); dataPointData.Free (); } @@ -5691,6 +5904,34 @@ public CToolpath (IntPtr NewHandle) : base (NewHandle) { } + public String GetUUID () + { + UInt32 sizeUUID = 0; + UInt32 neededUUID = 0; + CheckError(Internal.Lib3MFWrapper.Toolpath_GetUUID (Handle, sizeUUID, out neededUUID, IntPtr.Zero)); + sizeUUID = neededUUID; + byte[] bytesUUID = new byte[sizeUUID]; + GCHandle dataUUID = GCHandle.Alloc(bytesUUID, GCHandleType.Pinned); + + CheckError(Internal.Lib3MFWrapper.Toolpath_GetUUID (Handle, sizeUUID, out neededUUID, dataUUID.AddrOfPinnedObject())); + dataUUID.Free(); + return Encoding.UTF8.GetString(bytesUUID).TrimEnd(char.MinValue); + } + + public String ResetUUID () + { + UInt32 sizeNewUUID = 0; + UInt32 neededNewUUID = 0; + CheckError(Internal.Lib3MFWrapper.Toolpath_ResetUUID (Handle, sizeNewUUID, out neededNewUUID, IntPtr.Zero)); + sizeNewUUID = neededNewUUID; + byte[] bytesNewUUID = new byte[sizeNewUUID]; + GCHandle dataNewUUID = GCHandle.Alloc(bytesNewUUID, GCHandleType.Pinned); + + CheckError(Internal.Lib3MFWrapper.Toolpath_ResetUUID (Handle, sizeNewUUID, out neededNewUUID, dataNewUUID.AddrOfPinnedObject())); + dataNewUUID.Free(); + return Encoding.UTF8.GetString(bytesNewUUID).TrimEnd(char.MinValue); + } + public Double GetUnits () { Double resultUnits = 0; @@ -5779,12 +6020,28 @@ public UInt32 GetLayerZMax (UInt32 AIndex) return resultZMax; } - public UInt32 GetLayerZ (UInt32 ALayerIndex) + public UInt32 GetLayerZMin (UInt32 AIndex) + { + UInt32 resultZMin = 0; + + CheckError(Internal.Lib3MFWrapper.Toolpath_GetLayerZMin (Handle, AIndex, out resultZMin)); + return resultZMin; + } + + public UInt32 GetLayerThickness (UInt32 AIndex) + { + UInt32 resultZThickness = 0; + + CheckError(Internal.Lib3MFWrapper.Toolpath_GetLayerThickness (Handle, AIndex, out resultZThickness)); + return resultZThickness; + } + + public bool HasUniformThickness () { - UInt32 resultZValue = 0; + Byte resultUniformThickness = 0; - CheckError(Internal.Lib3MFWrapper.Toolpath_GetLayerZ (Handle, ALayerIndex, out resultZValue)); - return resultZValue; + CheckError(Internal.Lib3MFWrapper.Toolpath_HasUniformThickness (Handle, out resultUniformThickness)); + return (resultUniformThickness != 0); } public CToolpathProfile AddProfile (String AName) @@ -5908,20 +6165,20 @@ public bool DeleteCustomData (CCustomDOMTree AData) return (resultSuccess != 0); } - public void RegisterCustomIntegerAttribute (String ANameSpace, String AAttributeName) + public void RegisterCustomIntegerSegmentAttribute (String ANameSpace, String AAttributeName) { byte[] byteNameSpace = Encoding.UTF8.GetBytes(ANameSpace + char.MinValue); byte[] byteAttributeName = Encoding.UTF8.GetBytes(AAttributeName + char.MinValue); - CheckError(Internal.Lib3MFWrapper.Toolpath_RegisterCustomIntegerAttribute (Handle, byteNameSpace, byteAttributeName)); + CheckError(Internal.Lib3MFWrapper.Toolpath_RegisterCustomIntegerSegmentAttribute (Handle, byteNameSpace, byteAttributeName)); } - public void RegisterCustomDoubleAttribute (String ANameSpace, String AAttributeName) + public void RegisterCustomDoubleSegmentAttribute (String ANameSpace, String AAttributeName) { byte[] byteNameSpace = Encoding.UTF8.GetBytes(ANameSpace + char.MinValue); byte[] byteAttributeName = Encoding.UTF8.GetBytes(AAttributeName + char.MinValue); - CheckError(Internal.Lib3MFWrapper.Toolpath_RegisterCustomDoubleAttribute (Handle, byteNameSpace, byteAttributeName)); + CheckError(Internal.Lib3MFWrapper.Toolpath_RegisterCustomDoubleSegmentAttribute (Handle, byteNameSpace, byteAttributeName)); } } diff --git a/Autogenerated/Bindings/Cpp/lib3mf_abi.hpp b/Autogenerated/Bindings/Cpp/lib3mf_abi.hpp index a412a816f..0e27cd813 100644 --- a/Autogenerated/Bindings/Cpp/lib3mf_abi.hpp +++ b/Autogenerated/Bindings/Cpp/lib3mf_abi.hpp @@ -3363,10 +3363,22 @@ LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerreader_getpartuuidbylocalpartid * @param[in] nIndex - Index. Must be between 0 and Count - 1. * @param[in] nPointDataBufferSize - Number of elements in buffer * @param[out] pPointDataNeededCount - will be filled with the count of the written elements, or needed buffer size. -* @param[out] pPointDataBuffer - Position2D buffer of The point data array +* @param[out] pPointDataBuffer - Position2D buffer of The point data array. The point coordinates are in model units. * @return error code or 0 (success) */ -LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerreader_getsegmentpointdata(Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nIndex, const Lib3MF_uint64 nPointDataBufferSize, Lib3MF_uint64* pPointDataNeededCount, Lib3MF::sPosition2D * pPointDataBuffer); +LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerreader_getsegmentpointdatainmodelunits(Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nIndex, const Lib3MF_uint64 nPointDataBufferSize, Lib3MF_uint64* pPointDataNeededCount, Lib3MF::sPosition2D * pPointDataBuffer); + +/** +* Retrieves the assigned segment point list in units. For type hatch, the points are taken pairwise. +* +* @param[in] pToolpathLayerReader - ToolpathLayerReader instance. +* @param[in] nIndex - Index. Must be between 0 and Count - 1. +* @param[in] nPointDataBufferSize - Number of elements in buffer +* @param[out] pPointDataNeededCount - will be filled with the count of the written elements, or needed buffer size. +* @param[out] pPointDataBuffer - DiscretePosition2D buffer of The point data array. The point coordinates are in toolpath units. +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerreader_getsegmentpointdatadiscrete(Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nIndex, const Lib3MF_uint64 nPointDataBufferSize, Lib3MF_uint64* pPointDataNeededCount, Lib3MF::sDiscretePosition2D * pPointDataBuffer); /** * Retrieves a segment attribute Information by Attribute Name. Will fail if Attribute does not exist. @@ -3537,28 +3549,76 @@ LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerdata_setsegmentattribute(Lib3MF LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerdata_clearsegmentattributes(Lib3MF_ToolpathLayerData pToolpathLayerData); /** -* writes hatch data to the layer. +* Stores custom line attributes for the next WriteLoop, WritePolyline or WriteHatchData call. +* +* @param[in] pToolpathLayerData - ToolpathLayerData instance. +* @param[in] pNameSpace - The namespace of the attribute to register. +* @param[in] pAttributeName - The name of the attribute to register. +* @param[in] nValuesBufferSize - Number of elements in buffer +* @param[in] pValuesBuffer - int32 buffer of Custom Values to store on segment lines. Array MUST NOT be empty. If custom attributes had been already defined, the error cardinality MUST match, or an error will be thrown. +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerdata_addcustomlineattributes(Lib3MF_ToolpathLayerData pToolpathLayerData, const char * pNameSpace, const char * pAttributeName, Lib3MF_uint64 nValuesBufferSize, const Lib3MF_int32 * pValuesBuffer); + +/** +* Clears all custom line attributes. Any call to WriteLoop, WritePolyline or WriteHatchData will do this implicitely. +* +* @param[in] pToolpathLayerData - ToolpathLayerData instance. +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerdata_clearcustomlineattributes(Lib3MF_ToolpathLayerData pToolpathLayerData); + +/** +* writes hatch data to the layer in model units. +* +* @param[in] pToolpathLayerData - ToolpathLayerData instance. +* @param[in] nProfileID - The toolpath profile to use +* @param[in] nPartID - The toolpath part to use +* @param[in] bWriteCustomLineAttributes - If true, custom line attributes are written. The cardinality of each custom attribute MUST be equal to the number of hatches in the hatchdata array. In any case, stored custom attributes will be cleared after the call. +* @param[in] nHatchDataBufferSize - Number of elements in buffer +* @param[in] pHatchDataBuffer - Hatch2D buffer of The hatch data in model units. Array MUST NOT be empty. +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerdata_writehatchdatainmodelunits(Lib3MF_ToolpathLayerData pToolpathLayerData, Lib3MF_uint32 nProfileID, Lib3MF_uint32 nPartID, bool bWriteCustomLineAttributes, Lib3MF_uint64 nHatchDataBufferSize, const Lib3MF::sHatch2D * pHatchDataBuffer); + +/** +* writes hatch data to the layer in toolpath units. +* +* @param[in] pToolpathLayerData - ToolpathLayerData instance. +* @param[in] nProfileID - The toolpath profile to use +* @param[in] nPartID - The toolpath part to use +* @param[in] bWriteCustomLineAttributes - If true, custom line attributes are written. The cardinality of each custom attribute MUST be equal to the number of hatches in the hatchdata array. In any case, stored custom attributes will be cleared after the call. +* @param[in] nHatchDataBufferSize - Number of elements in buffer +* @param[in] pHatchDataBuffer - DiscreteHatch2D buffer of The hatch data in toolpath units. Array MUST NOT be empty. +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerdata_writehatchdatadiscrete(Lib3MF_ToolpathLayerData pToolpathLayerData, Lib3MF_uint32 nProfileID, Lib3MF_uint32 nPartID, bool bWriteCustomLineAttributes, Lib3MF_uint64 nHatchDataBufferSize, const Lib3MF::sDiscreteHatch2D * pHatchDataBuffer); + +/** +* writes loop data to the layer in model units. * * @param[in] pToolpathLayerData - ToolpathLayerData instance. * @param[in] nProfileID - The toolpath profile to use * @param[in] nPartID - The toolpath part to use +* @param[in] bWriteCustomLineAttributes - If true, custom line attributes are written. The cardinality of each custom attribute MUST be equal to the number of points in the pointdata array. In any case, stored custom attributes will be cleared after the call. * @param[in] nPointDataBufferSize - Number of elements in buffer -* @param[in] pPointDataBuffer - Position2D buffer of The point data +* @param[in] pPointDataBuffer - Position2D buffer of The point data in model units. Array MUST NOT be empty. * @return error code or 0 (success) */ -LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerdata_writehatchdata(Lib3MF_ToolpathLayerData pToolpathLayerData, Lib3MF_uint32 nProfileID, Lib3MF_uint32 nPartID, Lib3MF_uint64 nPointDataBufferSize, const Lib3MF::sPosition2D * pPointDataBuffer); +LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerdata_writeloopinmodelunits(Lib3MF_ToolpathLayerData pToolpathLayerData, Lib3MF_uint32 nProfileID, Lib3MF_uint32 nPartID, bool bWriteCustomLineAttributes, Lib3MF_uint64 nPointDataBufferSize, const Lib3MF::sPosition2D * pPointDataBuffer); /** -* writes loop data to the layer. +* writes loop data to the layer in toolpath units. * * @param[in] pToolpathLayerData - ToolpathLayerData instance. * @param[in] nProfileID - The toolpath profile to use * @param[in] nPartID - The toolpath part to use +* @param[in] bWriteCustomLineAttributes - If true, custom line attributes are written. The cardinality of each custom attribute MUST be equal to the number of points in the pointdata array. In any case, stored custom attributes will be cleared after the call. * @param[in] nPointDataBufferSize - Number of elements in buffer -* @param[in] pPointDataBuffer - Position2D buffer of The point data +* @param[in] pPointDataBuffer - DiscretePosition2D buffer of The point data in toolpath units. Array MUST NOT be empty. * @return error code or 0 (success) */ -LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerdata_writeloop(Lib3MF_ToolpathLayerData pToolpathLayerData, Lib3MF_uint32 nProfileID, Lib3MF_uint32 nPartID, Lib3MF_uint64 nPointDataBufferSize, const Lib3MF::sPosition2D * pPointDataBuffer); +LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerdata_writeloopdiscrete(Lib3MF_ToolpathLayerData pToolpathLayerData, Lib3MF_uint32 nProfileID, Lib3MF_uint32 nPartID, bool bWriteCustomLineAttributes, Lib3MF_uint64 nPointDataBufferSize, const Lib3MF::sDiscretePosition2D * pPointDataBuffer); /** * writes polyline data to the layer. @@ -3566,11 +3626,25 @@ LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerdata_writeloop(Lib3MF_ToolpathL * @param[in] pToolpathLayerData - ToolpathLayerData instance. * @param[in] nProfileID - The toolpath profile to use * @param[in] nPartID - The toolpath part to use +* @param[in] bWriteCustomLineAttributes - If true, custom line attributes are written. The cardinality of each custom attribute MUST be equal to the number of points in the pointdata array. In any case, stored custom attributes will be cleared after the call. * @param[in] nPointDataBufferSize - Number of elements in buffer -* @param[in] pPointDataBuffer - Position2D buffer of The point data +* @param[in] pPointDataBuffer - Position2D buffer of The point data in model units. Array MUST NOT be empty. * @return error code or 0 (success) */ -LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerdata_writepolyline(Lib3MF_ToolpathLayerData pToolpathLayerData, Lib3MF_uint32 nProfileID, Lib3MF_uint32 nPartID, Lib3MF_uint64 nPointDataBufferSize, const Lib3MF::sPosition2D * pPointDataBuffer); +LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerdata_writepolylineinmodelunits(Lib3MF_ToolpathLayerData pToolpathLayerData, Lib3MF_uint32 nProfileID, Lib3MF_uint32 nPartID, bool bWriteCustomLineAttributes, Lib3MF_uint64 nPointDataBufferSize, const Lib3MF::sPosition2D * pPointDataBuffer); + +/** +* writes polyline data to the layer. +* +* @param[in] pToolpathLayerData - ToolpathLayerData instance. +* @param[in] nProfileID - The toolpath profile to use +* @param[in] nPartID - The toolpath part to use +* @param[in] bWriteCustomLineAttributes - If true, custom line attributes are written. The cardinality of each custom attribute MUST be equal to the number of points in the pointdata array. In any case, stored custom attributes will be cleared after the call. +* @param[in] nPointDataBufferSize - Number of elements in buffer +* @param[in] pPointDataBuffer - DiscretePosition2D buffer of The point data in toolpath units. Array MUST NOT be empty. +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerdata_writepolylinediscrete(Lib3MF_ToolpathLayerData pToolpathLayerData, Lib3MF_uint32 nProfileID, Lib3MF_uint32 nPartID, bool bWriteCustomLineAttributes, Lib3MF_uint64 nPointDataBufferSize, const Lib3MF::sDiscretePosition2D * pPointDataBuffer); /** * Adds a custom data DOM tree to the layer. Layer MUST not be finished when changing the DOM tree. @@ -3596,7 +3670,29 @@ LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerdata_finish(Lib3MF_ToolpathLaye **************************************************************************************************************************/ /** -* Retrieves the unit factor +* Retrieves the UUID of the toolpath +* +* @param[in] pToolpath - Toolpath instance. +* @param[in] nUUIDBufferSize - size of the buffer (including trailing 0) +* @param[out] pUUIDNeededChars - will be filled with the count of the written bytes, or needed buffer size. +* @param[out] pUUIDBuffer - buffer of UUID Value., may be NULL +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpath_getuuid(Lib3MF_Toolpath pToolpath, const Lib3MF_uint32 nUUIDBufferSize, Lib3MF_uint32* pUUIDNeededChars, char * pUUIDBuffer); + +/** +* Generates a new unique identifier for this toolpath and sets its value. +* +* @param[in] pToolpath - Toolpath instance. +* @param[in] nNewUUIDBufferSize - size of the buffer (including trailing 0) +* @param[out] pNewUUIDNeededChars - will be filled with the count of the written bytes, or needed buffer size. +* @param[out] pNewUUIDBuffer - buffer of Newly created UUID Value., may be NULL +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpath_resetuuid(Lib3MF_Toolpath pToolpath, const Lib3MF_uint32 nNewUUIDBufferSize, Lib3MF_uint32* pNewUUIDNeededChars, char * pNewUUIDBuffer); + +/** +* Retrieves the unit factor, i.e. how many model units are one toolpath unit. * * @param[in] pToolpath - Toolpath instance. * @param[out] pUnits - Returns the unit factor. @@ -3626,7 +3722,7 @@ LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpath_getprofilecount(Lib3MF_Toolpath pTo * Adds a new toolpath layer * * @param[in] pToolpath - Toolpath instance. -* @param[in] nZMax - ZMax value of the layer. MUST be larger than the last layer added, as well as larger as BottomZ. +* @param[in] nZMax - ZMax value of the layer in toolpath units. MUST be larger than the last layer added, as well as larger as BottomZ. * @param[in] pPath - Package Path * @param[in] pModelWriter - The model writer that writes out the 3MF. * @param[out] pLayerData - Returns the layerdata object to write the layer content into. @@ -3638,7 +3734,7 @@ LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpath_addlayer(Lib3MF_Toolpath pToolpath, * Returns the bottom Z Value of the toolpath. * * @param[in] pToolpath - Toolpath instance. -* @param[out] pBottomZ - BottomZ value +* @param[out] pBottomZ - BottomZ value in Toolpath units * @return error code or 0 (success) */ LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpath_getbottomz(Lib3MF_Toolpath pToolpath, Lib3MF_uint32 * pBottomZ); @@ -3647,13 +3743,13 @@ LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpath_getbottomz(Lib3MF_Toolpath pToolpat * Sets the bottom Z Value of the toolpath. Will fail if a layer is already existing. * * @param[in] pToolpath - Toolpath instance. -* @param[in] nBottomZ - BottomZ value +* @param[in] nBottomZ - BottomZ value in Toolpath units * @return error code or 0 (success) */ LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpath_setbottomz(Lib3MF_Toolpath pToolpath, Lib3MF_uint32 nBottomZ); /** -* Retrieves the Attachment of a layer +* Retrieves the Attachment that contains the layer data. * * @param[in] pToolpath - Toolpath instance. * @param[in] nIndex - Layer Index @@ -3689,20 +3785,39 @@ LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpath_getlayerpath(Lib3MF_Toolpath pToolp * * @param[in] pToolpath - Toolpath instance. * @param[in] nIndex - Layer Index -* @param[out] pZMax - ZMax value +* @param[out] pZMax - ZMax value in toolpath units * @return error code or 0 (success) */ LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpath_getlayerzmax(Lib3MF_Toolpath pToolpath, Lib3MF_uint32 nIndex, Lib3MF_uint32 * pZMax); /** -* Return the z value of a layer in units. +* Retrieves the Minimum Z of a layer +* +* @param[in] pToolpath - Toolpath instance. +* @param[in] nIndex - Layer Index +* @param[out] pZMin - ZMin value in toolpath units +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpath_getlayerzmin(Lib3MF_Toolpath pToolpath, Lib3MF_uint32 nIndex, Lib3MF_uint32 * pZMin); + +/** +* Retrieves the Thickness of a layer +* +* @param[in] pToolpath - Toolpath instance. +* @param[in] nIndex - Layer Index +* @param[out] pZThickness - Thickness value in toolpath units +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpath_getlayerthickness(Lib3MF_Toolpath pToolpath, Lib3MF_uint32 nIndex, Lib3MF_uint32 * pZThickness); + +/** +* Checks if the toolpath has a uniform thickness value, i.e. each layer has the same thickness. * * @param[in] pToolpath - Toolpath instance. -* @param[in] nLayerIndex - Layer Index. -* @param[out] pZValue - Z Value in Units. +* @param[out] pUniformThickness - Returns true if the layer thicknesses are uniform, returns false otherwise. * @return error code or 0 (success) */ -LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpath_getlayerz(Lib3MF_Toolpath pToolpath, Lib3MF_uint32 nLayerIndex, Lib3MF_uint32 * pZValue); +LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpath_hasuniformthickness(Lib3MF_Toolpath pToolpath, bool * pUniformThickness); /** * Adds a new profile to the toolpath. @@ -3838,7 +3953,7 @@ LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpath_deletecustomdata(Lib3MF_Toolpath pT * @param[in] pAttributeName - Attribute name. MUST not be empty. * @return error code or 0 (success) */ -LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpath_registercustomintegerattribute(Lib3MF_Toolpath pToolpath, const char * pNameSpace, const char * pAttributeName); +LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpath_registercustomintegersegmentattribute(Lib3MF_Toolpath pToolpath, const char * pNameSpace, const char * pAttributeName); /** * Registers a Double Attribute that each segment holds. Registering only applies to reader or writer objects created after the call. @@ -3848,7 +3963,7 @@ LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpath_registercustomintegerattribute(Lib3 * @param[in] pAttributeName - Attribute name. MUST not be empty. * @return error code or 0 (success) */ -LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpath_registercustomdoubleattribute(Lib3MF_Toolpath pToolpath, const char * pNameSpace, const char * pAttributeName); +LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpath_registercustomdoublesegmentattribute(Lib3MF_Toolpath pToolpath, const char * pNameSpace, const char * pAttributeName); /************************************************************************************************************************* Class definition for ToolpathIterator diff --git a/Autogenerated/Bindings/Cpp/lib3mf_implicit.hpp b/Autogenerated/Bindings/Cpp/lib3mf_implicit.hpp index cc19d1c05..5fc8f8897 100644 --- a/Autogenerated/Bindings/Cpp/lib3mf_implicit.hpp +++ b/Autogenerated/Bindings/Cpp/lib3mf_implicit.hpp @@ -420,6 +420,9 @@ class ELib3MFException : public std::exception { case LIB3MF_ERROR_EMPTYNAMESPACE: return "EMPTYNAMESPACE"; case LIB3MF_ERROR_INVALIDNAMESPACEPREFIX: return "INVALIDNAMESPACEPREFIX"; case LIB3MF_ERROR_WRITERDOESNOTSUPPORTNAMESPACES: return "WRITERDOESNOTSUPPORTNAMESPACES"; + case LIB3MF_ERROR_TOOLPATH_INVALIDHATCHCOORDINATE: return "TOOLPATH_INVALIDHATCHCOORDINATE"; + case LIB3MF_ERROR_TOOLPATH_INVALIDPOINTCOORDINATE: return "TOOLPATH_INVALIDPOINTCOORDINATE"; + case LIB3MF_ERROR_TOOLPATH_INVALIDHATCHCOUNT: return "TOOLPATH_INVALIDHATCHCOUNT"; } return "UNKNOWN"; } @@ -485,6 +488,9 @@ class ELib3MFException : public std::exception { case LIB3MF_ERROR_EMPTYNAMESPACE: return "Empty namespace."; case LIB3MF_ERROR_INVALIDNAMESPACEPREFIX: return "Invalid namespace prefix."; case LIB3MF_ERROR_WRITERDOESNOTSUPPORTNAMESPACES: return "Writer does not support namespaces."; + case LIB3MF_ERROR_TOOLPATH_INVALIDHATCHCOORDINATE: return "Invalid hatch coordinate."; + case LIB3MF_ERROR_TOOLPATH_INVALIDPOINTCOORDINATE: return "Invalid point coordinate."; + case LIB3MF_ERROR_TOOLPATH_INVALIDHATCHCOUNT: return "Invalid hatch count"; } return "unknown error"; } @@ -1677,7 +1683,8 @@ class CToolpathLayerReader : public CBase { inline std::string GetSegmentPartUUID(const Lib3MF_uint32 nIndex); inline Lib3MF_uint32 GetSegmentLocalPartID(const Lib3MF_uint32 nIndex); inline std::string GetPartUUIDByLocalPartID(const Lib3MF_uint32 nLocalPartID); - inline void GetSegmentPointData(const Lib3MF_uint32 nIndex, std::vector & PointDataBuffer); + inline void GetSegmentPointDataInModelUnits(const Lib3MF_uint32 nIndex, std::vector & PointDataBuffer); + inline void GetSegmentPointDataDiscrete(const Lib3MF_uint32 nIndex, std::vector & PointDataBuffer); inline void FindAttributeInfoByName(const std::string & sNameSpace, const std::string & sAttributeName, Lib3MF_uint32 & nID, eToolpathAttributeType & eAttributeType); inline Lib3MF_uint32 FindAttributeIDByName(const std::string & sNameSpace, const std::string & sAttributeName); inline eToolpathAttributeType FindAttributeValueByName(const std::string & sNameSpace, const std::string & sAttributeName); @@ -1709,9 +1716,14 @@ class CToolpathLayerData : public CBase { inline Lib3MF_uint32 RegisterBuildItem(classParam pBuildItem); inline void SetSegmentAttribute(const std::string & sNameSpace, const std::string & sAttributeName, const std::string & sValue); inline void ClearSegmentAttributes(); - inline void WriteHatchData(const Lib3MF_uint32 nProfileID, const Lib3MF_uint32 nPartID, const CInputVector & PointDataBuffer); - inline void WriteLoop(const Lib3MF_uint32 nProfileID, const Lib3MF_uint32 nPartID, const CInputVector & PointDataBuffer); - inline void WritePolyline(const Lib3MF_uint32 nProfileID, const Lib3MF_uint32 nPartID, const CInputVector & PointDataBuffer); + inline void AddCustomLineAttributes(const std::string & sNameSpace, const std::string & sAttributeName, const CInputVector & ValuesBuffer); + inline void ClearCustomLineAttributes(); + inline void WriteHatchDataInModelUnits(const Lib3MF_uint32 nProfileID, const Lib3MF_uint32 nPartID, const bool bWriteCustomLineAttributes, const CInputVector & HatchDataBuffer); + inline void WriteHatchDataDiscrete(const Lib3MF_uint32 nProfileID, const Lib3MF_uint32 nPartID, const bool bWriteCustomLineAttributes, const CInputVector & HatchDataBuffer); + inline void WriteLoopInModelUnits(const Lib3MF_uint32 nProfileID, const Lib3MF_uint32 nPartID, const bool bWriteCustomLineAttributes, const CInputVector & PointDataBuffer); + inline void WriteLoopDiscrete(const Lib3MF_uint32 nProfileID, const Lib3MF_uint32 nPartID, const bool bWriteCustomLineAttributes, const CInputVector & PointDataBuffer); + inline void WritePolylineInModelUnits(const Lib3MF_uint32 nProfileID, const Lib3MF_uint32 nPartID, const bool bWriteCustomLineAttributes, const CInputVector & PointDataBuffer); + inline void WritePolylineDiscrete(const Lib3MF_uint32 nProfileID, const Lib3MF_uint32 nPartID, const bool bWriteCustomLineAttributes, const CInputVector & PointDataBuffer); inline PCustomDOMTree AddCustomData(const std::string & sNameSpace, const std::string & sDataName); inline void Finish(); }; @@ -1730,6 +1742,8 @@ class CToolpath : public CResource { { } + inline std::string GetUUID(); + inline std::string ResetUUID(); inline Lib3MF_double GetUnits(); inline Lib3MF_uint32 GetLayerCount(); inline Lib3MF_uint32 GetProfileCount(); @@ -1740,7 +1754,9 @@ class CToolpath : public CResource { inline PToolpathLayerReader ReadLayerData(const Lib3MF_uint32 nIndex); inline std::string GetLayerPath(const Lib3MF_uint32 nIndex); inline Lib3MF_uint32 GetLayerZMax(const Lib3MF_uint32 nIndex); - inline Lib3MF_uint32 GetLayerZ(const Lib3MF_uint32 nLayerIndex); + inline Lib3MF_uint32 GetLayerZMin(const Lib3MF_uint32 nIndex); + inline Lib3MF_uint32 GetLayerThickness(const Lib3MF_uint32 nIndex); + inline bool HasUniformThickness(); inline PToolpathProfile AddProfile(const std::string & sName); inline PToolpathProfile GetProfile(const Lib3MF_uint32 nProfileIndex); inline PToolpathProfile GetProfileUUID(const std::string & sProfileUUID); @@ -1753,8 +1769,8 @@ class CToolpath : public CResource { inline PCustomDOMTree AddCustomData(const std::string & sNameSpace, const std::string & sDataName); inline Lib3MF_uint32 ClearCustomData(); inline bool DeleteCustomData(classParam pData); - inline void RegisterCustomIntegerAttribute(const std::string & sNameSpace, const std::string & sAttributeName); - inline void RegisterCustomDoubleAttribute(const std::string & sNameSpace, const std::string & sAttributeName); + inline void RegisterCustomIntegerSegmentAttribute(const std::string & sNameSpace, const std::string & sAttributeName); + inline void RegisterCustomDoubleSegmentAttribute(const std::string & sNameSpace, const std::string & sAttributeName); }; /************************************************************************************************************************* @@ -6453,17 +6469,31 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle) } /** - * CToolpathLayerReader::GetSegmentPointData - Retrieves the assigned segment point list. For type hatch, the points are taken pairwise. + * CToolpathLayerReader::GetSegmentPointDataInModelUnits - Retrieves the assigned segment point list. For type hatch, the points are taken pairwise. + * @param[in] nIndex - Index. Must be between 0 and Count - 1. + * @param[out] PointDataBuffer - The point data array. The point coordinates are in model units. + */ + void CToolpathLayerReader::GetSegmentPointDataInModelUnits(const Lib3MF_uint32 nIndex, std::vector & PointDataBuffer) + { + Lib3MF_uint64 elementsNeededPointData = 0; + Lib3MF_uint64 elementsWrittenPointData = 0; + CheckError(lib3mf_toolpathlayerreader_getsegmentpointdatainmodelunits(m_pHandle, nIndex, 0, &elementsNeededPointData, nullptr)); + PointDataBuffer.resize((size_t) elementsNeededPointData); + CheckError(lib3mf_toolpathlayerreader_getsegmentpointdatainmodelunits(m_pHandle, nIndex, elementsNeededPointData, &elementsWrittenPointData, PointDataBuffer.data())); + } + + /** + * CToolpathLayerReader::GetSegmentPointDataDiscrete - Retrieves the assigned segment point list in units. For type hatch, the points are taken pairwise. * @param[in] nIndex - Index. Must be between 0 and Count - 1. - * @param[out] PointDataBuffer - The point data array + * @param[out] PointDataBuffer - The point data array. The point coordinates are in toolpath units. */ - void CToolpathLayerReader::GetSegmentPointData(const Lib3MF_uint32 nIndex, std::vector & PointDataBuffer) + void CToolpathLayerReader::GetSegmentPointDataDiscrete(const Lib3MF_uint32 nIndex, std::vector & PointDataBuffer) { Lib3MF_uint64 elementsNeededPointData = 0; Lib3MF_uint64 elementsWrittenPointData = 0; - CheckError(lib3mf_toolpathlayerreader_getsegmentpointdata(m_pHandle, nIndex, 0, &elementsNeededPointData, nullptr)); + CheckError(lib3mf_toolpathlayerreader_getsegmentpointdatadiscrete(m_pHandle, nIndex, 0, &elementsNeededPointData, nullptr)); PointDataBuffer.resize((size_t) elementsNeededPointData); - CheckError(lib3mf_toolpathlayerreader_getsegmentpointdata(m_pHandle, nIndex, elementsNeededPointData, &elementsWrittenPointData, PointDataBuffer.data())); + CheckError(lib3mf_toolpathlayerreader_getsegmentpointdatadiscrete(m_pHandle, nIndex, elementsNeededPointData, &elementsWrittenPointData, PointDataBuffer.data())); } /** @@ -6679,36 +6709,94 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle) } /** - * CToolpathLayerData::WriteHatchData - writes hatch data to the layer. + * CToolpathLayerData::AddCustomLineAttributes - Stores custom line attributes for the next WriteLoop, WritePolyline or WriteHatchData call. + * @param[in] sNameSpace - The namespace of the attribute to register. + * @param[in] sAttributeName - The name of the attribute to register. + * @param[in] ValuesBuffer - Custom Values to store on segment lines. Array MUST NOT be empty. If custom attributes had been already defined, the error cardinality MUST match, or an error will be thrown. + */ + void CToolpathLayerData::AddCustomLineAttributes(const std::string & sNameSpace, const std::string & sAttributeName, const CInputVector & ValuesBuffer) + { + CheckError(lib3mf_toolpathlayerdata_addcustomlineattributes(m_pHandle, sNameSpace.c_str(), sAttributeName.c_str(), (Lib3MF_uint64)ValuesBuffer.size(), ValuesBuffer.data())); + } + + /** + * CToolpathLayerData::ClearCustomLineAttributes - Clears all custom line attributes. Any call to WriteLoop, WritePolyline or WriteHatchData will do this implicitely. + */ + void CToolpathLayerData::ClearCustomLineAttributes() + { + CheckError(lib3mf_toolpathlayerdata_clearcustomlineattributes(m_pHandle)); + } + + /** + * CToolpathLayerData::WriteHatchDataInModelUnits - writes hatch data to the layer in model units. + * @param[in] nProfileID - The toolpath profile to use + * @param[in] nPartID - The toolpath part to use + * @param[in] bWriteCustomLineAttributes - If true, custom line attributes are written. The cardinality of each custom attribute MUST be equal to the number of hatches in the hatchdata array. In any case, stored custom attributes will be cleared after the call. + * @param[in] HatchDataBuffer - The hatch data in model units. Array MUST NOT be empty. + */ + void CToolpathLayerData::WriteHatchDataInModelUnits(const Lib3MF_uint32 nProfileID, const Lib3MF_uint32 nPartID, const bool bWriteCustomLineAttributes, const CInputVector & HatchDataBuffer) + { + CheckError(lib3mf_toolpathlayerdata_writehatchdatainmodelunits(m_pHandle, nProfileID, nPartID, bWriteCustomLineAttributes, (Lib3MF_uint64)HatchDataBuffer.size(), HatchDataBuffer.data())); + } + + /** + * CToolpathLayerData::WriteHatchDataDiscrete - writes hatch data to the layer in toolpath units. * @param[in] nProfileID - The toolpath profile to use * @param[in] nPartID - The toolpath part to use - * @param[in] PointDataBuffer - The point data + * @param[in] bWriteCustomLineAttributes - If true, custom line attributes are written. The cardinality of each custom attribute MUST be equal to the number of hatches in the hatchdata array. In any case, stored custom attributes will be cleared after the call. + * @param[in] HatchDataBuffer - The hatch data in toolpath units. Array MUST NOT be empty. */ - void CToolpathLayerData::WriteHatchData(const Lib3MF_uint32 nProfileID, const Lib3MF_uint32 nPartID, const CInputVector & PointDataBuffer) + void CToolpathLayerData::WriteHatchDataDiscrete(const Lib3MF_uint32 nProfileID, const Lib3MF_uint32 nPartID, const bool bWriteCustomLineAttributes, const CInputVector & HatchDataBuffer) { - CheckError(lib3mf_toolpathlayerdata_writehatchdata(m_pHandle, nProfileID, nPartID, (Lib3MF_uint64)PointDataBuffer.size(), PointDataBuffer.data())); + CheckError(lib3mf_toolpathlayerdata_writehatchdatadiscrete(m_pHandle, nProfileID, nPartID, bWriteCustomLineAttributes, (Lib3MF_uint64)HatchDataBuffer.size(), HatchDataBuffer.data())); } /** - * CToolpathLayerData::WriteLoop - writes loop data to the layer. + * CToolpathLayerData::WriteLoopInModelUnits - writes loop data to the layer in model units. * @param[in] nProfileID - The toolpath profile to use * @param[in] nPartID - The toolpath part to use - * @param[in] PointDataBuffer - The point data + * @param[in] bWriteCustomLineAttributes - If true, custom line attributes are written. The cardinality of each custom attribute MUST be equal to the number of points in the pointdata array. In any case, stored custom attributes will be cleared after the call. + * @param[in] PointDataBuffer - The point data in model units. Array MUST NOT be empty. */ - void CToolpathLayerData::WriteLoop(const Lib3MF_uint32 nProfileID, const Lib3MF_uint32 nPartID, const CInputVector & PointDataBuffer) + void CToolpathLayerData::WriteLoopInModelUnits(const Lib3MF_uint32 nProfileID, const Lib3MF_uint32 nPartID, const bool bWriteCustomLineAttributes, const CInputVector & PointDataBuffer) { - CheckError(lib3mf_toolpathlayerdata_writeloop(m_pHandle, nProfileID, nPartID, (Lib3MF_uint64)PointDataBuffer.size(), PointDataBuffer.data())); + CheckError(lib3mf_toolpathlayerdata_writeloopinmodelunits(m_pHandle, nProfileID, nPartID, bWriteCustomLineAttributes, (Lib3MF_uint64)PointDataBuffer.size(), PointDataBuffer.data())); } /** - * CToolpathLayerData::WritePolyline - writes polyline data to the layer. + * CToolpathLayerData::WriteLoopDiscrete - writes loop data to the layer in toolpath units. * @param[in] nProfileID - The toolpath profile to use * @param[in] nPartID - The toolpath part to use - * @param[in] PointDataBuffer - The point data + * @param[in] bWriteCustomLineAttributes - If true, custom line attributes are written. The cardinality of each custom attribute MUST be equal to the number of points in the pointdata array. In any case, stored custom attributes will be cleared after the call. + * @param[in] PointDataBuffer - The point data in toolpath units. Array MUST NOT be empty. */ - void CToolpathLayerData::WritePolyline(const Lib3MF_uint32 nProfileID, const Lib3MF_uint32 nPartID, const CInputVector & PointDataBuffer) + void CToolpathLayerData::WriteLoopDiscrete(const Lib3MF_uint32 nProfileID, const Lib3MF_uint32 nPartID, const bool bWriteCustomLineAttributes, const CInputVector & PointDataBuffer) { - CheckError(lib3mf_toolpathlayerdata_writepolyline(m_pHandle, nProfileID, nPartID, (Lib3MF_uint64)PointDataBuffer.size(), PointDataBuffer.data())); + CheckError(lib3mf_toolpathlayerdata_writeloopdiscrete(m_pHandle, nProfileID, nPartID, bWriteCustomLineAttributes, (Lib3MF_uint64)PointDataBuffer.size(), PointDataBuffer.data())); + } + + /** + * CToolpathLayerData::WritePolylineInModelUnits - writes polyline data to the layer. + * @param[in] nProfileID - The toolpath profile to use + * @param[in] nPartID - The toolpath part to use + * @param[in] bWriteCustomLineAttributes - If true, custom line attributes are written. The cardinality of each custom attribute MUST be equal to the number of points in the pointdata array. In any case, stored custom attributes will be cleared after the call. + * @param[in] PointDataBuffer - The point data in model units. Array MUST NOT be empty. + */ + void CToolpathLayerData::WritePolylineInModelUnits(const Lib3MF_uint32 nProfileID, const Lib3MF_uint32 nPartID, const bool bWriteCustomLineAttributes, const CInputVector & PointDataBuffer) + { + CheckError(lib3mf_toolpathlayerdata_writepolylineinmodelunits(m_pHandle, nProfileID, nPartID, bWriteCustomLineAttributes, (Lib3MF_uint64)PointDataBuffer.size(), PointDataBuffer.data())); + } + + /** + * CToolpathLayerData::WritePolylineDiscrete - writes polyline data to the layer. + * @param[in] nProfileID - The toolpath profile to use + * @param[in] nPartID - The toolpath part to use + * @param[in] bWriteCustomLineAttributes - If true, custom line attributes are written. The cardinality of each custom attribute MUST be equal to the number of points in the pointdata array. In any case, stored custom attributes will be cleared after the call. + * @param[in] PointDataBuffer - The point data in toolpath units. Array MUST NOT be empty. + */ + void CToolpathLayerData::WritePolylineDiscrete(const Lib3MF_uint32 nProfileID, const Lib3MF_uint32 nPartID, const bool bWriteCustomLineAttributes, const CInputVector & PointDataBuffer) + { + CheckError(lib3mf_toolpathlayerdata_writepolylinediscrete(m_pHandle, nProfileID, nPartID, bWriteCustomLineAttributes, (Lib3MF_uint64)PointDataBuffer.size(), PointDataBuffer.data())); } /** @@ -6741,7 +6829,37 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle) */ /** - * CToolpath::GetUnits - Retrieves the unit factor + * CToolpath::GetUUID - Retrieves the UUID of the toolpath + * @return UUID Value. + */ + std::string CToolpath::GetUUID() + { + Lib3MF_uint32 bytesNeededUUID = 0; + Lib3MF_uint32 bytesWrittenUUID = 0; + CheckError(lib3mf_toolpath_getuuid(m_pHandle, 0, &bytesNeededUUID, nullptr)); + std::vector bufferUUID(bytesNeededUUID); + CheckError(lib3mf_toolpath_getuuid(m_pHandle, bytesNeededUUID, &bytesWrittenUUID, &bufferUUID[0])); + + return std::string(&bufferUUID[0]); + } + + /** + * CToolpath::ResetUUID - Generates a new unique identifier for this toolpath and sets its value. + * @return Newly created UUID Value. + */ + std::string CToolpath::ResetUUID() + { + Lib3MF_uint32 bytesNeededNewUUID = 0; + Lib3MF_uint32 bytesWrittenNewUUID = 0; + CheckError(lib3mf_toolpath_resetuuid(m_pHandle, 0, &bytesNeededNewUUID, nullptr)); + std::vector bufferNewUUID(bytesNeededNewUUID); + CheckError(lib3mf_toolpath_resetuuid(m_pHandle, bytesNeededNewUUID, &bytesWrittenNewUUID, &bufferNewUUID[0])); + + return std::string(&bufferNewUUID[0]); + } + + /** + * CToolpath::GetUnits - Retrieves the unit factor, i.e. how many model units are one toolpath unit. * @return Returns the unit factor. */ Lib3MF_double CToolpath::GetUnits() @@ -6778,7 +6896,7 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle) /** * CToolpath::AddLayer - Adds a new toolpath layer - * @param[in] nZMax - ZMax value of the layer. MUST be larger than the last layer added, as well as larger as BottomZ. + * @param[in] nZMax - ZMax value of the layer in toolpath units. MUST be larger than the last layer added, as well as larger as BottomZ. * @param[in] sPath - Package Path * @param[in] pModelWriter - The model writer that writes out the 3MF. * @return Returns the layerdata object to write the layer content into. @@ -6797,7 +6915,7 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle) /** * CToolpath::GetBottomZ - Returns the bottom Z Value of the toolpath. - * @return BottomZ value + * @return BottomZ value in Toolpath units */ Lib3MF_uint32 CToolpath::GetBottomZ() { @@ -6809,7 +6927,7 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle) /** * CToolpath::SetBottomZ - Sets the bottom Z Value of the toolpath. Will fail if a layer is already existing. - * @param[in] nBottomZ - BottomZ value + * @param[in] nBottomZ - BottomZ value in Toolpath units */ void CToolpath::SetBottomZ(const Lib3MF_uint32 nBottomZ) { @@ -6817,7 +6935,7 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle) } /** - * CToolpath::GetLayerAttachment - Retrieves the Attachment of a layer + * CToolpath::GetLayerAttachment - Retrieves the Attachment that contains the layer data. * @param[in] nIndex - Layer Index * @return Attachment */ @@ -6867,7 +6985,7 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle) /** * CToolpath::GetLayerZMax - Retrieves the ZMax of a layer * @param[in] nIndex - Layer Index - * @return ZMax value + * @return ZMax value in toolpath units */ Lib3MF_uint32 CToolpath::GetLayerZMax(const Lib3MF_uint32 nIndex) { @@ -6878,16 +6996,41 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle) } /** - * CToolpath::GetLayerZ - Return the z value of a layer in units. - * @param[in] nLayerIndex - Layer Index. - * @return Z Value in Units. + * CToolpath::GetLayerZMin - Retrieves the Minimum Z of a layer + * @param[in] nIndex - Layer Index + * @return ZMin value in toolpath units + */ + Lib3MF_uint32 CToolpath::GetLayerZMin(const Lib3MF_uint32 nIndex) + { + Lib3MF_uint32 resultZMin = 0; + CheckError(lib3mf_toolpath_getlayerzmin(m_pHandle, nIndex, &resultZMin)); + + return resultZMin; + } + + /** + * CToolpath::GetLayerThickness - Retrieves the Thickness of a layer + * @param[in] nIndex - Layer Index + * @return Thickness value in toolpath units + */ + Lib3MF_uint32 CToolpath::GetLayerThickness(const Lib3MF_uint32 nIndex) + { + Lib3MF_uint32 resultZThickness = 0; + CheckError(lib3mf_toolpath_getlayerthickness(m_pHandle, nIndex, &resultZThickness)); + + return resultZThickness; + } + + /** + * CToolpath::HasUniformThickness - Checks if the toolpath has a uniform thickness value, i.e. each layer has the same thickness. + * @return Returns true if the layer thicknesses are uniform, returns false otherwise. */ - Lib3MF_uint32 CToolpath::GetLayerZ(const Lib3MF_uint32 nLayerIndex) + bool CToolpath::HasUniformThickness() { - Lib3MF_uint32 resultZValue = 0; - CheckError(lib3mf_toolpath_getlayerz(m_pHandle, nLayerIndex, &resultZValue)); + bool resultUniformThickness = 0; + CheckError(lib3mf_toolpath_hasuniformthickness(m_pHandle, &resultUniformThickness)); - return resultZValue; + return resultUniformThickness; } /** @@ -7077,23 +7220,23 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle) } /** - * CToolpath::RegisterCustomIntegerAttribute - Registers an Integer Attribute that each segment holds. + * CToolpath::RegisterCustomIntegerSegmentAttribute - Registers an Integer Attribute that each segment holds. * @param[in] sNameSpace - Namespace of the custom data tree. MUST not be empty. * @param[in] sAttributeName - Attribute name. MUST not be empty. */ - void CToolpath::RegisterCustomIntegerAttribute(const std::string & sNameSpace, const std::string & sAttributeName) + void CToolpath::RegisterCustomIntegerSegmentAttribute(const std::string & sNameSpace, const std::string & sAttributeName) { - CheckError(lib3mf_toolpath_registercustomintegerattribute(m_pHandle, sNameSpace.c_str(), sAttributeName.c_str())); + CheckError(lib3mf_toolpath_registercustomintegersegmentattribute(m_pHandle, sNameSpace.c_str(), sAttributeName.c_str())); } /** - * CToolpath::RegisterCustomDoubleAttribute - Registers a Double Attribute that each segment holds. Registering only applies to reader or writer objects created after the call. + * CToolpath::RegisterCustomDoubleSegmentAttribute - Registers a Double Attribute that each segment holds. Registering only applies to reader or writer objects created after the call. * @param[in] sNameSpace - Namespace of the custom data tree. MUST not be empty. * @param[in] sAttributeName - Attribute name. MUST not be empty. */ - void CToolpath::RegisterCustomDoubleAttribute(const std::string & sNameSpace, const std::string & sAttributeName) + void CToolpath::RegisterCustomDoubleSegmentAttribute(const std::string & sNameSpace, const std::string & sAttributeName) { - CheckError(lib3mf_toolpath_registercustomdoubleattribute(m_pHandle, sNameSpace.c_str(), sAttributeName.c_str())); + CheckError(lib3mf_toolpath_registercustomdoublesegmentattribute(m_pHandle, sNameSpace.c_str(), sAttributeName.c_str())); } /** diff --git a/Autogenerated/Bindings/Cpp/lib3mf_types.hpp b/Autogenerated/Bindings/Cpp/lib3mf_types.hpp index d7b8241ca..1388fa59f 100644 --- a/Autogenerated/Bindings/Cpp/lib3mf_types.hpp +++ b/Autogenerated/Bindings/Cpp/lib3mf_types.hpp @@ -150,6 +150,9 @@ typedef void * Lib3MF_pvoid; #define LIB3MF_ERROR_EMPTYNAMESPACE 4007 /** Empty namespace. */ #define LIB3MF_ERROR_INVALIDNAMESPACEPREFIX 4008 /** Invalid namespace prefix. */ #define LIB3MF_ERROR_WRITERDOESNOTSUPPORTNAMESPACES 4009 /** Writer does not support namespaces. */ +#define LIB3MF_ERROR_TOOLPATH_INVALIDHATCHCOORDINATE 4010 /** Invalid hatch coordinate. */ +#define LIB3MF_ERROR_TOOLPATH_INVALIDPOINTCOORDINATE 4011 /** Invalid point coordinate. */ +#define LIB3MF_ERROR_TOOLPATH_INVALIDHATCHCOUNT 4012 /** Invalid hatch count */ /************************************************************************************************************************* Error strings for Lib3MF @@ -215,6 +218,9 @@ inline const char * LIB3MF_GETERRORSTRING (Lib3MFResult nErrorCode) { case LIB3MF_ERROR_EMPTYNAMESPACE: return "Empty namespace."; case LIB3MF_ERROR_INVALIDNAMESPACEPREFIX: return "Invalid namespace prefix."; case LIB3MF_ERROR_WRITERDOESNOTSUPPORTNAMESPACES: return "Writer does not support namespaces."; + case LIB3MF_ERROR_TOOLPATH_INVALIDHATCHCOORDINATE: return "Invalid hatch coordinate."; + case LIB3MF_ERROR_TOOLPATH_INVALIDPOINTCOORDINATE: return "Invalid point coordinate."; + case LIB3MF_ERROR_TOOLPATH_INVALIDHATCHCOUNT: return "Invalid hatch count"; default: return "unknown error"; } } @@ -457,6 +463,20 @@ namespace Lib3MF { Lib3MF_single m_Coordinates[2]; } sPosition2D; + typedef struct sDiscretePosition2D { + Lib3MF_int32 m_Coordinates[2]; + } sDiscretePosition2D; + + typedef struct sHatch2D { + Lib3MF_single m_Point1Coordinates[2]; + Lib3MF_single m_Point2Coordinates[2]; + } sHatch2D; + + typedef struct sDiscreteHatch2D { + Lib3MF_int32 m_Point1Coordinates[2]; + Lib3MF_int32 m_Point2Coordinates[2]; + } sDiscreteHatch2D; + typedef struct sCompositeConstituent { Lib3MF_uint32 m_PropertyID; Lib3MF_double m_MixingRatio; @@ -607,6 +627,9 @@ typedef Lib3MF::sTriangle sLib3MFTriangle; typedef Lib3MF::sTriangleProperties sLib3MFTriangleProperties; typedef Lib3MF::sPosition sLib3MFPosition; typedef Lib3MF::sPosition2D sLib3MFPosition2D; +typedef Lib3MF::sDiscretePosition2D sLib3MFDiscretePosition2D; +typedef Lib3MF::sHatch2D sLib3MFHatch2D; +typedef Lib3MF::sDiscreteHatch2D sLib3MFDiscreteHatch2D; typedef Lib3MF::sCompositeConstituent sLib3MFCompositeConstituent; typedef Lib3MF::sMultiPropertyLayer sLib3MFMultiPropertyLayer; typedef Lib3MF::sTex2Coord sLib3MFTex2Coord; diff --git a/Autogenerated/Bindings/CppDynamic/lib3mf_dynamic.h b/Autogenerated/Bindings/CppDynamic/lib3mf_dynamic.h index 88cf46334..55f923282 100644 --- a/Autogenerated/Bindings/CppDynamic/lib3mf_dynamic.h +++ b/Autogenerated/Bindings/CppDynamic/lib3mf_dynamic.h @@ -3350,10 +3350,22 @@ typedef Lib3MFResult (*PLib3MFToolpathLayerReader_GetPartUUIDByLocalPartIDPtr) ( * @param[in] nIndex - Index. Must be between 0 and Count - 1. * @param[in] nPointDataBufferSize - Number of elements in buffer * @param[out] pPointDataNeededCount - will be filled with the count of the written elements, or needed buffer size. -* @param[out] pPointDataBuffer - Position2D buffer of The point data array +* @param[out] pPointDataBuffer - Position2D buffer of The point data array. The point coordinates are in model units. * @return error code or 0 (success) */ -typedef Lib3MFResult (*PLib3MFToolpathLayerReader_GetSegmentPointDataPtr) (Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nIndex, const Lib3MF_uint64 nPointDataBufferSize, Lib3MF_uint64* pPointDataNeededCount, Lib3MF::sPosition2D * pPointDataBuffer); +typedef Lib3MFResult (*PLib3MFToolpathLayerReader_GetSegmentPointDataInModelUnitsPtr) (Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nIndex, const Lib3MF_uint64 nPointDataBufferSize, Lib3MF_uint64* pPointDataNeededCount, Lib3MF::sPosition2D * pPointDataBuffer); + +/** +* Retrieves the assigned segment point list in units. For type hatch, the points are taken pairwise. +* +* @param[in] pToolpathLayerReader - ToolpathLayerReader instance. +* @param[in] nIndex - Index. Must be between 0 and Count - 1. +* @param[in] nPointDataBufferSize - Number of elements in buffer +* @param[out] pPointDataNeededCount - will be filled with the count of the written elements, or needed buffer size. +* @param[out] pPointDataBuffer - DiscretePosition2D buffer of The point data array. The point coordinates are in toolpath units. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFToolpathLayerReader_GetSegmentPointDataDiscretePtr) (Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nIndex, const Lib3MF_uint64 nPointDataBufferSize, Lib3MF_uint64* pPointDataNeededCount, Lib3MF::sDiscretePosition2D * pPointDataBuffer); /** * Retrieves a segment attribute Information by Attribute Name. Will fail if Attribute does not exist. @@ -3524,28 +3536,76 @@ typedef Lib3MFResult (*PLib3MFToolpathLayerData_SetSegmentAttributePtr) (Lib3MF_ typedef Lib3MFResult (*PLib3MFToolpathLayerData_ClearSegmentAttributesPtr) (Lib3MF_ToolpathLayerData pToolpathLayerData); /** -* writes hatch data to the layer. +* Stores custom line attributes for the next WriteLoop, WritePolyline or WriteHatchData call. +* +* @param[in] pToolpathLayerData - ToolpathLayerData instance. +* @param[in] pNameSpace - The namespace of the attribute to register. +* @param[in] pAttributeName - The name of the attribute to register. +* @param[in] nValuesBufferSize - Number of elements in buffer +* @param[in] pValuesBuffer - int32 buffer of Custom Values to store on segment lines. Array MUST NOT be empty. If custom attributes had been already defined, the error cardinality MUST match, or an error will be thrown. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFToolpathLayerData_AddCustomLineAttributesPtr) (Lib3MF_ToolpathLayerData pToolpathLayerData, const char * pNameSpace, const char * pAttributeName, Lib3MF_uint64 nValuesBufferSize, const Lib3MF_int32 * pValuesBuffer); + +/** +* Clears all custom line attributes. Any call to WriteLoop, WritePolyline or WriteHatchData will do this implicitely. +* +* @param[in] pToolpathLayerData - ToolpathLayerData instance. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFToolpathLayerData_ClearCustomLineAttributesPtr) (Lib3MF_ToolpathLayerData pToolpathLayerData); + +/** +* writes hatch data to the layer in model units. +* +* @param[in] pToolpathLayerData - ToolpathLayerData instance. +* @param[in] nProfileID - The toolpath profile to use +* @param[in] nPartID - The toolpath part to use +* @param[in] bWriteCustomLineAttributes - If true, custom line attributes are written. The cardinality of each custom attribute MUST be equal to the number of hatches in the hatchdata array. In any case, stored custom attributes will be cleared after the call. +* @param[in] nHatchDataBufferSize - Number of elements in buffer +* @param[in] pHatchDataBuffer - Hatch2D buffer of The hatch data in model units. Array MUST NOT be empty. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFToolpathLayerData_WriteHatchDataInModelUnitsPtr) (Lib3MF_ToolpathLayerData pToolpathLayerData, Lib3MF_uint32 nProfileID, Lib3MF_uint32 nPartID, bool bWriteCustomLineAttributes, Lib3MF_uint64 nHatchDataBufferSize, const Lib3MF::sHatch2D * pHatchDataBuffer); + +/** +* writes hatch data to the layer in toolpath units. +* +* @param[in] pToolpathLayerData - ToolpathLayerData instance. +* @param[in] nProfileID - The toolpath profile to use +* @param[in] nPartID - The toolpath part to use +* @param[in] bWriteCustomLineAttributes - If true, custom line attributes are written. The cardinality of each custom attribute MUST be equal to the number of hatches in the hatchdata array. In any case, stored custom attributes will be cleared after the call. +* @param[in] nHatchDataBufferSize - Number of elements in buffer +* @param[in] pHatchDataBuffer - DiscreteHatch2D buffer of The hatch data in toolpath units. Array MUST NOT be empty. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFToolpathLayerData_WriteHatchDataDiscretePtr) (Lib3MF_ToolpathLayerData pToolpathLayerData, Lib3MF_uint32 nProfileID, Lib3MF_uint32 nPartID, bool bWriteCustomLineAttributes, Lib3MF_uint64 nHatchDataBufferSize, const Lib3MF::sDiscreteHatch2D * pHatchDataBuffer); + +/** +* writes loop data to the layer in model units. * * @param[in] pToolpathLayerData - ToolpathLayerData instance. * @param[in] nProfileID - The toolpath profile to use * @param[in] nPartID - The toolpath part to use +* @param[in] bWriteCustomLineAttributes - If true, custom line attributes are written. The cardinality of each custom attribute MUST be equal to the number of points in the pointdata array. In any case, stored custom attributes will be cleared after the call. * @param[in] nPointDataBufferSize - Number of elements in buffer -* @param[in] pPointDataBuffer - Position2D buffer of The point data +* @param[in] pPointDataBuffer - Position2D buffer of The point data in model units. Array MUST NOT be empty. * @return error code or 0 (success) */ -typedef Lib3MFResult (*PLib3MFToolpathLayerData_WriteHatchDataPtr) (Lib3MF_ToolpathLayerData pToolpathLayerData, Lib3MF_uint32 nProfileID, Lib3MF_uint32 nPartID, Lib3MF_uint64 nPointDataBufferSize, const Lib3MF::sPosition2D * pPointDataBuffer); +typedef Lib3MFResult (*PLib3MFToolpathLayerData_WriteLoopInModelUnitsPtr) (Lib3MF_ToolpathLayerData pToolpathLayerData, Lib3MF_uint32 nProfileID, Lib3MF_uint32 nPartID, bool bWriteCustomLineAttributes, Lib3MF_uint64 nPointDataBufferSize, const Lib3MF::sPosition2D * pPointDataBuffer); /** -* writes loop data to the layer. +* writes loop data to the layer in toolpath units. * * @param[in] pToolpathLayerData - ToolpathLayerData instance. * @param[in] nProfileID - The toolpath profile to use * @param[in] nPartID - The toolpath part to use +* @param[in] bWriteCustomLineAttributes - If true, custom line attributes are written. The cardinality of each custom attribute MUST be equal to the number of points in the pointdata array. In any case, stored custom attributes will be cleared after the call. * @param[in] nPointDataBufferSize - Number of elements in buffer -* @param[in] pPointDataBuffer - Position2D buffer of The point data +* @param[in] pPointDataBuffer - DiscretePosition2D buffer of The point data in toolpath units. Array MUST NOT be empty. * @return error code or 0 (success) */ -typedef Lib3MFResult (*PLib3MFToolpathLayerData_WriteLoopPtr) (Lib3MF_ToolpathLayerData pToolpathLayerData, Lib3MF_uint32 nProfileID, Lib3MF_uint32 nPartID, Lib3MF_uint64 nPointDataBufferSize, const Lib3MF::sPosition2D * pPointDataBuffer); +typedef Lib3MFResult (*PLib3MFToolpathLayerData_WriteLoopDiscretePtr) (Lib3MF_ToolpathLayerData pToolpathLayerData, Lib3MF_uint32 nProfileID, Lib3MF_uint32 nPartID, bool bWriteCustomLineAttributes, Lib3MF_uint64 nPointDataBufferSize, const Lib3MF::sDiscretePosition2D * pPointDataBuffer); /** * writes polyline data to the layer. @@ -3553,11 +3613,25 @@ typedef Lib3MFResult (*PLib3MFToolpathLayerData_WriteLoopPtr) (Lib3MF_ToolpathLa * @param[in] pToolpathLayerData - ToolpathLayerData instance. * @param[in] nProfileID - The toolpath profile to use * @param[in] nPartID - The toolpath part to use +* @param[in] bWriteCustomLineAttributes - If true, custom line attributes are written. The cardinality of each custom attribute MUST be equal to the number of points in the pointdata array. In any case, stored custom attributes will be cleared after the call. * @param[in] nPointDataBufferSize - Number of elements in buffer -* @param[in] pPointDataBuffer - Position2D buffer of The point data +* @param[in] pPointDataBuffer - Position2D buffer of The point data in model units. Array MUST NOT be empty. * @return error code or 0 (success) */ -typedef Lib3MFResult (*PLib3MFToolpathLayerData_WritePolylinePtr) (Lib3MF_ToolpathLayerData pToolpathLayerData, Lib3MF_uint32 nProfileID, Lib3MF_uint32 nPartID, Lib3MF_uint64 nPointDataBufferSize, const Lib3MF::sPosition2D * pPointDataBuffer); +typedef Lib3MFResult (*PLib3MFToolpathLayerData_WritePolylineInModelUnitsPtr) (Lib3MF_ToolpathLayerData pToolpathLayerData, Lib3MF_uint32 nProfileID, Lib3MF_uint32 nPartID, bool bWriteCustomLineAttributes, Lib3MF_uint64 nPointDataBufferSize, const Lib3MF::sPosition2D * pPointDataBuffer); + +/** +* writes polyline data to the layer. +* +* @param[in] pToolpathLayerData - ToolpathLayerData instance. +* @param[in] nProfileID - The toolpath profile to use +* @param[in] nPartID - The toolpath part to use +* @param[in] bWriteCustomLineAttributes - If true, custom line attributes are written. The cardinality of each custom attribute MUST be equal to the number of points in the pointdata array. In any case, stored custom attributes will be cleared after the call. +* @param[in] nPointDataBufferSize - Number of elements in buffer +* @param[in] pPointDataBuffer - DiscretePosition2D buffer of The point data in toolpath units. Array MUST NOT be empty. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFToolpathLayerData_WritePolylineDiscretePtr) (Lib3MF_ToolpathLayerData pToolpathLayerData, Lib3MF_uint32 nProfileID, Lib3MF_uint32 nPartID, bool bWriteCustomLineAttributes, Lib3MF_uint64 nPointDataBufferSize, const Lib3MF::sDiscretePosition2D * pPointDataBuffer); /** * Adds a custom data DOM tree to the layer. Layer MUST not be finished when changing the DOM tree. @@ -3583,7 +3657,29 @@ typedef Lib3MFResult (*PLib3MFToolpathLayerData_FinishPtr) (Lib3MF_ToolpathLayer **************************************************************************************************************************/ /** -* Retrieves the unit factor +* Retrieves the UUID of the toolpath +* +* @param[in] pToolpath - Toolpath instance. +* @param[in] nUUIDBufferSize - size of the buffer (including trailing 0) +* @param[out] pUUIDNeededChars - will be filled with the count of the written bytes, or needed buffer size. +* @param[out] pUUIDBuffer - buffer of UUID Value., may be NULL +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFToolpath_GetUUIDPtr) (Lib3MF_Toolpath pToolpath, const Lib3MF_uint32 nUUIDBufferSize, Lib3MF_uint32* pUUIDNeededChars, char * pUUIDBuffer); + +/** +* Generates a new unique identifier for this toolpath and sets its value. +* +* @param[in] pToolpath - Toolpath instance. +* @param[in] nNewUUIDBufferSize - size of the buffer (including trailing 0) +* @param[out] pNewUUIDNeededChars - will be filled with the count of the written bytes, or needed buffer size. +* @param[out] pNewUUIDBuffer - buffer of Newly created UUID Value., may be NULL +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFToolpath_ResetUUIDPtr) (Lib3MF_Toolpath pToolpath, const Lib3MF_uint32 nNewUUIDBufferSize, Lib3MF_uint32* pNewUUIDNeededChars, char * pNewUUIDBuffer); + +/** +* Retrieves the unit factor, i.e. how many model units are one toolpath unit. * * @param[in] pToolpath - Toolpath instance. * @param[out] pUnits - Returns the unit factor. @@ -3613,7 +3709,7 @@ typedef Lib3MFResult (*PLib3MFToolpath_GetProfileCountPtr) (Lib3MF_Toolpath pToo * Adds a new toolpath layer * * @param[in] pToolpath - Toolpath instance. -* @param[in] nZMax - ZMax value of the layer. MUST be larger than the last layer added, as well as larger as BottomZ. +* @param[in] nZMax - ZMax value of the layer in toolpath units. MUST be larger than the last layer added, as well as larger as BottomZ. * @param[in] pPath - Package Path * @param[in] pModelWriter - The model writer that writes out the 3MF. * @param[out] pLayerData - Returns the layerdata object to write the layer content into. @@ -3625,7 +3721,7 @@ typedef Lib3MFResult (*PLib3MFToolpath_AddLayerPtr) (Lib3MF_Toolpath pToolpath, * Returns the bottom Z Value of the toolpath. * * @param[in] pToolpath - Toolpath instance. -* @param[out] pBottomZ - BottomZ value +* @param[out] pBottomZ - BottomZ value in Toolpath units * @return error code or 0 (success) */ typedef Lib3MFResult (*PLib3MFToolpath_GetBottomZPtr) (Lib3MF_Toolpath pToolpath, Lib3MF_uint32 * pBottomZ); @@ -3634,13 +3730,13 @@ typedef Lib3MFResult (*PLib3MFToolpath_GetBottomZPtr) (Lib3MF_Toolpath pToolpath * Sets the bottom Z Value of the toolpath. Will fail if a layer is already existing. * * @param[in] pToolpath - Toolpath instance. -* @param[in] nBottomZ - BottomZ value +* @param[in] nBottomZ - BottomZ value in Toolpath units * @return error code or 0 (success) */ typedef Lib3MFResult (*PLib3MFToolpath_SetBottomZPtr) (Lib3MF_Toolpath pToolpath, Lib3MF_uint32 nBottomZ); /** -* Retrieves the Attachment of a layer +* Retrieves the Attachment that contains the layer data. * * @param[in] pToolpath - Toolpath instance. * @param[in] nIndex - Layer Index @@ -3676,20 +3772,39 @@ typedef Lib3MFResult (*PLib3MFToolpath_GetLayerPathPtr) (Lib3MF_Toolpath pToolpa * * @param[in] pToolpath - Toolpath instance. * @param[in] nIndex - Layer Index -* @param[out] pZMax - ZMax value +* @param[out] pZMax - ZMax value in toolpath units * @return error code or 0 (success) */ typedef Lib3MFResult (*PLib3MFToolpath_GetLayerZMaxPtr) (Lib3MF_Toolpath pToolpath, Lib3MF_uint32 nIndex, Lib3MF_uint32 * pZMax); /** -* Return the z value of a layer in units. +* Retrieves the Minimum Z of a layer +* +* @param[in] pToolpath - Toolpath instance. +* @param[in] nIndex - Layer Index +* @param[out] pZMin - ZMin value in toolpath units +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFToolpath_GetLayerZMinPtr) (Lib3MF_Toolpath pToolpath, Lib3MF_uint32 nIndex, Lib3MF_uint32 * pZMin); + +/** +* Retrieves the Thickness of a layer +* +* @param[in] pToolpath - Toolpath instance. +* @param[in] nIndex - Layer Index +* @param[out] pZThickness - Thickness value in toolpath units +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFToolpath_GetLayerThicknessPtr) (Lib3MF_Toolpath pToolpath, Lib3MF_uint32 nIndex, Lib3MF_uint32 * pZThickness); + +/** +* Checks if the toolpath has a uniform thickness value, i.e. each layer has the same thickness. * * @param[in] pToolpath - Toolpath instance. -* @param[in] nLayerIndex - Layer Index. -* @param[out] pZValue - Z Value in Units. +* @param[out] pUniformThickness - Returns true if the layer thicknesses are uniform, returns false otherwise. * @return error code or 0 (success) */ -typedef Lib3MFResult (*PLib3MFToolpath_GetLayerZPtr) (Lib3MF_Toolpath pToolpath, Lib3MF_uint32 nLayerIndex, Lib3MF_uint32 * pZValue); +typedef Lib3MFResult (*PLib3MFToolpath_HasUniformThicknessPtr) (Lib3MF_Toolpath pToolpath, bool * pUniformThickness); /** * Adds a new profile to the toolpath. @@ -3825,7 +3940,7 @@ typedef Lib3MFResult (*PLib3MFToolpath_DeleteCustomDataPtr) (Lib3MF_Toolpath pTo * @param[in] pAttributeName - Attribute name. MUST not be empty. * @return error code or 0 (success) */ -typedef Lib3MFResult (*PLib3MFToolpath_RegisterCustomIntegerAttributePtr) (Lib3MF_Toolpath pToolpath, const char * pNameSpace, const char * pAttributeName); +typedef Lib3MFResult (*PLib3MFToolpath_RegisterCustomIntegerSegmentAttributePtr) (Lib3MF_Toolpath pToolpath, const char * pNameSpace, const char * pAttributeName); /** * Registers a Double Attribute that each segment holds. Registering only applies to reader or writer objects created after the call. @@ -3835,7 +3950,7 @@ typedef Lib3MFResult (*PLib3MFToolpath_RegisterCustomIntegerAttributePtr) (Lib3M * @param[in] pAttributeName - Attribute name. MUST not be empty. * @return error code or 0 (success) */ -typedef Lib3MFResult (*PLib3MFToolpath_RegisterCustomDoubleAttributePtr) (Lib3MF_Toolpath pToolpath, const char * pNameSpace, const char * pAttributeName); +typedef Lib3MFResult (*PLib3MFToolpath_RegisterCustomDoubleSegmentAttributePtr) (Lib3MF_Toolpath pToolpath, const char * pNameSpace, const char * pAttributeName); /************************************************************************************************************************* Class definition for ToolpathIterator @@ -5535,7 +5650,8 @@ typedef struct { PLib3MFToolpathLayerReader_GetSegmentPartUUIDPtr m_ToolpathLayerReader_GetSegmentPartUUID; PLib3MFToolpathLayerReader_GetSegmentLocalPartIDPtr m_ToolpathLayerReader_GetSegmentLocalPartID; PLib3MFToolpathLayerReader_GetPartUUIDByLocalPartIDPtr m_ToolpathLayerReader_GetPartUUIDByLocalPartID; - PLib3MFToolpathLayerReader_GetSegmentPointDataPtr m_ToolpathLayerReader_GetSegmentPointData; + PLib3MFToolpathLayerReader_GetSegmentPointDataInModelUnitsPtr m_ToolpathLayerReader_GetSegmentPointDataInModelUnits; + PLib3MFToolpathLayerReader_GetSegmentPointDataDiscretePtr m_ToolpathLayerReader_GetSegmentPointDataDiscrete; PLib3MFToolpathLayerReader_FindAttributeInfoByNamePtr m_ToolpathLayerReader_FindAttributeInfoByName; PLib3MFToolpathLayerReader_FindAttributeIDByNamePtr m_ToolpathLayerReader_FindAttributeIDByName; PLib3MFToolpathLayerReader_FindAttributeValueByNamePtr m_ToolpathLayerReader_FindAttributeValueByName; @@ -5551,11 +5667,18 @@ typedef struct { PLib3MFToolpathLayerData_RegisterBuildItemPtr m_ToolpathLayerData_RegisterBuildItem; PLib3MFToolpathLayerData_SetSegmentAttributePtr m_ToolpathLayerData_SetSegmentAttribute; PLib3MFToolpathLayerData_ClearSegmentAttributesPtr m_ToolpathLayerData_ClearSegmentAttributes; - PLib3MFToolpathLayerData_WriteHatchDataPtr m_ToolpathLayerData_WriteHatchData; - PLib3MFToolpathLayerData_WriteLoopPtr m_ToolpathLayerData_WriteLoop; - PLib3MFToolpathLayerData_WritePolylinePtr m_ToolpathLayerData_WritePolyline; + PLib3MFToolpathLayerData_AddCustomLineAttributesPtr m_ToolpathLayerData_AddCustomLineAttributes; + PLib3MFToolpathLayerData_ClearCustomLineAttributesPtr m_ToolpathLayerData_ClearCustomLineAttributes; + PLib3MFToolpathLayerData_WriteHatchDataInModelUnitsPtr m_ToolpathLayerData_WriteHatchDataInModelUnits; + PLib3MFToolpathLayerData_WriteHatchDataDiscretePtr m_ToolpathLayerData_WriteHatchDataDiscrete; + PLib3MFToolpathLayerData_WriteLoopInModelUnitsPtr m_ToolpathLayerData_WriteLoopInModelUnits; + PLib3MFToolpathLayerData_WriteLoopDiscretePtr m_ToolpathLayerData_WriteLoopDiscrete; + PLib3MFToolpathLayerData_WritePolylineInModelUnitsPtr m_ToolpathLayerData_WritePolylineInModelUnits; + PLib3MFToolpathLayerData_WritePolylineDiscretePtr m_ToolpathLayerData_WritePolylineDiscrete; PLib3MFToolpathLayerData_AddCustomDataPtr m_ToolpathLayerData_AddCustomData; PLib3MFToolpathLayerData_FinishPtr m_ToolpathLayerData_Finish; + PLib3MFToolpath_GetUUIDPtr m_Toolpath_GetUUID; + PLib3MFToolpath_ResetUUIDPtr m_Toolpath_ResetUUID; PLib3MFToolpath_GetUnitsPtr m_Toolpath_GetUnits; PLib3MFToolpath_GetLayerCountPtr m_Toolpath_GetLayerCount; PLib3MFToolpath_GetProfileCountPtr m_Toolpath_GetProfileCount; @@ -5566,7 +5689,9 @@ typedef struct { PLib3MFToolpath_ReadLayerDataPtr m_Toolpath_ReadLayerData; PLib3MFToolpath_GetLayerPathPtr m_Toolpath_GetLayerPath; PLib3MFToolpath_GetLayerZMaxPtr m_Toolpath_GetLayerZMax; - PLib3MFToolpath_GetLayerZPtr m_Toolpath_GetLayerZ; + PLib3MFToolpath_GetLayerZMinPtr m_Toolpath_GetLayerZMin; + PLib3MFToolpath_GetLayerThicknessPtr m_Toolpath_GetLayerThickness; + PLib3MFToolpath_HasUniformThicknessPtr m_Toolpath_HasUniformThickness; PLib3MFToolpath_AddProfilePtr m_Toolpath_AddProfile; PLib3MFToolpath_GetProfilePtr m_Toolpath_GetProfile; PLib3MFToolpath_GetProfileUUIDPtr m_Toolpath_GetProfileUUID; @@ -5579,8 +5704,8 @@ typedef struct { PLib3MFToolpath_AddCustomDataPtr m_Toolpath_AddCustomData; PLib3MFToolpath_ClearCustomDataPtr m_Toolpath_ClearCustomData; PLib3MFToolpath_DeleteCustomDataPtr m_Toolpath_DeleteCustomData; - PLib3MFToolpath_RegisterCustomIntegerAttributePtr m_Toolpath_RegisterCustomIntegerAttribute; - PLib3MFToolpath_RegisterCustomDoubleAttributePtr m_Toolpath_RegisterCustomDoubleAttribute; + PLib3MFToolpath_RegisterCustomIntegerSegmentAttributePtr m_Toolpath_RegisterCustomIntegerSegmentAttribute; + PLib3MFToolpath_RegisterCustomDoubleSegmentAttributePtr m_Toolpath_RegisterCustomDoubleSegmentAttribute; PLib3MFToolpathIterator_GetCurrentToolpathPtr m_ToolpathIterator_GetCurrentToolpath; PLib3MFSliceStack_GetBottomZPtr m_SliceStack_GetBottomZ; PLib3MFSliceStack_GetSliceCountPtr m_SliceStack_GetSliceCount; diff --git a/Autogenerated/Bindings/CppDynamic/lib3mf_dynamic.hpp b/Autogenerated/Bindings/CppDynamic/lib3mf_dynamic.hpp index f52e44f5a..a9ed29302 100644 --- a/Autogenerated/Bindings/CppDynamic/lib3mf_dynamic.hpp +++ b/Autogenerated/Bindings/CppDynamic/lib3mf_dynamic.hpp @@ -420,6 +420,9 @@ class ELib3MFException : public std::exception { case LIB3MF_ERROR_EMPTYNAMESPACE: return "EMPTYNAMESPACE"; case LIB3MF_ERROR_INVALIDNAMESPACEPREFIX: return "INVALIDNAMESPACEPREFIX"; case LIB3MF_ERROR_WRITERDOESNOTSUPPORTNAMESPACES: return "WRITERDOESNOTSUPPORTNAMESPACES"; + case LIB3MF_ERROR_TOOLPATH_INVALIDHATCHCOORDINATE: return "TOOLPATH_INVALIDHATCHCOORDINATE"; + case LIB3MF_ERROR_TOOLPATH_INVALIDPOINTCOORDINATE: return "TOOLPATH_INVALIDPOINTCOORDINATE"; + case LIB3MF_ERROR_TOOLPATH_INVALIDHATCHCOUNT: return "TOOLPATH_INVALIDHATCHCOUNT"; } return "UNKNOWN"; } @@ -485,6 +488,9 @@ class ELib3MFException : public std::exception { case LIB3MF_ERROR_EMPTYNAMESPACE: return "Empty namespace."; case LIB3MF_ERROR_INVALIDNAMESPACEPREFIX: return "Invalid namespace prefix."; case LIB3MF_ERROR_WRITERDOESNOTSUPPORTNAMESPACES: return "Writer does not support namespaces."; + case LIB3MF_ERROR_TOOLPATH_INVALIDHATCHCOORDINATE: return "Invalid hatch coordinate."; + case LIB3MF_ERROR_TOOLPATH_INVALIDPOINTCOORDINATE: return "Invalid point coordinate."; + case LIB3MF_ERROR_TOOLPATH_INVALIDHATCHCOUNT: return "Invalid hatch count"; } return "unknown error"; } @@ -1701,7 +1707,8 @@ class CToolpathLayerReader : public CBase { inline std::string GetSegmentPartUUID(const Lib3MF_uint32 nIndex); inline Lib3MF_uint32 GetSegmentLocalPartID(const Lib3MF_uint32 nIndex); inline std::string GetPartUUIDByLocalPartID(const Lib3MF_uint32 nLocalPartID); - inline void GetSegmentPointData(const Lib3MF_uint32 nIndex, std::vector & PointDataBuffer); + inline void GetSegmentPointDataInModelUnits(const Lib3MF_uint32 nIndex, std::vector & PointDataBuffer); + inline void GetSegmentPointDataDiscrete(const Lib3MF_uint32 nIndex, std::vector & PointDataBuffer); inline void FindAttributeInfoByName(const std::string & sNameSpace, const std::string & sAttributeName, Lib3MF_uint32 & nID, eToolpathAttributeType & eAttributeType); inline Lib3MF_uint32 FindAttributeIDByName(const std::string & sNameSpace, const std::string & sAttributeName); inline eToolpathAttributeType FindAttributeValueByName(const std::string & sNameSpace, const std::string & sAttributeName); @@ -1733,9 +1740,14 @@ class CToolpathLayerData : public CBase { inline Lib3MF_uint32 RegisterBuildItem(classParam pBuildItem); inline void SetSegmentAttribute(const std::string & sNameSpace, const std::string & sAttributeName, const std::string & sValue); inline void ClearSegmentAttributes(); - inline void WriteHatchData(const Lib3MF_uint32 nProfileID, const Lib3MF_uint32 nPartID, const CInputVector & PointDataBuffer); - inline void WriteLoop(const Lib3MF_uint32 nProfileID, const Lib3MF_uint32 nPartID, const CInputVector & PointDataBuffer); - inline void WritePolyline(const Lib3MF_uint32 nProfileID, const Lib3MF_uint32 nPartID, const CInputVector & PointDataBuffer); + inline void AddCustomLineAttributes(const std::string & sNameSpace, const std::string & sAttributeName, const CInputVector & ValuesBuffer); + inline void ClearCustomLineAttributes(); + inline void WriteHatchDataInModelUnits(const Lib3MF_uint32 nProfileID, const Lib3MF_uint32 nPartID, const bool bWriteCustomLineAttributes, const CInputVector & HatchDataBuffer); + inline void WriteHatchDataDiscrete(const Lib3MF_uint32 nProfileID, const Lib3MF_uint32 nPartID, const bool bWriteCustomLineAttributes, const CInputVector & HatchDataBuffer); + inline void WriteLoopInModelUnits(const Lib3MF_uint32 nProfileID, const Lib3MF_uint32 nPartID, const bool bWriteCustomLineAttributes, const CInputVector & PointDataBuffer); + inline void WriteLoopDiscrete(const Lib3MF_uint32 nProfileID, const Lib3MF_uint32 nPartID, const bool bWriteCustomLineAttributes, const CInputVector & PointDataBuffer); + inline void WritePolylineInModelUnits(const Lib3MF_uint32 nProfileID, const Lib3MF_uint32 nPartID, const bool bWriteCustomLineAttributes, const CInputVector & PointDataBuffer); + inline void WritePolylineDiscrete(const Lib3MF_uint32 nProfileID, const Lib3MF_uint32 nPartID, const bool bWriteCustomLineAttributes, const CInputVector & PointDataBuffer); inline PCustomDOMTree AddCustomData(const std::string & sNameSpace, const std::string & sDataName); inline void Finish(); }; @@ -1754,6 +1766,8 @@ class CToolpath : public CResource { { } + inline std::string GetUUID(); + inline std::string ResetUUID(); inline Lib3MF_double GetUnits(); inline Lib3MF_uint32 GetLayerCount(); inline Lib3MF_uint32 GetProfileCount(); @@ -1764,7 +1778,9 @@ class CToolpath : public CResource { inline PToolpathLayerReader ReadLayerData(const Lib3MF_uint32 nIndex); inline std::string GetLayerPath(const Lib3MF_uint32 nIndex); inline Lib3MF_uint32 GetLayerZMax(const Lib3MF_uint32 nIndex); - inline Lib3MF_uint32 GetLayerZ(const Lib3MF_uint32 nLayerIndex); + inline Lib3MF_uint32 GetLayerZMin(const Lib3MF_uint32 nIndex); + inline Lib3MF_uint32 GetLayerThickness(const Lib3MF_uint32 nIndex); + inline bool HasUniformThickness(); inline PToolpathProfile AddProfile(const std::string & sName); inline PToolpathProfile GetProfile(const Lib3MF_uint32 nProfileIndex); inline PToolpathProfile GetProfileUUID(const std::string & sProfileUUID); @@ -1777,8 +1793,8 @@ class CToolpath : public CResource { inline PCustomDOMTree AddCustomData(const std::string & sNameSpace, const std::string & sDataName); inline Lib3MF_uint32 ClearCustomData(); inline bool DeleteCustomData(classParam pData); - inline void RegisterCustomIntegerAttribute(const std::string & sNameSpace, const std::string & sAttributeName); - inline void RegisterCustomDoubleAttribute(const std::string & sNameSpace, const std::string & sAttributeName); + inline void RegisterCustomIntegerSegmentAttribute(const std::string & sNameSpace, const std::string & sAttributeName); + inline void RegisterCustomDoubleSegmentAttribute(const std::string & sNameSpace, const std::string & sAttributeName); }; /************************************************************************************************************************* @@ -2714,7 +2730,8 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle) pWrapperTable->m_ToolpathLayerReader_GetSegmentPartUUID = nullptr; pWrapperTable->m_ToolpathLayerReader_GetSegmentLocalPartID = nullptr; pWrapperTable->m_ToolpathLayerReader_GetPartUUIDByLocalPartID = nullptr; - pWrapperTable->m_ToolpathLayerReader_GetSegmentPointData = nullptr; + pWrapperTable->m_ToolpathLayerReader_GetSegmentPointDataInModelUnits = nullptr; + pWrapperTable->m_ToolpathLayerReader_GetSegmentPointDataDiscrete = nullptr; pWrapperTable->m_ToolpathLayerReader_FindAttributeInfoByName = nullptr; pWrapperTable->m_ToolpathLayerReader_FindAttributeIDByName = nullptr; pWrapperTable->m_ToolpathLayerReader_FindAttributeValueByName = nullptr; @@ -2730,11 +2747,18 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle) pWrapperTable->m_ToolpathLayerData_RegisterBuildItem = nullptr; pWrapperTable->m_ToolpathLayerData_SetSegmentAttribute = nullptr; pWrapperTable->m_ToolpathLayerData_ClearSegmentAttributes = nullptr; - pWrapperTable->m_ToolpathLayerData_WriteHatchData = nullptr; - pWrapperTable->m_ToolpathLayerData_WriteLoop = nullptr; - pWrapperTable->m_ToolpathLayerData_WritePolyline = nullptr; + pWrapperTable->m_ToolpathLayerData_AddCustomLineAttributes = nullptr; + pWrapperTable->m_ToolpathLayerData_ClearCustomLineAttributes = nullptr; + pWrapperTable->m_ToolpathLayerData_WriteHatchDataInModelUnits = nullptr; + pWrapperTable->m_ToolpathLayerData_WriteHatchDataDiscrete = nullptr; + pWrapperTable->m_ToolpathLayerData_WriteLoopInModelUnits = nullptr; + pWrapperTable->m_ToolpathLayerData_WriteLoopDiscrete = nullptr; + pWrapperTable->m_ToolpathLayerData_WritePolylineInModelUnits = nullptr; + pWrapperTable->m_ToolpathLayerData_WritePolylineDiscrete = nullptr; pWrapperTable->m_ToolpathLayerData_AddCustomData = nullptr; pWrapperTable->m_ToolpathLayerData_Finish = nullptr; + pWrapperTable->m_Toolpath_GetUUID = nullptr; + pWrapperTable->m_Toolpath_ResetUUID = nullptr; pWrapperTable->m_Toolpath_GetUnits = nullptr; pWrapperTable->m_Toolpath_GetLayerCount = nullptr; pWrapperTable->m_Toolpath_GetProfileCount = nullptr; @@ -2745,7 +2769,9 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle) pWrapperTable->m_Toolpath_ReadLayerData = nullptr; pWrapperTable->m_Toolpath_GetLayerPath = nullptr; pWrapperTable->m_Toolpath_GetLayerZMax = nullptr; - pWrapperTable->m_Toolpath_GetLayerZ = nullptr; + pWrapperTable->m_Toolpath_GetLayerZMin = nullptr; + pWrapperTable->m_Toolpath_GetLayerThickness = nullptr; + pWrapperTable->m_Toolpath_HasUniformThickness = nullptr; pWrapperTable->m_Toolpath_AddProfile = nullptr; pWrapperTable->m_Toolpath_GetProfile = nullptr; pWrapperTable->m_Toolpath_GetProfileUUID = nullptr; @@ -2758,8 +2784,8 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle) pWrapperTable->m_Toolpath_AddCustomData = nullptr; pWrapperTable->m_Toolpath_ClearCustomData = nullptr; pWrapperTable->m_Toolpath_DeleteCustomData = nullptr; - pWrapperTable->m_Toolpath_RegisterCustomIntegerAttribute = nullptr; - pWrapperTable->m_Toolpath_RegisterCustomDoubleAttribute = nullptr; + pWrapperTable->m_Toolpath_RegisterCustomIntegerSegmentAttribute = nullptr; + pWrapperTable->m_Toolpath_RegisterCustomDoubleSegmentAttribute = nullptr; pWrapperTable->m_ToolpathIterator_GetCurrentToolpath = nullptr; pWrapperTable->m_SliceStack_GetBottomZ = nullptr; pWrapperTable->m_SliceStack_GetSliceCount = nullptr; @@ -5800,12 +5826,21 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; #ifdef _WIN32 - pWrapperTable->m_ToolpathLayerReader_GetSegmentPointData = (PLib3MFToolpathLayerReader_GetSegmentPointDataPtr) GetProcAddress(hLibrary, "lib3mf_toolpathlayerreader_getsegmentpointdata"); + pWrapperTable->m_ToolpathLayerReader_GetSegmentPointDataInModelUnits = (PLib3MFToolpathLayerReader_GetSegmentPointDataInModelUnitsPtr) GetProcAddress(hLibrary, "lib3mf_toolpathlayerreader_getsegmentpointdatainmodelunits"); + #else // _WIN32 + pWrapperTable->m_ToolpathLayerReader_GetSegmentPointDataInModelUnits = (PLib3MFToolpathLayerReader_GetSegmentPointDataInModelUnitsPtr) dlsym(hLibrary, "lib3mf_toolpathlayerreader_getsegmentpointdatainmodelunits"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_ToolpathLayerReader_GetSegmentPointDataInModelUnits == nullptr) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_ToolpathLayerReader_GetSegmentPointDataDiscrete = (PLib3MFToolpathLayerReader_GetSegmentPointDataDiscretePtr) GetProcAddress(hLibrary, "lib3mf_toolpathlayerreader_getsegmentpointdatadiscrete"); #else // _WIN32 - pWrapperTable->m_ToolpathLayerReader_GetSegmentPointData = (PLib3MFToolpathLayerReader_GetSegmentPointDataPtr) dlsym(hLibrary, "lib3mf_toolpathlayerreader_getsegmentpointdata"); + pWrapperTable->m_ToolpathLayerReader_GetSegmentPointDataDiscrete = (PLib3MFToolpathLayerReader_GetSegmentPointDataDiscretePtr) dlsym(hLibrary, "lib3mf_toolpathlayerreader_getsegmentpointdatadiscrete"); dlerror(); #endif // _WIN32 - if (pWrapperTable->m_ToolpathLayerReader_GetSegmentPointData == nullptr) + if (pWrapperTable->m_ToolpathLayerReader_GetSegmentPointDataDiscrete == nullptr) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; #ifdef _WIN32 @@ -5944,30 +5979,75 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; #ifdef _WIN32 - pWrapperTable->m_ToolpathLayerData_WriteHatchData = (PLib3MFToolpathLayerData_WriteHatchDataPtr) GetProcAddress(hLibrary, "lib3mf_toolpathlayerdata_writehatchdata"); + pWrapperTable->m_ToolpathLayerData_AddCustomLineAttributes = (PLib3MFToolpathLayerData_AddCustomLineAttributesPtr) GetProcAddress(hLibrary, "lib3mf_toolpathlayerdata_addcustomlineattributes"); + #else // _WIN32 + pWrapperTable->m_ToolpathLayerData_AddCustomLineAttributes = (PLib3MFToolpathLayerData_AddCustomLineAttributesPtr) dlsym(hLibrary, "lib3mf_toolpathlayerdata_addcustomlineattributes"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_ToolpathLayerData_AddCustomLineAttributes == nullptr) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_ToolpathLayerData_ClearCustomLineAttributes = (PLib3MFToolpathLayerData_ClearCustomLineAttributesPtr) GetProcAddress(hLibrary, "lib3mf_toolpathlayerdata_clearcustomlineattributes"); + #else // _WIN32 + pWrapperTable->m_ToolpathLayerData_ClearCustomLineAttributes = (PLib3MFToolpathLayerData_ClearCustomLineAttributesPtr) dlsym(hLibrary, "lib3mf_toolpathlayerdata_clearcustomlineattributes"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_ToolpathLayerData_ClearCustomLineAttributes == nullptr) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_ToolpathLayerData_WriteHatchDataInModelUnits = (PLib3MFToolpathLayerData_WriteHatchDataInModelUnitsPtr) GetProcAddress(hLibrary, "lib3mf_toolpathlayerdata_writehatchdatainmodelunits"); #else // _WIN32 - pWrapperTable->m_ToolpathLayerData_WriteHatchData = (PLib3MFToolpathLayerData_WriteHatchDataPtr) dlsym(hLibrary, "lib3mf_toolpathlayerdata_writehatchdata"); + pWrapperTable->m_ToolpathLayerData_WriteHatchDataInModelUnits = (PLib3MFToolpathLayerData_WriteHatchDataInModelUnitsPtr) dlsym(hLibrary, "lib3mf_toolpathlayerdata_writehatchdatainmodelunits"); dlerror(); #endif // _WIN32 - if (pWrapperTable->m_ToolpathLayerData_WriteHatchData == nullptr) + if (pWrapperTable->m_ToolpathLayerData_WriteHatchDataInModelUnits == nullptr) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; #ifdef _WIN32 - pWrapperTable->m_ToolpathLayerData_WriteLoop = (PLib3MFToolpathLayerData_WriteLoopPtr) GetProcAddress(hLibrary, "lib3mf_toolpathlayerdata_writeloop"); + pWrapperTable->m_ToolpathLayerData_WriteHatchDataDiscrete = (PLib3MFToolpathLayerData_WriteHatchDataDiscretePtr) GetProcAddress(hLibrary, "lib3mf_toolpathlayerdata_writehatchdatadiscrete"); #else // _WIN32 - pWrapperTable->m_ToolpathLayerData_WriteLoop = (PLib3MFToolpathLayerData_WriteLoopPtr) dlsym(hLibrary, "lib3mf_toolpathlayerdata_writeloop"); + pWrapperTable->m_ToolpathLayerData_WriteHatchDataDiscrete = (PLib3MFToolpathLayerData_WriteHatchDataDiscretePtr) dlsym(hLibrary, "lib3mf_toolpathlayerdata_writehatchdatadiscrete"); dlerror(); #endif // _WIN32 - if (pWrapperTable->m_ToolpathLayerData_WriteLoop == nullptr) + if (pWrapperTable->m_ToolpathLayerData_WriteHatchDataDiscrete == nullptr) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; #ifdef _WIN32 - pWrapperTable->m_ToolpathLayerData_WritePolyline = (PLib3MFToolpathLayerData_WritePolylinePtr) GetProcAddress(hLibrary, "lib3mf_toolpathlayerdata_writepolyline"); + pWrapperTable->m_ToolpathLayerData_WriteLoopInModelUnits = (PLib3MFToolpathLayerData_WriteLoopInModelUnitsPtr) GetProcAddress(hLibrary, "lib3mf_toolpathlayerdata_writeloopinmodelunits"); #else // _WIN32 - pWrapperTable->m_ToolpathLayerData_WritePolyline = (PLib3MFToolpathLayerData_WritePolylinePtr) dlsym(hLibrary, "lib3mf_toolpathlayerdata_writepolyline"); + pWrapperTable->m_ToolpathLayerData_WriteLoopInModelUnits = (PLib3MFToolpathLayerData_WriteLoopInModelUnitsPtr) dlsym(hLibrary, "lib3mf_toolpathlayerdata_writeloopinmodelunits"); dlerror(); #endif // _WIN32 - if (pWrapperTable->m_ToolpathLayerData_WritePolyline == nullptr) + if (pWrapperTable->m_ToolpathLayerData_WriteLoopInModelUnits == nullptr) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_ToolpathLayerData_WriteLoopDiscrete = (PLib3MFToolpathLayerData_WriteLoopDiscretePtr) GetProcAddress(hLibrary, "lib3mf_toolpathlayerdata_writeloopdiscrete"); + #else // _WIN32 + pWrapperTable->m_ToolpathLayerData_WriteLoopDiscrete = (PLib3MFToolpathLayerData_WriteLoopDiscretePtr) dlsym(hLibrary, "lib3mf_toolpathlayerdata_writeloopdiscrete"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_ToolpathLayerData_WriteLoopDiscrete == nullptr) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_ToolpathLayerData_WritePolylineInModelUnits = (PLib3MFToolpathLayerData_WritePolylineInModelUnitsPtr) GetProcAddress(hLibrary, "lib3mf_toolpathlayerdata_writepolylineinmodelunits"); + #else // _WIN32 + pWrapperTable->m_ToolpathLayerData_WritePolylineInModelUnits = (PLib3MFToolpathLayerData_WritePolylineInModelUnitsPtr) dlsym(hLibrary, "lib3mf_toolpathlayerdata_writepolylineinmodelunits"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_ToolpathLayerData_WritePolylineInModelUnits == nullptr) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_ToolpathLayerData_WritePolylineDiscrete = (PLib3MFToolpathLayerData_WritePolylineDiscretePtr) GetProcAddress(hLibrary, "lib3mf_toolpathlayerdata_writepolylinediscrete"); + #else // _WIN32 + pWrapperTable->m_ToolpathLayerData_WritePolylineDiscrete = (PLib3MFToolpathLayerData_WritePolylineDiscretePtr) dlsym(hLibrary, "lib3mf_toolpathlayerdata_writepolylinediscrete"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_ToolpathLayerData_WritePolylineDiscrete == nullptr) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; #ifdef _WIN32 @@ -5988,6 +6068,24 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle) if (pWrapperTable->m_ToolpathLayerData_Finish == nullptr) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + #ifdef _WIN32 + pWrapperTable->m_Toolpath_GetUUID = (PLib3MFToolpath_GetUUIDPtr) GetProcAddress(hLibrary, "lib3mf_toolpath_getuuid"); + #else // _WIN32 + pWrapperTable->m_Toolpath_GetUUID = (PLib3MFToolpath_GetUUIDPtr) dlsym(hLibrary, "lib3mf_toolpath_getuuid"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_Toolpath_GetUUID == nullptr) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_Toolpath_ResetUUID = (PLib3MFToolpath_ResetUUIDPtr) GetProcAddress(hLibrary, "lib3mf_toolpath_resetuuid"); + #else // _WIN32 + pWrapperTable->m_Toolpath_ResetUUID = (PLib3MFToolpath_ResetUUIDPtr) dlsym(hLibrary, "lib3mf_toolpath_resetuuid"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_Toolpath_ResetUUID == nullptr) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + #ifdef _WIN32 pWrapperTable->m_Toolpath_GetUnits = (PLib3MFToolpath_GetUnitsPtr) GetProcAddress(hLibrary, "lib3mf_toolpath_getunits"); #else // _WIN32 @@ -6079,12 +6177,30 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; #ifdef _WIN32 - pWrapperTable->m_Toolpath_GetLayerZ = (PLib3MFToolpath_GetLayerZPtr) GetProcAddress(hLibrary, "lib3mf_toolpath_getlayerz"); + pWrapperTable->m_Toolpath_GetLayerZMin = (PLib3MFToolpath_GetLayerZMinPtr) GetProcAddress(hLibrary, "lib3mf_toolpath_getlayerzmin"); + #else // _WIN32 + pWrapperTable->m_Toolpath_GetLayerZMin = (PLib3MFToolpath_GetLayerZMinPtr) dlsym(hLibrary, "lib3mf_toolpath_getlayerzmin"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_Toolpath_GetLayerZMin == nullptr) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_Toolpath_GetLayerThickness = (PLib3MFToolpath_GetLayerThicknessPtr) GetProcAddress(hLibrary, "lib3mf_toolpath_getlayerthickness"); + #else // _WIN32 + pWrapperTable->m_Toolpath_GetLayerThickness = (PLib3MFToolpath_GetLayerThicknessPtr) dlsym(hLibrary, "lib3mf_toolpath_getlayerthickness"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_Toolpath_GetLayerThickness == nullptr) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_Toolpath_HasUniformThickness = (PLib3MFToolpath_HasUniformThicknessPtr) GetProcAddress(hLibrary, "lib3mf_toolpath_hasuniformthickness"); #else // _WIN32 - pWrapperTable->m_Toolpath_GetLayerZ = (PLib3MFToolpath_GetLayerZPtr) dlsym(hLibrary, "lib3mf_toolpath_getlayerz"); + pWrapperTable->m_Toolpath_HasUniformThickness = (PLib3MFToolpath_HasUniformThicknessPtr) dlsym(hLibrary, "lib3mf_toolpath_hasuniformthickness"); dlerror(); #endif // _WIN32 - if (pWrapperTable->m_Toolpath_GetLayerZ == nullptr) + if (pWrapperTable->m_Toolpath_HasUniformThickness == nullptr) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; #ifdef _WIN32 @@ -6196,21 +6312,21 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; #ifdef _WIN32 - pWrapperTable->m_Toolpath_RegisterCustomIntegerAttribute = (PLib3MFToolpath_RegisterCustomIntegerAttributePtr) GetProcAddress(hLibrary, "lib3mf_toolpath_registercustomintegerattribute"); + pWrapperTable->m_Toolpath_RegisterCustomIntegerSegmentAttribute = (PLib3MFToolpath_RegisterCustomIntegerSegmentAttributePtr) GetProcAddress(hLibrary, "lib3mf_toolpath_registercustomintegersegmentattribute"); #else // _WIN32 - pWrapperTable->m_Toolpath_RegisterCustomIntegerAttribute = (PLib3MFToolpath_RegisterCustomIntegerAttributePtr) dlsym(hLibrary, "lib3mf_toolpath_registercustomintegerattribute"); + pWrapperTable->m_Toolpath_RegisterCustomIntegerSegmentAttribute = (PLib3MFToolpath_RegisterCustomIntegerSegmentAttributePtr) dlsym(hLibrary, "lib3mf_toolpath_registercustomintegersegmentattribute"); dlerror(); #endif // _WIN32 - if (pWrapperTable->m_Toolpath_RegisterCustomIntegerAttribute == nullptr) + if (pWrapperTable->m_Toolpath_RegisterCustomIntegerSegmentAttribute == nullptr) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; #ifdef _WIN32 - pWrapperTable->m_Toolpath_RegisterCustomDoubleAttribute = (PLib3MFToolpath_RegisterCustomDoubleAttributePtr) GetProcAddress(hLibrary, "lib3mf_toolpath_registercustomdoubleattribute"); + pWrapperTable->m_Toolpath_RegisterCustomDoubleSegmentAttribute = (PLib3MFToolpath_RegisterCustomDoubleSegmentAttributePtr) GetProcAddress(hLibrary, "lib3mf_toolpath_registercustomdoublesegmentattribute"); #else // _WIN32 - pWrapperTable->m_Toolpath_RegisterCustomDoubleAttribute = (PLib3MFToolpath_RegisterCustomDoubleAttributePtr) dlsym(hLibrary, "lib3mf_toolpath_registercustomdoubleattribute"); + pWrapperTable->m_Toolpath_RegisterCustomDoubleSegmentAttribute = (PLib3MFToolpath_RegisterCustomDoubleSegmentAttributePtr) dlsym(hLibrary, "lib3mf_toolpath_registercustomdoublesegmentattribute"); dlerror(); #endif // _WIN32 - if (pWrapperTable->m_Toolpath_RegisterCustomDoubleAttribute == nullptr) + if (pWrapperTable->m_Toolpath_RegisterCustomDoubleSegmentAttribute == nullptr) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; #ifdef _WIN32 @@ -8721,8 +8837,12 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle) if ( (eLookupError != 0) || (pWrapperTable->m_ToolpathLayerReader_GetPartUUIDByLocalPartID == nullptr) ) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; - eLookupError = (*pLookup)("lib3mf_toolpathlayerreader_getsegmentpointdata", (void**)&(pWrapperTable->m_ToolpathLayerReader_GetSegmentPointData)); - if ( (eLookupError != 0) || (pWrapperTable->m_ToolpathLayerReader_GetSegmentPointData == nullptr) ) + eLookupError = (*pLookup)("lib3mf_toolpathlayerreader_getsegmentpointdatainmodelunits", (void**)&(pWrapperTable->m_ToolpathLayerReader_GetSegmentPointDataInModelUnits)); + if ( (eLookupError != 0) || (pWrapperTable->m_ToolpathLayerReader_GetSegmentPointDataInModelUnits == nullptr) ) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + eLookupError = (*pLookup)("lib3mf_toolpathlayerreader_getsegmentpointdatadiscrete", (void**)&(pWrapperTable->m_ToolpathLayerReader_GetSegmentPointDataDiscrete)); + if ( (eLookupError != 0) || (pWrapperTable->m_ToolpathLayerReader_GetSegmentPointDataDiscrete == nullptr) ) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; eLookupError = (*pLookup)("lib3mf_toolpathlayerreader_findattributeinfobyname", (void**)&(pWrapperTable->m_ToolpathLayerReader_FindAttributeInfoByName)); @@ -8785,16 +8905,36 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle) if ( (eLookupError != 0) || (pWrapperTable->m_ToolpathLayerData_ClearSegmentAttributes == nullptr) ) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; - eLookupError = (*pLookup)("lib3mf_toolpathlayerdata_writehatchdata", (void**)&(pWrapperTable->m_ToolpathLayerData_WriteHatchData)); - if ( (eLookupError != 0) || (pWrapperTable->m_ToolpathLayerData_WriteHatchData == nullptr) ) + eLookupError = (*pLookup)("lib3mf_toolpathlayerdata_addcustomlineattributes", (void**)&(pWrapperTable->m_ToolpathLayerData_AddCustomLineAttributes)); + if ( (eLookupError != 0) || (pWrapperTable->m_ToolpathLayerData_AddCustomLineAttributes == nullptr) ) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; - eLookupError = (*pLookup)("lib3mf_toolpathlayerdata_writeloop", (void**)&(pWrapperTable->m_ToolpathLayerData_WriteLoop)); - if ( (eLookupError != 0) || (pWrapperTable->m_ToolpathLayerData_WriteLoop == nullptr) ) + eLookupError = (*pLookup)("lib3mf_toolpathlayerdata_clearcustomlineattributes", (void**)&(pWrapperTable->m_ToolpathLayerData_ClearCustomLineAttributes)); + if ( (eLookupError != 0) || (pWrapperTable->m_ToolpathLayerData_ClearCustomLineAttributes == nullptr) ) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; - eLookupError = (*pLookup)("lib3mf_toolpathlayerdata_writepolyline", (void**)&(pWrapperTable->m_ToolpathLayerData_WritePolyline)); - if ( (eLookupError != 0) || (pWrapperTable->m_ToolpathLayerData_WritePolyline == nullptr) ) + eLookupError = (*pLookup)("lib3mf_toolpathlayerdata_writehatchdatainmodelunits", (void**)&(pWrapperTable->m_ToolpathLayerData_WriteHatchDataInModelUnits)); + if ( (eLookupError != 0) || (pWrapperTable->m_ToolpathLayerData_WriteHatchDataInModelUnits == nullptr) ) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + eLookupError = (*pLookup)("lib3mf_toolpathlayerdata_writehatchdatadiscrete", (void**)&(pWrapperTable->m_ToolpathLayerData_WriteHatchDataDiscrete)); + if ( (eLookupError != 0) || (pWrapperTable->m_ToolpathLayerData_WriteHatchDataDiscrete == nullptr) ) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + eLookupError = (*pLookup)("lib3mf_toolpathlayerdata_writeloopinmodelunits", (void**)&(pWrapperTable->m_ToolpathLayerData_WriteLoopInModelUnits)); + if ( (eLookupError != 0) || (pWrapperTable->m_ToolpathLayerData_WriteLoopInModelUnits == nullptr) ) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + eLookupError = (*pLookup)("lib3mf_toolpathlayerdata_writeloopdiscrete", (void**)&(pWrapperTable->m_ToolpathLayerData_WriteLoopDiscrete)); + if ( (eLookupError != 0) || (pWrapperTable->m_ToolpathLayerData_WriteLoopDiscrete == nullptr) ) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + eLookupError = (*pLookup)("lib3mf_toolpathlayerdata_writepolylineinmodelunits", (void**)&(pWrapperTable->m_ToolpathLayerData_WritePolylineInModelUnits)); + if ( (eLookupError != 0) || (pWrapperTable->m_ToolpathLayerData_WritePolylineInModelUnits == nullptr) ) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + eLookupError = (*pLookup)("lib3mf_toolpathlayerdata_writepolylinediscrete", (void**)&(pWrapperTable->m_ToolpathLayerData_WritePolylineDiscrete)); + if ( (eLookupError != 0) || (pWrapperTable->m_ToolpathLayerData_WritePolylineDiscrete == nullptr) ) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; eLookupError = (*pLookup)("lib3mf_toolpathlayerdata_addcustomdata", (void**)&(pWrapperTable->m_ToolpathLayerData_AddCustomData)); @@ -8805,6 +8945,14 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle) if ( (eLookupError != 0) || (pWrapperTable->m_ToolpathLayerData_Finish == nullptr) ) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + eLookupError = (*pLookup)("lib3mf_toolpath_getuuid", (void**)&(pWrapperTable->m_Toolpath_GetUUID)); + if ( (eLookupError != 0) || (pWrapperTable->m_Toolpath_GetUUID == nullptr) ) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + eLookupError = (*pLookup)("lib3mf_toolpath_resetuuid", (void**)&(pWrapperTable->m_Toolpath_ResetUUID)); + if ( (eLookupError != 0) || (pWrapperTable->m_Toolpath_ResetUUID == nullptr) ) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + eLookupError = (*pLookup)("lib3mf_toolpath_getunits", (void**)&(pWrapperTable->m_Toolpath_GetUnits)); if ( (eLookupError != 0) || (pWrapperTable->m_Toolpath_GetUnits == nullptr) ) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; @@ -8845,8 +8993,16 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle) if ( (eLookupError != 0) || (pWrapperTable->m_Toolpath_GetLayerZMax == nullptr) ) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; - eLookupError = (*pLookup)("lib3mf_toolpath_getlayerz", (void**)&(pWrapperTable->m_Toolpath_GetLayerZ)); - if ( (eLookupError != 0) || (pWrapperTable->m_Toolpath_GetLayerZ == nullptr) ) + eLookupError = (*pLookup)("lib3mf_toolpath_getlayerzmin", (void**)&(pWrapperTable->m_Toolpath_GetLayerZMin)); + if ( (eLookupError != 0) || (pWrapperTable->m_Toolpath_GetLayerZMin == nullptr) ) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + eLookupError = (*pLookup)("lib3mf_toolpath_getlayerthickness", (void**)&(pWrapperTable->m_Toolpath_GetLayerThickness)); + if ( (eLookupError != 0) || (pWrapperTable->m_Toolpath_GetLayerThickness == nullptr) ) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + eLookupError = (*pLookup)("lib3mf_toolpath_hasuniformthickness", (void**)&(pWrapperTable->m_Toolpath_HasUniformThickness)); + if ( (eLookupError != 0) || (pWrapperTable->m_Toolpath_HasUniformThickness == nullptr) ) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; eLookupError = (*pLookup)("lib3mf_toolpath_addprofile", (void**)&(pWrapperTable->m_Toolpath_AddProfile)); @@ -8897,12 +9053,12 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle) if ( (eLookupError != 0) || (pWrapperTable->m_Toolpath_DeleteCustomData == nullptr) ) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; - eLookupError = (*pLookup)("lib3mf_toolpath_registercustomintegerattribute", (void**)&(pWrapperTable->m_Toolpath_RegisterCustomIntegerAttribute)); - if ( (eLookupError != 0) || (pWrapperTable->m_Toolpath_RegisterCustomIntegerAttribute == nullptr) ) + eLookupError = (*pLookup)("lib3mf_toolpath_registercustomintegersegmentattribute", (void**)&(pWrapperTable->m_Toolpath_RegisterCustomIntegerSegmentAttribute)); + if ( (eLookupError != 0) || (pWrapperTable->m_Toolpath_RegisterCustomIntegerSegmentAttribute == nullptr) ) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; - eLookupError = (*pLookup)("lib3mf_toolpath_registercustomdoubleattribute", (void**)&(pWrapperTable->m_Toolpath_RegisterCustomDoubleAttribute)); - if ( (eLookupError != 0) || (pWrapperTable->m_Toolpath_RegisterCustomDoubleAttribute == nullptr) ) + eLookupError = (*pLookup)("lib3mf_toolpath_registercustomdoublesegmentattribute", (void**)&(pWrapperTable->m_Toolpath_RegisterCustomDoubleSegmentAttribute)); + if ( (eLookupError != 0) || (pWrapperTable->m_Toolpath_RegisterCustomDoubleSegmentAttribute == nullptr) ) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; eLookupError = (*pLookup)("lib3mf_toolpathiterator_getcurrenttoolpath", (void**)&(pWrapperTable->m_ToolpathIterator_GetCurrentToolpath)); @@ -13539,17 +13695,31 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle) } /** - * CToolpathLayerReader::GetSegmentPointData - Retrieves the assigned segment point list. For type hatch, the points are taken pairwise. + * CToolpathLayerReader::GetSegmentPointDataInModelUnits - Retrieves the assigned segment point list. For type hatch, the points are taken pairwise. * @param[in] nIndex - Index. Must be between 0 and Count - 1. - * @param[out] PointDataBuffer - The point data array + * @param[out] PointDataBuffer - The point data array. The point coordinates are in model units. */ - void CToolpathLayerReader::GetSegmentPointData(const Lib3MF_uint32 nIndex, std::vector & PointDataBuffer) + void CToolpathLayerReader::GetSegmentPointDataInModelUnits(const Lib3MF_uint32 nIndex, std::vector & PointDataBuffer) { Lib3MF_uint64 elementsNeededPointData = 0; Lib3MF_uint64 elementsWrittenPointData = 0; - CheckError(m_pWrapper->m_WrapperTable.m_ToolpathLayerReader_GetSegmentPointData(m_pHandle, nIndex, 0, &elementsNeededPointData, nullptr)); + CheckError(m_pWrapper->m_WrapperTable.m_ToolpathLayerReader_GetSegmentPointDataInModelUnits(m_pHandle, nIndex, 0, &elementsNeededPointData, nullptr)); PointDataBuffer.resize((size_t) elementsNeededPointData); - CheckError(m_pWrapper->m_WrapperTable.m_ToolpathLayerReader_GetSegmentPointData(m_pHandle, nIndex, elementsNeededPointData, &elementsWrittenPointData, PointDataBuffer.data())); + CheckError(m_pWrapper->m_WrapperTable.m_ToolpathLayerReader_GetSegmentPointDataInModelUnits(m_pHandle, nIndex, elementsNeededPointData, &elementsWrittenPointData, PointDataBuffer.data())); + } + + /** + * CToolpathLayerReader::GetSegmentPointDataDiscrete - Retrieves the assigned segment point list in units. For type hatch, the points are taken pairwise. + * @param[in] nIndex - Index. Must be between 0 and Count - 1. + * @param[out] PointDataBuffer - The point data array. The point coordinates are in toolpath units. + */ + void CToolpathLayerReader::GetSegmentPointDataDiscrete(const Lib3MF_uint32 nIndex, std::vector & PointDataBuffer) + { + Lib3MF_uint64 elementsNeededPointData = 0; + Lib3MF_uint64 elementsWrittenPointData = 0; + CheckError(m_pWrapper->m_WrapperTable.m_ToolpathLayerReader_GetSegmentPointDataDiscrete(m_pHandle, nIndex, 0, &elementsNeededPointData, nullptr)); + PointDataBuffer.resize((size_t) elementsNeededPointData); + CheckError(m_pWrapper->m_WrapperTable.m_ToolpathLayerReader_GetSegmentPointDataDiscrete(m_pHandle, nIndex, elementsNeededPointData, &elementsWrittenPointData, PointDataBuffer.data())); } /** @@ -13765,36 +13935,94 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle) } /** - * CToolpathLayerData::WriteHatchData - writes hatch data to the layer. + * CToolpathLayerData::AddCustomLineAttributes - Stores custom line attributes for the next WriteLoop, WritePolyline or WriteHatchData call. + * @param[in] sNameSpace - The namespace of the attribute to register. + * @param[in] sAttributeName - The name of the attribute to register. + * @param[in] ValuesBuffer - Custom Values to store on segment lines. Array MUST NOT be empty. If custom attributes had been already defined, the error cardinality MUST match, or an error will be thrown. + */ + void CToolpathLayerData::AddCustomLineAttributes(const std::string & sNameSpace, const std::string & sAttributeName, const CInputVector & ValuesBuffer) + { + CheckError(m_pWrapper->m_WrapperTable.m_ToolpathLayerData_AddCustomLineAttributes(m_pHandle, sNameSpace.c_str(), sAttributeName.c_str(), (Lib3MF_uint64)ValuesBuffer.size(), ValuesBuffer.data())); + } + + /** + * CToolpathLayerData::ClearCustomLineAttributes - Clears all custom line attributes. Any call to WriteLoop, WritePolyline or WriteHatchData will do this implicitely. + */ + void CToolpathLayerData::ClearCustomLineAttributes() + { + CheckError(m_pWrapper->m_WrapperTable.m_ToolpathLayerData_ClearCustomLineAttributes(m_pHandle)); + } + + /** + * CToolpathLayerData::WriteHatchDataInModelUnits - writes hatch data to the layer in model units. + * @param[in] nProfileID - The toolpath profile to use + * @param[in] nPartID - The toolpath part to use + * @param[in] bWriteCustomLineAttributes - If true, custom line attributes are written. The cardinality of each custom attribute MUST be equal to the number of hatches in the hatchdata array. In any case, stored custom attributes will be cleared after the call. + * @param[in] HatchDataBuffer - The hatch data in model units. Array MUST NOT be empty. + */ + void CToolpathLayerData::WriteHatchDataInModelUnits(const Lib3MF_uint32 nProfileID, const Lib3MF_uint32 nPartID, const bool bWriteCustomLineAttributes, const CInputVector & HatchDataBuffer) + { + CheckError(m_pWrapper->m_WrapperTable.m_ToolpathLayerData_WriteHatchDataInModelUnits(m_pHandle, nProfileID, nPartID, bWriteCustomLineAttributes, (Lib3MF_uint64)HatchDataBuffer.size(), HatchDataBuffer.data())); + } + + /** + * CToolpathLayerData::WriteHatchDataDiscrete - writes hatch data to the layer in toolpath units. + * @param[in] nProfileID - The toolpath profile to use + * @param[in] nPartID - The toolpath part to use + * @param[in] bWriteCustomLineAttributes - If true, custom line attributes are written. The cardinality of each custom attribute MUST be equal to the number of hatches in the hatchdata array. In any case, stored custom attributes will be cleared after the call. + * @param[in] HatchDataBuffer - The hatch data in toolpath units. Array MUST NOT be empty. + */ + void CToolpathLayerData::WriteHatchDataDiscrete(const Lib3MF_uint32 nProfileID, const Lib3MF_uint32 nPartID, const bool bWriteCustomLineAttributes, const CInputVector & HatchDataBuffer) + { + CheckError(m_pWrapper->m_WrapperTable.m_ToolpathLayerData_WriteHatchDataDiscrete(m_pHandle, nProfileID, nPartID, bWriteCustomLineAttributes, (Lib3MF_uint64)HatchDataBuffer.size(), HatchDataBuffer.data())); + } + + /** + * CToolpathLayerData::WriteLoopInModelUnits - writes loop data to the layer in model units. + * @param[in] nProfileID - The toolpath profile to use + * @param[in] nPartID - The toolpath part to use + * @param[in] bWriteCustomLineAttributes - If true, custom line attributes are written. The cardinality of each custom attribute MUST be equal to the number of points in the pointdata array. In any case, stored custom attributes will be cleared after the call. + * @param[in] PointDataBuffer - The point data in model units. Array MUST NOT be empty. + */ + void CToolpathLayerData::WriteLoopInModelUnits(const Lib3MF_uint32 nProfileID, const Lib3MF_uint32 nPartID, const bool bWriteCustomLineAttributes, const CInputVector & PointDataBuffer) + { + CheckError(m_pWrapper->m_WrapperTable.m_ToolpathLayerData_WriteLoopInModelUnits(m_pHandle, nProfileID, nPartID, bWriteCustomLineAttributes, (Lib3MF_uint64)PointDataBuffer.size(), PointDataBuffer.data())); + } + + /** + * CToolpathLayerData::WriteLoopDiscrete - writes loop data to the layer in toolpath units. * @param[in] nProfileID - The toolpath profile to use * @param[in] nPartID - The toolpath part to use - * @param[in] PointDataBuffer - The point data + * @param[in] bWriteCustomLineAttributes - If true, custom line attributes are written. The cardinality of each custom attribute MUST be equal to the number of points in the pointdata array. In any case, stored custom attributes will be cleared after the call. + * @param[in] PointDataBuffer - The point data in toolpath units. Array MUST NOT be empty. */ - void CToolpathLayerData::WriteHatchData(const Lib3MF_uint32 nProfileID, const Lib3MF_uint32 nPartID, const CInputVector & PointDataBuffer) + void CToolpathLayerData::WriteLoopDiscrete(const Lib3MF_uint32 nProfileID, const Lib3MF_uint32 nPartID, const bool bWriteCustomLineAttributes, const CInputVector & PointDataBuffer) { - CheckError(m_pWrapper->m_WrapperTable.m_ToolpathLayerData_WriteHatchData(m_pHandle, nProfileID, nPartID, (Lib3MF_uint64)PointDataBuffer.size(), PointDataBuffer.data())); + CheckError(m_pWrapper->m_WrapperTable.m_ToolpathLayerData_WriteLoopDiscrete(m_pHandle, nProfileID, nPartID, bWriteCustomLineAttributes, (Lib3MF_uint64)PointDataBuffer.size(), PointDataBuffer.data())); } /** - * CToolpathLayerData::WriteLoop - writes loop data to the layer. + * CToolpathLayerData::WritePolylineInModelUnits - writes polyline data to the layer. * @param[in] nProfileID - The toolpath profile to use * @param[in] nPartID - The toolpath part to use - * @param[in] PointDataBuffer - The point data + * @param[in] bWriteCustomLineAttributes - If true, custom line attributes are written. The cardinality of each custom attribute MUST be equal to the number of points in the pointdata array. In any case, stored custom attributes will be cleared after the call. + * @param[in] PointDataBuffer - The point data in model units. Array MUST NOT be empty. */ - void CToolpathLayerData::WriteLoop(const Lib3MF_uint32 nProfileID, const Lib3MF_uint32 nPartID, const CInputVector & PointDataBuffer) + void CToolpathLayerData::WritePolylineInModelUnits(const Lib3MF_uint32 nProfileID, const Lib3MF_uint32 nPartID, const bool bWriteCustomLineAttributes, const CInputVector & PointDataBuffer) { - CheckError(m_pWrapper->m_WrapperTable.m_ToolpathLayerData_WriteLoop(m_pHandle, nProfileID, nPartID, (Lib3MF_uint64)PointDataBuffer.size(), PointDataBuffer.data())); + CheckError(m_pWrapper->m_WrapperTable.m_ToolpathLayerData_WritePolylineInModelUnits(m_pHandle, nProfileID, nPartID, bWriteCustomLineAttributes, (Lib3MF_uint64)PointDataBuffer.size(), PointDataBuffer.data())); } /** - * CToolpathLayerData::WritePolyline - writes polyline data to the layer. + * CToolpathLayerData::WritePolylineDiscrete - writes polyline data to the layer. * @param[in] nProfileID - The toolpath profile to use * @param[in] nPartID - The toolpath part to use - * @param[in] PointDataBuffer - The point data + * @param[in] bWriteCustomLineAttributes - If true, custom line attributes are written. The cardinality of each custom attribute MUST be equal to the number of points in the pointdata array. In any case, stored custom attributes will be cleared after the call. + * @param[in] PointDataBuffer - The point data in toolpath units. Array MUST NOT be empty. */ - void CToolpathLayerData::WritePolyline(const Lib3MF_uint32 nProfileID, const Lib3MF_uint32 nPartID, const CInputVector & PointDataBuffer) + void CToolpathLayerData::WritePolylineDiscrete(const Lib3MF_uint32 nProfileID, const Lib3MF_uint32 nPartID, const bool bWriteCustomLineAttributes, const CInputVector & PointDataBuffer) { - CheckError(m_pWrapper->m_WrapperTable.m_ToolpathLayerData_WritePolyline(m_pHandle, nProfileID, nPartID, (Lib3MF_uint64)PointDataBuffer.size(), PointDataBuffer.data())); + CheckError(m_pWrapper->m_WrapperTable.m_ToolpathLayerData_WritePolylineDiscrete(m_pHandle, nProfileID, nPartID, bWriteCustomLineAttributes, (Lib3MF_uint64)PointDataBuffer.size(), PointDataBuffer.data())); } /** @@ -13827,7 +14055,37 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle) */ /** - * CToolpath::GetUnits - Retrieves the unit factor + * CToolpath::GetUUID - Retrieves the UUID of the toolpath + * @return UUID Value. + */ + std::string CToolpath::GetUUID() + { + Lib3MF_uint32 bytesNeededUUID = 0; + Lib3MF_uint32 bytesWrittenUUID = 0; + CheckError(m_pWrapper->m_WrapperTable.m_Toolpath_GetUUID(m_pHandle, 0, &bytesNeededUUID, nullptr)); + std::vector bufferUUID(bytesNeededUUID); + CheckError(m_pWrapper->m_WrapperTable.m_Toolpath_GetUUID(m_pHandle, bytesNeededUUID, &bytesWrittenUUID, &bufferUUID[0])); + + return std::string(&bufferUUID[0]); + } + + /** + * CToolpath::ResetUUID - Generates a new unique identifier for this toolpath and sets its value. + * @return Newly created UUID Value. + */ + std::string CToolpath::ResetUUID() + { + Lib3MF_uint32 bytesNeededNewUUID = 0; + Lib3MF_uint32 bytesWrittenNewUUID = 0; + CheckError(m_pWrapper->m_WrapperTable.m_Toolpath_ResetUUID(m_pHandle, 0, &bytesNeededNewUUID, nullptr)); + std::vector bufferNewUUID(bytesNeededNewUUID); + CheckError(m_pWrapper->m_WrapperTable.m_Toolpath_ResetUUID(m_pHandle, bytesNeededNewUUID, &bytesWrittenNewUUID, &bufferNewUUID[0])); + + return std::string(&bufferNewUUID[0]); + } + + /** + * CToolpath::GetUnits - Retrieves the unit factor, i.e. how many model units are one toolpath unit. * @return Returns the unit factor. */ Lib3MF_double CToolpath::GetUnits() @@ -13864,7 +14122,7 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle) /** * CToolpath::AddLayer - Adds a new toolpath layer - * @param[in] nZMax - ZMax value of the layer. MUST be larger than the last layer added, as well as larger as BottomZ. + * @param[in] nZMax - ZMax value of the layer in toolpath units. MUST be larger than the last layer added, as well as larger as BottomZ. * @param[in] sPath - Package Path * @param[in] pModelWriter - The model writer that writes out the 3MF. * @return Returns the layerdata object to write the layer content into. @@ -13883,7 +14141,7 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle) /** * CToolpath::GetBottomZ - Returns the bottom Z Value of the toolpath. - * @return BottomZ value + * @return BottomZ value in Toolpath units */ Lib3MF_uint32 CToolpath::GetBottomZ() { @@ -13895,7 +14153,7 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle) /** * CToolpath::SetBottomZ - Sets the bottom Z Value of the toolpath. Will fail if a layer is already existing. - * @param[in] nBottomZ - BottomZ value + * @param[in] nBottomZ - BottomZ value in Toolpath units */ void CToolpath::SetBottomZ(const Lib3MF_uint32 nBottomZ) { @@ -13903,7 +14161,7 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle) } /** - * CToolpath::GetLayerAttachment - Retrieves the Attachment of a layer + * CToolpath::GetLayerAttachment - Retrieves the Attachment that contains the layer data. * @param[in] nIndex - Layer Index * @return Attachment */ @@ -13953,7 +14211,7 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle) /** * CToolpath::GetLayerZMax - Retrieves the ZMax of a layer * @param[in] nIndex - Layer Index - * @return ZMax value + * @return ZMax value in toolpath units */ Lib3MF_uint32 CToolpath::GetLayerZMax(const Lib3MF_uint32 nIndex) { @@ -13964,16 +14222,41 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle) } /** - * CToolpath::GetLayerZ - Return the z value of a layer in units. - * @param[in] nLayerIndex - Layer Index. - * @return Z Value in Units. + * CToolpath::GetLayerZMin - Retrieves the Minimum Z of a layer + * @param[in] nIndex - Layer Index + * @return ZMin value in toolpath units + */ + Lib3MF_uint32 CToolpath::GetLayerZMin(const Lib3MF_uint32 nIndex) + { + Lib3MF_uint32 resultZMin = 0; + CheckError(m_pWrapper->m_WrapperTable.m_Toolpath_GetLayerZMin(m_pHandle, nIndex, &resultZMin)); + + return resultZMin; + } + + /** + * CToolpath::GetLayerThickness - Retrieves the Thickness of a layer + * @param[in] nIndex - Layer Index + * @return Thickness value in toolpath units + */ + Lib3MF_uint32 CToolpath::GetLayerThickness(const Lib3MF_uint32 nIndex) + { + Lib3MF_uint32 resultZThickness = 0; + CheckError(m_pWrapper->m_WrapperTable.m_Toolpath_GetLayerThickness(m_pHandle, nIndex, &resultZThickness)); + + return resultZThickness; + } + + /** + * CToolpath::HasUniformThickness - Checks if the toolpath has a uniform thickness value, i.e. each layer has the same thickness. + * @return Returns true if the layer thicknesses are uniform, returns false otherwise. */ - Lib3MF_uint32 CToolpath::GetLayerZ(const Lib3MF_uint32 nLayerIndex) + bool CToolpath::HasUniformThickness() { - Lib3MF_uint32 resultZValue = 0; - CheckError(m_pWrapper->m_WrapperTable.m_Toolpath_GetLayerZ(m_pHandle, nLayerIndex, &resultZValue)); + bool resultUniformThickness = 0; + CheckError(m_pWrapper->m_WrapperTable.m_Toolpath_HasUniformThickness(m_pHandle, &resultUniformThickness)); - return resultZValue; + return resultUniformThickness; } /** @@ -14163,23 +14446,23 @@ inline CBase* CWrapper::polymorphicFactory(Lib3MFHandle pHandle) } /** - * CToolpath::RegisterCustomIntegerAttribute - Registers an Integer Attribute that each segment holds. + * CToolpath::RegisterCustomIntegerSegmentAttribute - Registers an Integer Attribute that each segment holds. * @param[in] sNameSpace - Namespace of the custom data tree. MUST not be empty. * @param[in] sAttributeName - Attribute name. MUST not be empty. */ - void CToolpath::RegisterCustomIntegerAttribute(const std::string & sNameSpace, const std::string & sAttributeName) + void CToolpath::RegisterCustomIntegerSegmentAttribute(const std::string & sNameSpace, const std::string & sAttributeName) { - CheckError(m_pWrapper->m_WrapperTable.m_Toolpath_RegisterCustomIntegerAttribute(m_pHandle, sNameSpace.c_str(), sAttributeName.c_str())); + CheckError(m_pWrapper->m_WrapperTable.m_Toolpath_RegisterCustomIntegerSegmentAttribute(m_pHandle, sNameSpace.c_str(), sAttributeName.c_str())); } /** - * CToolpath::RegisterCustomDoubleAttribute - Registers a Double Attribute that each segment holds. Registering only applies to reader or writer objects created after the call. + * CToolpath::RegisterCustomDoubleSegmentAttribute - Registers a Double Attribute that each segment holds. Registering only applies to reader or writer objects created after the call. * @param[in] sNameSpace - Namespace of the custom data tree. MUST not be empty. * @param[in] sAttributeName - Attribute name. MUST not be empty. */ - void CToolpath::RegisterCustomDoubleAttribute(const std::string & sNameSpace, const std::string & sAttributeName) + void CToolpath::RegisterCustomDoubleSegmentAttribute(const std::string & sNameSpace, const std::string & sAttributeName) { - CheckError(m_pWrapper->m_WrapperTable.m_Toolpath_RegisterCustomDoubleAttribute(m_pHandle, sNameSpace.c_str(), sAttributeName.c_str())); + CheckError(m_pWrapper->m_WrapperTable.m_Toolpath_RegisterCustomDoubleSegmentAttribute(m_pHandle, sNameSpace.c_str(), sAttributeName.c_str())); } /** diff --git a/Autogenerated/Bindings/CppDynamic/lib3mf_types.hpp b/Autogenerated/Bindings/CppDynamic/lib3mf_types.hpp index d7b8241ca..1388fa59f 100644 --- a/Autogenerated/Bindings/CppDynamic/lib3mf_types.hpp +++ b/Autogenerated/Bindings/CppDynamic/lib3mf_types.hpp @@ -150,6 +150,9 @@ typedef void * Lib3MF_pvoid; #define LIB3MF_ERROR_EMPTYNAMESPACE 4007 /** Empty namespace. */ #define LIB3MF_ERROR_INVALIDNAMESPACEPREFIX 4008 /** Invalid namespace prefix. */ #define LIB3MF_ERROR_WRITERDOESNOTSUPPORTNAMESPACES 4009 /** Writer does not support namespaces. */ +#define LIB3MF_ERROR_TOOLPATH_INVALIDHATCHCOORDINATE 4010 /** Invalid hatch coordinate. */ +#define LIB3MF_ERROR_TOOLPATH_INVALIDPOINTCOORDINATE 4011 /** Invalid point coordinate. */ +#define LIB3MF_ERROR_TOOLPATH_INVALIDHATCHCOUNT 4012 /** Invalid hatch count */ /************************************************************************************************************************* Error strings for Lib3MF @@ -215,6 +218,9 @@ inline const char * LIB3MF_GETERRORSTRING (Lib3MFResult nErrorCode) { case LIB3MF_ERROR_EMPTYNAMESPACE: return "Empty namespace."; case LIB3MF_ERROR_INVALIDNAMESPACEPREFIX: return "Invalid namespace prefix."; case LIB3MF_ERROR_WRITERDOESNOTSUPPORTNAMESPACES: return "Writer does not support namespaces."; + case LIB3MF_ERROR_TOOLPATH_INVALIDHATCHCOORDINATE: return "Invalid hatch coordinate."; + case LIB3MF_ERROR_TOOLPATH_INVALIDPOINTCOORDINATE: return "Invalid point coordinate."; + case LIB3MF_ERROR_TOOLPATH_INVALIDHATCHCOUNT: return "Invalid hatch count"; default: return "unknown error"; } } @@ -457,6 +463,20 @@ namespace Lib3MF { Lib3MF_single m_Coordinates[2]; } sPosition2D; + typedef struct sDiscretePosition2D { + Lib3MF_int32 m_Coordinates[2]; + } sDiscretePosition2D; + + typedef struct sHatch2D { + Lib3MF_single m_Point1Coordinates[2]; + Lib3MF_single m_Point2Coordinates[2]; + } sHatch2D; + + typedef struct sDiscreteHatch2D { + Lib3MF_int32 m_Point1Coordinates[2]; + Lib3MF_int32 m_Point2Coordinates[2]; + } sDiscreteHatch2D; + typedef struct sCompositeConstituent { Lib3MF_uint32 m_PropertyID; Lib3MF_double m_MixingRatio; @@ -607,6 +627,9 @@ typedef Lib3MF::sTriangle sLib3MFTriangle; typedef Lib3MF::sTriangleProperties sLib3MFTriangleProperties; typedef Lib3MF::sPosition sLib3MFPosition; typedef Lib3MF::sPosition2D sLib3MFPosition2D; +typedef Lib3MF::sDiscretePosition2D sLib3MFDiscretePosition2D; +typedef Lib3MF::sHatch2D sLib3MFHatch2D; +typedef Lib3MF::sDiscreteHatch2D sLib3MFDiscreteHatch2D; typedef Lib3MF::sCompositeConstituent sLib3MFCompositeConstituent; typedef Lib3MF::sMultiPropertyLayer sLib3MFMultiPropertyLayer; typedef Lib3MF::sTex2Coord sLib3MFTex2Coord; diff --git a/Autogenerated/Bindings/Go/lib3mf.go b/Autogenerated/Bindings/Go/lib3mf.go index a7191c312..71a1ff353 100644 --- a/Autogenerated/Bindings/Go/lib3mf.go +++ b/Autogenerated/Bindings/Go/lib3mf.go @@ -2925,12 +2925,21 @@ Lib3MFResult CCall_lib3mf_toolpathlayerreader_getpartuuidbylocalpartid(Lib3MFHan } -Lib3MFResult CCall_lib3mf_toolpathlayerreader_getsegmentpointdata(Lib3MFHandle libraryHandle, Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nIndex, const Lib3MF_uint64 nPointDataBufferSize, Lib3MF_uint64* pPointDataNeededCount, sLib3MFPosition2D * pPointDataBuffer) +Lib3MFResult CCall_lib3mf_toolpathlayerreader_getsegmentpointdatainmodelunits(Lib3MFHandle libraryHandle, Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nIndex, const Lib3MF_uint64 nPointDataBufferSize, Lib3MF_uint64* pPointDataNeededCount, sLib3MFPosition2D * pPointDataBuffer) { if (libraryHandle == 0) return LIB3MF_ERROR_INVALIDCAST; sLib3MFDynamicWrapperTable * wrapperTable = (sLib3MFDynamicWrapperTable *) libraryHandle; - return wrapperTable->m_ToolpathLayerReader_GetSegmentPointData (pToolpathLayerReader, nIndex, nPointDataBufferSize, pPointDataNeededCount, pPointDataBuffer); + return wrapperTable->m_ToolpathLayerReader_GetSegmentPointDataInModelUnits (pToolpathLayerReader, nIndex, nPointDataBufferSize, pPointDataNeededCount, pPointDataBuffer); +} + + +Lib3MFResult CCall_lib3mf_toolpathlayerreader_getsegmentpointdatadiscrete(Lib3MFHandle libraryHandle, Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nIndex, const Lib3MF_uint64 nPointDataBufferSize, Lib3MF_uint64* pPointDataNeededCount, sLib3MFDiscretePosition2D * pPointDataBuffer) +{ + if (libraryHandle == 0) + return LIB3MF_ERROR_INVALIDCAST; + sLib3MFDynamicWrapperTable * wrapperTable = (sLib3MFDynamicWrapperTable *) libraryHandle; + return wrapperTable->m_ToolpathLayerReader_GetSegmentPointDataDiscrete (pToolpathLayerReader, nIndex, nPointDataBufferSize, pPointDataNeededCount, pPointDataBuffer); } @@ -3069,30 +3078,75 @@ Lib3MFResult CCall_lib3mf_toolpathlayerdata_clearsegmentattributes(Lib3MFHandle } -Lib3MFResult CCall_lib3mf_toolpathlayerdata_writehatchdata(Lib3MFHandle libraryHandle, Lib3MF_ToolpathLayerData pToolpathLayerData, Lib3MF_uint32 nProfileID, Lib3MF_uint32 nPartID, Lib3MF_uint64 nPointDataBufferSize, const sLib3MFPosition2D * pPointDataBuffer) +Lib3MFResult CCall_lib3mf_toolpathlayerdata_addcustomlineattributes(Lib3MFHandle libraryHandle, Lib3MF_ToolpathLayerData pToolpathLayerData, const char * pNameSpace, const char * pAttributeName, Lib3MF_uint64 nValuesBufferSize, const Lib3MF_int32 * pValuesBuffer) +{ + if (libraryHandle == 0) + return LIB3MF_ERROR_INVALIDCAST; + sLib3MFDynamicWrapperTable * wrapperTable = (sLib3MFDynamicWrapperTable *) libraryHandle; + return wrapperTable->m_ToolpathLayerData_AddCustomLineAttributes (pToolpathLayerData, pNameSpace, pAttributeName, nValuesBufferSize, pValuesBuffer); +} + + +Lib3MFResult CCall_lib3mf_toolpathlayerdata_clearcustomlineattributes(Lib3MFHandle libraryHandle, Lib3MF_ToolpathLayerData pToolpathLayerData) +{ + if (libraryHandle == 0) + return LIB3MF_ERROR_INVALIDCAST; + sLib3MFDynamicWrapperTable * wrapperTable = (sLib3MFDynamicWrapperTable *) libraryHandle; + return wrapperTable->m_ToolpathLayerData_ClearCustomLineAttributes (pToolpathLayerData); +} + + +Lib3MFResult CCall_lib3mf_toolpathlayerdata_writehatchdatainmodelunits(Lib3MFHandle libraryHandle, Lib3MF_ToolpathLayerData pToolpathLayerData, Lib3MF_uint32 nProfileID, Lib3MF_uint32 nPartID, bool bWriteCustomLineAttributes, Lib3MF_uint64 nHatchDataBufferSize, const sLib3MFHatch2D * pHatchDataBuffer) +{ + if (libraryHandle == 0) + return LIB3MF_ERROR_INVALIDCAST; + sLib3MFDynamicWrapperTable * wrapperTable = (sLib3MFDynamicWrapperTable *) libraryHandle; + return wrapperTable->m_ToolpathLayerData_WriteHatchDataInModelUnits (pToolpathLayerData, nProfileID, nPartID, bWriteCustomLineAttributes, nHatchDataBufferSize, pHatchDataBuffer); +} + + +Lib3MFResult CCall_lib3mf_toolpathlayerdata_writehatchdatadiscrete(Lib3MFHandle libraryHandle, Lib3MF_ToolpathLayerData pToolpathLayerData, Lib3MF_uint32 nProfileID, Lib3MF_uint32 nPartID, bool bWriteCustomLineAttributes, Lib3MF_uint64 nHatchDataBufferSize, const sLib3MFDiscreteHatch2D * pHatchDataBuffer) { if (libraryHandle == 0) return LIB3MF_ERROR_INVALIDCAST; sLib3MFDynamicWrapperTable * wrapperTable = (sLib3MFDynamicWrapperTable *) libraryHandle; - return wrapperTable->m_ToolpathLayerData_WriteHatchData (pToolpathLayerData, nProfileID, nPartID, nPointDataBufferSize, pPointDataBuffer); + return wrapperTable->m_ToolpathLayerData_WriteHatchDataDiscrete (pToolpathLayerData, nProfileID, nPartID, bWriteCustomLineAttributes, nHatchDataBufferSize, pHatchDataBuffer); } -Lib3MFResult CCall_lib3mf_toolpathlayerdata_writeloop(Lib3MFHandle libraryHandle, Lib3MF_ToolpathLayerData pToolpathLayerData, Lib3MF_uint32 nProfileID, Lib3MF_uint32 nPartID, Lib3MF_uint64 nPointDataBufferSize, const sLib3MFPosition2D * pPointDataBuffer) +Lib3MFResult CCall_lib3mf_toolpathlayerdata_writeloopinmodelunits(Lib3MFHandle libraryHandle, Lib3MF_ToolpathLayerData pToolpathLayerData, Lib3MF_uint32 nProfileID, Lib3MF_uint32 nPartID, bool bWriteCustomLineAttributes, Lib3MF_uint64 nPointDataBufferSize, const sLib3MFPosition2D * pPointDataBuffer) { if (libraryHandle == 0) return LIB3MF_ERROR_INVALIDCAST; sLib3MFDynamicWrapperTable * wrapperTable = (sLib3MFDynamicWrapperTable *) libraryHandle; - return wrapperTable->m_ToolpathLayerData_WriteLoop (pToolpathLayerData, nProfileID, nPartID, nPointDataBufferSize, pPointDataBuffer); + return wrapperTable->m_ToolpathLayerData_WriteLoopInModelUnits (pToolpathLayerData, nProfileID, nPartID, bWriteCustomLineAttributes, nPointDataBufferSize, pPointDataBuffer); } -Lib3MFResult CCall_lib3mf_toolpathlayerdata_writepolyline(Lib3MFHandle libraryHandle, Lib3MF_ToolpathLayerData pToolpathLayerData, Lib3MF_uint32 nProfileID, Lib3MF_uint32 nPartID, Lib3MF_uint64 nPointDataBufferSize, const sLib3MFPosition2D * pPointDataBuffer) +Lib3MFResult CCall_lib3mf_toolpathlayerdata_writeloopdiscrete(Lib3MFHandle libraryHandle, Lib3MF_ToolpathLayerData pToolpathLayerData, Lib3MF_uint32 nProfileID, Lib3MF_uint32 nPartID, bool bWriteCustomLineAttributes, Lib3MF_uint64 nPointDataBufferSize, const sLib3MFDiscretePosition2D * pPointDataBuffer) { if (libraryHandle == 0) return LIB3MF_ERROR_INVALIDCAST; sLib3MFDynamicWrapperTable * wrapperTable = (sLib3MFDynamicWrapperTable *) libraryHandle; - return wrapperTable->m_ToolpathLayerData_WritePolyline (pToolpathLayerData, nProfileID, nPartID, nPointDataBufferSize, pPointDataBuffer); + return wrapperTable->m_ToolpathLayerData_WriteLoopDiscrete (pToolpathLayerData, nProfileID, nPartID, bWriteCustomLineAttributes, nPointDataBufferSize, pPointDataBuffer); +} + + +Lib3MFResult CCall_lib3mf_toolpathlayerdata_writepolylineinmodelunits(Lib3MFHandle libraryHandle, Lib3MF_ToolpathLayerData pToolpathLayerData, Lib3MF_uint32 nProfileID, Lib3MF_uint32 nPartID, bool bWriteCustomLineAttributes, Lib3MF_uint64 nPointDataBufferSize, const sLib3MFPosition2D * pPointDataBuffer) +{ + if (libraryHandle == 0) + return LIB3MF_ERROR_INVALIDCAST; + sLib3MFDynamicWrapperTable * wrapperTable = (sLib3MFDynamicWrapperTable *) libraryHandle; + return wrapperTable->m_ToolpathLayerData_WritePolylineInModelUnits (pToolpathLayerData, nProfileID, nPartID, bWriteCustomLineAttributes, nPointDataBufferSize, pPointDataBuffer); +} + + +Lib3MFResult CCall_lib3mf_toolpathlayerdata_writepolylinediscrete(Lib3MFHandle libraryHandle, Lib3MF_ToolpathLayerData pToolpathLayerData, Lib3MF_uint32 nProfileID, Lib3MF_uint32 nPartID, bool bWriteCustomLineAttributes, Lib3MF_uint64 nPointDataBufferSize, const sLib3MFDiscretePosition2D * pPointDataBuffer) +{ + if (libraryHandle == 0) + return LIB3MF_ERROR_INVALIDCAST; + sLib3MFDynamicWrapperTable * wrapperTable = (sLib3MFDynamicWrapperTable *) libraryHandle; + return wrapperTable->m_ToolpathLayerData_WritePolylineDiscrete (pToolpathLayerData, nProfileID, nPartID, bWriteCustomLineAttributes, nPointDataBufferSize, pPointDataBuffer); } @@ -3114,6 +3168,24 @@ Lib3MFResult CCall_lib3mf_toolpathlayerdata_finish(Lib3MFHandle libraryHandle, L } +Lib3MFResult CCall_lib3mf_toolpath_getuuid(Lib3MFHandle libraryHandle, Lib3MF_Toolpath pToolpath, const Lib3MF_uint32 nUUIDBufferSize, Lib3MF_uint32* pUUIDNeededChars, char * pUUIDBuffer) +{ + if (libraryHandle == 0) + return LIB3MF_ERROR_INVALIDCAST; + sLib3MFDynamicWrapperTable * wrapperTable = (sLib3MFDynamicWrapperTable *) libraryHandle; + return wrapperTable->m_Toolpath_GetUUID (pToolpath, nUUIDBufferSize, pUUIDNeededChars, pUUIDBuffer); +} + + +Lib3MFResult CCall_lib3mf_toolpath_resetuuid(Lib3MFHandle libraryHandle, Lib3MF_Toolpath pToolpath, const Lib3MF_uint32 nNewUUIDBufferSize, Lib3MF_uint32* pNewUUIDNeededChars, char * pNewUUIDBuffer) +{ + if (libraryHandle == 0) + return LIB3MF_ERROR_INVALIDCAST; + sLib3MFDynamicWrapperTable * wrapperTable = (sLib3MFDynamicWrapperTable *) libraryHandle; + return wrapperTable->m_Toolpath_ResetUUID (pToolpath, nNewUUIDBufferSize, pNewUUIDNeededChars, pNewUUIDBuffer); +} + + Lib3MFResult CCall_lib3mf_toolpath_getunits(Lib3MFHandle libraryHandle, Lib3MF_Toolpath pToolpath, Lib3MF_double * pUnits) { if (libraryHandle == 0) @@ -3204,12 +3276,30 @@ Lib3MFResult CCall_lib3mf_toolpath_getlayerzmax(Lib3MFHandle libraryHandle, Lib3 } -Lib3MFResult CCall_lib3mf_toolpath_getlayerz(Lib3MFHandle libraryHandle, Lib3MF_Toolpath pToolpath, Lib3MF_uint32 nLayerIndex, Lib3MF_uint32 * pZValue) +Lib3MFResult CCall_lib3mf_toolpath_getlayerzmin(Lib3MFHandle libraryHandle, Lib3MF_Toolpath pToolpath, Lib3MF_uint32 nIndex, Lib3MF_uint32 * pZMin) { if (libraryHandle == 0) return LIB3MF_ERROR_INVALIDCAST; sLib3MFDynamicWrapperTable * wrapperTable = (sLib3MFDynamicWrapperTable *) libraryHandle; - return wrapperTable->m_Toolpath_GetLayerZ (pToolpath, nLayerIndex, pZValue); + return wrapperTable->m_Toolpath_GetLayerZMin (pToolpath, nIndex, pZMin); +} + + +Lib3MFResult CCall_lib3mf_toolpath_getlayerthickness(Lib3MFHandle libraryHandle, Lib3MF_Toolpath pToolpath, Lib3MF_uint32 nIndex, Lib3MF_uint32 * pZThickness) +{ + if (libraryHandle == 0) + return LIB3MF_ERROR_INVALIDCAST; + sLib3MFDynamicWrapperTable * wrapperTable = (sLib3MFDynamicWrapperTable *) libraryHandle; + return wrapperTable->m_Toolpath_GetLayerThickness (pToolpath, nIndex, pZThickness); +} + + +Lib3MFResult CCall_lib3mf_toolpath_hasuniformthickness(Lib3MFHandle libraryHandle, Lib3MF_Toolpath pToolpath, bool * pUniformThickness) +{ + if (libraryHandle == 0) + return LIB3MF_ERROR_INVALIDCAST; + sLib3MFDynamicWrapperTable * wrapperTable = (sLib3MFDynamicWrapperTable *) libraryHandle; + return wrapperTable->m_Toolpath_HasUniformThickness (pToolpath, pUniformThickness); } @@ -3321,21 +3411,21 @@ Lib3MFResult CCall_lib3mf_toolpath_deletecustomdata(Lib3MFHandle libraryHandle, } -Lib3MFResult CCall_lib3mf_toolpath_registercustomintegerattribute(Lib3MFHandle libraryHandle, Lib3MF_Toolpath pToolpath, const char * pNameSpace, const char * pAttributeName) +Lib3MFResult CCall_lib3mf_toolpath_registercustomintegersegmentattribute(Lib3MFHandle libraryHandle, Lib3MF_Toolpath pToolpath, const char * pNameSpace, const char * pAttributeName) { if (libraryHandle == 0) return LIB3MF_ERROR_INVALIDCAST; sLib3MFDynamicWrapperTable * wrapperTable = (sLib3MFDynamicWrapperTable *) libraryHandle; - return wrapperTable->m_Toolpath_RegisterCustomIntegerAttribute (pToolpath, pNameSpace, pAttributeName); + return wrapperTable->m_Toolpath_RegisterCustomIntegerSegmentAttribute (pToolpath, pNameSpace, pAttributeName); } -Lib3MFResult CCall_lib3mf_toolpath_registercustomdoubleattribute(Lib3MFHandle libraryHandle, Lib3MF_Toolpath pToolpath, const char * pNameSpace, const char * pAttributeName) +Lib3MFResult CCall_lib3mf_toolpath_registercustomdoublesegmentattribute(Lib3MFHandle libraryHandle, Lib3MF_Toolpath pToolpath, const char * pNameSpace, const char * pAttributeName) { if (libraryHandle == 0) return LIB3MF_ERROR_INVALIDCAST; sLib3MFDynamicWrapperTable * wrapperTable = (sLib3MFDynamicWrapperTable *) libraryHandle; - return wrapperTable->m_Toolpath_RegisterCustomDoubleAttribute (pToolpath, pNameSpace, pAttributeName); + return wrapperTable->m_Toolpath_RegisterCustomDoubleSegmentAttribute (pToolpath, pNameSpace, pAttributeName); } @@ -4809,6 +4899,23 @@ type Position2D struct { Coordinates[2] float32 } +// DiscretePosition2D represents a Lib3MF struct. +type DiscretePosition2D struct { + Coordinates[2] int32 +} + +// Hatch2D represents a Lib3MF struct. +type Hatch2D struct { + Point1Coordinates[2] float32 + Point2Coordinates[2] float32 +} + +// DiscreteHatch2D represents a Lib3MF struct. +type DiscreteHatch2D struct { + Point1Coordinates[2] int32 + Point2Coordinates[2] int32 +} + // CompositeConstituent represents a Lib3MF struct. type CompositeConstituent struct { PropertyID uint32 @@ -4917,6 +5024,9 @@ const LIB3MF_ERROR_EMPTYNAMESPACEPREFIX = 4006; const LIB3MF_ERROR_EMPTYNAMESPACE = 4007; const LIB3MF_ERROR_INVALIDNAMESPACEPREFIX = 4008; const LIB3MF_ERROR_WRITERDOESNOTSUPPORTNAMESPACES = 4009; +const LIB3MF_ERROR_TOOLPATH_INVALIDHATCHCOORDINATE = 4010; +const LIB3MF_ERROR_TOOLPATH_INVALIDPOINTCOORDINATE = 4011; +const LIB3MF_ERROR_TOOLPATH_INVALIDHATCHCOUNT = 4012; // WrappedError is an error that wraps a Lib3MF error. type WrappedError struct { @@ -5044,6 +5154,12 @@ func errorMessage(errorcode uint32) string { return "Invalid namespace prefix."; case LIB3MF_ERROR_WRITERDOESNOTSUPPORTNAMESPACES: return "Writer does not support namespaces."; + case LIB3MF_ERROR_TOOLPATH_INVALIDHATCHCOORDINATE: + return "Invalid hatch coordinate."; + case LIB3MF_ERROR_TOOLPATH_INVALIDPOINTCOORDINATE: + return "Invalid point coordinate."; + case LIB3MF_ERROR_TOOLPATH_INVALIDHATCHCOUNT: + return "Invalid hatch count"; default: return "unknown"; } @@ -9091,17 +9207,34 @@ func (inst ToolpathLayerReader) GetPartUUIDByLocalPartID(localPartID uint32) (st return string(bufferpartUUID[:(filledinpartUUID-1)]), nil } -// GetSegmentPointData retrieves the assigned segment point list. For type hatch, the points are taken pairwise. -func (inst ToolpathLayerReader) GetSegmentPointData(index uint32, pointData []Position2D) ([]Position2D, error) { +// GetSegmentPointDataInModelUnits retrieves the assigned segment point list. For type hatch, the points are taken pairwise. +func (inst ToolpathLayerReader) GetSegmentPointDataInModelUnits(index uint32, pointData []Position2D) ([]Position2D, error) { var neededforpointData C.uint64_t - ret := C.CCall_lib3mf_toolpathlayerreader_getsegmentpointdata(inst.wrapperRef.LibraryHandle, inst.Ref, C.uint32_t(index), 0, &neededforpointData, nil) + ret := C.CCall_lib3mf_toolpathlayerreader_getsegmentpointdatainmodelunits(inst.wrapperRef.LibraryHandle, inst.Ref, C.uint32_t(index), 0, &neededforpointData, nil) if ret != 0 { return nil, makeError(uint32(ret)) } if len(pointData) < int(neededforpointData) { pointData = append(pointData, make([]Position2D, int(neededforpointData)-len(pointData))...) } - ret = C.CCall_lib3mf_toolpathlayerreader_getsegmentpointdata(inst.wrapperRef.LibraryHandle, inst.Ref, C.uint32_t(index), neededforpointData, nil, (*C.sLib3MFPosition2D)(unsafe.Pointer(&pointData[0]))) + ret = C.CCall_lib3mf_toolpathlayerreader_getsegmentpointdatainmodelunits(inst.wrapperRef.LibraryHandle, inst.Ref, C.uint32_t(index), neededforpointData, nil, (*C.sLib3MFPosition2D)(unsafe.Pointer(&pointData[0]))) + if ret != 0 { + return nil, makeError(uint32(ret)) + } + return pointData[:int(neededforpointData)], nil +} + +// GetSegmentPointDataDiscrete retrieves the assigned segment point list in units. For type hatch, the points are taken pairwise. +func (inst ToolpathLayerReader) GetSegmentPointDataDiscrete(index uint32, pointData []DiscretePosition2D) ([]DiscretePosition2D, error) { + var neededforpointData C.uint64_t + ret := C.CCall_lib3mf_toolpathlayerreader_getsegmentpointdatadiscrete(inst.wrapperRef.LibraryHandle, inst.Ref, C.uint32_t(index), 0, &neededforpointData, nil) + if ret != 0 { + return nil, makeError(uint32(ret)) + } + if len(pointData) < int(neededforpointData) { + pointData = append(pointData, make([]DiscretePosition2D, int(neededforpointData)-len(pointData))...) + } + ret = C.CCall_lib3mf_toolpathlayerreader_getsegmentpointdatadiscrete(inst.wrapperRef.LibraryHandle, inst.Ref, C.uint32_t(index), neededforpointData, nil, (*C.sLib3MFDiscretePosition2D)(unsafe.Pointer(&pointData[0]))) if ret != 0 { return nil, makeError(uint32(ret)) } @@ -9285,27 +9418,72 @@ func (inst ToolpathLayerData) ClearSegmentAttributes() error { return nil } -// WriteHatchData writes hatch data to the layer. -func (inst ToolpathLayerData) WriteHatchData(profileID uint32, partID uint32, pointData []Position2D) error { - ret := C.CCall_lib3mf_toolpathlayerdata_writehatchdata(inst.wrapperRef.LibraryHandle, inst.Ref, C.uint32_t(profileID), C.uint32_t(partID), C.uint64_t(len(pointData)), (*C.sLib3MFPosition2D)(unsafe.Pointer(&pointData[0]))) +// AddCustomLineAttributes stores custom line attributes for the next WriteLoop, WritePolyline or WriteHatchData call. +func (inst ToolpathLayerData) AddCustomLineAttributes(nameSpace string, attributeName string, values []int32) error { + ret := C.CCall_lib3mf_toolpathlayerdata_addcustomlineattributes(inst.wrapperRef.LibraryHandle, inst.Ref, (*C.char)(unsafe.Pointer(&[]byte(nameSpace)[0])), (*C.char)(unsafe.Pointer(&[]byte(attributeName)[0])), C.uint64_t(len(values)), (*C.int32_t)(unsafe.Pointer(&values[0]))) + if ret != 0 { + return makeError(uint32(ret)) + } + return nil +} + +// ClearCustomLineAttributes clears all custom line attributes. Any call to WriteLoop, WritePolyline or WriteHatchData will do this implicitely. +func (inst ToolpathLayerData) ClearCustomLineAttributes() error { + ret := C.CCall_lib3mf_toolpathlayerdata_clearcustomlineattributes(inst.wrapperRef.LibraryHandle, inst.Ref) + if ret != 0 { + return makeError(uint32(ret)) + } + return nil +} + +// WriteHatchDataInModelUnits writes hatch data to the layer in model units. +func (inst ToolpathLayerData) WriteHatchDataInModelUnits(profileID uint32, partID uint32, writeCustomLineAttributes bool, hatchData []Hatch2D) error { + ret := C.CCall_lib3mf_toolpathlayerdata_writehatchdatainmodelunits(inst.wrapperRef.LibraryHandle, inst.Ref, C.uint32_t(profileID), C.uint32_t(partID), C.bool(writeCustomLineAttributes), C.uint64_t(len(hatchData)), (*C.sLib3MFHatch2D)(unsafe.Pointer(&hatchData[0]))) + if ret != 0 { + return makeError(uint32(ret)) + } + return nil +} + +// WriteHatchDataDiscrete writes hatch data to the layer in toolpath units. +func (inst ToolpathLayerData) WriteHatchDataDiscrete(profileID uint32, partID uint32, writeCustomLineAttributes bool, hatchData []DiscreteHatch2D) error { + ret := C.CCall_lib3mf_toolpathlayerdata_writehatchdatadiscrete(inst.wrapperRef.LibraryHandle, inst.Ref, C.uint32_t(profileID), C.uint32_t(partID), C.bool(writeCustomLineAttributes), C.uint64_t(len(hatchData)), (*C.sLib3MFDiscreteHatch2D)(unsafe.Pointer(&hatchData[0]))) + if ret != 0 { + return makeError(uint32(ret)) + } + return nil +} + +// WriteLoopInModelUnits writes loop data to the layer in model units. +func (inst ToolpathLayerData) WriteLoopInModelUnits(profileID uint32, partID uint32, writeCustomLineAttributes bool, pointData []Position2D) error { + ret := C.CCall_lib3mf_toolpathlayerdata_writeloopinmodelunits(inst.wrapperRef.LibraryHandle, inst.Ref, C.uint32_t(profileID), C.uint32_t(partID), C.bool(writeCustomLineAttributes), C.uint64_t(len(pointData)), (*C.sLib3MFPosition2D)(unsafe.Pointer(&pointData[0]))) if ret != 0 { return makeError(uint32(ret)) } return nil } -// WriteLoop writes loop data to the layer. -func (inst ToolpathLayerData) WriteLoop(profileID uint32, partID uint32, pointData []Position2D) error { - ret := C.CCall_lib3mf_toolpathlayerdata_writeloop(inst.wrapperRef.LibraryHandle, inst.Ref, C.uint32_t(profileID), C.uint32_t(partID), C.uint64_t(len(pointData)), (*C.sLib3MFPosition2D)(unsafe.Pointer(&pointData[0]))) +// WriteLoopDiscrete writes loop data to the layer in toolpath units. +func (inst ToolpathLayerData) WriteLoopDiscrete(profileID uint32, partID uint32, writeCustomLineAttributes bool, pointData []DiscretePosition2D) error { + ret := C.CCall_lib3mf_toolpathlayerdata_writeloopdiscrete(inst.wrapperRef.LibraryHandle, inst.Ref, C.uint32_t(profileID), C.uint32_t(partID), C.bool(writeCustomLineAttributes), C.uint64_t(len(pointData)), (*C.sLib3MFDiscretePosition2D)(unsafe.Pointer(&pointData[0]))) if ret != 0 { return makeError(uint32(ret)) } return nil } -// WritePolyline writes polyline data to the layer. -func (inst ToolpathLayerData) WritePolyline(profileID uint32, partID uint32, pointData []Position2D) error { - ret := C.CCall_lib3mf_toolpathlayerdata_writepolyline(inst.wrapperRef.LibraryHandle, inst.Ref, C.uint32_t(profileID), C.uint32_t(partID), C.uint64_t(len(pointData)), (*C.sLib3MFPosition2D)(unsafe.Pointer(&pointData[0]))) +// WritePolylineInModelUnits writes polyline data to the layer. +func (inst ToolpathLayerData) WritePolylineInModelUnits(profileID uint32, partID uint32, writeCustomLineAttributes bool, pointData []Position2D) error { + ret := C.CCall_lib3mf_toolpathlayerdata_writepolylineinmodelunits(inst.wrapperRef.LibraryHandle, inst.Ref, C.uint32_t(profileID), C.uint32_t(partID), C.bool(writeCustomLineAttributes), C.uint64_t(len(pointData)), (*C.sLib3MFPosition2D)(unsafe.Pointer(&pointData[0]))) + if ret != 0 { + return makeError(uint32(ret)) + } + return nil +} + +// WritePolylineDiscrete writes polyline data to the layer. +func (inst ToolpathLayerData) WritePolylineDiscrete(profileID uint32, partID uint32, writeCustomLineAttributes bool, pointData []DiscretePosition2D) error { + ret := C.CCall_lib3mf_toolpathlayerdata_writepolylinediscrete(inst.wrapperRef.LibraryHandle, inst.Ref, C.uint32_t(profileID), C.uint32_t(partID), C.bool(writeCustomLineAttributes), C.uint64_t(len(pointData)), (*C.sLib3MFDiscretePosition2D)(unsafe.Pointer(&pointData[0]))) if ret != 0 { return makeError(uint32(ret)) } @@ -9341,7 +9519,41 @@ func (wrapper Wrapper) NewToolpath(r ref) Toolpath { return Toolpath{wrapper.NewResource(r)} } -// GetUnits retrieves the unit factor. +// GetUUID retrieves the UUID of the toolpath. +func (inst Toolpath) GetUUID() (string, error) { + var neededforuUID C.uint32_t + var filledinuUID C.uint32_t + ret := C.CCall_lib3mf_toolpath_getuuid(inst.wrapperRef.LibraryHandle, inst.Ref, 0, &neededforuUID, nil) + if ret != 0 { + return "", makeError(uint32(ret)) + } + bufferSizeuUID := neededforuUID + bufferuUID := make([]byte, bufferSizeuUID) + ret = C.CCall_lib3mf_toolpath_getuuid(inst.wrapperRef.LibraryHandle, inst.Ref, bufferSizeuUID, &filledinuUID, (*C.char)(unsafe.Pointer(&bufferuUID[0]))) + if ret != 0 { + return "", makeError(uint32(ret)) + } + return string(bufferuUID[:(filledinuUID-1)]), nil +} + +// ResetUUID generates a new unique identifier for this toolpath and sets its value. +func (inst Toolpath) ResetUUID() (string, error) { + var neededfornewUUID C.uint32_t + var filledinnewUUID C.uint32_t + ret := C.CCall_lib3mf_toolpath_resetuuid(inst.wrapperRef.LibraryHandle, inst.Ref, 0, &neededfornewUUID, nil) + if ret != 0 { + return "", makeError(uint32(ret)) + } + bufferSizenewUUID := neededfornewUUID + buffernewUUID := make([]byte, bufferSizenewUUID) + ret = C.CCall_lib3mf_toolpath_resetuuid(inst.wrapperRef.LibraryHandle, inst.Ref, bufferSizenewUUID, &filledinnewUUID, (*C.char)(unsafe.Pointer(&buffernewUUID[0]))) + if ret != 0 { + return "", makeError(uint32(ret)) + } + return string(buffernewUUID[:(filledinnewUUID-1)]), nil +} + +// GetUnits retrieves the unit factor, i.e. how many model units are one toolpath unit. func (inst Toolpath) GetUnits() (float64, error) { var units C.double ret := C.CCall_lib3mf_toolpath_getunits(inst.wrapperRef.LibraryHandle, inst.Ref, &units) @@ -9400,7 +9612,7 @@ func (inst Toolpath) SetBottomZ(bottomZ uint32) error { return nil } -// GetLayerAttachment retrieves the Attachment of a layer. +// GetLayerAttachment retrieves the Attachment that contains the layer data. func (inst Toolpath) GetLayerAttachment(index uint32) (Attachment, error) { var attachment ref ret := C.CCall_lib3mf_toolpath_getlayerattachment(inst.wrapperRef.LibraryHandle, inst.Ref, C.uint32_t(index), &attachment) @@ -9447,14 +9659,34 @@ func (inst Toolpath) GetLayerZMax(index uint32) (uint32, error) { return uint32(zMax), nil } -// GetLayerZ return the z value of a layer in units. -func (inst Toolpath) GetLayerZ(layerIndex uint32) (uint32, error) { - var zValue C.uint32_t - ret := C.CCall_lib3mf_toolpath_getlayerz(inst.wrapperRef.LibraryHandle, inst.Ref, C.uint32_t(layerIndex), &zValue) +// GetLayerZMin retrieves the Minimum Z of a layer. +func (inst Toolpath) GetLayerZMin(index uint32) (uint32, error) { + var zMin C.uint32_t + ret := C.CCall_lib3mf_toolpath_getlayerzmin(inst.wrapperRef.LibraryHandle, inst.Ref, C.uint32_t(index), &zMin) + if ret != 0 { + return 0, makeError(uint32(ret)) + } + return uint32(zMin), nil +} + +// GetLayerThickness retrieves the Thickness of a layer. +func (inst Toolpath) GetLayerThickness(index uint32) (uint32, error) { + var zThickness C.uint32_t + ret := C.CCall_lib3mf_toolpath_getlayerthickness(inst.wrapperRef.LibraryHandle, inst.Ref, C.uint32_t(index), &zThickness) if ret != 0 { return 0, makeError(uint32(ret)) } - return uint32(zValue), nil + return uint32(zThickness), nil +} + +// HasUniformThickness checks if the toolpath has a uniform thickness value, i.e. each layer has the same thickness. +func (inst Toolpath) HasUniformThickness() (bool, error) { + var uniformThickness C.bool + ret := C.CCall_lib3mf_toolpath_hasuniformthickness(inst.wrapperRef.LibraryHandle, inst.Ref, &uniformThickness) + if ret != 0 { + return false, makeError(uint32(ret)) + } + return bool(uniformThickness), nil } // AddProfile adds a new profile to the toolpath. @@ -9588,18 +9820,18 @@ func (inst Toolpath) DeleteCustomData(data CustomDOMTree) (bool, error) { return bool(success), nil } -// RegisterCustomIntegerAttribute registers an Integer Attribute that each segment holds. -func (inst Toolpath) RegisterCustomIntegerAttribute(nameSpace string, attributeName string) error { - ret := C.CCall_lib3mf_toolpath_registercustomintegerattribute(inst.wrapperRef.LibraryHandle, inst.Ref, (*C.char)(unsafe.Pointer(&[]byte(nameSpace)[0])), (*C.char)(unsafe.Pointer(&[]byte(attributeName)[0]))) +// RegisterCustomIntegerSegmentAttribute registers an Integer Attribute that each segment holds. +func (inst Toolpath) RegisterCustomIntegerSegmentAttribute(nameSpace string, attributeName string) error { + ret := C.CCall_lib3mf_toolpath_registercustomintegersegmentattribute(inst.wrapperRef.LibraryHandle, inst.Ref, (*C.char)(unsafe.Pointer(&[]byte(nameSpace)[0])), (*C.char)(unsafe.Pointer(&[]byte(attributeName)[0]))) if ret != 0 { return makeError(uint32(ret)) } return nil } -// RegisterCustomDoubleAttribute registers a Double Attribute that each segment holds. Registering only applies to reader or writer objects created after the call. -func (inst Toolpath) RegisterCustomDoubleAttribute(nameSpace string, attributeName string) error { - ret := C.CCall_lib3mf_toolpath_registercustomdoubleattribute(inst.wrapperRef.LibraryHandle, inst.Ref, (*C.char)(unsafe.Pointer(&[]byte(nameSpace)[0])), (*C.char)(unsafe.Pointer(&[]byte(attributeName)[0]))) +// RegisterCustomDoubleSegmentAttribute registers a Double Attribute that each segment holds. Registering only applies to reader or writer objects created after the call. +func (inst Toolpath) RegisterCustomDoubleSegmentAttribute(nameSpace string, attributeName string) error { + ret := C.CCall_lib3mf_toolpath_registercustomdoublesegmentattribute(inst.wrapperRef.LibraryHandle, inst.Ref, (*C.char)(unsafe.Pointer(&[]byte(nameSpace)[0])), (*C.char)(unsafe.Pointer(&[]byte(attributeName)[0]))) if ret != 0 { return makeError(uint32(ret)) } diff --git a/Autogenerated/Bindings/Go/lib3mf_dynamic.cc b/Autogenerated/Bindings/Go/lib3mf_dynamic.cc index f7823f878..170c13f27 100644 --- a/Autogenerated/Bindings/Go/lib3mf_dynamic.cc +++ b/Autogenerated/Bindings/Go/lib3mf_dynamic.cc @@ -365,7 +365,8 @@ Lib3MFResult InitLib3MFWrapperTable(sLib3MFDynamicWrapperTable * pWrapperTable) pWrapperTable->m_ToolpathLayerReader_GetSegmentPartUUID = NULL; pWrapperTable->m_ToolpathLayerReader_GetSegmentLocalPartID = NULL; pWrapperTable->m_ToolpathLayerReader_GetPartUUIDByLocalPartID = NULL; - pWrapperTable->m_ToolpathLayerReader_GetSegmentPointData = NULL; + pWrapperTable->m_ToolpathLayerReader_GetSegmentPointDataInModelUnits = NULL; + pWrapperTable->m_ToolpathLayerReader_GetSegmentPointDataDiscrete = NULL; pWrapperTable->m_ToolpathLayerReader_FindAttributeInfoByName = NULL; pWrapperTable->m_ToolpathLayerReader_FindAttributeIDByName = NULL; pWrapperTable->m_ToolpathLayerReader_FindAttributeValueByName = NULL; @@ -381,11 +382,18 @@ Lib3MFResult InitLib3MFWrapperTable(sLib3MFDynamicWrapperTable * pWrapperTable) pWrapperTable->m_ToolpathLayerData_RegisterBuildItem = NULL; pWrapperTable->m_ToolpathLayerData_SetSegmentAttribute = NULL; pWrapperTable->m_ToolpathLayerData_ClearSegmentAttributes = NULL; - pWrapperTable->m_ToolpathLayerData_WriteHatchData = NULL; - pWrapperTable->m_ToolpathLayerData_WriteLoop = NULL; - pWrapperTable->m_ToolpathLayerData_WritePolyline = NULL; + pWrapperTable->m_ToolpathLayerData_AddCustomLineAttributes = NULL; + pWrapperTable->m_ToolpathLayerData_ClearCustomLineAttributes = NULL; + pWrapperTable->m_ToolpathLayerData_WriteHatchDataInModelUnits = NULL; + pWrapperTable->m_ToolpathLayerData_WriteHatchDataDiscrete = NULL; + pWrapperTable->m_ToolpathLayerData_WriteLoopInModelUnits = NULL; + pWrapperTable->m_ToolpathLayerData_WriteLoopDiscrete = NULL; + pWrapperTable->m_ToolpathLayerData_WritePolylineInModelUnits = NULL; + pWrapperTable->m_ToolpathLayerData_WritePolylineDiscrete = NULL; pWrapperTable->m_ToolpathLayerData_AddCustomData = NULL; pWrapperTable->m_ToolpathLayerData_Finish = NULL; + pWrapperTable->m_Toolpath_GetUUID = NULL; + pWrapperTable->m_Toolpath_ResetUUID = NULL; pWrapperTable->m_Toolpath_GetUnits = NULL; pWrapperTable->m_Toolpath_GetLayerCount = NULL; pWrapperTable->m_Toolpath_GetProfileCount = NULL; @@ -396,7 +404,9 @@ Lib3MFResult InitLib3MFWrapperTable(sLib3MFDynamicWrapperTable * pWrapperTable) pWrapperTable->m_Toolpath_ReadLayerData = NULL; pWrapperTable->m_Toolpath_GetLayerPath = NULL; pWrapperTable->m_Toolpath_GetLayerZMax = NULL; - pWrapperTable->m_Toolpath_GetLayerZ = NULL; + pWrapperTable->m_Toolpath_GetLayerZMin = NULL; + pWrapperTable->m_Toolpath_GetLayerThickness = NULL; + pWrapperTable->m_Toolpath_HasUniformThickness = NULL; pWrapperTable->m_Toolpath_AddProfile = NULL; pWrapperTable->m_Toolpath_GetProfile = NULL; pWrapperTable->m_Toolpath_GetProfileUUID = NULL; @@ -409,8 +419,8 @@ Lib3MFResult InitLib3MFWrapperTable(sLib3MFDynamicWrapperTable * pWrapperTable) pWrapperTable->m_Toolpath_AddCustomData = NULL; pWrapperTable->m_Toolpath_ClearCustomData = NULL; pWrapperTable->m_Toolpath_DeleteCustomData = NULL; - pWrapperTable->m_Toolpath_RegisterCustomIntegerAttribute = NULL; - pWrapperTable->m_Toolpath_RegisterCustomDoubleAttribute = NULL; + pWrapperTable->m_Toolpath_RegisterCustomIntegerSegmentAttribute = NULL; + pWrapperTable->m_Toolpath_RegisterCustomDoubleSegmentAttribute = NULL; pWrapperTable->m_ToolpathIterator_GetCurrentToolpath = NULL; pWrapperTable->m_SliceStack_GetBottomZ = NULL; pWrapperTable->m_SliceStack_GetSliceCount = NULL; @@ -3455,12 +3465,21 @@ Lib3MFResult LoadLib3MFWrapperTable(sLib3MFDynamicWrapperTable * pWrapperTable, return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; #ifdef _WIN32 - pWrapperTable->m_ToolpathLayerReader_GetSegmentPointData = (PLib3MFToolpathLayerReader_GetSegmentPointDataPtr) GetProcAddress(hLibrary, "lib3mf_toolpathlayerreader_getsegmentpointdata"); + pWrapperTable->m_ToolpathLayerReader_GetSegmentPointDataInModelUnits = (PLib3MFToolpathLayerReader_GetSegmentPointDataInModelUnitsPtr) GetProcAddress(hLibrary, "lib3mf_toolpathlayerreader_getsegmentpointdatainmodelunits"); #else // _WIN32 - pWrapperTable->m_ToolpathLayerReader_GetSegmentPointData = (PLib3MFToolpathLayerReader_GetSegmentPointDataPtr) dlsym(hLibrary, "lib3mf_toolpathlayerreader_getsegmentpointdata"); + pWrapperTable->m_ToolpathLayerReader_GetSegmentPointDataInModelUnits = (PLib3MFToolpathLayerReader_GetSegmentPointDataInModelUnitsPtr) dlsym(hLibrary, "lib3mf_toolpathlayerreader_getsegmentpointdatainmodelunits"); dlerror(); #endif // _WIN32 - if (pWrapperTable->m_ToolpathLayerReader_GetSegmentPointData == NULL) + if (pWrapperTable->m_ToolpathLayerReader_GetSegmentPointDataInModelUnits == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_ToolpathLayerReader_GetSegmentPointDataDiscrete = (PLib3MFToolpathLayerReader_GetSegmentPointDataDiscretePtr) GetProcAddress(hLibrary, "lib3mf_toolpathlayerreader_getsegmentpointdatadiscrete"); + #else // _WIN32 + pWrapperTable->m_ToolpathLayerReader_GetSegmentPointDataDiscrete = (PLib3MFToolpathLayerReader_GetSegmentPointDataDiscretePtr) dlsym(hLibrary, "lib3mf_toolpathlayerreader_getsegmentpointdatadiscrete"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_ToolpathLayerReader_GetSegmentPointDataDiscrete == NULL) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; #ifdef _WIN32 @@ -3599,30 +3618,75 @@ Lib3MFResult LoadLib3MFWrapperTable(sLib3MFDynamicWrapperTable * pWrapperTable, return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; #ifdef _WIN32 - pWrapperTable->m_ToolpathLayerData_WriteHatchData = (PLib3MFToolpathLayerData_WriteHatchDataPtr) GetProcAddress(hLibrary, "lib3mf_toolpathlayerdata_writehatchdata"); + pWrapperTable->m_ToolpathLayerData_AddCustomLineAttributes = (PLib3MFToolpathLayerData_AddCustomLineAttributesPtr) GetProcAddress(hLibrary, "lib3mf_toolpathlayerdata_addcustomlineattributes"); + #else // _WIN32 + pWrapperTable->m_ToolpathLayerData_AddCustomLineAttributes = (PLib3MFToolpathLayerData_AddCustomLineAttributesPtr) dlsym(hLibrary, "lib3mf_toolpathlayerdata_addcustomlineattributes"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_ToolpathLayerData_AddCustomLineAttributes == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_ToolpathLayerData_ClearCustomLineAttributes = (PLib3MFToolpathLayerData_ClearCustomLineAttributesPtr) GetProcAddress(hLibrary, "lib3mf_toolpathlayerdata_clearcustomlineattributes"); + #else // _WIN32 + pWrapperTable->m_ToolpathLayerData_ClearCustomLineAttributes = (PLib3MFToolpathLayerData_ClearCustomLineAttributesPtr) dlsym(hLibrary, "lib3mf_toolpathlayerdata_clearcustomlineattributes"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_ToolpathLayerData_ClearCustomLineAttributes == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_ToolpathLayerData_WriteHatchDataInModelUnits = (PLib3MFToolpathLayerData_WriteHatchDataInModelUnitsPtr) GetProcAddress(hLibrary, "lib3mf_toolpathlayerdata_writehatchdatainmodelunits"); + #else // _WIN32 + pWrapperTable->m_ToolpathLayerData_WriteHatchDataInModelUnits = (PLib3MFToolpathLayerData_WriteHatchDataInModelUnitsPtr) dlsym(hLibrary, "lib3mf_toolpathlayerdata_writehatchdatainmodelunits"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_ToolpathLayerData_WriteHatchDataInModelUnits == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_ToolpathLayerData_WriteHatchDataDiscrete = (PLib3MFToolpathLayerData_WriteHatchDataDiscretePtr) GetProcAddress(hLibrary, "lib3mf_toolpathlayerdata_writehatchdatadiscrete"); + #else // _WIN32 + pWrapperTable->m_ToolpathLayerData_WriteHatchDataDiscrete = (PLib3MFToolpathLayerData_WriteHatchDataDiscretePtr) dlsym(hLibrary, "lib3mf_toolpathlayerdata_writehatchdatadiscrete"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_ToolpathLayerData_WriteHatchDataDiscrete == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_ToolpathLayerData_WriteLoopInModelUnits = (PLib3MFToolpathLayerData_WriteLoopInModelUnitsPtr) GetProcAddress(hLibrary, "lib3mf_toolpathlayerdata_writeloopinmodelunits"); #else // _WIN32 - pWrapperTable->m_ToolpathLayerData_WriteHatchData = (PLib3MFToolpathLayerData_WriteHatchDataPtr) dlsym(hLibrary, "lib3mf_toolpathlayerdata_writehatchdata"); + pWrapperTable->m_ToolpathLayerData_WriteLoopInModelUnits = (PLib3MFToolpathLayerData_WriteLoopInModelUnitsPtr) dlsym(hLibrary, "lib3mf_toolpathlayerdata_writeloopinmodelunits"); dlerror(); #endif // _WIN32 - if (pWrapperTable->m_ToolpathLayerData_WriteHatchData == NULL) + if (pWrapperTable->m_ToolpathLayerData_WriteLoopInModelUnits == NULL) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; #ifdef _WIN32 - pWrapperTable->m_ToolpathLayerData_WriteLoop = (PLib3MFToolpathLayerData_WriteLoopPtr) GetProcAddress(hLibrary, "lib3mf_toolpathlayerdata_writeloop"); + pWrapperTable->m_ToolpathLayerData_WriteLoopDiscrete = (PLib3MFToolpathLayerData_WriteLoopDiscretePtr) GetProcAddress(hLibrary, "lib3mf_toolpathlayerdata_writeloopdiscrete"); #else // _WIN32 - pWrapperTable->m_ToolpathLayerData_WriteLoop = (PLib3MFToolpathLayerData_WriteLoopPtr) dlsym(hLibrary, "lib3mf_toolpathlayerdata_writeloop"); + pWrapperTable->m_ToolpathLayerData_WriteLoopDiscrete = (PLib3MFToolpathLayerData_WriteLoopDiscretePtr) dlsym(hLibrary, "lib3mf_toolpathlayerdata_writeloopdiscrete"); dlerror(); #endif // _WIN32 - if (pWrapperTable->m_ToolpathLayerData_WriteLoop == NULL) + if (pWrapperTable->m_ToolpathLayerData_WriteLoopDiscrete == NULL) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; #ifdef _WIN32 - pWrapperTable->m_ToolpathLayerData_WritePolyline = (PLib3MFToolpathLayerData_WritePolylinePtr) GetProcAddress(hLibrary, "lib3mf_toolpathlayerdata_writepolyline"); + pWrapperTable->m_ToolpathLayerData_WritePolylineInModelUnits = (PLib3MFToolpathLayerData_WritePolylineInModelUnitsPtr) GetProcAddress(hLibrary, "lib3mf_toolpathlayerdata_writepolylineinmodelunits"); #else // _WIN32 - pWrapperTable->m_ToolpathLayerData_WritePolyline = (PLib3MFToolpathLayerData_WritePolylinePtr) dlsym(hLibrary, "lib3mf_toolpathlayerdata_writepolyline"); + pWrapperTable->m_ToolpathLayerData_WritePolylineInModelUnits = (PLib3MFToolpathLayerData_WritePolylineInModelUnitsPtr) dlsym(hLibrary, "lib3mf_toolpathlayerdata_writepolylineinmodelunits"); dlerror(); #endif // _WIN32 - if (pWrapperTable->m_ToolpathLayerData_WritePolyline == NULL) + if (pWrapperTable->m_ToolpathLayerData_WritePolylineInModelUnits == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_ToolpathLayerData_WritePolylineDiscrete = (PLib3MFToolpathLayerData_WritePolylineDiscretePtr) GetProcAddress(hLibrary, "lib3mf_toolpathlayerdata_writepolylinediscrete"); + #else // _WIN32 + pWrapperTable->m_ToolpathLayerData_WritePolylineDiscrete = (PLib3MFToolpathLayerData_WritePolylineDiscretePtr) dlsym(hLibrary, "lib3mf_toolpathlayerdata_writepolylinediscrete"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_ToolpathLayerData_WritePolylineDiscrete == NULL) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; #ifdef _WIN32 @@ -3643,6 +3707,24 @@ Lib3MFResult LoadLib3MFWrapperTable(sLib3MFDynamicWrapperTable * pWrapperTable, if (pWrapperTable->m_ToolpathLayerData_Finish == NULL) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + #ifdef _WIN32 + pWrapperTable->m_Toolpath_GetUUID = (PLib3MFToolpath_GetUUIDPtr) GetProcAddress(hLibrary, "lib3mf_toolpath_getuuid"); + #else // _WIN32 + pWrapperTable->m_Toolpath_GetUUID = (PLib3MFToolpath_GetUUIDPtr) dlsym(hLibrary, "lib3mf_toolpath_getuuid"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_Toolpath_GetUUID == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_Toolpath_ResetUUID = (PLib3MFToolpath_ResetUUIDPtr) GetProcAddress(hLibrary, "lib3mf_toolpath_resetuuid"); + #else // _WIN32 + pWrapperTable->m_Toolpath_ResetUUID = (PLib3MFToolpath_ResetUUIDPtr) dlsym(hLibrary, "lib3mf_toolpath_resetuuid"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_Toolpath_ResetUUID == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + #ifdef _WIN32 pWrapperTable->m_Toolpath_GetUnits = (PLib3MFToolpath_GetUnitsPtr) GetProcAddress(hLibrary, "lib3mf_toolpath_getunits"); #else // _WIN32 @@ -3734,12 +3816,30 @@ Lib3MFResult LoadLib3MFWrapperTable(sLib3MFDynamicWrapperTable * pWrapperTable, return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; #ifdef _WIN32 - pWrapperTable->m_Toolpath_GetLayerZ = (PLib3MFToolpath_GetLayerZPtr) GetProcAddress(hLibrary, "lib3mf_toolpath_getlayerz"); + pWrapperTable->m_Toolpath_GetLayerZMin = (PLib3MFToolpath_GetLayerZMinPtr) GetProcAddress(hLibrary, "lib3mf_toolpath_getlayerzmin"); + #else // _WIN32 + pWrapperTable->m_Toolpath_GetLayerZMin = (PLib3MFToolpath_GetLayerZMinPtr) dlsym(hLibrary, "lib3mf_toolpath_getlayerzmin"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_Toolpath_GetLayerZMin == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_Toolpath_GetLayerThickness = (PLib3MFToolpath_GetLayerThicknessPtr) GetProcAddress(hLibrary, "lib3mf_toolpath_getlayerthickness"); + #else // _WIN32 + pWrapperTable->m_Toolpath_GetLayerThickness = (PLib3MFToolpath_GetLayerThicknessPtr) dlsym(hLibrary, "lib3mf_toolpath_getlayerthickness"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_Toolpath_GetLayerThickness == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_Toolpath_HasUniformThickness = (PLib3MFToolpath_HasUniformThicknessPtr) GetProcAddress(hLibrary, "lib3mf_toolpath_hasuniformthickness"); #else // _WIN32 - pWrapperTable->m_Toolpath_GetLayerZ = (PLib3MFToolpath_GetLayerZPtr) dlsym(hLibrary, "lib3mf_toolpath_getlayerz"); + pWrapperTable->m_Toolpath_HasUniformThickness = (PLib3MFToolpath_HasUniformThicknessPtr) dlsym(hLibrary, "lib3mf_toolpath_hasuniformthickness"); dlerror(); #endif // _WIN32 - if (pWrapperTable->m_Toolpath_GetLayerZ == NULL) + if (pWrapperTable->m_Toolpath_HasUniformThickness == NULL) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; #ifdef _WIN32 @@ -3851,21 +3951,21 @@ Lib3MFResult LoadLib3MFWrapperTable(sLib3MFDynamicWrapperTable * pWrapperTable, return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; #ifdef _WIN32 - pWrapperTable->m_Toolpath_RegisterCustomIntegerAttribute = (PLib3MFToolpath_RegisterCustomIntegerAttributePtr) GetProcAddress(hLibrary, "lib3mf_toolpath_registercustomintegerattribute"); + pWrapperTable->m_Toolpath_RegisterCustomIntegerSegmentAttribute = (PLib3MFToolpath_RegisterCustomIntegerSegmentAttributePtr) GetProcAddress(hLibrary, "lib3mf_toolpath_registercustomintegersegmentattribute"); #else // _WIN32 - pWrapperTable->m_Toolpath_RegisterCustomIntegerAttribute = (PLib3MFToolpath_RegisterCustomIntegerAttributePtr) dlsym(hLibrary, "lib3mf_toolpath_registercustomintegerattribute"); + pWrapperTable->m_Toolpath_RegisterCustomIntegerSegmentAttribute = (PLib3MFToolpath_RegisterCustomIntegerSegmentAttributePtr) dlsym(hLibrary, "lib3mf_toolpath_registercustomintegersegmentattribute"); dlerror(); #endif // _WIN32 - if (pWrapperTable->m_Toolpath_RegisterCustomIntegerAttribute == NULL) + if (pWrapperTable->m_Toolpath_RegisterCustomIntegerSegmentAttribute == NULL) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; #ifdef _WIN32 - pWrapperTable->m_Toolpath_RegisterCustomDoubleAttribute = (PLib3MFToolpath_RegisterCustomDoubleAttributePtr) GetProcAddress(hLibrary, "lib3mf_toolpath_registercustomdoubleattribute"); + pWrapperTable->m_Toolpath_RegisterCustomDoubleSegmentAttribute = (PLib3MFToolpath_RegisterCustomDoubleSegmentAttributePtr) GetProcAddress(hLibrary, "lib3mf_toolpath_registercustomdoublesegmentattribute"); #else // _WIN32 - pWrapperTable->m_Toolpath_RegisterCustomDoubleAttribute = (PLib3MFToolpath_RegisterCustomDoubleAttributePtr) dlsym(hLibrary, "lib3mf_toolpath_registercustomdoubleattribute"); + pWrapperTable->m_Toolpath_RegisterCustomDoubleSegmentAttribute = (PLib3MFToolpath_RegisterCustomDoubleSegmentAttributePtr) dlsym(hLibrary, "lib3mf_toolpath_registercustomdoublesegmentattribute"); dlerror(); #endif // _WIN32 - if (pWrapperTable->m_Toolpath_RegisterCustomDoubleAttribute == NULL) + if (pWrapperTable->m_Toolpath_RegisterCustomDoubleSegmentAttribute == NULL) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; #ifdef _WIN32 diff --git a/Autogenerated/Bindings/Go/lib3mf_dynamic.h b/Autogenerated/Bindings/Go/lib3mf_dynamic.h index 7a7807dd7..99768a151 100644 --- a/Autogenerated/Bindings/Go/lib3mf_dynamic.h +++ b/Autogenerated/Bindings/Go/lib3mf_dynamic.h @@ -3350,10 +3350,22 @@ typedef Lib3MFResult (*PLib3MFToolpathLayerReader_GetPartUUIDByLocalPartIDPtr) ( * @param[in] nIndex - Index. Must be between 0 and Count - 1. * @param[in] nPointDataBufferSize - Number of elements in buffer * @param[out] pPointDataNeededCount - will be filled with the count of the written elements, or needed buffer size. -* @param[out] pPointDataBuffer - Position2D buffer of The point data array +* @param[out] pPointDataBuffer - Position2D buffer of The point data array. The point coordinates are in model units. * @return error code or 0 (success) */ -typedef Lib3MFResult (*PLib3MFToolpathLayerReader_GetSegmentPointDataPtr) (Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nIndex, const Lib3MF_uint64 nPointDataBufferSize, Lib3MF_uint64* pPointDataNeededCount, sLib3MFPosition2D * pPointDataBuffer); +typedef Lib3MFResult (*PLib3MFToolpathLayerReader_GetSegmentPointDataInModelUnitsPtr) (Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nIndex, const Lib3MF_uint64 nPointDataBufferSize, Lib3MF_uint64* pPointDataNeededCount, sLib3MFPosition2D * pPointDataBuffer); + +/** +* Retrieves the assigned segment point list in units. For type hatch, the points are taken pairwise. +* +* @param[in] pToolpathLayerReader - ToolpathLayerReader instance. +* @param[in] nIndex - Index. Must be between 0 and Count - 1. +* @param[in] nPointDataBufferSize - Number of elements in buffer +* @param[out] pPointDataNeededCount - will be filled with the count of the written elements, or needed buffer size. +* @param[out] pPointDataBuffer - DiscretePosition2D buffer of The point data array. The point coordinates are in toolpath units. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFToolpathLayerReader_GetSegmentPointDataDiscretePtr) (Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nIndex, const Lib3MF_uint64 nPointDataBufferSize, Lib3MF_uint64* pPointDataNeededCount, sLib3MFDiscretePosition2D * pPointDataBuffer); /** * Retrieves a segment attribute Information by Attribute Name. Will fail if Attribute does not exist. @@ -3524,28 +3536,76 @@ typedef Lib3MFResult (*PLib3MFToolpathLayerData_SetSegmentAttributePtr) (Lib3MF_ typedef Lib3MFResult (*PLib3MFToolpathLayerData_ClearSegmentAttributesPtr) (Lib3MF_ToolpathLayerData pToolpathLayerData); /** -* writes hatch data to the layer. +* Stores custom line attributes for the next WriteLoop, WritePolyline or WriteHatchData call. +* +* @param[in] pToolpathLayerData - ToolpathLayerData instance. +* @param[in] pNameSpace - The namespace of the attribute to register. +* @param[in] pAttributeName - The name of the attribute to register. +* @param[in] nValuesBufferSize - Number of elements in buffer +* @param[in] pValuesBuffer - int32 buffer of Custom Values to store on segment lines. Array MUST NOT be empty. If custom attributes had been already defined, the error cardinality MUST match, or an error will be thrown. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFToolpathLayerData_AddCustomLineAttributesPtr) (Lib3MF_ToolpathLayerData pToolpathLayerData, const char * pNameSpace, const char * pAttributeName, Lib3MF_uint64 nValuesBufferSize, const Lib3MF_int32 * pValuesBuffer); + +/** +* Clears all custom line attributes. Any call to WriteLoop, WritePolyline or WriteHatchData will do this implicitely. +* +* @param[in] pToolpathLayerData - ToolpathLayerData instance. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFToolpathLayerData_ClearCustomLineAttributesPtr) (Lib3MF_ToolpathLayerData pToolpathLayerData); + +/** +* writes hatch data to the layer in model units. +* +* @param[in] pToolpathLayerData - ToolpathLayerData instance. +* @param[in] nProfileID - The toolpath profile to use +* @param[in] nPartID - The toolpath part to use +* @param[in] bWriteCustomLineAttributes - If true, custom line attributes are written. The cardinality of each custom attribute MUST be equal to the number of hatches in the hatchdata array. In any case, stored custom attributes will be cleared after the call. +* @param[in] nHatchDataBufferSize - Number of elements in buffer +* @param[in] pHatchDataBuffer - Hatch2D buffer of The hatch data in model units. Array MUST NOT be empty. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFToolpathLayerData_WriteHatchDataInModelUnitsPtr) (Lib3MF_ToolpathLayerData pToolpathLayerData, Lib3MF_uint32 nProfileID, Lib3MF_uint32 nPartID, bool bWriteCustomLineAttributes, Lib3MF_uint64 nHatchDataBufferSize, const sLib3MFHatch2D * pHatchDataBuffer); + +/** +* writes hatch data to the layer in toolpath units. +* +* @param[in] pToolpathLayerData - ToolpathLayerData instance. +* @param[in] nProfileID - The toolpath profile to use +* @param[in] nPartID - The toolpath part to use +* @param[in] bWriteCustomLineAttributes - If true, custom line attributes are written. The cardinality of each custom attribute MUST be equal to the number of hatches in the hatchdata array. In any case, stored custom attributes will be cleared after the call. +* @param[in] nHatchDataBufferSize - Number of elements in buffer +* @param[in] pHatchDataBuffer - DiscreteHatch2D buffer of The hatch data in toolpath units. Array MUST NOT be empty. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFToolpathLayerData_WriteHatchDataDiscretePtr) (Lib3MF_ToolpathLayerData pToolpathLayerData, Lib3MF_uint32 nProfileID, Lib3MF_uint32 nPartID, bool bWriteCustomLineAttributes, Lib3MF_uint64 nHatchDataBufferSize, const sLib3MFDiscreteHatch2D * pHatchDataBuffer); + +/** +* writes loop data to the layer in model units. * * @param[in] pToolpathLayerData - ToolpathLayerData instance. * @param[in] nProfileID - The toolpath profile to use * @param[in] nPartID - The toolpath part to use +* @param[in] bWriteCustomLineAttributes - If true, custom line attributes are written. The cardinality of each custom attribute MUST be equal to the number of points in the pointdata array. In any case, stored custom attributes will be cleared after the call. * @param[in] nPointDataBufferSize - Number of elements in buffer -* @param[in] pPointDataBuffer - Position2D buffer of The point data +* @param[in] pPointDataBuffer - Position2D buffer of The point data in model units. Array MUST NOT be empty. * @return error code or 0 (success) */ -typedef Lib3MFResult (*PLib3MFToolpathLayerData_WriteHatchDataPtr) (Lib3MF_ToolpathLayerData pToolpathLayerData, Lib3MF_uint32 nProfileID, Lib3MF_uint32 nPartID, Lib3MF_uint64 nPointDataBufferSize, const sLib3MFPosition2D * pPointDataBuffer); +typedef Lib3MFResult (*PLib3MFToolpathLayerData_WriteLoopInModelUnitsPtr) (Lib3MF_ToolpathLayerData pToolpathLayerData, Lib3MF_uint32 nProfileID, Lib3MF_uint32 nPartID, bool bWriteCustomLineAttributes, Lib3MF_uint64 nPointDataBufferSize, const sLib3MFPosition2D * pPointDataBuffer); /** -* writes loop data to the layer. +* writes loop data to the layer in toolpath units. * * @param[in] pToolpathLayerData - ToolpathLayerData instance. * @param[in] nProfileID - The toolpath profile to use * @param[in] nPartID - The toolpath part to use +* @param[in] bWriteCustomLineAttributes - If true, custom line attributes are written. The cardinality of each custom attribute MUST be equal to the number of points in the pointdata array. In any case, stored custom attributes will be cleared after the call. * @param[in] nPointDataBufferSize - Number of elements in buffer -* @param[in] pPointDataBuffer - Position2D buffer of The point data +* @param[in] pPointDataBuffer - DiscretePosition2D buffer of The point data in toolpath units. Array MUST NOT be empty. * @return error code or 0 (success) */ -typedef Lib3MFResult (*PLib3MFToolpathLayerData_WriteLoopPtr) (Lib3MF_ToolpathLayerData pToolpathLayerData, Lib3MF_uint32 nProfileID, Lib3MF_uint32 nPartID, Lib3MF_uint64 nPointDataBufferSize, const sLib3MFPosition2D * pPointDataBuffer); +typedef Lib3MFResult (*PLib3MFToolpathLayerData_WriteLoopDiscretePtr) (Lib3MF_ToolpathLayerData pToolpathLayerData, Lib3MF_uint32 nProfileID, Lib3MF_uint32 nPartID, bool bWriteCustomLineAttributes, Lib3MF_uint64 nPointDataBufferSize, const sLib3MFDiscretePosition2D * pPointDataBuffer); /** * writes polyline data to the layer. @@ -3553,11 +3613,25 @@ typedef Lib3MFResult (*PLib3MFToolpathLayerData_WriteLoopPtr) (Lib3MF_ToolpathLa * @param[in] pToolpathLayerData - ToolpathLayerData instance. * @param[in] nProfileID - The toolpath profile to use * @param[in] nPartID - The toolpath part to use +* @param[in] bWriteCustomLineAttributes - If true, custom line attributes are written. The cardinality of each custom attribute MUST be equal to the number of points in the pointdata array. In any case, stored custom attributes will be cleared after the call. * @param[in] nPointDataBufferSize - Number of elements in buffer -* @param[in] pPointDataBuffer - Position2D buffer of The point data +* @param[in] pPointDataBuffer - Position2D buffer of The point data in model units. Array MUST NOT be empty. * @return error code or 0 (success) */ -typedef Lib3MFResult (*PLib3MFToolpathLayerData_WritePolylinePtr) (Lib3MF_ToolpathLayerData pToolpathLayerData, Lib3MF_uint32 nProfileID, Lib3MF_uint32 nPartID, Lib3MF_uint64 nPointDataBufferSize, const sLib3MFPosition2D * pPointDataBuffer); +typedef Lib3MFResult (*PLib3MFToolpathLayerData_WritePolylineInModelUnitsPtr) (Lib3MF_ToolpathLayerData pToolpathLayerData, Lib3MF_uint32 nProfileID, Lib3MF_uint32 nPartID, bool bWriteCustomLineAttributes, Lib3MF_uint64 nPointDataBufferSize, const sLib3MFPosition2D * pPointDataBuffer); + +/** +* writes polyline data to the layer. +* +* @param[in] pToolpathLayerData - ToolpathLayerData instance. +* @param[in] nProfileID - The toolpath profile to use +* @param[in] nPartID - The toolpath part to use +* @param[in] bWriteCustomLineAttributes - If true, custom line attributes are written. The cardinality of each custom attribute MUST be equal to the number of points in the pointdata array. In any case, stored custom attributes will be cleared after the call. +* @param[in] nPointDataBufferSize - Number of elements in buffer +* @param[in] pPointDataBuffer - DiscretePosition2D buffer of The point data in toolpath units. Array MUST NOT be empty. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFToolpathLayerData_WritePolylineDiscretePtr) (Lib3MF_ToolpathLayerData pToolpathLayerData, Lib3MF_uint32 nProfileID, Lib3MF_uint32 nPartID, bool bWriteCustomLineAttributes, Lib3MF_uint64 nPointDataBufferSize, const sLib3MFDiscretePosition2D * pPointDataBuffer); /** * Adds a custom data DOM tree to the layer. Layer MUST not be finished when changing the DOM tree. @@ -3583,7 +3657,29 @@ typedef Lib3MFResult (*PLib3MFToolpathLayerData_FinishPtr) (Lib3MF_ToolpathLayer **************************************************************************************************************************/ /** -* Retrieves the unit factor +* Retrieves the UUID of the toolpath +* +* @param[in] pToolpath - Toolpath instance. +* @param[in] nUUIDBufferSize - size of the buffer (including trailing 0) +* @param[out] pUUIDNeededChars - will be filled with the count of the written bytes, or needed buffer size. +* @param[out] pUUIDBuffer - buffer of UUID Value., may be NULL +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFToolpath_GetUUIDPtr) (Lib3MF_Toolpath pToolpath, const Lib3MF_uint32 nUUIDBufferSize, Lib3MF_uint32* pUUIDNeededChars, char * pUUIDBuffer); + +/** +* Generates a new unique identifier for this toolpath and sets its value. +* +* @param[in] pToolpath - Toolpath instance. +* @param[in] nNewUUIDBufferSize - size of the buffer (including trailing 0) +* @param[out] pNewUUIDNeededChars - will be filled with the count of the written bytes, or needed buffer size. +* @param[out] pNewUUIDBuffer - buffer of Newly created UUID Value., may be NULL +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFToolpath_ResetUUIDPtr) (Lib3MF_Toolpath pToolpath, const Lib3MF_uint32 nNewUUIDBufferSize, Lib3MF_uint32* pNewUUIDNeededChars, char * pNewUUIDBuffer); + +/** +* Retrieves the unit factor, i.e. how many model units are one toolpath unit. * * @param[in] pToolpath - Toolpath instance. * @param[out] pUnits - Returns the unit factor. @@ -3613,7 +3709,7 @@ typedef Lib3MFResult (*PLib3MFToolpath_GetProfileCountPtr) (Lib3MF_Toolpath pToo * Adds a new toolpath layer * * @param[in] pToolpath - Toolpath instance. -* @param[in] nZMax - ZMax value of the layer. MUST be larger than the last layer added, as well as larger as BottomZ. +* @param[in] nZMax - ZMax value of the layer in toolpath units. MUST be larger than the last layer added, as well as larger as BottomZ. * @param[in] pPath - Package Path * @param[in] pModelWriter - The model writer that writes out the 3MF. * @param[out] pLayerData - Returns the layerdata object to write the layer content into. @@ -3625,7 +3721,7 @@ typedef Lib3MFResult (*PLib3MFToolpath_AddLayerPtr) (Lib3MF_Toolpath pToolpath, * Returns the bottom Z Value of the toolpath. * * @param[in] pToolpath - Toolpath instance. -* @param[out] pBottomZ - BottomZ value +* @param[out] pBottomZ - BottomZ value in Toolpath units * @return error code or 0 (success) */ typedef Lib3MFResult (*PLib3MFToolpath_GetBottomZPtr) (Lib3MF_Toolpath pToolpath, Lib3MF_uint32 * pBottomZ); @@ -3634,13 +3730,13 @@ typedef Lib3MFResult (*PLib3MFToolpath_GetBottomZPtr) (Lib3MF_Toolpath pToolpath * Sets the bottom Z Value of the toolpath. Will fail if a layer is already existing. * * @param[in] pToolpath - Toolpath instance. -* @param[in] nBottomZ - BottomZ value +* @param[in] nBottomZ - BottomZ value in Toolpath units * @return error code or 0 (success) */ typedef Lib3MFResult (*PLib3MFToolpath_SetBottomZPtr) (Lib3MF_Toolpath pToolpath, Lib3MF_uint32 nBottomZ); /** -* Retrieves the Attachment of a layer +* Retrieves the Attachment that contains the layer data. * * @param[in] pToolpath - Toolpath instance. * @param[in] nIndex - Layer Index @@ -3676,20 +3772,39 @@ typedef Lib3MFResult (*PLib3MFToolpath_GetLayerPathPtr) (Lib3MF_Toolpath pToolpa * * @param[in] pToolpath - Toolpath instance. * @param[in] nIndex - Layer Index -* @param[out] pZMax - ZMax value +* @param[out] pZMax - ZMax value in toolpath units * @return error code or 0 (success) */ typedef Lib3MFResult (*PLib3MFToolpath_GetLayerZMaxPtr) (Lib3MF_Toolpath pToolpath, Lib3MF_uint32 nIndex, Lib3MF_uint32 * pZMax); /** -* Return the z value of a layer in units. +* Retrieves the Minimum Z of a layer +* +* @param[in] pToolpath - Toolpath instance. +* @param[in] nIndex - Layer Index +* @param[out] pZMin - ZMin value in toolpath units +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFToolpath_GetLayerZMinPtr) (Lib3MF_Toolpath pToolpath, Lib3MF_uint32 nIndex, Lib3MF_uint32 * pZMin); + +/** +* Retrieves the Thickness of a layer +* +* @param[in] pToolpath - Toolpath instance. +* @param[in] nIndex - Layer Index +* @param[out] pZThickness - Thickness value in toolpath units +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFToolpath_GetLayerThicknessPtr) (Lib3MF_Toolpath pToolpath, Lib3MF_uint32 nIndex, Lib3MF_uint32 * pZThickness); + +/** +* Checks if the toolpath has a uniform thickness value, i.e. each layer has the same thickness. * * @param[in] pToolpath - Toolpath instance. -* @param[in] nLayerIndex - Layer Index. -* @param[out] pZValue - Z Value in Units. +* @param[out] pUniformThickness - Returns true if the layer thicknesses are uniform, returns false otherwise. * @return error code or 0 (success) */ -typedef Lib3MFResult (*PLib3MFToolpath_GetLayerZPtr) (Lib3MF_Toolpath pToolpath, Lib3MF_uint32 nLayerIndex, Lib3MF_uint32 * pZValue); +typedef Lib3MFResult (*PLib3MFToolpath_HasUniformThicknessPtr) (Lib3MF_Toolpath pToolpath, bool * pUniformThickness); /** * Adds a new profile to the toolpath. @@ -3825,7 +3940,7 @@ typedef Lib3MFResult (*PLib3MFToolpath_DeleteCustomDataPtr) (Lib3MF_Toolpath pTo * @param[in] pAttributeName - Attribute name. MUST not be empty. * @return error code or 0 (success) */ -typedef Lib3MFResult (*PLib3MFToolpath_RegisterCustomIntegerAttributePtr) (Lib3MF_Toolpath pToolpath, const char * pNameSpace, const char * pAttributeName); +typedef Lib3MFResult (*PLib3MFToolpath_RegisterCustomIntegerSegmentAttributePtr) (Lib3MF_Toolpath pToolpath, const char * pNameSpace, const char * pAttributeName); /** * Registers a Double Attribute that each segment holds. Registering only applies to reader or writer objects created after the call. @@ -3835,7 +3950,7 @@ typedef Lib3MFResult (*PLib3MFToolpath_RegisterCustomIntegerAttributePtr) (Lib3M * @param[in] pAttributeName - Attribute name. MUST not be empty. * @return error code or 0 (success) */ -typedef Lib3MFResult (*PLib3MFToolpath_RegisterCustomDoubleAttributePtr) (Lib3MF_Toolpath pToolpath, const char * pNameSpace, const char * pAttributeName); +typedef Lib3MFResult (*PLib3MFToolpath_RegisterCustomDoubleSegmentAttributePtr) (Lib3MF_Toolpath pToolpath, const char * pNameSpace, const char * pAttributeName); /************************************************************************************************************************* Class definition for ToolpathIterator @@ -5535,7 +5650,8 @@ typedef struct { PLib3MFToolpathLayerReader_GetSegmentPartUUIDPtr m_ToolpathLayerReader_GetSegmentPartUUID; PLib3MFToolpathLayerReader_GetSegmentLocalPartIDPtr m_ToolpathLayerReader_GetSegmentLocalPartID; PLib3MFToolpathLayerReader_GetPartUUIDByLocalPartIDPtr m_ToolpathLayerReader_GetPartUUIDByLocalPartID; - PLib3MFToolpathLayerReader_GetSegmentPointDataPtr m_ToolpathLayerReader_GetSegmentPointData; + PLib3MFToolpathLayerReader_GetSegmentPointDataInModelUnitsPtr m_ToolpathLayerReader_GetSegmentPointDataInModelUnits; + PLib3MFToolpathLayerReader_GetSegmentPointDataDiscretePtr m_ToolpathLayerReader_GetSegmentPointDataDiscrete; PLib3MFToolpathLayerReader_FindAttributeInfoByNamePtr m_ToolpathLayerReader_FindAttributeInfoByName; PLib3MFToolpathLayerReader_FindAttributeIDByNamePtr m_ToolpathLayerReader_FindAttributeIDByName; PLib3MFToolpathLayerReader_FindAttributeValueByNamePtr m_ToolpathLayerReader_FindAttributeValueByName; @@ -5551,11 +5667,18 @@ typedef struct { PLib3MFToolpathLayerData_RegisterBuildItemPtr m_ToolpathLayerData_RegisterBuildItem; PLib3MFToolpathLayerData_SetSegmentAttributePtr m_ToolpathLayerData_SetSegmentAttribute; PLib3MFToolpathLayerData_ClearSegmentAttributesPtr m_ToolpathLayerData_ClearSegmentAttributes; - PLib3MFToolpathLayerData_WriteHatchDataPtr m_ToolpathLayerData_WriteHatchData; - PLib3MFToolpathLayerData_WriteLoopPtr m_ToolpathLayerData_WriteLoop; - PLib3MFToolpathLayerData_WritePolylinePtr m_ToolpathLayerData_WritePolyline; + PLib3MFToolpathLayerData_AddCustomLineAttributesPtr m_ToolpathLayerData_AddCustomLineAttributes; + PLib3MFToolpathLayerData_ClearCustomLineAttributesPtr m_ToolpathLayerData_ClearCustomLineAttributes; + PLib3MFToolpathLayerData_WriteHatchDataInModelUnitsPtr m_ToolpathLayerData_WriteHatchDataInModelUnits; + PLib3MFToolpathLayerData_WriteHatchDataDiscretePtr m_ToolpathLayerData_WriteHatchDataDiscrete; + PLib3MFToolpathLayerData_WriteLoopInModelUnitsPtr m_ToolpathLayerData_WriteLoopInModelUnits; + PLib3MFToolpathLayerData_WriteLoopDiscretePtr m_ToolpathLayerData_WriteLoopDiscrete; + PLib3MFToolpathLayerData_WritePolylineInModelUnitsPtr m_ToolpathLayerData_WritePolylineInModelUnits; + PLib3MFToolpathLayerData_WritePolylineDiscretePtr m_ToolpathLayerData_WritePolylineDiscrete; PLib3MFToolpathLayerData_AddCustomDataPtr m_ToolpathLayerData_AddCustomData; PLib3MFToolpathLayerData_FinishPtr m_ToolpathLayerData_Finish; + PLib3MFToolpath_GetUUIDPtr m_Toolpath_GetUUID; + PLib3MFToolpath_ResetUUIDPtr m_Toolpath_ResetUUID; PLib3MFToolpath_GetUnitsPtr m_Toolpath_GetUnits; PLib3MFToolpath_GetLayerCountPtr m_Toolpath_GetLayerCount; PLib3MFToolpath_GetProfileCountPtr m_Toolpath_GetProfileCount; @@ -5566,7 +5689,9 @@ typedef struct { PLib3MFToolpath_ReadLayerDataPtr m_Toolpath_ReadLayerData; PLib3MFToolpath_GetLayerPathPtr m_Toolpath_GetLayerPath; PLib3MFToolpath_GetLayerZMaxPtr m_Toolpath_GetLayerZMax; - PLib3MFToolpath_GetLayerZPtr m_Toolpath_GetLayerZ; + PLib3MFToolpath_GetLayerZMinPtr m_Toolpath_GetLayerZMin; + PLib3MFToolpath_GetLayerThicknessPtr m_Toolpath_GetLayerThickness; + PLib3MFToolpath_HasUniformThicknessPtr m_Toolpath_HasUniformThickness; PLib3MFToolpath_AddProfilePtr m_Toolpath_AddProfile; PLib3MFToolpath_GetProfilePtr m_Toolpath_GetProfile; PLib3MFToolpath_GetProfileUUIDPtr m_Toolpath_GetProfileUUID; @@ -5579,8 +5704,8 @@ typedef struct { PLib3MFToolpath_AddCustomDataPtr m_Toolpath_AddCustomData; PLib3MFToolpath_ClearCustomDataPtr m_Toolpath_ClearCustomData; PLib3MFToolpath_DeleteCustomDataPtr m_Toolpath_DeleteCustomData; - PLib3MFToolpath_RegisterCustomIntegerAttributePtr m_Toolpath_RegisterCustomIntegerAttribute; - PLib3MFToolpath_RegisterCustomDoubleAttributePtr m_Toolpath_RegisterCustomDoubleAttribute; + PLib3MFToolpath_RegisterCustomIntegerSegmentAttributePtr m_Toolpath_RegisterCustomIntegerSegmentAttribute; + PLib3MFToolpath_RegisterCustomDoubleSegmentAttributePtr m_Toolpath_RegisterCustomDoubleSegmentAttribute; PLib3MFToolpathIterator_GetCurrentToolpathPtr m_ToolpathIterator_GetCurrentToolpath; PLib3MFSliceStack_GetBottomZPtr m_SliceStack_GetBottomZ; PLib3MFSliceStack_GetSliceCountPtr m_SliceStack_GetSliceCount; diff --git a/Autogenerated/Bindings/Go/lib3mf_types.h b/Autogenerated/Bindings/Go/lib3mf_types.h index ed4941824..e4a331e83 100644 --- a/Autogenerated/Bindings/Go/lib3mf_types.h +++ b/Autogenerated/Bindings/Go/lib3mf_types.h @@ -151,6 +151,9 @@ typedef void * Lib3MF_pvoid; #define LIB3MF_ERROR_EMPTYNAMESPACE 4007 /** Empty namespace. */ #define LIB3MF_ERROR_INVALIDNAMESPACEPREFIX 4008 /** Invalid namespace prefix. */ #define LIB3MF_ERROR_WRITERDOESNOTSUPPORTNAMESPACES 4009 /** Writer does not support namespaces. */ +#define LIB3MF_ERROR_TOOLPATH_INVALIDHATCHCOORDINATE 4010 /** Invalid hatch coordinate. */ +#define LIB3MF_ERROR_TOOLPATH_INVALIDPOINTCOORDINATE 4011 /** Invalid point coordinate. */ +#define LIB3MF_ERROR_TOOLPATH_INVALIDHATCHCOUNT 4012 /** Invalid hatch count */ /************************************************************************************************************************* Error strings for Lib3MF @@ -216,6 +219,9 @@ inline const char * LIB3MF_GETERRORSTRING (Lib3MFResult nErrorCode) { case LIB3MF_ERROR_EMPTYNAMESPACE: return "Empty namespace."; case LIB3MF_ERROR_INVALIDNAMESPACEPREFIX: return "Invalid namespace prefix."; case LIB3MF_ERROR_WRITERDOESNOTSUPPORTNAMESPACES: return "Writer does not support namespaces."; + case LIB3MF_ERROR_TOOLPATH_INVALIDHATCHCOORDINATE: return "Invalid hatch coordinate."; + case LIB3MF_ERROR_TOOLPATH_INVALIDPOINTCOORDINATE: return "Invalid point coordinate."; + case LIB3MF_ERROR_TOOLPATH_INVALIDHATCHCOUNT: return "Invalid hatch count"; default: return "unknown error"; } } @@ -565,6 +571,20 @@ typedef struct sLib3MFPosition2D { Lib3MF_single m_Coordinates[2]; } sLib3MFPosition2D; +typedef struct sLib3MFDiscretePosition2D { + Lib3MF_int32 m_Coordinates[2]; +} sLib3MFDiscretePosition2D; + +typedef struct sLib3MFHatch2D { + Lib3MF_single m_Point1Coordinates[2]; + Lib3MF_single m_Point2Coordinates[2]; +} sLib3MFHatch2D; + +typedef struct sLib3MFDiscreteHatch2D { + Lib3MF_int32 m_Point1Coordinates[2]; + Lib3MF_int32 m_Point2Coordinates[2]; +} sLib3MFDiscreteHatch2D; + typedef struct sLib3MFCompositeConstituent { Lib3MF_uint32 m_PropertyID; Lib3MF_double m_MixingRatio; diff --git a/Autogenerated/Bindings/NodeJS/lib3mf_dynamic.cc b/Autogenerated/Bindings/NodeJS/lib3mf_dynamic.cc index f7823f878..170c13f27 100644 --- a/Autogenerated/Bindings/NodeJS/lib3mf_dynamic.cc +++ b/Autogenerated/Bindings/NodeJS/lib3mf_dynamic.cc @@ -365,7 +365,8 @@ Lib3MFResult InitLib3MFWrapperTable(sLib3MFDynamicWrapperTable * pWrapperTable) pWrapperTable->m_ToolpathLayerReader_GetSegmentPartUUID = NULL; pWrapperTable->m_ToolpathLayerReader_GetSegmentLocalPartID = NULL; pWrapperTable->m_ToolpathLayerReader_GetPartUUIDByLocalPartID = NULL; - pWrapperTable->m_ToolpathLayerReader_GetSegmentPointData = NULL; + pWrapperTable->m_ToolpathLayerReader_GetSegmentPointDataInModelUnits = NULL; + pWrapperTable->m_ToolpathLayerReader_GetSegmentPointDataDiscrete = NULL; pWrapperTable->m_ToolpathLayerReader_FindAttributeInfoByName = NULL; pWrapperTable->m_ToolpathLayerReader_FindAttributeIDByName = NULL; pWrapperTable->m_ToolpathLayerReader_FindAttributeValueByName = NULL; @@ -381,11 +382,18 @@ Lib3MFResult InitLib3MFWrapperTable(sLib3MFDynamicWrapperTable * pWrapperTable) pWrapperTable->m_ToolpathLayerData_RegisterBuildItem = NULL; pWrapperTable->m_ToolpathLayerData_SetSegmentAttribute = NULL; pWrapperTable->m_ToolpathLayerData_ClearSegmentAttributes = NULL; - pWrapperTable->m_ToolpathLayerData_WriteHatchData = NULL; - pWrapperTable->m_ToolpathLayerData_WriteLoop = NULL; - pWrapperTable->m_ToolpathLayerData_WritePolyline = NULL; + pWrapperTable->m_ToolpathLayerData_AddCustomLineAttributes = NULL; + pWrapperTable->m_ToolpathLayerData_ClearCustomLineAttributes = NULL; + pWrapperTable->m_ToolpathLayerData_WriteHatchDataInModelUnits = NULL; + pWrapperTable->m_ToolpathLayerData_WriteHatchDataDiscrete = NULL; + pWrapperTable->m_ToolpathLayerData_WriteLoopInModelUnits = NULL; + pWrapperTable->m_ToolpathLayerData_WriteLoopDiscrete = NULL; + pWrapperTable->m_ToolpathLayerData_WritePolylineInModelUnits = NULL; + pWrapperTable->m_ToolpathLayerData_WritePolylineDiscrete = NULL; pWrapperTable->m_ToolpathLayerData_AddCustomData = NULL; pWrapperTable->m_ToolpathLayerData_Finish = NULL; + pWrapperTable->m_Toolpath_GetUUID = NULL; + pWrapperTable->m_Toolpath_ResetUUID = NULL; pWrapperTable->m_Toolpath_GetUnits = NULL; pWrapperTable->m_Toolpath_GetLayerCount = NULL; pWrapperTable->m_Toolpath_GetProfileCount = NULL; @@ -396,7 +404,9 @@ Lib3MFResult InitLib3MFWrapperTable(sLib3MFDynamicWrapperTable * pWrapperTable) pWrapperTable->m_Toolpath_ReadLayerData = NULL; pWrapperTable->m_Toolpath_GetLayerPath = NULL; pWrapperTable->m_Toolpath_GetLayerZMax = NULL; - pWrapperTable->m_Toolpath_GetLayerZ = NULL; + pWrapperTable->m_Toolpath_GetLayerZMin = NULL; + pWrapperTable->m_Toolpath_GetLayerThickness = NULL; + pWrapperTable->m_Toolpath_HasUniformThickness = NULL; pWrapperTable->m_Toolpath_AddProfile = NULL; pWrapperTable->m_Toolpath_GetProfile = NULL; pWrapperTable->m_Toolpath_GetProfileUUID = NULL; @@ -409,8 +419,8 @@ Lib3MFResult InitLib3MFWrapperTable(sLib3MFDynamicWrapperTable * pWrapperTable) pWrapperTable->m_Toolpath_AddCustomData = NULL; pWrapperTable->m_Toolpath_ClearCustomData = NULL; pWrapperTable->m_Toolpath_DeleteCustomData = NULL; - pWrapperTable->m_Toolpath_RegisterCustomIntegerAttribute = NULL; - pWrapperTable->m_Toolpath_RegisterCustomDoubleAttribute = NULL; + pWrapperTable->m_Toolpath_RegisterCustomIntegerSegmentAttribute = NULL; + pWrapperTable->m_Toolpath_RegisterCustomDoubleSegmentAttribute = NULL; pWrapperTable->m_ToolpathIterator_GetCurrentToolpath = NULL; pWrapperTable->m_SliceStack_GetBottomZ = NULL; pWrapperTable->m_SliceStack_GetSliceCount = NULL; @@ -3455,12 +3465,21 @@ Lib3MFResult LoadLib3MFWrapperTable(sLib3MFDynamicWrapperTable * pWrapperTable, return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; #ifdef _WIN32 - pWrapperTable->m_ToolpathLayerReader_GetSegmentPointData = (PLib3MFToolpathLayerReader_GetSegmentPointDataPtr) GetProcAddress(hLibrary, "lib3mf_toolpathlayerreader_getsegmentpointdata"); + pWrapperTable->m_ToolpathLayerReader_GetSegmentPointDataInModelUnits = (PLib3MFToolpathLayerReader_GetSegmentPointDataInModelUnitsPtr) GetProcAddress(hLibrary, "lib3mf_toolpathlayerreader_getsegmentpointdatainmodelunits"); #else // _WIN32 - pWrapperTable->m_ToolpathLayerReader_GetSegmentPointData = (PLib3MFToolpathLayerReader_GetSegmentPointDataPtr) dlsym(hLibrary, "lib3mf_toolpathlayerreader_getsegmentpointdata"); + pWrapperTable->m_ToolpathLayerReader_GetSegmentPointDataInModelUnits = (PLib3MFToolpathLayerReader_GetSegmentPointDataInModelUnitsPtr) dlsym(hLibrary, "lib3mf_toolpathlayerreader_getsegmentpointdatainmodelunits"); dlerror(); #endif // _WIN32 - if (pWrapperTable->m_ToolpathLayerReader_GetSegmentPointData == NULL) + if (pWrapperTable->m_ToolpathLayerReader_GetSegmentPointDataInModelUnits == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_ToolpathLayerReader_GetSegmentPointDataDiscrete = (PLib3MFToolpathLayerReader_GetSegmentPointDataDiscretePtr) GetProcAddress(hLibrary, "lib3mf_toolpathlayerreader_getsegmentpointdatadiscrete"); + #else // _WIN32 + pWrapperTable->m_ToolpathLayerReader_GetSegmentPointDataDiscrete = (PLib3MFToolpathLayerReader_GetSegmentPointDataDiscretePtr) dlsym(hLibrary, "lib3mf_toolpathlayerreader_getsegmentpointdatadiscrete"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_ToolpathLayerReader_GetSegmentPointDataDiscrete == NULL) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; #ifdef _WIN32 @@ -3599,30 +3618,75 @@ Lib3MFResult LoadLib3MFWrapperTable(sLib3MFDynamicWrapperTable * pWrapperTable, return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; #ifdef _WIN32 - pWrapperTable->m_ToolpathLayerData_WriteHatchData = (PLib3MFToolpathLayerData_WriteHatchDataPtr) GetProcAddress(hLibrary, "lib3mf_toolpathlayerdata_writehatchdata"); + pWrapperTable->m_ToolpathLayerData_AddCustomLineAttributes = (PLib3MFToolpathLayerData_AddCustomLineAttributesPtr) GetProcAddress(hLibrary, "lib3mf_toolpathlayerdata_addcustomlineattributes"); + #else // _WIN32 + pWrapperTable->m_ToolpathLayerData_AddCustomLineAttributes = (PLib3MFToolpathLayerData_AddCustomLineAttributesPtr) dlsym(hLibrary, "lib3mf_toolpathlayerdata_addcustomlineattributes"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_ToolpathLayerData_AddCustomLineAttributes == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_ToolpathLayerData_ClearCustomLineAttributes = (PLib3MFToolpathLayerData_ClearCustomLineAttributesPtr) GetProcAddress(hLibrary, "lib3mf_toolpathlayerdata_clearcustomlineattributes"); + #else // _WIN32 + pWrapperTable->m_ToolpathLayerData_ClearCustomLineAttributes = (PLib3MFToolpathLayerData_ClearCustomLineAttributesPtr) dlsym(hLibrary, "lib3mf_toolpathlayerdata_clearcustomlineattributes"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_ToolpathLayerData_ClearCustomLineAttributes == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_ToolpathLayerData_WriteHatchDataInModelUnits = (PLib3MFToolpathLayerData_WriteHatchDataInModelUnitsPtr) GetProcAddress(hLibrary, "lib3mf_toolpathlayerdata_writehatchdatainmodelunits"); + #else // _WIN32 + pWrapperTable->m_ToolpathLayerData_WriteHatchDataInModelUnits = (PLib3MFToolpathLayerData_WriteHatchDataInModelUnitsPtr) dlsym(hLibrary, "lib3mf_toolpathlayerdata_writehatchdatainmodelunits"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_ToolpathLayerData_WriteHatchDataInModelUnits == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_ToolpathLayerData_WriteHatchDataDiscrete = (PLib3MFToolpathLayerData_WriteHatchDataDiscretePtr) GetProcAddress(hLibrary, "lib3mf_toolpathlayerdata_writehatchdatadiscrete"); + #else // _WIN32 + pWrapperTable->m_ToolpathLayerData_WriteHatchDataDiscrete = (PLib3MFToolpathLayerData_WriteHatchDataDiscretePtr) dlsym(hLibrary, "lib3mf_toolpathlayerdata_writehatchdatadiscrete"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_ToolpathLayerData_WriteHatchDataDiscrete == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_ToolpathLayerData_WriteLoopInModelUnits = (PLib3MFToolpathLayerData_WriteLoopInModelUnitsPtr) GetProcAddress(hLibrary, "lib3mf_toolpathlayerdata_writeloopinmodelunits"); #else // _WIN32 - pWrapperTable->m_ToolpathLayerData_WriteHatchData = (PLib3MFToolpathLayerData_WriteHatchDataPtr) dlsym(hLibrary, "lib3mf_toolpathlayerdata_writehatchdata"); + pWrapperTable->m_ToolpathLayerData_WriteLoopInModelUnits = (PLib3MFToolpathLayerData_WriteLoopInModelUnitsPtr) dlsym(hLibrary, "lib3mf_toolpathlayerdata_writeloopinmodelunits"); dlerror(); #endif // _WIN32 - if (pWrapperTable->m_ToolpathLayerData_WriteHatchData == NULL) + if (pWrapperTable->m_ToolpathLayerData_WriteLoopInModelUnits == NULL) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; #ifdef _WIN32 - pWrapperTable->m_ToolpathLayerData_WriteLoop = (PLib3MFToolpathLayerData_WriteLoopPtr) GetProcAddress(hLibrary, "lib3mf_toolpathlayerdata_writeloop"); + pWrapperTable->m_ToolpathLayerData_WriteLoopDiscrete = (PLib3MFToolpathLayerData_WriteLoopDiscretePtr) GetProcAddress(hLibrary, "lib3mf_toolpathlayerdata_writeloopdiscrete"); #else // _WIN32 - pWrapperTable->m_ToolpathLayerData_WriteLoop = (PLib3MFToolpathLayerData_WriteLoopPtr) dlsym(hLibrary, "lib3mf_toolpathlayerdata_writeloop"); + pWrapperTable->m_ToolpathLayerData_WriteLoopDiscrete = (PLib3MFToolpathLayerData_WriteLoopDiscretePtr) dlsym(hLibrary, "lib3mf_toolpathlayerdata_writeloopdiscrete"); dlerror(); #endif // _WIN32 - if (pWrapperTable->m_ToolpathLayerData_WriteLoop == NULL) + if (pWrapperTable->m_ToolpathLayerData_WriteLoopDiscrete == NULL) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; #ifdef _WIN32 - pWrapperTable->m_ToolpathLayerData_WritePolyline = (PLib3MFToolpathLayerData_WritePolylinePtr) GetProcAddress(hLibrary, "lib3mf_toolpathlayerdata_writepolyline"); + pWrapperTable->m_ToolpathLayerData_WritePolylineInModelUnits = (PLib3MFToolpathLayerData_WritePolylineInModelUnitsPtr) GetProcAddress(hLibrary, "lib3mf_toolpathlayerdata_writepolylineinmodelunits"); #else // _WIN32 - pWrapperTable->m_ToolpathLayerData_WritePolyline = (PLib3MFToolpathLayerData_WritePolylinePtr) dlsym(hLibrary, "lib3mf_toolpathlayerdata_writepolyline"); + pWrapperTable->m_ToolpathLayerData_WritePolylineInModelUnits = (PLib3MFToolpathLayerData_WritePolylineInModelUnitsPtr) dlsym(hLibrary, "lib3mf_toolpathlayerdata_writepolylineinmodelunits"); dlerror(); #endif // _WIN32 - if (pWrapperTable->m_ToolpathLayerData_WritePolyline == NULL) + if (pWrapperTable->m_ToolpathLayerData_WritePolylineInModelUnits == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_ToolpathLayerData_WritePolylineDiscrete = (PLib3MFToolpathLayerData_WritePolylineDiscretePtr) GetProcAddress(hLibrary, "lib3mf_toolpathlayerdata_writepolylinediscrete"); + #else // _WIN32 + pWrapperTable->m_ToolpathLayerData_WritePolylineDiscrete = (PLib3MFToolpathLayerData_WritePolylineDiscretePtr) dlsym(hLibrary, "lib3mf_toolpathlayerdata_writepolylinediscrete"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_ToolpathLayerData_WritePolylineDiscrete == NULL) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; #ifdef _WIN32 @@ -3643,6 +3707,24 @@ Lib3MFResult LoadLib3MFWrapperTable(sLib3MFDynamicWrapperTable * pWrapperTable, if (pWrapperTable->m_ToolpathLayerData_Finish == NULL) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + #ifdef _WIN32 + pWrapperTable->m_Toolpath_GetUUID = (PLib3MFToolpath_GetUUIDPtr) GetProcAddress(hLibrary, "lib3mf_toolpath_getuuid"); + #else // _WIN32 + pWrapperTable->m_Toolpath_GetUUID = (PLib3MFToolpath_GetUUIDPtr) dlsym(hLibrary, "lib3mf_toolpath_getuuid"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_Toolpath_GetUUID == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_Toolpath_ResetUUID = (PLib3MFToolpath_ResetUUIDPtr) GetProcAddress(hLibrary, "lib3mf_toolpath_resetuuid"); + #else // _WIN32 + pWrapperTable->m_Toolpath_ResetUUID = (PLib3MFToolpath_ResetUUIDPtr) dlsym(hLibrary, "lib3mf_toolpath_resetuuid"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_Toolpath_ResetUUID == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + #ifdef _WIN32 pWrapperTable->m_Toolpath_GetUnits = (PLib3MFToolpath_GetUnitsPtr) GetProcAddress(hLibrary, "lib3mf_toolpath_getunits"); #else // _WIN32 @@ -3734,12 +3816,30 @@ Lib3MFResult LoadLib3MFWrapperTable(sLib3MFDynamicWrapperTable * pWrapperTable, return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; #ifdef _WIN32 - pWrapperTable->m_Toolpath_GetLayerZ = (PLib3MFToolpath_GetLayerZPtr) GetProcAddress(hLibrary, "lib3mf_toolpath_getlayerz"); + pWrapperTable->m_Toolpath_GetLayerZMin = (PLib3MFToolpath_GetLayerZMinPtr) GetProcAddress(hLibrary, "lib3mf_toolpath_getlayerzmin"); + #else // _WIN32 + pWrapperTable->m_Toolpath_GetLayerZMin = (PLib3MFToolpath_GetLayerZMinPtr) dlsym(hLibrary, "lib3mf_toolpath_getlayerzmin"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_Toolpath_GetLayerZMin == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_Toolpath_GetLayerThickness = (PLib3MFToolpath_GetLayerThicknessPtr) GetProcAddress(hLibrary, "lib3mf_toolpath_getlayerthickness"); + #else // _WIN32 + pWrapperTable->m_Toolpath_GetLayerThickness = (PLib3MFToolpath_GetLayerThicknessPtr) dlsym(hLibrary, "lib3mf_toolpath_getlayerthickness"); + dlerror(); + #endif // _WIN32 + if (pWrapperTable->m_Toolpath_GetLayerThickness == NULL) + return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; + + #ifdef _WIN32 + pWrapperTable->m_Toolpath_HasUniformThickness = (PLib3MFToolpath_HasUniformThicknessPtr) GetProcAddress(hLibrary, "lib3mf_toolpath_hasuniformthickness"); #else // _WIN32 - pWrapperTable->m_Toolpath_GetLayerZ = (PLib3MFToolpath_GetLayerZPtr) dlsym(hLibrary, "lib3mf_toolpath_getlayerz"); + pWrapperTable->m_Toolpath_HasUniformThickness = (PLib3MFToolpath_HasUniformThicknessPtr) dlsym(hLibrary, "lib3mf_toolpath_hasuniformthickness"); dlerror(); #endif // _WIN32 - if (pWrapperTable->m_Toolpath_GetLayerZ == NULL) + if (pWrapperTable->m_Toolpath_HasUniformThickness == NULL) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; #ifdef _WIN32 @@ -3851,21 +3951,21 @@ Lib3MFResult LoadLib3MFWrapperTable(sLib3MFDynamicWrapperTable * pWrapperTable, return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; #ifdef _WIN32 - pWrapperTable->m_Toolpath_RegisterCustomIntegerAttribute = (PLib3MFToolpath_RegisterCustomIntegerAttributePtr) GetProcAddress(hLibrary, "lib3mf_toolpath_registercustomintegerattribute"); + pWrapperTable->m_Toolpath_RegisterCustomIntegerSegmentAttribute = (PLib3MFToolpath_RegisterCustomIntegerSegmentAttributePtr) GetProcAddress(hLibrary, "lib3mf_toolpath_registercustomintegersegmentattribute"); #else // _WIN32 - pWrapperTable->m_Toolpath_RegisterCustomIntegerAttribute = (PLib3MFToolpath_RegisterCustomIntegerAttributePtr) dlsym(hLibrary, "lib3mf_toolpath_registercustomintegerattribute"); + pWrapperTable->m_Toolpath_RegisterCustomIntegerSegmentAttribute = (PLib3MFToolpath_RegisterCustomIntegerSegmentAttributePtr) dlsym(hLibrary, "lib3mf_toolpath_registercustomintegersegmentattribute"); dlerror(); #endif // _WIN32 - if (pWrapperTable->m_Toolpath_RegisterCustomIntegerAttribute == NULL) + if (pWrapperTable->m_Toolpath_RegisterCustomIntegerSegmentAttribute == NULL) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; #ifdef _WIN32 - pWrapperTable->m_Toolpath_RegisterCustomDoubleAttribute = (PLib3MFToolpath_RegisterCustomDoubleAttributePtr) GetProcAddress(hLibrary, "lib3mf_toolpath_registercustomdoubleattribute"); + pWrapperTable->m_Toolpath_RegisterCustomDoubleSegmentAttribute = (PLib3MFToolpath_RegisterCustomDoubleSegmentAttributePtr) GetProcAddress(hLibrary, "lib3mf_toolpath_registercustomdoublesegmentattribute"); #else // _WIN32 - pWrapperTable->m_Toolpath_RegisterCustomDoubleAttribute = (PLib3MFToolpath_RegisterCustomDoubleAttributePtr) dlsym(hLibrary, "lib3mf_toolpath_registercustomdoubleattribute"); + pWrapperTable->m_Toolpath_RegisterCustomDoubleSegmentAttribute = (PLib3MFToolpath_RegisterCustomDoubleSegmentAttributePtr) dlsym(hLibrary, "lib3mf_toolpath_registercustomdoublesegmentattribute"); dlerror(); #endif // _WIN32 - if (pWrapperTable->m_Toolpath_RegisterCustomDoubleAttribute == NULL) + if (pWrapperTable->m_Toolpath_RegisterCustomDoubleSegmentAttribute == NULL) return LIB3MF_ERROR_COULDNOTFINDLIBRARYEXPORT; #ifdef _WIN32 diff --git a/Autogenerated/Bindings/NodeJS/lib3mf_dynamic.h b/Autogenerated/Bindings/NodeJS/lib3mf_dynamic.h index 7a7807dd7..99768a151 100644 --- a/Autogenerated/Bindings/NodeJS/lib3mf_dynamic.h +++ b/Autogenerated/Bindings/NodeJS/lib3mf_dynamic.h @@ -3350,10 +3350,22 @@ typedef Lib3MFResult (*PLib3MFToolpathLayerReader_GetPartUUIDByLocalPartIDPtr) ( * @param[in] nIndex - Index. Must be between 0 and Count - 1. * @param[in] nPointDataBufferSize - Number of elements in buffer * @param[out] pPointDataNeededCount - will be filled with the count of the written elements, or needed buffer size. -* @param[out] pPointDataBuffer - Position2D buffer of The point data array +* @param[out] pPointDataBuffer - Position2D buffer of The point data array. The point coordinates are in model units. * @return error code or 0 (success) */ -typedef Lib3MFResult (*PLib3MFToolpathLayerReader_GetSegmentPointDataPtr) (Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nIndex, const Lib3MF_uint64 nPointDataBufferSize, Lib3MF_uint64* pPointDataNeededCount, sLib3MFPosition2D * pPointDataBuffer); +typedef Lib3MFResult (*PLib3MFToolpathLayerReader_GetSegmentPointDataInModelUnitsPtr) (Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nIndex, const Lib3MF_uint64 nPointDataBufferSize, Lib3MF_uint64* pPointDataNeededCount, sLib3MFPosition2D * pPointDataBuffer); + +/** +* Retrieves the assigned segment point list in units. For type hatch, the points are taken pairwise. +* +* @param[in] pToolpathLayerReader - ToolpathLayerReader instance. +* @param[in] nIndex - Index. Must be between 0 and Count - 1. +* @param[in] nPointDataBufferSize - Number of elements in buffer +* @param[out] pPointDataNeededCount - will be filled with the count of the written elements, or needed buffer size. +* @param[out] pPointDataBuffer - DiscretePosition2D buffer of The point data array. The point coordinates are in toolpath units. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFToolpathLayerReader_GetSegmentPointDataDiscretePtr) (Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nIndex, const Lib3MF_uint64 nPointDataBufferSize, Lib3MF_uint64* pPointDataNeededCount, sLib3MFDiscretePosition2D * pPointDataBuffer); /** * Retrieves a segment attribute Information by Attribute Name. Will fail if Attribute does not exist. @@ -3524,28 +3536,76 @@ typedef Lib3MFResult (*PLib3MFToolpathLayerData_SetSegmentAttributePtr) (Lib3MF_ typedef Lib3MFResult (*PLib3MFToolpathLayerData_ClearSegmentAttributesPtr) (Lib3MF_ToolpathLayerData pToolpathLayerData); /** -* writes hatch data to the layer. +* Stores custom line attributes for the next WriteLoop, WritePolyline or WriteHatchData call. +* +* @param[in] pToolpathLayerData - ToolpathLayerData instance. +* @param[in] pNameSpace - The namespace of the attribute to register. +* @param[in] pAttributeName - The name of the attribute to register. +* @param[in] nValuesBufferSize - Number of elements in buffer +* @param[in] pValuesBuffer - int32 buffer of Custom Values to store on segment lines. Array MUST NOT be empty. If custom attributes had been already defined, the error cardinality MUST match, or an error will be thrown. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFToolpathLayerData_AddCustomLineAttributesPtr) (Lib3MF_ToolpathLayerData pToolpathLayerData, const char * pNameSpace, const char * pAttributeName, Lib3MF_uint64 nValuesBufferSize, const Lib3MF_int32 * pValuesBuffer); + +/** +* Clears all custom line attributes. Any call to WriteLoop, WritePolyline or WriteHatchData will do this implicitely. +* +* @param[in] pToolpathLayerData - ToolpathLayerData instance. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFToolpathLayerData_ClearCustomLineAttributesPtr) (Lib3MF_ToolpathLayerData pToolpathLayerData); + +/** +* writes hatch data to the layer in model units. +* +* @param[in] pToolpathLayerData - ToolpathLayerData instance. +* @param[in] nProfileID - The toolpath profile to use +* @param[in] nPartID - The toolpath part to use +* @param[in] bWriteCustomLineAttributes - If true, custom line attributes are written. The cardinality of each custom attribute MUST be equal to the number of hatches in the hatchdata array. In any case, stored custom attributes will be cleared after the call. +* @param[in] nHatchDataBufferSize - Number of elements in buffer +* @param[in] pHatchDataBuffer - Hatch2D buffer of The hatch data in model units. Array MUST NOT be empty. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFToolpathLayerData_WriteHatchDataInModelUnitsPtr) (Lib3MF_ToolpathLayerData pToolpathLayerData, Lib3MF_uint32 nProfileID, Lib3MF_uint32 nPartID, bool bWriteCustomLineAttributes, Lib3MF_uint64 nHatchDataBufferSize, const sLib3MFHatch2D * pHatchDataBuffer); + +/** +* writes hatch data to the layer in toolpath units. +* +* @param[in] pToolpathLayerData - ToolpathLayerData instance. +* @param[in] nProfileID - The toolpath profile to use +* @param[in] nPartID - The toolpath part to use +* @param[in] bWriteCustomLineAttributes - If true, custom line attributes are written. The cardinality of each custom attribute MUST be equal to the number of hatches in the hatchdata array. In any case, stored custom attributes will be cleared after the call. +* @param[in] nHatchDataBufferSize - Number of elements in buffer +* @param[in] pHatchDataBuffer - DiscreteHatch2D buffer of The hatch data in toolpath units. Array MUST NOT be empty. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFToolpathLayerData_WriteHatchDataDiscretePtr) (Lib3MF_ToolpathLayerData pToolpathLayerData, Lib3MF_uint32 nProfileID, Lib3MF_uint32 nPartID, bool bWriteCustomLineAttributes, Lib3MF_uint64 nHatchDataBufferSize, const sLib3MFDiscreteHatch2D * pHatchDataBuffer); + +/** +* writes loop data to the layer in model units. * * @param[in] pToolpathLayerData - ToolpathLayerData instance. * @param[in] nProfileID - The toolpath profile to use * @param[in] nPartID - The toolpath part to use +* @param[in] bWriteCustomLineAttributes - If true, custom line attributes are written. The cardinality of each custom attribute MUST be equal to the number of points in the pointdata array. In any case, stored custom attributes will be cleared after the call. * @param[in] nPointDataBufferSize - Number of elements in buffer -* @param[in] pPointDataBuffer - Position2D buffer of The point data +* @param[in] pPointDataBuffer - Position2D buffer of The point data in model units. Array MUST NOT be empty. * @return error code or 0 (success) */ -typedef Lib3MFResult (*PLib3MFToolpathLayerData_WriteHatchDataPtr) (Lib3MF_ToolpathLayerData pToolpathLayerData, Lib3MF_uint32 nProfileID, Lib3MF_uint32 nPartID, Lib3MF_uint64 nPointDataBufferSize, const sLib3MFPosition2D * pPointDataBuffer); +typedef Lib3MFResult (*PLib3MFToolpathLayerData_WriteLoopInModelUnitsPtr) (Lib3MF_ToolpathLayerData pToolpathLayerData, Lib3MF_uint32 nProfileID, Lib3MF_uint32 nPartID, bool bWriteCustomLineAttributes, Lib3MF_uint64 nPointDataBufferSize, const sLib3MFPosition2D * pPointDataBuffer); /** -* writes loop data to the layer. +* writes loop data to the layer in toolpath units. * * @param[in] pToolpathLayerData - ToolpathLayerData instance. * @param[in] nProfileID - The toolpath profile to use * @param[in] nPartID - The toolpath part to use +* @param[in] bWriteCustomLineAttributes - If true, custom line attributes are written. The cardinality of each custom attribute MUST be equal to the number of points in the pointdata array. In any case, stored custom attributes will be cleared after the call. * @param[in] nPointDataBufferSize - Number of elements in buffer -* @param[in] pPointDataBuffer - Position2D buffer of The point data +* @param[in] pPointDataBuffer - DiscretePosition2D buffer of The point data in toolpath units. Array MUST NOT be empty. * @return error code or 0 (success) */ -typedef Lib3MFResult (*PLib3MFToolpathLayerData_WriteLoopPtr) (Lib3MF_ToolpathLayerData pToolpathLayerData, Lib3MF_uint32 nProfileID, Lib3MF_uint32 nPartID, Lib3MF_uint64 nPointDataBufferSize, const sLib3MFPosition2D * pPointDataBuffer); +typedef Lib3MFResult (*PLib3MFToolpathLayerData_WriteLoopDiscretePtr) (Lib3MF_ToolpathLayerData pToolpathLayerData, Lib3MF_uint32 nProfileID, Lib3MF_uint32 nPartID, bool bWriteCustomLineAttributes, Lib3MF_uint64 nPointDataBufferSize, const sLib3MFDiscretePosition2D * pPointDataBuffer); /** * writes polyline data to the layer. @@ -3553,11 +3613,25 @@ typedef Lib3MFResult (*PLib3MFToolpathLayerData_WriteLoopPtr) (Lib3MF_ToolpathLa * @param[in] pToolpathLayerData - ToolpathLayerData instance. * @param[in] nProfileID - The toolpath profile to use * @param[in] nPartID - The toolpath part to use +* @param[in] bWriteCustomLineAttributes - If true, custom line attributes are written. The cardinality of each custom attribute MUST be equal to the number of points in the pointdata array. In any case, stored custom attributes will be cleared after the call. * @param[in] nPointDataBufferSize - Number of elements in buffer -* @param[in] pPointDataBuffer - Position2D buffer of The point data +* @param[in] pPointDataBuffer - Position2D buffer of The point data in model units. Array MUST NOT be empty. * @return error code or 0 (success) */ -typedef Lib3MFResult (*PLib3MFToolpathLayerData_WritePolylinePtr) (Lib3MF_ToolpathLayerData pToolpathLayerData, Lib3MF_uint32 nProfileID, Lib3MF_uint32 nPartID, Lib3MF_uint64 nPointDataBufferSize, const sLib3MFPosition2D * pPointDataBuffer); +typedef Lib3MFResult (*PLib3MFToolpathLayerData_WritePolylineInModelUnitsPtr) (Lib3MF_ToolpathLayerData pToolpathLayerData, Lib3MF_uint32 nProfileID, Lib3MF_uint32 nPartID, bool bWriteCustomLineAttributes, Lib3MF_uint64 nPointDataBufferSize, const sLib3MFPosition2D * pPointDataBuffer); + +/** +* writes polyline data to the layer. +* +* @param[in] pToolpathLayerData - ToolpathLayerData instance. +* @param[in] nProfileID - The toolpath profile to use +* @param[in] nPartID - The toolpath part to use +* @param[in] bWriteCustomLineAttributes - If true, custom line attributes are written. The cardinality of each custom attribute MUST be equal to the number of points in the pointdata array. In any case, stored custom attributes will be cleared after the call. +* @param[in] nPointDataBufferSize - Number of elements in buffer +* @param[in] pPointDataBuffer - DiscretePosition2D buffer of The point data in toolpath units. Array MUST NOT be empty. +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFToolpathLayerData_WritePolylineDiscretePtr) (Lib3MF_ToolpathLayerData pToolpathLayerData, Lib3MF_uint32 nProfileID, Lib3MF_uint32 nPartID, bool bWriteCustomLineAttributes, Lib3MF_uint64 nPointDataBufferSize, const sLib3MFDiscretePosition2D * pPointDataBuffer); /** * Adds a custom data DOM tree to the layer. Layer MUST not be finished when changing the DOM tree. @@ -3583,7 +3657,29 @@ typedef Lib3MFResult (*PLib3MFToolpathLayerData_FinishPtr) (Lib3MF_ToolpathLayer **************************************************************************************************************************/ /** -* Retrieves the unit factor +* Retrieves the UUID of the toolpath +* +* @param[in] pToolpath - Toolpath instance. +* @param[in] nUUIDBufferSize - size of the buffer (including trailing 0) +* @param[out] pUUIDNeededChars - will be filled with the count of the written bytes, or needed buffer size. +* @param[out] pUUIDBuffer - buffer of UUID Value., may be NULL +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFToolpath_GetUUIDPtr) (Lib3MF_Toolpath pToolpath, const Lib3MF_uint32 nUUIDBufferSize, Lib3MF_uint32* pUUIDNeededChars, char * pUUIDBuffer); + +/** +* Generates a new unique identifier for this toolpath and sets its value. +* +* @param[in] pToolpath - Toolpath instance. +* @param[in] nNewUUIDBufferSize - size of the buffer (including trailing 0) +* @param[out] pNewUUIDNeededChars - will be filled with the count of the written bytes, or needed buffer size. +* @param[out] pNewUUIDBuffer - buffer of Newly created UUID Value., may be NULL +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFToolpath_ResetUUIDPtr) (Lib3MF_Toolpath pToolpath, const Lib3MF_uint32 nNewUUIDBufferSize, Lib3MF_uint32* pNewUUIDNeededChars, char * pNewUUIDBuffer); + +/** +* Retrieves the unit factor, i.e. how many model units are one toolpath unit. * * @param[in] pToolpath - Toolpath instance. * @param[out] pUnits - Returns the unit factor. @@ -3613,7 +3709,7 @@ typedef Lib3MFResult (*PLib3MFToolpath_GetProfileCountPtr) (Lib3MF_Toolpath pToo * Adds a new toolpath layer * * @param[in] pToolpath - Toolpath instance. -* @param[in] nZMax - ZMax value of the layer. MUST be larger than the last layer added, as well as larger as BottomZ. +* @param[in] nZMax - ZMax value of the layer in toolpath units. MUST be larger than the last layer added, as well as larger as BottomZ. * @param[in] pPath - Package Path * @param[in] pModelWriter - The model writer that writes out the 3MF. * @param[out] pLayerData - Returns the layerdata object to write the layer content into. @@ -3625,7 +3721,7 @@ typedef Lib3MFResult (*PLib3MFToolpath_AddLayerPtr) (Lib3MF_Toolpath pToolpath, * Returns the bottom Z Value of the toolpath. * * @param[in] pToolpath - Toolpath instance. -* @param[out] pBottomZ - BottomZ value +* @param[out] pBottomZ - BottomZ value in Toolpath units * @return error code or 0 (success) */ typedef Lib3MFResult (*PLib3MFToolpath_GetBottomZPtr) (Lib3MF_Toolpath pToolpath, Lib3MF_uint32 * pBottomZ); @@ -3634,13 +3730,13 @@ typedef Lib3MFResult (*PLib3MFToolpath_GetBottomZPtr) (Lib3MF_Toolpath pToolpath * Sets the bottom Z Value of the toolpath. Will fail if a layer is already existing. * * @param[in] pToolpath - Toolpath instance. -* @param[in] nBottomZ - BottomZ value +* @param[in] nBottomZ - BottomZ value in Toolpath units * @return error code or 0 (success) */ typedef Lib3MFResult (*PLib3MFToolpath_SetBottomZPtr) (Lib3MF_Toolpath pToolpath, Lib3MF_uint32 nBottomZ); /** -* Retrieves the Attachment of a layer +* Retrieves the Attachment that contains the layer data. * * @param[in] pToolpath - Toolpath instance. * @param[in] nIndex - Layer Index @@ -3676,20 +3772,39 @@ typedef Lib3MFResult (*PLib3MFToolpath_GetLayerPathPtr) (Lib3MF_Toolpath pToolpa * * @param[in] pToolpath - Toolpath instance. * @param[in] nIndex - Layer Index -* @param[out] pZMax - ZMax value +* @param[out] pZMax - ZMax value in toolpath units * @return error code or 0 (success) */ typedef Lib3MFResult (*PLib3MFToolpath_GetLayerZMaxPtr) (Lib3MF_Toolpath pToolpath, Lib3MF_uint32 nIndex, Lib3MF_uint32 * pZMax); /** -* Return the z value of a layer in units. +* Retrieves the Minimum Z of a layer +* +* @param[in] pToolpath - Toolpath instance. +* @param[in] nIndex - Layer Index +* @param[out] pZMin - ZMin value in toolpath units +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFToolpath_GetLayerZMinPtr) (Lib3MF_Toolpath pToolpath, Lib3MF_uint32 nIndex, Lib3MF_uint32 * pZMin); + +/** +* Retrieves the Thickness of a layer +* +* @param[in] pToolpath - Toolpath instance. +* @param[in] nIndex - Layer Index +* @param[out] pZThickness - Thickness value in toolpath units +* @return error code or 0 (success) +*/ +typedef Lib3MFResult (*PLib3MFToolpath_GetLayerThicknessPtr) (Lib3MF_Toolpath pToolpath, Lib3MF_uint32 nIndex, Lib3MF_uint32 * pZThickness); + +/** +* Checks if the toolpath has a uniform thickness value, i.e. each layer has the same thickness. * * @param[in] pToolpath - Toolpath instance. -* @param[in] nLayerIndex - Layer Index. -* @param[out] pZValue - Z Value in Units. +* @param[out] pUniformThickness - Returns true if the layer thicknesses are uniform, returns false otherwise. * @return error code or 0 (success) */ -typedef Lib3MFResult (*PLib3MFToolpath_GetLayerZPtr) (Lib3MF_Toolpath pToolpath, Lib3MF_uint32 nLayerIndex, Lib3MF_uint32 * pZValue); +typedef Lib3MFResult (*PLib3MFToolpath_HasUniformThicknessPtr) (Lib3MF_Toolpath pToolpath, bool * pUniformThickness); /** * Adds a new profile to the toolpath. @@ -3825,7 +3940,7 @@ typedef Lib3MFResult (*PLib3MFToolpath_DeleteCustomDataPtr) (Lib3MF_Toolpath pTo * @param[in] pAttributeName - Attribute name. MUST not be empty. * @return error code or 0 (success) */ -typedef Lib3MFResult (*PLib3MFToolpath_RegisterCustomIntegerAttributePtr) (Lib3MF_Toolpath pToolpath, const char * pNameSpace, const char * pAttributeName); +typedef Lib3MFResult (*PLib3MFToolpath_RegisterCustomIntegerSegmentAttributePtr) (Lib3MF_Toolpath pToolpath, const char * pNameSpace, const char * pAttributeName); /** * Registers a Double Attribute that each segment holds. Registering only applies to reader or writer objects created after the call. @@ -3835,7 +3950,7 @@ typedef Lib3MFResult (*PLib3MFToolpath_RegisterCustomIntegerAttributePtr) (Lib3M * @param[in] pAttributeName - Attribute name. MUST not be empty. * @return error code or 0 (success) */ -typedef Lib3MFResult (*PLib3MFToolpath_RegisterCustomDoubleAttributePtr) (Lib3MF_Toolpath pToolpath, const char * pNameSpace, const char * pAttributeName); +typedef Lib3MFResult (*PLib3MFToolpath_RegisterCustomDoubleSegmentAttributePtr) (Lib3MF_Toolpath pToolpath, const char * pNameSpace, const char * pAttributeName); /************************************************************************************************************************* Class definition for ToolpathIterator @@ -5535,7 +5650,8 @@ typedef struct { PLib3MFToolpathLayerReader_GetSegmentPartUUIDPtr m_ToolpathLayerReader_GetSegmentPartUUID; PLib3MFToolpathLayerReader_GetSegmentLocalPartIDPtr m_ToolpathLayerReader_GetSegmentLocalPartID; PLib3MFToolpathLayerReader_GetPartUUIDByLocalPartIDPtr m_ToolpathLayerReader_GetPartUUIDByLocalPartID; - PLib3MFToolpathLayerReader_GetSegmentPointDataPtr m_ToolpathLayerReader_GetSegmentPointData; + PLib3MFToolpathLayerReader_GetSegmentPointDataInModelUnitsPtr m_ToolpathLayerReader_GetSegmentPointDataInModelUnits; + PLib3MFToolpathLayerReader_GetSegmentPointDataDiscretePtr m_ToolpathLayerReader_GetSegmentPointDataDiscrete; PLib3MFToolpathLayerReader_FindAttributeInfoByNamePtr m_ToolpathLayerReader_FindAttributeInfoByName; PLib3MFToolpathLayerReader_FindAttributeIDByNamePtr m_ToolpathLayerReader_FindAttributeIDByName; PLib3MFToolpathLayerReader_FindAttributeValueByNamePtr m_ToolpathLayerReader_FindAttributeValueByName; @@ -5551,11 +5667,18 @@ typedef struct { PLib3MFToolpathLayerData_RegisterBuildItemPtr m_ToolpathLayerData_RegisterBuildItem; PLib3MFToolpathLayerData_SetSegmentAttributePtr m_ToolpathLayerData_SetSegmentAttribute; PLib3MFToolpathLayerData_ClearSegmentAttributesPtr m_ToolpathLayerData_ClearSegmentAttributes; - PLib3MFToolpathLayerData_WriteHatchDataPtr m_ToolpathLayerData_WriteHatchData; - PLib3MFToolpathLayerData_WriteLoopPtr m_ToolpathLayerData_WriteLoop; - PLib3MFToolpathLayerData_WritePolylinePtr m_ToolpathLayerData_WritePolyline; + PLib3MFToolpathLayerData_AddCustomLineAttributesPtr m_ToolpathLayerData_AddCustomLineAttributes; + PLib3MFToolpathLayerData_ClearCustomLineAttributesPtr m_ToolpathLayerData_ClearCustomLineAttributes; + PLib3MFToolpathLayerData_WriteHatchDataInModelUnitsPtr m_ToolpathLayerData_WriteHatchDataInModelUnits; + PLib3MFToolpathLayerData_WriteHatchDataDiscretePtr m_ToolpathLayerData_WriteHatchDataDiscrete; + PLib3MFToolpathLayerData_WriteLoopInModelUnitsPtr m_ToolpathLayerData_WriteLoopInModelUnits; + PLib3MFToolpathLayerData_WriteLoopDiscretePtr m_ToolpathLayerData_WriteLoopDiscrete; + PLib3MFToolpathLayerData_WritePolylineInModelUnitsPtr m_ToolpathLayerData_WritePolylineInModelUnits; + PLib3MFToolpathLayerData_WritePolylineDiscretePtr m_ToolpathLayerData_WritePolylineDiscrete; PLib3MFToolpathLayerData_AddCustomDataPtr m_ToolpathLayerData_AddCustomData; PLib3MFToolpathLayerData_FinishPtr m_ToolpathLayerData_Finish; + PLib3MFToolpath_GetUUIDPtr m_Toolpath_GetUUID; + PLib3MFToolpath_ResetUUIDPtr m_Toolpath_ResetUUID; PLib3MFToolpath_GetUnitsPtr m_Toolpath_GetUnits; PLib3MFToolpath_GetLayerCountPtr m_Toolpath_GetLayerCount; PLib3MFToolpath_GetProfileCountPtr m_Toolpath_GetProfileCount; @@ -5566,7 +5689,9 @@ typedef struct { PLib3MFToolpath_ReadLayerDataPtr m_Toolpath_ReadLayerData; PLib3MFToolpath_GetLayerPathPtr m_Toolpath_GetLayerPath; PLib3MFToolpath_GetLayerZMaxPtr m_Toolpath_GetLayerZMax; - PLib3MFToolpath_GetLayerZPtr m_Toolpath_GetLayerZ; + PLib3MFToolpath_GetLayerZMinPtr m_Toolpath_GetLayerZMin; + PLib3MFToolpath_GetLayerThicknessPtr m_Toolpath_GetLayerThickness; + PLib3MFToolpath_HasUniformThicknessPtr m_Toolpath_HasUniformThickness; PLib3MFToolpath_AddProfilePtr m_Toolpath_AddProfile; PLib3MFToolpath_GetProfilePtr m_Toolpath_GetProfile; PLib3MFToolpath_GetProfileUUIDPtr m_Toolpath_GetProfileUUID; @@ -5579,8 +5704,8 @@ typedef struct { PLib3MFToolpath_AddCustomDataPtr m_Toolpath_AddCustomData; PLib3MFToolpath_ClearCustomDataPtr m_Toolpath_ClearCustomData; PLib3MFToolpath_DeleteCustomDataPtr m_Toolpath_DeleteCustomData; - PLib3MFToolpath_RegisterCustomIntegerAttributePtr m_Toolpath_RegisterCustomIntegerAttribute; - PLib3MFToolpath_RegisterCustomDoubleAttributePtr m_Toolpath_RegisterCustomDoubleAttribute; + PLib3MFToolpath_RegisterCustomIntegerSegmentAttributePtr m_Toolpath_RegisterCustomIntegerSegmentAttribute; + PLib3MFToolpath_RegisterCustomDoubleSegmentAttributePtr m_Toolpath_RegisterCustomDoubleSegmentAttribute; PLib3MFToolpathIterator_GetCurrentToolpathPtr m_ToolpathIterator_GetCurrentToolpath; PLib3MFSliceStack_GetBottomZPtr m_SliceStack_GetBottomZ; PLib3MFSliceStack_GetSliceCountPtr m_SliceStack_GetSliceCount; diff --git a/Autogenerated/Bindings/NodeJS/lib3mf_nodewrapper.cc b/Autogenerated/Bindings/NodeJS/lib3mf_nodewrapper.cc index ea5b8fcdd..88cf9ddee 100644 --- a/Autogenerated/Bindings/NodeJS/lib3mf_nodewrapper.cc +++ b/Autogenerated/Bindings/NodeJS/lib3mf_nodewrapper.cc @@ -395,6 +395,289 @@ Local convertLib3MFPosition2DToObject(Isolate* isolate, sLib3MFPosition2 return returnInstance; } +/************************************************************************************************************************* + Class sLib3MFDiscretePosition2D Conversion +**************************************************************************************************************************/ +sLib3MFDiscretePosition2D convertObjectToLib3MFDiscretePosition2D(Isolate* isolate, const Local & pParamValue) +{ + sLib3MFDiscretePosition2D sDiscretePosition2D; + Local context = isolate->GetCurrentContext(); + int rowIndex; + + for (rowIndex = 0; rowIndex < 2; rowIndex++) + sDiscretePosition2D.m_Coordinates[rowIndex] = 0; + + if (pParamValue->IsObject()) { + MaybeLocal maybeObject = pParamValue->ToObject(context); + + if (!maybeObject.IsEmpty()) { + Local obj = maybeObject.ToLocalChecked(); + + // Coordinates Member + MaybeLocal maybeValCoordinates = obj->Get(context, String::NewFromUtf8(isolate, "Coordinates")); + if (!maybeValCoordinates.IsEmpty()) { + Local valCoordinates = maybeValCoordinates.ToLocalChecked(); + if (valCoordinates->IsArray()) { + Local arrayCoordinates = Local::Cast(valCoordinates); + for (int rowIndex = 0; rowIndex < 2; rowIndex++) { + MaybeLocal mlocalValue = arrayCoordinates->Get(context, rowIndex); + Local localValue; + if (mlocalValue.ToLocal(&localValue)) { + if (localValue->IsNumber()) { + MaybeLocal localNumber = localValue->ToNumber(context); + sDiscretePosition2D.m_Coordinates[rowIndex] = localNumber.ToLocalChecked()->Int32Value(isolate->GetCurrentContext()).ToChecked(); + } else { + isolate->ThrowException(Exception::TypeError(String::NewFromUtf8(isolate, "Coordinates array entry is not a number" ))); + } + } else { + isolate->ThrowException(Exception::TypeError(String::NewFromUtf8(isolate, "Coordinates array entry is invalid" ))); + } + } + } else { + isolate->ThrowException(Exception::TypeError(String::NewFromUtf8(isolate, "Coordinates member is not an array" ))); + } + } else { + isolate->ThrowException(Exception::TypeError(String::NewFromUtf8(isolate, "Coordinates 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 sDiscretePosition2D; +} + + + +Local convertLib3MFDiscretePosition2DToObject(Isolate* isolate, sLib3MFDiscretePosition2D sDiscretePosition2D) +{ + Local returnInstance = Object::New(isolate); + Local newCoordinates = Array::New(isolate, 2); + for (int rowIndex = 0; rowIndex < 2; rowIndex++) { + newCoordinates->Set(rowIndex, Integer::New(isolate, sDiscretePosition2D.m_Coordinates[rowIndex])); + } + returnInstance->Set(String::NewFromUtf8(isolate, "Coordinates"), newCoordinates); + + + return returnInstance; +} + +/************************************************************************************************************************* + Class sLib3MFHatch2D Conversion +**************************************************************************************************************************/ +sLib3MFHatch2D convertObjectToLib3MFHatch2D(Isolate* isolate, const Local & pParamValue) +{ + sLib3MFHatch2D sHatch2D; + Local context = isolate->GetCurrentContext(); + int rowIndex; + + for (rowIndex = 0; rowIndex < 2; rowIndex++) + sHatch2D.m_Point1Coordinates[rowIndex] = 0.0f; + for (rowIndex = 0; rowIndex < 2; rowIndex++) + sHatch2D.m_Point2Coordinates[rowIndex] = 0.0f; + + if (pParamValue->IsObject()) { + MaybeLocal maybeObject = pParamValue->ToObject(context); + + if (!maybeObject.IsEmpty()) { + Local obj = maybeObject.ToLocalChecked(); + + // Point1Coordinates Member + MaybeLocal maybeValPoint1Coordinates = obj->Get(context, String::NewFromUtf8(isolate, "Point1Coordinates")); + if (!maybeValPoint1Coordinates.IsEmpty()) { + Local valPoint1Coordinates = maybeValPoint1Coordinates.ToLocalChecked(); + if (valPoint1Coordinates->IsArray()) { + Local arrayPoint1Coordinates = Local::Cast(valPoint1Coordinates); + for (int rowIndex = 0; rowIndex < 2; rowIndex++) { + MaybeLocal mlocalValue = arrayPoint1Coordinates->Get(context, rowIndex); + Local localValue; + if (mlocalValue.ToLocal(&localValue)) { + if (localValue->IsNumber()) { + MaybeLocal localNumber = localValue->ToNumber(context); + sHatch2D.m_Point1Coordinates[rowIndex] = (float)localNumber.ToLocalChecked()->NumberValue(isolate->GetCurrentContext()).ToChecked(); + } else { + isolate->ThrowException(Exception::TypeError(String::NewFromUtf8(isolate, "Point1Coordinates array entry is not a number" ))); + } + } else { + isolate->ThrowException(Exception::TypeError(String::NewFromUtf8(isolate, "Point1Coordinates array entry is invalid" ))); + } + } + } else { + isolate->ThrowException(Exception::TypeError(String::NewFromUtf8(isolate, "Point1Coordinates member is not an array" ))); + } + } else { + isolate->ThrowException(Exception::TypeError(String::NewFromUtf8(isolate, "Point1Coordinates member not found in object" ))); + } + + // Point2Coordinates Member + MaybeLocal maybeValPoint2Coordinates = obj->Get(context, String::NewFromUtf8(isolate, "Point2Coordinates")); + if (!maybeValPoint2Coordinates.IsEmpty()) { + Local valPoint2Coordinates = maybeValPoint2Coordinates.ToLocalChecked(); + if (valPoint2Coordinates->IsArray()) { + Local arrayPoint2Coordinates = Local::Cast(valPoint2Coordinates); + for (int rowIndex = 0; rowIndex < 2; rowIndex++) { + MaybeLocal mlocalValue = arrayPoint2Coordinates->Get(context, rowIndex); + Local localValue; + if (mlocalValue.ToLocal(&localValue)) { + if (localValue->IsNumber()) { + MaybeLocal localNumber = localValue->ToNumber(context); + sHatch2D.m_Point2Coordinates[rowIndex] = (float)localNumber.ToLocalChecked()->NumberValue(isolate->GetCurrentContext()).ToChecked(); + } else { + isolate->ThrowException(Exception::TypeError(String::NewFromUtf8(isolate, "Point2Coordinates array entry is not a number" ))); + } + } else { + isolate->ThrowException(Exception::TypeError(String::NewFromUtf8(isolate, "Point2Coordinates array entry is invalid" ))); + } + } + } else { + isolate->ThrowException(Exception::TypeError(String::NewFromUtf8(isolate, "Point2Coordinates member is not an array" ))); + } + } else { + isolate->ThrowException(Exception::TypeError(String::NewFromUtf8(isolate, "Point2Coordinates 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 sHatch2D; +} + + + +Local convertLib3MFHatch2DToObject(Isolate* isolate, sLib3MFHatch2D sHatch2D) +{ + Local returnInstance = Object::New(isolate); + Local newPoint1Coordinates = Array::New(isolate, 2); + for (int rowIndex = 0; rowIndex < 2; rowIndex++) { + newPoint1Coordinates->Set(rowIndex, Number::New(isolate, (double) sHatch2D.m_Point1Coordinates[rowIndex])); + } + returnInstance->Set(String::NewFromUtf8(isolate, "Point1Coordinates"), newPoint1Coordinates); + + Local newPoint2Coordinates = Array::New(isolate, 2); + for (int rowIndex = 0; rowIndex < 2; rowIndex++) { + newPoint2Coordinates->Set(rowIndex, Number::New(isolate, (double) sHatch2D.m_Point2Coordinates[rowIndex])); + } + returnInstance->Set(String::NewFromUtf8(isolate, "Point2Coordinates"), newPoint2Coordinates); + + + return returnInstance; +} + +/************************************************************************************************************************* + Class sLib3MFDiscreteHatch2D Conversion +**************************************************************************************************************************/ +sLib3MFDiscreteHatch2D convertObjectToLib3MFDiscreteHatch2D(Isolate* isolate, const Local & pParamValue) +{ + sLib3MFDiscreteHatch2D sDiscreteHatch2D; + Local context = isolate->GetCurrentContext(); + int rowIndex; + + for (rowIndex = 0; rowIndex < 2; rowIndex++) + sDiscreteHatch2D.m_Point1Coordinates[rowIndex] = 0; + for (rowIndex = 0; rowIndex < 2; rowIndex++) + sDiscreteHatch2D.m_Point2Coordinates[rowIndex] = 0; + + if (pParamValue->IsObject()) { + MaybeLocal maybeObject = pParamValue->ToObject(context); + + if (!maybeObject.IsEmpty()) { + Local obj = maybeObject.ToLocalChecked(); + + // Point1Coordinates Member + MaybeLocal maybeValPoint1Coordinates = obj->Get(context, String::NewFromUtf8(isolate, "Point1Coordinates")); + if (!maybeValPoint1Coordinates.IsEmpty()) { + Local valPoint1Coordinates = maybeValPoint1Coordinates.ToLocalChecked(); + if (valPoint1Coordinates->IsArray()) { + Local arrayPoint1Coordinates = Local::Cast(valPoint1Coordinates); + for (int rowIndex = 0; rowIndex < 2; rowIndex++) { + MaybeLocal mlocalValue = arrayPoint1Coordinates->Get(context, rowIndex); + Local localValue; + if (mlocalValue.ToLocal(&localValue)) { + if (localValue->IsNumber()) { + MaybeLocal localNumber = localValue->ToNumber(context); + sDiscreteHatch2D.m_Point1Coordinates[rowIndex] = localNumber.ToLocalChecked()->Int32Value(isolate->GetCurrentContext()).ToChecked(); + } else { + isolate->ThrowException(Exception::TypeError(String::NewFromUtf8(isolate, "Point1Coordinates array entry is not a number" ))); + } + } else { + isolate->ThrowException(Exception::TypeError(String::NewFromUtf8(isolate, "Point1Coordinates array entry is invalid" ))); + } + } + } else { + isolate->ThrowException(Exception::TypeError(String::NewFromUtf8(isolate, "Point1Coordinates member is not an array" ))); + } + } else { + isolate->ThrowException(Exception::TypeError(String::NewFromUtf8(isolate, "Point1Coordinates member not found in object" ))); + } + + // Point2Coordinates Member + MaybeLocal maybeValPoint2Coordinates = obj->Get(context, String::NewFromUtf8(isolate, "Point2Coordinates")); + if (!maybeValPoint2Coordinates.IsEmpty()) { + Local valPoint2Coordinates = maybeValPoint2Coordinates.ToLocalChecked(); + if (valPoint2Coordinates->IsArray()) { + Local arrayPoint2Coordinates = Local::Cast(valPoint2Coordinates); + for (int rowIndex = 0; rowIndex < 2; rowIndex++) { + MaybeLocal mlocalValue = arrayPoint2Coordinates->Get(context, rowIndex); + Local localValue; + if (mlocalValue.ToLocal(&localValue)) { + if (localValue->IsNumber()) { + MaybeLocal localNumber = localValue->ToNumber(context); + sDiscreteHatch2D.m_Point2Coordinates[rowIndex] = localNumber.ToLocalChecked()->Int32Value(isolate->GetCurrentContext()).ToChecked(); + } else { + isolate->ThrowException(Exception::TypeError(String::NewFromUtf8(isolate, "Point2Coordinates array entry is not a number" ))); + } + } else { + isolate->ThrowException(Exception::TypeError(String::NewFromUtf8(isolate, "Point2Coordinates array entry is invalid" ))); + } + } + } else { + isolate->ThrowException(Exception::TypeError(String::NewFromUtf8(isolate, "Point2Coordinates member is not an array" ))); + } + } else { + isolate->ThrowException(Exception::TypeError(String::NewFromUtf8(isolate, "Point2Coordinates 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 sDiscreteHatch2D; +} + + + +Local convertLib3MFDiscreteHatch2DToObject(Isolate* isolate, sLib3MFDiscreteHatch2D sDiscreteHatch2D) +{ + Local returnInstance = Object::New(isolate); + Local newPoint1Coordinates = Array::New(isolate, 2); + for (int rowIndex = 0; rowIndex < 2; rowIndex++) { + newPoint1Coordinates->Set(rowIndex, Integer::New(isolate, sDiscreteHatch2D.m_Point1Coordinates[rowIndex])); + } + returnInstance->Set(String::NewFromUtf8(isolate, "Point1Coordinates"), newPoint1Coordinates); + + Local newPoint2Coordinates = Array::New(isolate, 2); + for (int rowIndex = 0; rowIndex < 2; rowIndex++) { + newPoint2Coordinates->Set(rowIndex, Integer::New(isolate, sDiscreteHatch2D.m_Point2Coordinates[rowIndex])); + } + returnInstance->Set(String::NewFromUtf8(isolate, "Point2Coordinates"), newPoint2Coordinates); + + + return returnInstance; +} + /************************************************************************************************************************* Class sLib3MFCompositeConstituent Conversion **************************************************************************************************************************/ @@ -11569,7 +11852,8 @@ void CLib3MFToolpathLayerReader::Init() NODE_SET_PROTOTYPE_METHOD(tpl, "GetSegmentPartUUID", GetSegmentPartUUID); NODE_SET_PROTOTYPE_METHOD(tpl, "GetSegmentLocalPartID", GetSegmentLocalPartID); NODE_SET_PROTOTYPE_METHOD(tpl, "GetPartUUIDByLocalPartID", GetPartUUIDByLocalPartID); - NODE_SET_PROTOTYPE_METHOD(tpl, "GetSegmentPointData", GetSegmentPointData); + NODE_SET_PROTOTYPE_METHOD(tpl, "GetSegmentPointDataInModelUnits", GetSegmentPointDataInModelUnits); + NODE_SET_PROTOTYPE_METHOD(tpl, "GetSegmentPointDataDiscrete", GetSegmentPointDataDiscrete); NODE_SET_PROTOTYPE_METHOD(tpl, "FindAttributeInfoByName", FindAttributeInfoByName); NODE_SET_PROTOTYPE_METHOD(tpl, "FindAttributeIDByName", FindAttributeIDByName); NODE_SET_PROTOTYPE_METHOD(tpl, "FindAttributeValueByName", FindAttributeValueByName); @@ -11865,7 +12149,31 @@ void CLib3MFToolpathLayerReader::GetPartUUIDByLocalPartID(const FunctionCallback } -void CLib3MFToolpathLayerReader::GetSegmentPointData(const FunctionCallbackInfo& args) +void CLib3MFToolpathLayerReader::GetSegmentPointDataInModelUnits(const FunctionCallbackInfo& args) +{ + Isolate* isolate = args.GetIsolate(); + HandleScope scope(isolate); + try { + if (!args[0]->IsUint32()) { + throw std::runtime_error("Expected uint32 parameter 0 (Index)"); + } + unsigned int nIndex = (unsigned int) args[0]->IntegerValue(isolate->GetCurrentContext()).ToChecked(); + sLib3MFDynamicWrapperTable * wrapperTable = CLib3MFBaseClass::getDynamicWrapperTable(args.Holder()); + if (wrapperTable == nullptr) + throw std::runtime_error("Could not get wrapper table for Lib3MF method GetSegmentPointDataInModelUnits."); + if (wrapperTable->m_ToolpathLayerReader_GetSegmentPointDataInModelUnits == nullptr) + throw std::runtime_error("Could not call Lib3MF method ToolpathLayerReader::GetSegmentPointDataInModelUnits."); + Lib3MFHandle instanceHandle = CLib3MFBaseClass::getHandle(args.Holder()); + Lib3MFResult errorCode = wrapperTable->m_ToolpathLayerReader_GetSegmentPointDataInModelUnits(instanceHandle, nIndex, 0, nullptr, nullptr); + CheckError(isolate, wrapperTable, instanceHandle, errorCode); + + } catch (std::exception & E) { + RaiseError(isolate, E.what()); + } +} + + +void CLib3MFToolpathLayerReader::GetSegmentPointDataDiscrete(const FunctionCallbackInfo& args) { Isolate* isolate = args.GetIsolate(); HandleScope scope(isolate); @@ -11876,11 +12184,11 @@ void CLib3MFToolpathLayerReader::GetSegmentPointData(const FunctionCallbackInfo< unsigned int nIndex = (unsigned int) args[0]->IntegerValue(isolate->GetCurrentContext()).ToChecked(); sLib3MFDynamicWrapperTable * wrapperTable = CLib3MFBaseClass::getDynamicWrapperTable(args.Holder()); if (wrapperTable == nullptr) - throw std::runtime_error("Could not get wrapper table for Lib3MF method GetSegmentPointData."); - if (wrapperTable->m_ToolpathLayerReader_GetSegmentPointData == nullptr) - throw std::runtime_error("Could not call Lib3MF method ToolpathLayerReader::GetSegmentPointData."); + throw std::runtime_error("Could not get wrapper table for Lib3MF method GetSegmentPointDataDiscrete."); + if (wrapperTable->m_ToolpathLayerReader_GetSegmentPointDataDiscrete == nullptr) + throw std::runtime_error("Could not call Lib3MF method ToolpathLayerReader::GetSegmentPointDataDiscrete."); Lib3MFHandle instanceHandle = CLib3MFBaseClass::getHandle(args.Holder()); - Lib3MFResult errorCode = wrapperTable->m_ToolpathLayerReader_GetSegmentPointData(instanceHandle, nIndex, 0, nullptr, nullptr); + Lib3MFResult errorCode = wrapperTable->m_ToolpathLayerReader_GetSegmentPointDataDiscrete(instanceHandle, nIndex, 0, nullptr, nullptr); CheckError(isolate, wrapperTable, instanceHandle, errorCode); } catch (std::exception & E) { @@ -12235,9 +12543,14 @@ void CLib3MFToolpathLayerData::Init() NODE_SET_PROTOTYPE_METHOD(tpl, "RegisterBuildItem", RegisterBuildItem); NODE_SET_PROTOTYPE_METHOD(tpl, "SetSegmentAttribute", SetSegmentAttribute); NODE_SET_PROTOTYPE_METHOD(tpl, "ClearSegmentAttributes", ClearSegmentAttributes); - NODE_SET_PROTOTYPE_METHOD(tpl, "WriteHatchData", WriteHatchData); - NODE_SET_PROTOTYPE_METHOD(tpl, "WriteLoop", WriteLoop); - NODE_SET_PROTOTYPE_METHOD(tpl, "WritePolyline", WritePolyline); + NODE_SET_PROTOTYPE_METHOD(tpl, "AddCustomLineAttributes", AddCustomLineAttributes); + NODE_SET_PROTOTYPE_METHOD(tpl, "ClearCustomLineAttributes", ClearCustomLineAttributes); + NODE_SET_PROTOTYPE_METHOD(tpl, "WriteHatchDataInModelUnits", WriteHatchDataInModelUnits); + NODE_SET_PROTOTYPE_METHOD(tpl, "WriteHatchDataDiscrete", WriteHatchDataDiscrete); + NODE_SET_PROTOTYPE_METHOD(tpl, "WriteLoopInModelUnits", WriteLoopInModelUnits); + NODE_SET_PROTOTYPE_METHOD(tpl, "WriteLoopDiscrete", WriteLoopDiscrete); + NODE_SET_PROTOTYPE_METHOD(tpl, "WritePolylineInModelUnits", WritePolylineInModelUnits); + NODE_SET_PROTOTYPE_METHOD(tpl, "WritePolylineDiscrete", WritePolylineDiscrete); NODE_SET_PROTOTYPE_METHOD(tpl, "AddCustomData", AddCustomData); NODE_SET_PROTOTYPE_METHOD(tpl, "Finish", Finish); constructor.Reset(isolate, tpl->GetFunction(isolate->GetCurrentContext()).ToLocalChecked()); @@ -12415,7 +12728,57 @@ void CLib3MFToolpathLayerData::ClearSegmentAttributes(const FunctionCallbackInfo } -void CLib3MFToolpathLayerData::WriteHatchData(const FunctionCallbackInfo& args) +void CLib3MFToolpathLayerData::AddCustomLineAttributes(const FunctionCallbackInfo& args) +{ + Isolate* isolate = args.GetIsolate(); + HandleScope scope(isolate); + try { + if (!args[0]->IsString()) { + throw std::runtime_error("Expected string parameter 0 (NameSpace)"); + } + if (!args[1]->IsString()) { + throw std::runtime_error("Expected string parameter 1 (AttributeName)"); + } + v8::String::Utf8Value sutf8NameSpace(isolate, args[0]); + std::string sNameSpace = *sutf8NameSpace; + v8::String::Utf8Value sutf8AttributeName(isolate, args[1]); + std::string sAttributeName = *sutf8AttributeName; + sLib3MFDynamicWrapperTable * wrapperTable = CLib3MFBaseClass::getDynamicWrapperTable(args.Holder()); + if (wrapperTable == nullptr) + throw std::runtime_error("Could not get wrapper table for Lib3MF method AddCustomLineAttributes."); + if (wrapperTable->m_ToolpathLayerData_AddCustomLineAttributes == nullptr) + throw std::runtime_error("Could not call Lib3MF method ToolpathLayerData::AddCustomLineAttributes."); + Lib3MFHandle instanceHandle = CLib3MFBaseClass::getHandle(args.Holder()); + Lib3MFResult errorCode = wrapperTable->m_ToolpathLayerData_AddCustomLineAttributes(instanceHandle, sNameSpace.c_str(), sAttributeName.c_str(), 0, nullptr); + CheckError(isolate, wrapperTable, instanceHandle, errorCode); + + } catch (std::exception & E) { + RaiseError(isolate, E.what()); + } +} + + +void CLib3MFToolpathLayerData::ClearCustomLineAttributes(const FunctionCallbackInfo& args) +{ + Isolate* isolate = args.GetIsolate(); + HandleScope scope(isolate); + try { + sLib3MFDynamicWrapperTable * wrapperTable = CLib3MFBaseClass::getDynamicWrapperTable(args.Holder()); + if (wrapperTable == nullptr) + throw std::runtime_error("Could not get wrapper table for Lib3MF method ClearCustomLineAttributes."); + if (wrapperTable->m_ToolpathLayerData_ClearCustomLineAttributes == nullptr) + throw std::runtime_error("Could not call Lib3MF method ToolpathLayerData::ClearCustomLineAttributes."); + Lib3MFHandle instanceHandle = CLib3MFBaseClass::getHandle(args.Holder()); + Lib3MFResult errorCode = wrapperTable->m_ToolpathLayerData_ClearCustomLineAttributes(instanceHandle); + CheckError(isolate, wrapperTable, instanceHandle, errorCode); + + } catch (std::exception & E) { + RaiseError(isolate, E.what()); + } +} + + +void CLib3MFToolpathLayerData::WriteHatchDataInModelUnits(const FunctionCallbackInfo& args) { Isolate* isolate = args.GetIsolate(); HandleScope scope(isolate); @@ -12426,15 +12789,19 @@ void CLib3MFToolpathLayerData::WriteHatchData(const FunctionCallbackInfo& if (!args[1]->IsUint32()) { throw std::runtime_error("Expected uint32 parameter 1 (PartID)"); } + if (!args[2]->IsBoolean()) { + throw std::runtime_error("Expected bool parameter 2 (WriteCustomLineAttributes)"); + } unsigned int nProfileID = (unsigned int) args[0]->IntegerValue(isolate->GetCurrentContext()).ToChecked(); unsigned int nPartID = (unsigned int) args[1]->IntegerValue(isolate->GetCurrentContext()).ToChecked(); + bool bWriteCustomLineAttributes = args[2]->BooleanValue(isolate->GetCurrentContext()).ToChecked(); sLib3MFDynamicWrapperTable * wrapperTable = CLib3MFBaseClass::getDynamicWrapperTable(args.Holder()); if (wrapperTable == nullptr) - throw std::runtime_error("Could not get wrapper table for Lib3MF method WriteHatchData."); - if (wrapperTable->m_ToolpathLayerData_WriteHatchData == nullptr) - throw std::runtime_error("Could not call Lib3MF method ToolpathLayerData::WriteHatchData."); + throw std::runtime_error("Could not get wrapper table for Lib3MF method WriteHatchDataInModelUnits."); + if (wrapperTable->m_ToolpathLayerData_WriteHatchDataInModelUnits == nullptr) + throw std::runtime_error("Could not call Lib3MF method ToolpathLayerData::WriteHatchDataInModelUnits."); Lib3MFHandle instanceHandle = CLib3MFBaseClass::getHandle(args.Holder()); - Lib3MFResult errorCode = wrapperTable->m_ToolpathLayerData_WriteHatchData(instanceHandle, nProfileID, nPartID, 0, nullptr); + Lib3MFResult errorCode = wrapperTable->m_ToolpathLayerData_WriteHatchDataInModelUnits(instanceHandle, nProfileID, nPartID, bWriteCustomLineAttributes, 0, nullptr); CheckError(isolate, wrapperTable, instanceHandle, errorCode); } catch (std::exception & E) { @@ -12443,7 +12810,7 @@ void CLib3MFToolpathLayerData::WriteHatchData(const FunctionCallbackInfo& } -void CLib3MFToolpathLayerData::WriteLoop(const FunctionCallbackInfo& args) +void CLib3MFToolpathLayerData::WriteHatchDataDiscrete(const FunctionCallbackInfo& args) { Isolate* isolate = args.GetIsolate(); HandleScope scope(isolate); @@ -12454,15 +12821,51 @@ void CLib3MFToolpathLayerData::WriteLoop(const FunctionCallbackInfo& args if (!args[1]->IsUint32()) { throw std::runtime_error("Expected uint32 parameter 1 (PartID)"); } + if (!args[2]->IsBoolean()) { + throw std::runtime_error("Expected bool parameter 2 (WriteCustomLineAttributes)"); + } + unsigned int nProfileID = (unsigned int) args[0]->IntegerValue(isolate->GetCurrentContext()).ToChecked(); + unsigned int nPartID = (unsigned int) args[1]->IntegerValue(isolate->GetCurrentContext()).ToChecked(); + bool bWriteCustomLineAttributes = args[2]->BooleanValue(isolate->GetCurrentContext()).ToChecked(); + sLib3MFDynamicWrapperTable * wrapperTable = CLib3MFBaseClass::getDynamicWrapperTable(args.Holder()); + if (wrapperTable == nullptr) + throw std::runtime_error("Could not get wrapper table for Lib3MF method WriteHatchDataDiscrete."); + if (wrapperTable->m_ToolpathLayerData_WriteHatchDataDiscrete == nullptr) + throw std::runtime_error("Could not call Lib3MF method ToolpathLayerData::WriteHatchDataDiscrete."); + Lib3MFHandle instanceHandle = CLib3MFBaseClass::getHandle(args.Holder()); + Lib3MFResult errorCode = wrapperTable->m_ToolpathLayerData_WriteHatchDataDiscrete(instanceHandle, nProfileID, nPartID, bWriteCustomLineAttributes, 0, nullptr); + CheckError(isolate, wrapperTable, instanceHandle, errorCode); + + } catch (std::exception & E) { + RaiseError(isolate, E.what()); + } +} + + +void CLib3MFToolpathLayerData::WriteLoopInModelUnits(const FunctionCallbackInfo& args) +{ + Isolate* isolate = args.GetIsolate(); + HandleScope scope(isolate); + try { + if (!args[0]->IsUint32()) { + throw std::runtime_error("Expected uint32 parameter 0 (ProfileID)"); + } + if (!args[1]->IsUint32()) { + throw std::runtime_error("Expected uint32 parameter 1 (PartID)"); + } + if (!args[2]->IsBoolean()) { + throw std::runtime_error("Expected bool parameter 2 (WriteCustomLineAttributes)"); + } unsigned int nProfileID = (unsigned int) args[0]->IntegerValue(isolate->GetCurrentContext()).ToChecked(); unsigned int nPartID = (unsigned int) args[1]->IntegerValue(isolate->GetCurrentContext()).ToChecked(); + bool bWriteCustomLineAttributes = args[2]->BooleanValue(isolate->GetCurrentContext()).ToChecked(); sLib3MFDynamicWrapperTable * wrapperTable = CLib3MFBaseClass::getDynamicWrapperTable(args.Holder()); if (wrapperTable == nullptr) - throw std::runtime_error("Could not get wrapper table for Lib3MF method WriteLoop."); - if (wrapperTable->m_ToolpathLayerData_WriteLoop == nullptr) - throw std::runtime_error("Could not call Lib3MF method ToolpathLayerData::WriteLoop."); + throw std::runtime_error("Could not get wrapper table for Lib3MF method WriteLoopInModelUnits."); + if (wrapperTable->m_ToolpathLayerData_WriteLoopInModelUnits == nullptr) + throw std::runtime_error("Could not call Lib3MF method ToolpathLayerData::WriteLoopInModelUnits."); Lib3MFHandle instanceHandle = CLib3MFBaseClass::getHandle(args.Holder()); - Lib3MFResult errorCode = wrapperTable->m_ToolpathLayerData_WriteLoop(instanceHandle, nProfileID, nPartID, 0, nullptr); + Lib3MFResult errorCode = wrapperTable->m_ToolpathLayerData_WriteLoopInModelUnits(instanceHandle, nProfileID, nPartID, bWriteCustomLineAttributes, 0, nullptr); CheckError(isolate, wrapperTable, instanceHandle, errorCode); } catch (std::exception & E) { @@ -12471,7 +12874,7 @@ void CLib3MFToolpathLayerData::WriteLoop(const FunctionCallbackInfo& args } -void CLib3MFToolpathLayerData::WritePolyline(const FunctionCallbackInfo& args) +void CLib3MFToolpathLayerData::WriteLoopDiscrete(const FunctionCallbackInfo& args) { Isolate* isolate = args.GetIsolate(); HandleScope scope(isolate); @@ -12482,15 +12885,83 @@ void CLib3MFToolpathLayerData::WritePolyline(const FunctionCallbackInfo& if (!args[1]->IsUint32()) { throw std::runtime_error("Expected uint32 parameter 1 (PartID)"); } + if (!args[2]->IsBoolean()) { + throw std::runtime_error("Expected bool parameter 2 (WriteCustomLineAttributes)"); + } unsigned int nProfileID = (unsigned int) args[0]->IntegerValue(isolate->GetCurrentContext()).ToChecked(); unsigned int nPartID = (unsigned int) args[1]->IntegerValue(isolate->GetCurrentContext()).ToChecked(); + bool bWriteCustomLineAttributes = args[2]->BooleanValue(isolate->GetCurrentContext()).ToChecked(); sLib3MFDynamicWrapperTable * wrapperTable = CLib3MFBaseClass::getDynamicWrapperTable(args.Holder()); if (wrapperTable == nullptr) - throw std::runtime_error("Could not get wrapper table for Lib3MF method WritePolyline."); - if (wrapperTable->m_ToolpathLayerData_WritePolyline == nullptr) - throw std::runtime_error("Could not call Lib3MF method ToolpathLayerData::WritePolyline."); + throw std::runtime_error("Could not get wrapper table for Lib3MF method WriteLoopDiscrete."); + if (wrapperTable->m_ToolpathLayerData_WriteLoopDiscrete == nullptr) + throw std::runtime_error("Could not call Lib3MF method ToolpathLayerData::WriteLoopDiscrete."); Lib3MFHandle instanceHandle = CLib3MFBaseClass::getHandle(args.Holder()); - Lib3MFResult errorCode = wrapperTable->m_ToolpathLayerData_WritePolyline(instanceHandle, nProfileID, nPartID, 0, nullptr); + Lib3MFResult errorCode = wrapperTable->m_ToolpathLayerData_WriteLoopDiscrete(instanceHandle, nProfileID, nPartID, bWriteCustomLineAttributes, 0, nullptr); + CheckError(isolate, wrapperTable, instanceHandle, errorCode); + + } catch (std::exception & E) { + RaiseError(isolate, E.what()); + } +} + + +void CLib3MFToolpathLayerData::WritePolylineInModelUnits(const FunctionCallbackInfo& args) +{ + Isolate* isolate = args.GetIsolate(); + HandleScope scope(isolate); + try { + if (!args[0]->IsUint32()) { + throw std::runtime_error("Expected uint32 parameter 0 (ProfileID)"); + } + if (!args[1]->IsUint32()) { + throw std::runtime_error("Expected uint32 parameter 1 (PartID)"); + } + if (!args[2]->IsBoolean()) { + throw std::runtime_error("Expected bool parameter 2 (WriteCustomLineAttributes)"); + } + unsigned int nProfileID = (unsigned int) args[0]->IntegerValue(isolate->GetCurrentContext()).ToChecked(); + unsigned int nPartID = (unsigned int) args[1]->IntegerValue(isolate->GetCurrentContext()).ToChecked(); + bool bWriteCustomLineAttributes = args[2]->BooleanValue(isolate->GetCurrentContext()).ToChecked(); + sLib3MFDynamicWrapperTable * wrapperTable = CLib3MFBaseClass::getDynamicWrapperTable(args.Holder()); + if (wrapperTable == nullptr) + throw std::runtime_error("Could not get wrapper table for Lib3MF method WritePolylineInModelUnits."); + if (wrapperTable->m_ToolpathLayerData_WritePolylineInModelUnits == nullptr) + throw std::runtime_error("Could not call Lib3MF method ToolpathLayerData::WritePolylineInModelUnits."); + Lib3MFHandle instanceHandle = CLib3MFBaseClass::getHandle(args.Holder()); + Lib3MFResult errorCode = wrapperTable->m_ToolpathLayerData_WritePolylineInModelUnits(instanceHandle, nProfileID, nPartID, bWriteCustomLineAttributes, 0, nullptr); + CheckError(isolate, wrapperTable, instanceHandle, errorCode); + + } catch (std::exception & E) { + RaiseError(isolate, E.what()); + } +} + + +void CLib3MFToolpathLayerData::WritePolylineDiscrete(const FunctionCallbackInfo& args) +{ + Isolate* isolate = args.GetIsolate(); + HandleScope scope(isolate); + try { + if (!args[0]->IsUint32()) { + throw std::runtime_error("Expected uint32 parameter 0 (ProfileID)"); + } + if (!args[1]->IsUint32()) { + throw std::runtime_error("Expected uint32 parameter 1 (PartID)"); + } + if (!args[2]->IsBoolean()) { + throw std::runtime_error("Expected bool parameter 2 (WriteCustomLineAttributes)"); + } + unsigned int nProfileID = (unsigned int) args[0]->IntegerValue(isolate->GetCurrentContext()).ToChecked(); + unsigned int nPartID = (unsigned int) args[1]->IntegerValue(isolate->GetCurrentContext()).ToChecked(); + bool bWriteCustomLineAttributes = args[2]->BooleanValue(isolate->GetCurrentContext()).ToChecked(); + sLib3MFDynamicWrapperTable * wrapperTable = CLib3MFBaseClass::getDynamicWrapperTable(args.Holder()); + if (wrapperTable == nullptr) + throw std::runtime_error("Could not get wrapper table for Lib3MF method WritePolylineDiscrete."); + if (wrapperTable->m_ToolpathLayerData_WritePolylineDiscrete == nullptr) + throw std::runtime_error("Could not call Lib3MF method ToolpathLayerData::WritePolylineDiscrete."); + Lib3MFHandle instanceHandle = CLib3MFBaseClass::getHandle(args.Holder()); + Lib3MFResult errorCode = wrapperTable->m_ToolpathLayerData_WritePolylineDiscrete(instanceHandle, nProfileID, nPartID, bWriteCustomLineAttributes, 0, nullptr); CheckError(isolate, wrapperTable, instanceHandle, errorCode); } catch (std::exception & E) { @@ -12574,6 +13045,8 @@ void CLib3MFToolpath::Init() tpl->InstanceTemplate()->SetInternalFieldCount(NODEWRAPPER_FIELDCOUNT); // Prototype + NODE_SET_PROTOTYPE_METHOD(tpl, "GetUUID", GetUUID); + NODE_SET_PROTOTYPE_METHOD(tpl, "ResetUUID", ResetUUID); NODE_SET_PROTOTYPE_METHOD(tpl, "GetUnits", GetUnits); NODE_SET_PROTOTYPE_METHOD(tpl, "GetLayerCount", GetLayerCount); NODE_SET_PROTOTYPE_METHOD(tpl, "GetProfileCount", GetProfileCount); @@ -12584,7 +13057,9 @@ void CLib3MFToolpath::Init() NODE_SET_PROTOTYPE_METHOD(tpl, "ReadLayerData", ReadLayerData); NODE_SET_PROTOTYPE_METHOD(tpl, "GetLayerPath", GetLayerPath); NODE_SET_PROTOTYPE_METHOD(tpl, "GetLayerZMax", GetLayerZMax); - NODE_SET_PROTOTYPE_METHOD(tpl, "GetLayerZ", GetLayerZ); + NODE_SET_PROTOTYPE_METHOD(tpl, "GetLayerZMin", GetLayerZMin); + NODE_SET_PROTOTYPE_METHOD(tpl, "GetLayerThickness", GetLayerThickness); + NODE_SET_PROTOTYPE_METHOD(tpl, "HasUniformThickness", HasUniformThickness); NODE_SET_PROTOTYPE_METHOD(tpl, "AddProfile", AddProfile); NODE_SET_PROTOTYPE_METHOD(tpl, "GetProfile", GetProfile); NODE_SET_PROTOTYPE_METHOD(tpl, "GetProfileUUID", GetProfileUUID); @@ -12597,8 +13072,8 @@ void CLib3MFToolpath::Init() NODE_SET_PROTOTYPE_METHOD(tpl, "AddCustomData", AddCustomData); NODE_SET_PROTOTYPE_METHOD(tpl, "ClearCustomData", ClearCustomData); NODE_SET_PROTOTYPE_METHOD(tpl, "DeleteCustomData", DeleteCustomData); - NODE_SET_PROTOTYPE_METHOD(tpl, "RegisterCustomIntegerAttribute", RegisterCustomIntegerAttribute); - NODE_SET_PROTOTYPE_METHOD(tpl, "RegisterCustomDoubleAttribute", RegisterCustomDoubleAttribute); + NODE_SET_PROTOTYPE_METHOD(tpl, "RegisterCustomIntegerSegmentAttribute", RegisterCustomIntegerSegmentAttribute); + NODE_SET_PROTOTYPE_METHOD(tpl, "RegisterCustomDoubleSegmentAttribute", RegisterCustomDoubleSegmentAttribute); constructor.Reset(isolate, tpl->GetFunction(isolate->GetCurrentContext()).ToLocalChecked()); } @@ -12632,6 +13107,60 @@ Local CLib3MFToolpath::NewInstance(Local pParent, Lib3MFHandle p } +void CLib3MFToolpath::GetUUID(const FunctionCallbackInfo& args) +{ + Isolate* isolate = args.GetIsolate(); + HandleScope scope(isolate); + try { + unsigned int bytesNeededUUID = 0; + unsigned int bytesWrittenUUID = 0; + sLib3MFDynamicWrapperTable * wrapperTable = CLib3MFBaseClass::getDynamicWrapperTable(args.Holder()); + if (wrapperTable == nullptr) + throw std::runtime_error("Could not get wrapper table for Lib3MF method GetUUID."); + if (wrapperTable->m_Toolpath_GetUUID == nullptr) + throw std::runtime_error("Could not call Lib3MF method Toolpath::GetUUID."); + Lib3MFHandle instanceHandle = CLib3MFBaseClass::getHandle(args.Holder()); + Lib3MFResult initErrorCode = wrapperTable->m_Toolpath_GetUUID(instanceHandle, 0, &bytesNeededUUID, nullptr); + CheckError(isolate, wrapperTable, instanceHandle, initErrorCode); + std::vector bufferUUID; + bufferUUID.resize(bytesNeededUUID); + Lib3MFResult errorCode = wrapperTable->m_Toolpath_GetUUID(instanceHandle, bytesNeededUUID, &bytesWrittenUUID, &bufferUUID[0]); + CheckError(isolate, wrapperTable, instanceHandle, errorCode); + args.GetReturnValue().Set(String::NewFromUtf8(isolate, &bufferUUID[0])); + + } catch (std::exception & E) { + RaiseError(isolate, E.what()); + } +} + + +void CLib3MFToolpath::ResetUUID(const FunctionCallbackInfo& args) +{ + Isolate* isolate = args.GetIsolate(); + HandleScope scope(isolate); + try { + unsigned int bytesNeededNewUUID = 0; + unsigned int bytesWrittenNewUUID = 0; + sLib3MFDynamicWrapperTable * wrapperTable = CLib3MFBaseClass::getDynamicWrapperTable(args.Holder()); + if (wrapperTable == nullptr) + throw std::runtime_error("Could not get wrapper table for Lib3MF method ResetUUID."); + if (wrapperTable->m_Toolpath_ResetUUID == nullptr) + throw std::runtime_error("Could not call Lib3MF method Toolpath::ResetUUID."); + Lib3MFHandle instanceHandle = CLib3MFBaseClass::getHandle(args.Holder()); + Lib3MFResult initErrorCode = wrapperTable->m_Toolpath_ResetUUID(instanceHandle, 0, &bytesNeededNewUUID, nullptr); + CheckError(isolate, wrapperTable, instanceHandle, initErrorCode); + std::vector bufferNewUUID; + bufferNewUUID.resize(bytesNeededNewUUID); + Lib3MFResult errorCode = wrapperTable->m_Toolpath_ResetUUID(instanceHandle, bytesNeededNewUUID, &bytesWrittenNewUUID, &bufferNewUUID[0]); + CheckError(isolate, wrapperTable, instanceHandle, errorCode); + args.GetReturnValue().Set(String::NewFromUtf8(isolate, &bufferNewUUID[0])); + + } catch (std::exception & E) { + RaiseError(isolate, E.what()); + } +} + + void CLib3MFToolpath::GetUnits(const FunctionCallbackInfo& args) { Isolate* isolate = args.GetIsolate(); @@ -12895,25 +13424,73 @@ void CLib3MFToolpath::GetLayerZMax(const FunctionCallbackInfo& args) } -void CLib3MFToolpath::GetLayerZ(const FunctionCallbackInfo& args) +void CLib3MFToolpath::GetLayerZMin(const FunctionCallbackInfo& args) { Isolate* isolate = args.GetIsolate(); HandleScope scope(isolate); try { if (!args[0]->IsUint32()) { - throw std::runtime_error("Expected uint32 parameter 0 (LayerIndex)"); + throw std::runtime_error("Expected uint32 parameter 0 (Index)"); } - unsigned int nLayerIndex = (unsigned int) args[0]->IntegerValue(isolate->GetCurrentContext()).ToChecked(); - unsigned int nReturnZValue = 0; + unsigned int nIndex = (unsigned int) args[0]->IntegerValue(isolate->GetCurrentContext()).ToChecked(); + unsigned int nReturnZMin = 0; + sLib3MFDynamicWrapperTable * wrapperTable = CLib3MFBaseClass::getDynamicWrapperTable(args.Holder()); + if (wrapperTable == nullptr) + throw std::runtime_error("Could not get wrapper table for Lib3MF method GetLayerZMin."); + if (wrapperTable->m_Toolpath_GetLayerZMin == nullptr) + throw std::runtime_error("Could not call Lib3MF method Toolpath::GetLayerZMin."); + Lib3MFHandle instanceHandle = CLib3MFBaseClass::getHandle(args.Holder()); + Lib3MFResult errorCode = wrapperTable->m_Toolpath_GetLayerZMin(instanceHandle, nIndex, &nReturnZMin); + CheckError(isolate, wrapperTable, instanceHandle, errorCode); + args.GetReturnValue().Set(Integer::NewFromUnsigned(isolate, nReturnZMin)); + + } catch (std::exception & E) { + RaiseError(isolate, E.what()); + } +} + + +void CLib3MFToolpath::GetLayerThickness(const FunctionCallbackInfo& args) +{ + Isolate* isolate = args.GetIsolate(); + HandleScope scope(isolate); + try { + if (!args[0]->IsUint32()) { + throw std::runtime_error("Expected uint32 parameter 0 (Index)"); + } + unsigned int nIndex = (unsigned int) args[0]->IntegerValue(isolate->GetCurrentContext()).ToChecked(); + unsigned int nReturnZThickness = 0; + sLib3MFDynamicWrapperTable * wrapperTable = CLib3MFBaseClass::getDynamicWrapperTable(args.Holder()); + if (wrapperTable == nullptr) + throw std::runtime_error("Could not get wrapper table for Lib3MF method GetLayerThickness."); + if (wrapperTable->m_Toolpath_GetLayerThickness == nullptr) + throw std::runtime_error("Could not call Lib3MF method Toolpath::GetLayerThickness."); + Lib3MFHandle instanceHandle = CLib3MFBaseClass::getHandle(args.Holder()); + Lib3MFResult errorCode = wrapperTable->m_Toolpath_GetLayerThickness(instanceHandle, nIndex, &nReturnZThickness); + CheckError(isolate, wrapperTable, instanceHandle, errorCode); + args.GetReturnValue().Set(Integer::NewFromUnsigned(isolate, nReturnZThickness)); + + } catch (std::exception & E) { + RaiseError(isolate, E.what()); + } +} + + +void CLib3MFToolpath::HasUniformThickness(const FunctionCallbackInfo& args) +{ + Isolate* isolate = args.GetIsolate(); + HandleScope scope(isolate); + try { + bool bReturnUniformThickness = false; sLib3MFDynamicWrapperTable * wrapperTable = CLib3MFBaseClass::getDynamicWrapperTable(args.Holder()); if (wrapperTable == nullptr) - throw std::runtime_error("Could not get wrapper table for Lib3MF method GetLayerZ."); - if (wrapperTable->m_Toolpath_GetLayerZ == nullptr) - throw std::runtime_error("Could not call Lib3MF method Toolpath::GetLayerZ."); + throw std::runtime_error("Could not get wrapper table for Lib3MF method HasUniformThickness."); + if (wrapperTable->m_Toolpath_HasUniformThickness == nullptr) + throw std::runtime_error("Could not call Lib3MF method Toolpath::HasUniformThickness."); Lib3MFHandle instanceHandle = CLib3MFBaseClass::getHandle(args.Holder()); - Lib3MFResult errorCode = wrapperTable->m_Toolpath_GetLayerZ(instanceHandle, nLayerIndex, &nReturnZValue); + Lib3MFResult errorCode = wrapperTable->m_Toolpath_HasUniformThickness(instanceHandle, &bReturnUniformThickness); CheckError(isolate, wrapperTable, instanceHandle, errorCode); - args.GetReturnValue().Set(Integer::NewFromUnsigned(isolate, nReturnZValue)); + args.GetReturnValue().Set(Boolean::New(isolate, bReturnUniformThickness)); } catch (std::exception & E) { RaiseError(isolate, E.what()); @@ -13269,7 +13846,7 @@ void CLib3MFToolpath::DeleteCustomData(const FunctionCallbackInfo& args) } -void CLib3MFToolpath::RegisterCustomIntegerAttribute(const FunctionCallbackInfo& args) +void CLib3MFToolpath::RegisterCustomIntegerSegmentAttribute(const FunctionCallbackInfo& args) { Isolate* isolate = args.GetIsolate(); HandleScope scope(isolate); @@ -13286,11 +13863,11 @@ void CLib3MFToolpath::RegisterCustomIntegerAttribute(const FunctionCallbackInfo< std::string sAttributeName = *sutf8AttributeName; sLib3MFDynamicWrapperTable * wrapperTable = CLib3MFBaseClass::getDynamicWrapperTable(args.Holder()); if (wrapperTable == nullptr) - throw std::runtime_error("Could not get wrapper table for Lib3MF method RegisterCustomIntegerAttribute."); - if (wrapperTable->m_Toolpath_RegisterCustomIntegerAttribute == nullptr) - throw std::runtime_error("Could not call Lib3MF method Toolpath::RegisterCustomIntegerAttribute."); + throw std::runtime_error("Could not get wrapper table for Lib3MF method RegisterCustomIntegerSegmentAttribute."); + if (wrapperTable->m_Toolpath_RegisterCustomIntegerSegmentAttribute == nullptr) + throw std::runtime_error("Could not call Lib3MF method Toolpath::RegisterCustomIntegerSegmentAttribute."); Lib3MFHandle instanceHandle = CLib3MFBaseClass::getHandle(args.Holder()); - Lib3MFResult errorCode = wrapperTable->m_Toolpath_RegisterCustomIntegerAttribute(instanceHandle, sNameSpace.c_str(), sAttributeName.c_str()); + Lib3MFResult errorCode = wrapperTable->m_Toolpath_RegisterCustomIntegerSegmentAttribute(instanceHandle, sNameSpace.c_str(), sAttributeName.c_str()); CheckError(isolate, wrapperTable, instanceHandle, errorCode); } catch (std::exception & E) { @@ -13299,7 +13876,7 @@ void CLib3MFToolpath::RegisterCustomIntegerAttribute(const FunctionCallbackInfo< } -void CLib3MFToolpath::RegisterCustomDoubleAttribute(const FunctionCallbackInfo& args) +void CLib3MFToolpath::RegisterCustomDoubleSegmentAttribute(const FunctionCallbackInfo& args) { Isolate* isolate = args.GetIsolate(); HandleScope scope(isolate); @@ -13316,11 +13893,11 @@ void CLib3MFToolpath::RegisterCustomDoubleAttribute(const FunctionCallbackInfom_Toolpath_RegisterCustomDoubleAttribute == nullptr) - throw std::runtime_error("Could not call Lib3MF method Toolpath::RegisterCustomDoubleAttribute."); + throw std::runtime_error("Could not get wrapper table for Lib3MF method RegisterCustomDoubleSegmentAttribute."); + if (wrapperTable->m_Toolpath_RegisterCustomDoubleSegmentAttribute == nullptr) + throw std::runtime_error("Could not call Lib3MF method Toolpath::RegisterCustomDoubleSegmentAttribute."); Lib3MFHandle instanceHandle = CLib3MFBaseClass::getHandle(args.Holder()); - Lib3MFResult errorCode = wrapperTable->m_Toolpath_RegisterCustomDoubleAttribute(instanceHandle, sNameSpace.c_str(), sAttributeName.c_str()); + Lib3MFResult errorCode = wrapperTable->m_Toolpath_RegisterCustomDoubleSegmentAttribute(instanceHandle, sNameSpace.c_str(), sAttributeName.c_str()); CheckError(isolate, wrapperTable, instanceHandle, errorCode); } catch (std::exception & E) { diff --git a/Autogenerated/Bindings/NodeJS/lib3mf_nodewrapper.h b/Autogenerated/Bindings/NodeJS/lib3mf_nodewrapper.h index db7457462..2a574d460 100644 --- a/Autogenerated/Bindings/NodeJS/lib3mf_nodewrapper.h +++ b/Autogenerated/Bindings/NodeJS/lib3mf_nodewrapper.h @@ -1090,7 +1090,8 @@ class CLib3MFToolpathLayerReader : public CLib3MFBaseClass { static void GetSegmentPartUUID(const v8::FunctionCallbackInfo& args); static void GetSegmentLocalPartID(const v8::FunctionCallbackInfo& args); static void GetPartUUIDByLocalPartID(const v8::FunctionCallbackInfo& args); - static void GetSegmentPointData(const v8::FunctionCallbackInfo& args); + static void GetSegmentPointDataInModelUnits(const v8::FunctionCallbackInfo& args); + static void GetSegmentPointDataDiscrete(const v8::FunctionCallbackInfo& args); static void FindAttributeInfoByName(const v8::FunctionCallbackInfo& args); static void FindAttributeIDByName(const v8::FunctionCallbackInfo& args); static void FindAttributeValueByName(const v8::FunctionCallbackInfo& args); @@ -1123,9 +1124,14 @@ class CLib3MFToolpathLayerData : public CLib3MFBaseClass { static void RegisterBuildItem(const v8::FunctionCallbackInfo& args); static void SetSegmentAttribute(const v8::FunctionCallbackInfo& args); static void ClearSegmentAttributes(const v8::FunctionCallbackInfo& args); - static void WriteHatchData(const v8::FunctionCallbackInfo& args); - static void WriteLoop(const v8::FunctionCallbackInfo& args); - static void WritePolyline(const v8::FunctionCallbackInfo& args); + static void AddCustomLineAttributes(const v8::FunctionCallbackInfo& args); + static void ClearCustomLineAttributes(const v8::FunctionCallbackInfo& args); + static void WriteHatchDataInModelUnits(const v8::FunctionCallbackInfo& args); + static void WriteHatchDataDiscrete(const v8::FunctionCallbackInfo& args); + static void WriteLoopInModelUnits(const v8::FunctionCallbackInfo& args); + static void WriteLoopDiscrete(const v8::FunctionCallbackInfo& args); + static void WritePolylineInModelUnits(const v8::FunctionCallbackInfo& args); + static void WritePolylineDiscrete(const v8::FunctionCallbackInfo& args); static void AddCustomData(const v8::FunctionCallbackInfo& args); static void Finish(const v8::FunctionCallbackInfo& args); @@ -1145,6 +1151,8 @@ class CLib3MFToolpath : public CLib3MFBaseClass { private: static void New(const v8::FunctionCallbackInfo& args); static v8::Persistent constructor; + static void GetUUID(const v8::FunctionCallbackInfo& args); + static void ResetUUID(const v8::FunctionCallbackInfo& args); static void GetUnits(const v8::FunctionCallbackInfo& args); static void GetLayerCount(const v8::FunctionCallbackInfo& args); static void GetProfileCount(const v8::FunctionCallbackInfo& args); @@ -1155,7 +1163,9 @@ class CLib3MFToolpath : public CLib3MFBaseClass { static void ReadLayerData(const v8::FunctionCallbackInfo& args); static void GetLayerPath(const v8::FunctionCallbackInfo& args); static void GetLayerZMax(const v8::FunctionCallbackInfo& args); - static void GetLayerZ(const v8::FunctionCallbackInfo& args); + static void GetLayerZMin(const v8::FunctionCallbackInfo& args); + static void GetLayerThickness(const v8::FunctionCallbackInfo& args); + static void HasUniformThickness(const v8::FunctionCallbackInfo& args); static void AddProfile(const v8::FunctionCallbackInfo& args); static void GetProfile(const v8::FunctionCallbackInfo& args); static void GetProfileUUID(const v8::FunctionCallbackInfo& args); @@ -1168,8 +1178,8 @@ class CLib3MFToolpath : public CLib3MFBaseClass { static void AddCustomData(const v8::FunctionCallbackInfo& args); static void ClearCustomData(const v8::FunctionCallbackInfo& args); static void DeleteCustomData(const v8::FunctionCallbackInfo& args); - static void RegisterCustomIntegerAttribute(const v8::FunctionCallbackInfo& args); - static void RegisterCustomDoubleAttribute(const v8::FunctionCallbackInfo& args); + static void RegisterCustomIntegerSegmentAttribute(const v8::FunctionCallbackInfo& args); + static void RegisterCustomDoubleSegmentAttribute(const v8::FunctionCallbackInfo& args); public: CLib3MFToolpath(); diff --git a/Autogenerated/Bindings/NodeJS/lib3mf_types.h b/Autogenerated/Bindings/NodeJS/lib3mf_types.h index ed4941824..e4a331e83 100644 --- a/Autogenerated/Bindings/NodeJS/lib3mf_types.h +++ b/Autogenerated/Bindings/NodeJS/lib3mf_types.h @@ -151,6 +151,9 @@ typedef void * Lib3MF_pvoid; #define LIB3MF_ERROR_EMPTYNAMESPACE 4007 /** Empty namespace. */ #define LIB3MF_ERROR_INVALIDNAMESPACEPREFIX 4008 /** Invalid namespace prefix. */ #define LIB3MF_ERROR_WRITERDOESNOTSUPPORTNAMESPACES 4009 /** Writer does not support namespaces. */ +#define LIB3MF_ERROR_TOOLPATH_INVALIDHATCHCOORDINATE 4010 /** Invalid hatch coordinate. */ +#define LIB3MF_ERROR_TOOLPATH_INVALIDPOINTCOORDINATE 4011 /** Invalid point coordinate. */ +#define LIB3MF_ERROR_TOOLPATH_INVALIDHATCHCOUNT 4012 /** Invalid hatch count */ /************************************************************************************************************************* Error strings for Lib3MF @@ -216,6 +219,9 @@ inline const char * LIB3MF_GETERRORSTRING (Lib3MFResult nErrorCode) { case LIB3MF_ERROR_EMPTYNAMESPACE: return "Empty namespace."; case LIB3MF_ERROR_INVALIDNAMESPACEPREFIX: return "Invalid namespace prefix."; case LIB3MF_ERROR_WRITERDOESNOTSUPPORTNAMESPACES: return "Writer does not support namespaces."; + case LIB3MF_ERROR_TOOLPATH_INVALIDHATCHCOORDINATE: return "Invalid hatch coordinate."; + case LIB3MF_ERROR_TOOLPATH_INVALIDPOINTCOORDINATE: return "Invalid point coordinate."; + case LIB3MF_ERROR_TOOLPATH_INVALIDHATCHCOUNT: return "Invalid hatch count"; default: return "unknown error"; } } @@ -565,6 +571,20 @@ typedef struct sLib3MFPosition2D { Lib3MF_single m_Coordinates[2]; } sLib3MFPosition2D; +typedef struct sLib3MFDiscretePosition2D { + Lib3MF_int32 m_Coordinates[2]; +} sLib3MFDiscretePosition2D; + +typedef struct sLib3MFHatch2D { + Lib3MF_single m_Point1Coordinates[2]; + Lib3MF_single m_Point2Coordinates[2]; +} sLib3MFHatch2D; + +typedef struct sLib3MFDiscreteHatch2D { + Lib3MF_int32 m_Point1Coordinates[2]; + Lib3MF_int32 m_Point2Coordinates[2]; +} sLib3MFDiscreteHatch2D; + typedef struct sLib3MFCompositeConstituent { Lib3MF_uint32 m_PropertyID; Lib3MF_double m_MixingRatio; diff --git a/Autogenerated/Bindings/Pascal/Unit_Lib3MF.pas b/Autogenerated/Bindings/Pascal/Unit_Lib3MF.pas index 6c372d518..47cd46512 100644 --- a/Autogenerated/Bindings/Pascal/Unit_Lib3MF.pas +++ b/Autogenerated/Bindings/Pascal/Unit_Lib3MF.pas @@ -134,6 +134,9 @@ interface LIB3MF_ERROR_EMPTYNAMESPACE = 4007; LIB3MF_ERROR_INVALIDNAMESPACEPREFIX = 4008; LIB3MF_ERROR_WRITERDOESNOTSUPPORTNAMESPACES = 4009; + LIB3MF_ERROR_TOOLPATH_INVALIDHATCHCOORDINATE = 4010; + LIB3MF_ERROR_TOOLPATH_INVALIDPOINTCOORDINATE = 4011; + LIB3MF_ERROR_TOOLPATH_INVALIDHATCHCOUNT = 4012; (************************************************************************************************************************* Declaration of enums @@ -319,6 +322,23 @@ interface FCoordinates: array [0..1] of Single; end; + PLib3MFDiscretePosition2D = ^TLib3MFDiscretePosition2D; + TLib3MFDiscretePosition2D = packed record + FCoordinates: array [0..1] of Integer; + end; + + PLib3MFHatch2D = ^TLib3MFHatch2D; + TLib3MFHatch2D = packed record + FPoint1Coordinates: array [0..1] of Single; + FPoint2Coordinates: array [0..1] of Single; + end; + + PLib3MFDiscreteHatch2D = ^TLib3MFDiscreteHatch2D; + TLib3MFDiscreteHatch2D = packed record + FPoint1Coordinates: array [0..1] of Integer; + FPoint2Coordinates: array [0..1] of Integer; + end; + PLib3MFCompositeConstituent = ^TLib3MFCompositeConstituent; TLib3MFCompositeConstituent = packed record FPropertyID: Cardinal; @@ -378,6 +398,9 @@ interface ArrayOfLib3MFTriangleProperties = array of TLib3MFTriangleProperties; ArrayOfLib3MFPosition = array of TLib3MFPosition; ArrayOfLib3MFPosition2D = array of TLib3MFPosition2D; + ArrayOfLib3MFDiscretePosition2D = array of TLib3MFDiscretePosition2D; + ArrayOfLib3MFHatch2D = array of TLib3MFHatch2D; + ArrayOfLib3MFDiscreteHatch2D = array of TLib3MFDiscreteHatch2D; ArrayOfLib3MFCompositeConstituent = array of TLib3MFCompositeConstituent; ArrayOfLib3MFMultiPropertyLayer = array of TLib3MFMultiPropertyLayer; ArrayOfLib3MFTex2Coord = array of TLib3MFTex2Coord; @@ -3813,10 +3836,22 @@ TLib3MFModel = class; * @param[in] nIndex - Index. Must be between 0 and Count - 1. * @param[in] nPointDataCount - Number of elements in buffer * @param[out] pPointDataNeededCount - will be filled with the count of the written elements, or needed buffer size. - * @param[out] pPointDataBuffer - Position2D buffer of The point data array + * @param[out] pPointDataBuffer - Position2D buffer of The point data array. The point coordinates are in model units. + * @return error code or 0 (success) + *) + TLib3MFToolpathLayerReader_GetSegmentPointDataInModelUnitsFunc = function(pToolpathLayerReader: TLib3MFHandle; const nIndex: Cardinal; const nPointDataCount: QWord; out pPointDataNeededCount: QWord; pPointDataBuffer: PLib3MFPosition2D): TLib3MFResult; cdecl; + + (** + * Retrieves the assigned segment point list in units. For type hatch, the points are taken pairwise. + * + * @param[in] pToolpathLayerReader - ToolpathLayerReader instance. + * @param[in] nIndex - Index. Must be between 0 and Count - 1. + * @param[in] nPointDataCount - Number of elements in buffer + * @param[out] pPointDataNeededCount - will be filled with the count of the written elements, or needed buffer size. + * @param[out] pPointDataBuffer - DiscretePosition2D buffer of The point data array. The point coordinates are in toolpath units. * @return error code or 0 (success) *) - TLib3MFToolpathLayerReader_GetSegmentPointDataFunc = function(pToolpathLayerReader: TLib3MFHandle; const nIndex: Cardinal; const nPointDataCount: QWord; out pPointDataNeededCount: QWord; pPointDataBuffer: PLib3MFPosition2D): TLib3MFResult; cdecl; + TLib3MFToolpathLayerReader_GetSegmentPointDataDiscreteFunc = function(pToolpathLayerReader: TLib3MFHandle; const nIndex: Cardinal; const nPointDataCount: QWord; out pPointDataNeededCount: QWord; pPointDataBuffer: PLib3MFDiscretePosition2D): TLib3MFResult; cdecl; (** * Retrieves a segment attribute Information by Attribute Name. Will fail if Attribute does not exist. @@ -3988,28 +4023,89 @@ TLib3MFModel = class; TLib3MFToolpathLayerData_ClearSegmentAttributesFunc = function(pToolpathLayerData: TLib3MFHandle): TLib3MFResult; cdecl; (** - * writes hatch data to the layer. + * Stores custom line attributes for the next WriteLoop, WritePolyline or WriteHatchData call. + * + * @param[in] pToolpathLayerData - ToolpathLayerData instance. + * @param[in] pNameSpace - The namespace of the attribute to register. + * @param[in] pAttributeName - The name of the attribute to register. + * @param[in] nValuesCount - Number of elements in buffer + * @param[in] pValuesBuffer - int32 buffer of Custom Values to store on segment lines. Array MUST NOT be empty. If custom attributes had been already defined, the error cardinality MUST match, or an error will be thrown. + * @return error code or 0 (success) + *) + TLib3MFToolpathLayerData_AddCustomLineAttributesFunc = function(pToolpathLayerData: TLib3MFHandle; const pNameSpace: PAnsiChar; const pAttributeName: PAnsiChar; const nValuesCount: QWord; const pValuesBuffer: PInteger): TLib3MFResult; cdecl; + + (** + * Clears all custom line attributes. Any call to WriteLoop, WritePolyline or WriteHatchData will do this implicitely. + * + * @param[in] pToolpathLayerData - ToolpathLayerData instance. + * @return error code or 0 (success) + *) + TLib3MFToolpathLayerData_ClearCustomLineAttributesFunc = function(pToolpathLayerData: TLib3MFHandle): TLib3MFResult; cdecl; + + (** + * writes hatch data to the layer in model units. + * + * @param[in] pToolpathLayerData - ToolpathLayerData instance. + * @param[in] nProfileID - The toolpath profile to use + * @param[in] nPartID - The toolpath part to use + * @param[in] bWriteCustomLineAttributes - If true, custom line attributes are written. The cardinality of each custom attribute MUST be equal to the number of hatches in the hatchdata array. In any case, stored custom attributes will be cleared after the call. + * @param[in] nHatchDataCount - Number of elements in buffer + * @param[in] pHatchDataBuffer - Hatch2D buffer of The hatch data in model units. Array MUST NOT be empty. + * @return error code or 0 (success) + *) + TLib3MFToolpathLayerData_WriteHatchDataInModelUnitsFunc = function(pToolpathLayerData: TLib3MFHandle; const nProfileID: Cardinal; const nPartID: Cardinal; const bWriteCustomLineAttributes: Byte; const nHatchDataCount: QWord; const pHatchDataBuffer: PLib3MFHatch2D): TLib3MFResult; cdecl; + + (** + * writes hatch data to the layer in toolpath units. * * @param[in] pToolpathLayerData - ToolpathLayerData instance. * @param[in] nProfileID - The toolpath profile to use * @param[in] nPartID - The toolpath part to use + * @param[in] bWriteCustomLineAttributes - If true, custom line attributes are written. The cardinality of each custom attribute MUST be equal to the number of hatches in the hatchdata array. In any case, stored custom attributes will be cleared after the call. + * @param[in] nHatchDataCount - Number of elements in buffer + * @param[in] pHatchDataBuffer - DiscreteHatch2D buffer of The hatch data in toolpath units. Array MUST NOT be empty. + * @return error code or 0 (success) + *) + TLib3MFToolpathLayerData_WriteHatchDataDiscreteFunc = function(pToolpathLayerData: TLib3MFHandle; const nProfileID: Cardinal; const nPartID: Cardinal; const bWriteCustomLineAttributes: Byte; const nHatchDataCount: QWord; const pHatchDataBuffer: PLib3MFDiscreteHatch2D): TLib3MFResult; cdecl; + + (** + * writes loop data to the layer in model units. + * + * @param[in] pToolpathLayerData - ToolpathLayerData instance. + * @param[in] nProfileID - The toolpath profile to use + * @param[in] nPartID - The toolpath part to use + * @param[in] bWriteCustomLineAttributes - If true, custom line attributes are written. The cardinality of each custom attribute MUST be equal to the number of points in the pointdata array. In any case, stored custom attributes will be cleared after the call. * @param[in] nPointDataCount - Number of elements in buffer - * @param[in] pPointDataBuffer - Position2D buffer of The point data + * @param[in] pPointDataBuffer - Position2D buffer of The point data in model units. Array MUST NOT be empty. * @return error code or 0 (success) *) - TLib3MFToolpathLayerData_WriteHatchDataFunc = function(pToolpathLayerData: TLib3MFHandle; const nProfileID: Cardinal; const nPartID: Cardinal; const nPointDataCount: QWord; const pPointDataBuffer: PLib3MFPosition2D): TLib3MFResult; cdecl; + TLib3MFToolpathLayerData_WriteLoopInModelUnitsFunc = function(pToolpathLayerData: TLib3MFHandle; const nProfileID: Cardinal; const nPartID: Cardinal; const bWriteCustomLineAttributes: Byte; const nPointDataCount: QWord; const pPointDataBuffer: PLib3MFPosition2D): TLib3MFResult; cdecl; (** - * writes loop data to the layer. + * writes loop data to the layer in toolpath units. + * + * @param[in] pToolpathLayerData - ToolpathLayerData instance. + * @param[in] nProfileID - The toolpath profile to use + * @param[in] nPartID - The toolpath part to use + * @param[in] bWriteCustomLineAttributes - If true, custom line attributes are written. The cardinality of each custom attribute MUST be equal to the number of points in the pointdata array. In any case, stored custom attributes will be cleared after the call. + * @param[in] nPointDataCount - Number of elements in buffer + * @param[in] pPointDataBuffer - DiscretePosition2D buffer of The point data in toolpath units. Array MUST NOT be empty. + * @return error code or 0 (success) + *) + TLib3MFToolpathLayerData_WriteLoopDiscreteFunc = function(pToolpathLayerData: TLib3MFHandle; const nProfileID: Cardinal; const nPartID: Cardinal; const bWriteCustomLineAttributes: Byte; const nPointDataCount: QWord; const pPointDataBuffer: PLib3MFDiscretePosition2D): TLib3MFResult; cdecl; + + (** + * writes polyline data to the layer. * * @param[in] pToolpathLayerData - ToolpathLayerData instance. * @param[in] nProfileID - The toolpath profile to use * @param[in] nPartID - The toolpath part to use + * @param[in] bWriteCustomLineAttributes - If true, custom line attributes are written. The cardinality of each custom attribute MUST be equal to the number of points in the pointdata array. In any case, stored custom attributes will be cleared after the call. * @param[in] nPointDataCount - Number of elements in buffer - * @param[in] pPointDataBuffer - Position2D buffer of The point data + * @param[in] pPointDataBuffer - Position2D buffer of The point data in model units. Array MUST NOT be empty. * @return error code or 0 (success) *) - TLib3MFToolpathLayerData_WriteLoopFunc = function(pToolpathLayerData: TLib3MFHandle; const nProfileID: Cardinal; const nPartID: Cardinal; const nPointDataCount: QWord; const pPointDataBuffer: PLib3MFPosition2D): TLib3MFResult; cdecl; + TLib3MFToolpathLayerData_WritePolylineInModelUnitsFunc = function(pToolpathLayerData: TLib3MFHandle; const nProfileID: Cardinal; const nPartID: Cardinal; const bWriteCustomLineAttributes: Byte; const nPointDataCount: QWord; const pPointDataBuffer: PLib3MFPosition2D): TLib3MFResult; cdecl; (** * writes polyline data to the layer. @@ -4017,11 +4113,12 @@ TLib3MFModel = class; * @param[in] pToolpathLayerData - ToolpathLayerData instance. * @param[in] nProfileID - The toolpath profile to use * @param[in] nPartID - The toolpath part to use + * @param[in] bWriteCustomLineAttributes - If true, custom line attributes are written. The cardinality of each custom attribute MUST be equal to the number of points in the pointdata array. In any case, stored custom attributes will be cleared after the call. * @param[in] nPointDataCount - Number of elements in buffer - * @param[in] pPointDataBuffer - Position2D buffer of The point data + * @param[in] pPointDataBuffer - DiscretePosition2D buffer of The point data in toolpath units. Array MUST NOT be empty. * @return error code or 0 (success) *) - TLib3MFToolpathLayerData_WritePolylineFunc = function(pToolpathLayerData: TLib3MFHandle; const nProfileID: Cardinal; const nPartID: Cardinal; const nPointDataCount: QWord; const pPointDataBuffer: PLib3MFPosition2D): TLib3MFResult; cdecl; + TLib3MFToolpathLayerData_WritePolylineDiscreteFunc = function(pToolpathLayerData: TLib3MFHandle; const nProfileID: Cardinal; const nPartID: Cardinal; const bWriteCustomLineAttributes: Byte; const nPointDataCount: QWord; const pPointDataBuffer: PLib3MFDiscretePosition2D): TLib3MFResult; cdecl; (** * Adds a custom data DOM tree to the layer. Layer MUST not be finished when changing the DOM tree. @@ -4048,7 +4145,29 @@ TLib3MFModel = class; **************************************************************************************************************************) (** - * Retrieves the unit factor + * Retrieves the UUID of the toolpath + * + * @param[in] pToolpath - Toolpath instance. + * @param[in] nUUIDBufferSize - size of the buffer (including trailing 0) + * @param[out] pUUIDNeededChars - will be filled with the count of the written bytes, or needed buffer size. + * @param[out] pUUIDBuffer - buffer of UUID Value., may be NULL + * @return error code or 0 (success) + *) + TLib3MFToolpath_GetUUIDFunc = function(pToolpath: TLib3MFHandle; const nUUIDBufferSize: Cardinal; out pUUIDNeededChars: Cardinal; pUUIDBuffer: PAnsiChar): TLib3MFResult; cdecl; + + (** + * Generates a new unique identifier for this toolpath and sets its value. + * + * @param[in] pToolpath - Toolpath instance. + * @param[in] nNewUUIDBufferSize - size of the buffer (including trailing 0) + * @param[out] pNewUUIDNeededChars - will be filled with the count of the written bytes, or needed buffer size. + * @param[out] pNewUUIDBuffer - buffer of Newly created UUID Value., may be NULL + * @return error code or 0 (success) + *) + TLib3MFToolpath_ResetUUIDFunc = function(pToolpath: TLib3MFHandle; const nNewUUIDBufferSize: Cardinal; out pNewUUIDNeededChars: Cardinal; pNewUUIDBuffer: PAnsiChar): TLib3MFResult; cdecl; + + (** + * Retrieves the unit factor, i.e. how many model units are one toolpath unit. * * @param[in] pToolpath - Toolpath instance. * @param[out] pUnits - Returns the unit factor. @@ -4078,7 +4197,7 @@ TLib3MFModel = class; * Adds a new toolpath layer * * @param[in] pToolpath - Toolpath instance. - * @param[in] nZMax - ZMax value of the layer. MUST be larger than the last layer added, as well as larger as BottomZ. + * @param[in] nZMax - ZMax value of the layer in toolpath units. MUST be larger than the last layer added, as well as larger as BottomZ. * @param[in] pPath - Package Path * @param[in] pModelWriter - The model writer that writes out the 3MF. * @param[out] pLayerData - Returns the layerdata object to write the layer content into. @@ -4090,7 +4209,7 @@ TLib3MFModel = class; * Returns the bottom Z Value of the toolpath. * * @param[in] pToolpath - Toolpath instance. - * @param[out] pBottomZ - BottomZ value + * @param[out] pBottomZ - BottomZ value in Toolpath units * @return error code or 0 (success) *) TLib3MFToolpath_GetBottomZFunc = function(pToolpath: TLib3MFHandle; out pBottomZ: Cardinal): TLib3MFResult; cdecl; @@ -4099,13 +4218,13 @@ TLib3MFModel = class; * Sets the bottom Z Value of the toolpath. Will fail if a layer is already existing. * * @param[in] pToolpath - Toolpath instance. - * @param[in] nBottomZ - BottomZ value + * @param[in] nBottomZ - BottomZ value in Toolpath units * @return error code or 0 (success) *) TLib3MFToolpath_SetBottomZFunc = function(pToolpath: TLib3MFHandle; const nBottomZ: Cardinal): TLib3MFResult; cdecl; (** - * Retrieves the Attachment of a layer + * Retrieves the Attachment that contains the layer data. * * @param[in] pToolpath - Toolpath instance. * @param[in] nIndex - Layer Index @@ -4141,20 +4260,39 @@ TLib3MFModel = class; * * @param[in] pToolpath - Toolpath instance. * @param[in] nIndex - Layer Index - * @param[out] pZMax - ZMax value + * @param[out] pZMax - ZMax value in toolpath units * @return error code or 0 (success) *) TLib3MFToolpath_GetLayerZMaxFunc = function(pToolpath: TLib3MFHandle; const nIndex: Cardinal; out pZMax: Cardinal): TLib3MFResult; cdecl; (** - * Return the z value of a layer in units. + * Retrieves the Minimum Z of a layer * * @param[in] pToolpath - Toolpath instance. - * @param[in] nLayerIndex - Layer Index. - * @param[out] pZValue - Z Value in Units. + * @param[in] nIndex - Layer Index + * @param[out] pZMin - ZMin value in toolpath units + * @return error code or 0 (success) + *) + TLib3MFToolpath_GetLayerZMinFunc = function(pToolpath: TLib3MFHandle; const nIndex: Cardinal; out pZMin: Cardinal): TLib3MFResult; cdecl; + + (** + * Retrieves the Thickness of a layer + * + * @param[in] pToolpath - Toolpath instance. + * @param[in] nIndex - Layer Index + * @param[out] pZThickness - Thickness value in toolpath units * @return error code or 0 (success) *) - TLib3MFToolpath_GetLayerZFunc = function(pToolpath: TLib3MFHandle; const nLayerIndex: Cardinal; out pZValue: Cardinal): TLib3MFResult; cdecl; + TLib3MFToolpath_GetLayerThicknessFunc = function(pToolpath: TLib3MFHandle; const nIndex: Cardinal; out pZThickness: Cardinal): TLib3MFResult; cdecl; + + (** + * Checks if the toolpath has a uniform thickness value, i.e. each layer has the same thickness. + * + * @param[in] pToolpath - Toolpath instance. + * @param[out] pUniformThickness - Returns true if the layer thicknesses are uniform, returns false otherwise. + * @return error code or 0 (success) + *) + TLib3MFToolpath_HasUniformThicknessFunc = function(pToolpath: TLib3MFHandle; out pUniformThickness: Byte): TLib3MFResult; cdecl; (** * Adds a new profile to the toolpath. @@ -4290,7 +4428,7 @@ TLib3MFModel = class; * @param[in] pAttributeName - Attribute name. MUST not be empty. * @return error code or 0 (success) *) - TLib3MFToolpath_RegisterCustomIntegerAttributeFunc = function(pToolpath: TLib3MFHandle; const pNameSpace: PAnsiChar; const pAttributeName: PAnsiChar): TLib3MFResult; cdecl; + TLib3MFToolpath_RegisterCustomIntegerSegmentAttributeFunc = function(pToolpath: TLib3MFHandle; const pNameSpace: PAnsiChar; const pAttributeName: PAnsiChar): TLib3MFResult; cdecl; (** * Registers a Double Attribute that each segment holds. Registering only applies to reader or writer objects created after the call. @@ -4300,7 +4438,7 @@ TLib3MFModel = class; * @param[in] pAttributeName - Attribute name. MUST not be empty. * @return error code or 0 (success) *) - TLib3MFToolpath_RegisterCustomDoubleAttributeFunc = function(pToolpath: TLib3MFHandle; const pNameSpace: PAnsiChar; const pAttributeName: PAnsiChar): TLib3MFResult; cdecl; + TLib3MFToolpath_RegisterCustomDoubleSegmentAttributeFunc = function(pToolpath: TLib3MFHandle; const pNameSpace: PAnsiChar; const pAttributeName: PAnsiChar): TLib3MFResult; cdecl; (************************************************************************************************************************* @@ -6488,7 +6626,8 @@ TLib3MFToolpathLayerReader = class(TLib3MFBase) function GetSegmentPartUUID(const AIndex: Cardinal): String; function GetSegmentLocalPartID(const AIndex: Cardinal): Cardinal; function GetPartUUIDByLocalPartID(const ALocalPartID: Cardinal): String; - procedure GetSegmentPointData(const AIndex: Cardinal; out APointData: ArrayOfLib3MFPosition2D); + procedure GetSegmentPointDataInModelUnits(const AIndex: Cardinal; out APointData: ArrayOfLib3MFPosition2D); + procedure GetSegmentPointDataDiscrete(const AIndex: Cardinal; out APointData: ArrayOfLib3MFDiscretePosition2D); procedure FindAttributeInfoByName(const ANameSpace: String; const AAttributeName: String; out AID: Cardinal; out AAttributeType: TLib3MFToolpathAttributeType); function FindAttributeIDByName(const ANameSpace: String; const AAttributeName: String): Cardinal; function FindAttributeValueByName(const ANameSpace: String; const AAttributeName: String): TLib3MFToolpathAttributeType; @@ -6515,9 +6654,14 @@ TLib3MFToolpathLayerData = class(TLib3MFBase) function RegisterBuildItem(const ABuildItem: TLib3MFBuildItem): Cardinal; procedure SetSegmentAttribute(const ANameSpace: String; const AAttributeName: String; const AValue: String); procedure ClearSegmentAttributes(); - procedure WriteHatchData(const AProfileID: Cardinal; const APartID: Cardinal; const APointData: ArrayOfLib3MFPosition2D); - procedure WriteLoop(const AProfileID: Cardinal; const APartID: Cardinal; const APointData: ArrayOfLib3MFPosition2D); - procedure WritePolyline(const AProfileID: Cardinal; const APartID: Cardinal; const APointData: ArrayOfLib3MFPosition2D); + procedure AddCustomLineAttributes(const ANameSpace: String; const AAttributeName: String; const AValues: TIntegerDynArray); + procedure ClearCustomLineAttributes(); + procedure WriteHatchDataInModelUnits(const AProfileID: Cardinal; const APartID: Cardinal; const AWriteCustomLineAttributes: Boolean; const AHatchData: ArrayOfLib3MFHatch2D); + procedure WriteHatchDataDiscrete(const AProfileID: Cardinal; const APartID: Cardinal; const AWriteCustomLineAttributes: Boolean; const AHatchData: ArrayOfLib3MFDiscreteHatch2D); + procedure WriteLoopInModelUnits(const AProfileID: Cardinal; const APartID: Cardinal; const AWriteCustomLineAttributes: Boolean; const APointData: ArrayOfLib3MFPosition2D); + procedure WriteLoopDiscrete(const AProfileID: Cardinal; const APartID: Cardinal; const AWriteCustomLineAttributes: Boolean; const APointData: ArrayOfLib3MFDiscretePosition2D); + procedure WritePolylineInModelUnits(const AProfileID: Cardinal; const APartID: Cardinal; const AWriteCustomLineAttributes: Boolean; const APointData: ArrayOfLib3MFPosition2D); + procedure WritePolylineDiscrete(const AProfileID: Cardinal; const APartID: Cardinal; const AWriteCustomLineAttributes: Boolean; const APointData: ArrayOfLib3MFDiscretePosition2D); function AddCustomData(const ANameSpace: String; const ADataName: String): TLib3MFCustomDOMTree; procedure Finish(); end; @@ -6531,6 +6675,8 @@ TLib3MFToolpath = class(TLib3MFResource) public constructor Create(AWrapper: TLib3MFWrapper; AHandle: TLib3MFHandle); destructor Destroy; override; + function GetUUID(): String; + function ResetUUID(): String; function GetUnits(): Double; function GetLayerCount(): Cardinal; function GetProfileCount(): Cardinal; @@ -6541,7 +6687,9 @@ TLib3MFToolpath = class(TLib3MFResource) function ReadLayerData(const AIndex: Cardinal): TLib3MFToolpathLayerReader; function GetLayerPath(const AIndex: Cardinal): String; function GetLayerZMax(const AIndex: Cardinal): Cardinal; - function GetLayerZ(const ALayerIndex: Cardinal): Cardinal; + function GetLayerZMin(const AIndex: Cardinal): Cardinal; + function GetLayerThickness(const AIndex: Cardinal): Cardinal; + function HasUniformThickness(): Boolean; function AddProfile(const AName: String): TLib3MFToolpathProfile; function GetProfile(const AProfileIndex: Cardinal): TLib3MFToolpathProfile; function GetProfileUUID(const AProfileUUID: String): TLib3MFToolpathProfile; @@ -6554,8 +6702,8 @@ TLib3MFToolpath = class(TLib3MFResource) function AddCustomData(const ANameSpace: String; const ADataName: String): TLib3MFCustomDOMTree; function ClearCustomData(): Cardinal; function DeleteCustomData(const AData: TLib3MFCustomDOMTree): Boolean; - procedure RegisterCustomIntegerAttribute(const ANameSpace: String; const AAttributeName: String); - procedure RegisterCustomDoubleAttribute(const ANameSpace: String; const AAttributeName: String); + procedure RegisterCustomIntegerSegmentAttribute(const ANameSpace: String; const AAttributeName: String); + procedure RegisterCustomDoubleSegmentAttribute(const ANameSpace: String; const AAttributeName: String); end; @@ -7098,7 +7246,8 @@ TLib3MFWrapper = class(TObject) FLib3MFToolpathLayerReader_GetSegmentPartUUIDFunc: TLib3MFToolpathLayerReader_GetSegmentPartUUIDFunc; FLib3MFToolpathLayerReader_GetSegmentLocalPartIDFunc: TLib3MFToolpathLayerReader_GetSegmentLocalPartIDFunc; FLib3MFToolpathLayerReader_GetPartUUIDByLocalPartIDFunc: TLib3MFToolpathLayerReader_GetPartUUIDByLocalPartIDFunc; - FLib3MFToolpathLayerReader_GetSegmentPointDataFunc: TLib3MFToolpathLayerReader_GetSegmentPointDataFunc; + FLib3MFToolpathLayerReader_GetSegmentPointDataInModelUnitsFunc: TLib3MFToolpathLayerReader_GetSegmentPointDataInModelUnitsFunc; + FLib3MFToolpathLayerReader_GetSegmentPointDataDiscreteFunc: TLib3MFToolpathLayerReader_GetSegmentPointDataDiscreteFunc; FLib3MFToolpathLayerReader_FindAttributeInfoByNameFunc: TLib3MFToolpathLayerReader_FindAttributeInfoByNameFunc; FLib3MFToolpathLayerReader_FindAttributeIDByNameFunc: TLib3MFToolpathLayerReader_FindAttributeIDByNameFunc; FLib3MFToolpathLayerReader_FindAttributeValueByNameFunc: TLib3MFToolpathLayerReader_FindAttributeValueByNameFunc; @@ -7114,11 +7263,18 @@ TLib3MFWrapper = class(TObject) FLib3MFToolpathLayerData_RegisterBuildItemFunc: TLib3MFToolpathLayerData_RegisterBuildItemFunc; FLib3MFToolpathLayerData_SetSegmentAttributeFunc: TLib3MFToolpathLayerData_SetSegmentAttributeFunc; FLib3MFToolpathLayerData_ClearSegmentAttributesFunc: TLib3MFToolpathLayerData_ClearSegmentAttributesFunc; - FLib3MFToolpathLayerData_WriteHatchDataFunc: TLib3MFToolpathLayerData_WriteHatchDataFunc; - FLib3MFToolpathLayerData_WriteLoopFunc: TLib3MFToolpathLayerData_WriteLoopFunc; - FLib3MFToolpathLayerData_WritePolylineFunc: TLib3MFToolpathLayerData_WritePolylineFunc; + FLib3MFToolpathLayerData_AddCustomLineAttributesFunc: TLib3MFToolpathLayerData_AddCustomLineAttributesFunc; + FLib3MFToolpathLayerData_ClearCustomLineAttributesFunc: TLib3MFToolpathLayerData_ClearCustomLineAttributesFunc; + FLib3MFToolpathLayerData_WriteHatchDataInModelUnitsFunc: TLib3MFToolpathLayerData_WriteHatchDataInModelUnitsFunc; + FLib3MFToolpathLayerData_WriteHatchDataDiscreteFunc: TLib3MFToolpathLayerData_WriteHatchDataDiscreteFunc; + FLib3MFToolpathLayerData_WriteLoopInModelUnitsFunc: TLib3MFToolpathLayerData_WriteLoopInModelUnitsFunc; + FLib3MFToolpathLayerData_WriteLoopDiscreteFunc: TLib3MFToolpathLayerData_WriteLoopDiscreteFunc; + FLib3MFToolpathLayerData_WritePolylineInModelUnitsFunc: TLib3MFToolpathLayerData_WritePolylineInModelUnitsFunc; + FLib3MFToolpathLayerData_WritePolylineDiscreteFunc: TLib3MFToolpathLayerData_WritePolylineDiscreteFunc; FLib3MFToolpathLayerData_AddCustomDataFunc: TLib3MFToolpathLayerData_AddCustomDataFunc; FLib3MFToolpathLayerData_FinishFunc: TLib3MFToolpathLayerData_FinishFunc; + FLib3MFToolpath_GetUUIDFunc: TLib3MFToolpath_GetUUIDFunc; + FLib3MFToolpath_ResetUUIDFunc: TLib3MFToolpath_ResetUUIDFunc; FLib3MFToolpath_GetUnitsFunc: TLib3MFToolpath_GetUnitsFunc; FLib3MFToolpath_GetLayerCountFunc: TLib3MFToolpath_GetLayerCountFunc; FLib3MFToolpath_GetProfileCountFunc: TLib3MFToolpath_GetProfileCountFunc; @@ -7129,7 +7285,9 @@ TLib3MFWrapper = class(TObject) FLib3MFToolpath_ReadLayerDataFunc: TLib3MFToolpath_ReadLayerDataFunc; FLib3MFToolpath_GetLayerPathFunc: TLib3MFToolpath_GetLayerPathFunc; FLib3MFToolpath_GetLayerZMaxFunc: TLib3MFToolpath_GetLayerZMaxFunc; - FLib3MFToolpath_GetLayerZFunc: TLib3MFToolpath_GetLayerZFunc; + FLib3MFToolpath_GetLayerZMinFunc: TLib3MFToolpath_GetLayerZMinFunc; + FLib3MFToolpath_GetLayerThicknessFunc: TLib3MFToolpath_GetLayerThicknessFunc; + FLib3MFToolpath_HasUniformThicknessFunc: TLib3MFToolpath_HasUniformThicknessFunc; FLib3MFToolpath_AddProfileFunc: TLib3MFToolpath_AddProfileFunc; FLib3MFToolpath_GetProfileFunc: TLib3MFToolpath_GetProfileFunc; FLib3MFToolpath_GetProfileUUIDFunc: TLib3MFToolpath_GetProfileUUIDFunc; @@ -7142,8 +7300,8 @@ TLib3MFWrapper = class(TObject) FLib3MFToolpath_AddCustomDataFunc: TLib3MFToolpath_AddCustomDataFunc; FLib3MFToolpath_ClearCustomDataFunc: TLib3MFToolpath_ClearCustomDataFunc; FLib3MFToolpath_DeleteCustomDataFunc: TLib3MFToolpath_DeleteCustomDataFunc; - FLib3MFToolpath_RegisterCustomIntegerAttributeFunc: TLib3MFToolpath_RegisterCustomIntegerAttributeFunc; - FLib3MFToolpath_RegisterCustomDoubleAttributeFunc: TLib3MFToolpath_RegisterCustomDoubleAttributeFunc; + FLib3MFToolpath_RegisterCustomIntegerSegmentAttributeFunc: TLib3MFToolpath_RegisterCustomIntegerSegmentAttributeFunc; + FLib3MFToolpath_RegisterCustomDoubleSegmentAttributeFunc: TLib3MFToolpath_RegisterCustomDoubleSegmentAttributeFunc; FLib3MFToolpathIterator_GetCurrentToolpathFunc: TLib3MFToolpathIterator_GetCurrentToolpathFunc; FLib3MFSliceStack_GetBottomZFunc: TLib3MFSliceStack_GetBottomZFunc; FLib3MFSliceStack_GetSliceCountFunc: TLib3MFSliceStack_GetSliceCountFunc; @@ -7607,7 +7765,8 @@ TLib3MFWrapper = class(TObject) property Lib3MFToolpathLayerReader_GetSegmentPartUUIDFunc: TLib3MFToolpathLayerReader_GetSegmentPartUUIDFunc read FLib3MFToolpathLayerReader_GetSegmentPartUUIDFunc; property Lib3MFToolpathLayerReader_GetSegmentLocalPartIDFunc: TLib3MFToolpathLayerReader_GetSegmentLocalPartIDFunc read FLib3MFToolpathLayerReader_GetSegmentLocalPartIDFunc; property Lib3MFToolpathLayerReader_GetPartUUIDByLocalPartIDFunc: TLib3MFToolpathLayerReader_GetPartUUIDByLocalPartIDFunc read FLib3MFToolpathLayerReader_GetPartUUIDByLocalPartIDFunc; - property Lib3MFToolpathLayerReader_GetSegmentPointDataFunc: TLib3MFToolpathLayerReader_GetSegmentPointDataFunc read FLib3MFToolpathLayerReader_GetSegmentPointDataFunc; + property Lib3MFToolpathLayerReader_GetSegmentPointDataInModelUnitsFunc: TLib3MFToolpathLayerReader_GetSegmentPointDataInModelUnitsFunc read FLib3MFToolpathLayerReader_GetSegmentPointDataInModelUnitsFunc; + property Lib3MFToolpathLayerReader_GetSegmentPointDataDiscreteFunc: TLib3MFToolpathLayerReader_GetSegmentPointDataDiscreteFunc read FLib3MFToolpathLayerReader_GetSegmentPointDataDiscreteFunc; property Lib3MFToolpathLayerReader_FindAttributeInfoByNameFunc: TLib3MFToolpathLayerReader_FindAttributeInfoByNameFunc read FLib3MFToolpathLayerReader_FindAttributeInfoByNameFunc; property Lib3MFToolpathLayerReader_FindAttributeIDByNameFunc: TLib3MFToolpathLayerReader_FindAttributeIDByNameFunc read FLib3MFToolpathLayerReader_FindAttributeIDByNameFunc; property Lib3MFToolpathLayerReader_FindAttributeValueByNameFunc: TLib3MFToolpathLayerReader_FindAttributeValueByNameFunc read FLib3MFToolpathLayerReader_FindAttributeValueByNameFunc; @@ -7623,11 +7782,18 @@ TLib3MFWrapper = class(TObject) property Lib3MFToolpathLayerData_RegisterBuildItemFunc: TLib3MFToolpathLayerData_RegisterBuildItemFunc read FLib3MFToolpathLayerData_RegisterBuildItemFunc; property Lib3MFToolpathLayerData_SetSegmentAttributeFunc: TLib3MFToolpathLayerData_SetSegmentAttributeFunc read FLib3MFToolpathLayerData_SetSegmentAttributeFunc; property Lib3MFToolpathLayerData_ClearSegmentAttributesFunc: TLib3MFToolpathLayerData_ClearSegmentAttributesFunc read FLib3MFToolpathLayerData_ClearSegmentAttributesFunc; - property Lib3MFToolpathLayerData_WriteHatchDataFunc: TLib3MFToolpathLayerData_WriteHatchDataFunc read FLib3MFToolpathLayerData_WriteHatchDataFunc; - property Lib3MFToolpathLayerData_WriteLoopFunc: TLib3MFToolpathLayerData_WriteLoopFunc read FLib3MFToolpathLayerData_WriteLoopFunc; - property Lib3MFToolpathLayerData_WritePolylineFunc: TLib3MFToolpathLayerData_WritePolylineFunc read FLib3MFToolpathLayerData_WritePolylineFunc; + property Lib3MFToolpathLayerData_AddCustomLineAttributesFunc: TLib3MFToolpathLayerData_AddCustomLineAttributesFunc read FLib3MFToolpathLayerData_AddCustomLineAttributesFunc; + property Lib3MFToolpathLayerData_ClearCustomLineAttributesFunc: TLib3MFToolpathLayerData_ClearCustomLineAttributesFunc read FLib3MFToolpathLayerData_ClearCustomLineAttributesFunc; + property Lib3MFToolpathLayerData_WriteHatchDataInModelUnitsFunc: TLib3MFToolpathLayerData_WriteHatchDataInModelUnitsFunc read FLib3MFToolpathLayerData_WriteHatchDataInModelUnitsFunc; + property Lib3MFToolpathLayerData_WriteHatchDataDiscreteFunc: TLib3MFToolpathLayerData_WriteHatchDataDiscreteFunc read FLib3MFToolpathLayerData_WriteHatchDataDiscreteFunc; + property Lib3MFToolpathLayerData_WriteLoopInModelUnitsFunc: TLib3MFToolpathLayerData_WriteLoopInModelUnitsFunc read FLib3MFToolpathLayerData_WriteLoopInModelUnitsFunc; + property Lib3MFToolpathLayerData_WriteLoopDiscreteFunc: TLib3MFToolpathLayerData_WriteLoopDiscreteFunc read FLib3MFToolpathLayerData_WriteLoopDiscreteFunc; + property Lib3MFToolpathLayerData_WritePolylineInModelUnitsFunc: TLib3MFToolpathLayerData_WritePolylineInModelUnitsFunc read FLib3MFToolpathLayerData_WritePolylineInModelUnitsFunc; + property Lib3MFToolpathLayerData_WritePolylineDiscreteFunc: TLib3MFToolpathLayerData_WritePolylineDiscreteFunc read FLib3MFToolpathLayerData_WritePolylineDiscreteFunc; property Lib3MFToolpathLayerData_AddCustomDataFunc: TLib3MFToolpathLayerData_AddCustomDataFunc read FLib3MFToolpathLayerData_AddCustomDataFunc; property Lib3MFToolpathLayerData_FinishFunc: TLib3MFToolpathLayerData_FinishFunc read FLib3MFToolpathLayerData_FinishFunc; + property Lib3MFToolpath_GetUUIDFunc: TLib3MFToolpath_GetUUIDFunc read FLib3MFToolpath_GetUUIDFunc; + property Lib3MFToolpath_ResetUUIDFunc: TLib3MFToolpath_ResetUUIDFunc read FLib3MFToolpath_ResetUUIDFunc; property Lib3MFToolpath_GetUnitsFunc: TLib3MFToolpath_GetUnitsFunc read FLib3MFToolpath_GetUnitsFunc; property Lib3MFToolpath_GetLayerCountFunc: TLib3MFToolpath_GetLayerCountFunc read FLib3MFToolpath_GetLayerCountFunc; property Lib3MFToolpath_GetProfileCountFunc: TLib3MFToolpath_GetProfileCountFunc read FLib3MFToolpath_GetProfileCountFunc; @@ -7638,7 +7804,9 @@ TLib3MFWrapper = class(TObject) property Lib3MFToolpath_ReadLayerDataFunc: TLib3MFToolpath_ReadLayerDataFunc read FLib3MFToolpath_ReadLayerDataFunc; property Lib3MFToolpath_GetLayerPathFunc: TLib3MFToolpath_GetLayerPathFunc read FLib3MFToolpath_GetLayerPathFunc; property Lib3MFToolpath_GetLayerZMaxFunc: TLib3MFToolpath_GetLayerZMaxFunc read FLib3MFToolpath_GetLayerZMaxFunc; - property Lib3MFToolpath_GetLayerZFunc: TLib3MFToolpath_GetLayerZFunc read FLib3MFToolpath_GetLayerZFunc; + property Lib3MFToolpath_GetLayerZMinFunc: TLib3MFToolpath_GetLayerZMinFunc read FLib3MFToolpath_GetLayerZMinFunc; + property Lib3MFToolpath_GetLayerThicknessFunc: TLib3MFToolpath_GetLayerThicknessFunc read FLib3MFToolpath_GetLayerThicknessFunc; + property Lib3MFToolpath_HasUniformThicknessFunc: TLib3MFToolpath_HasUniformThicknessFunc read FLib3MFToolpath_HasUniformThicknessFunc; property Lib3MFToolpath_AddProfileFunc: TLib3MFToolpath_AddProfileFunc read FLib3MFToolpath_AddProfileFunc; property Lib3MFToolpath_GetProfileFunc: TLib3MFToolpath_GetProfileFunc read FLib3MFToolpath_GetProfileFunc; property Lib3MFToolpath_GetProfileUUIDFunc: TLib3MFToolpath_GetProfileUUIDFunc read FLib3MFToolpath_GetProfileUUIDFunc; @@ -7651,8 +7819,8 @@ TLib3MFWrapper = class(TObject) property Lib3MFToolpath_AddCustomDataFunc: TLib3MFToolpath_AddCustomDataFunc read FLib3MFToolpath_AddCustomDataFunc; property Lib3MFToolpath_ClearCustomDataFunc: TLib3MFToolpath_ClearCustomDataFunc read FLib3MFToolpath_ClearCustomDataFunc; property Lib3MFToolpath_DeleteCustomDataFunc: TLib3MFToolpath_DeleteCustomDataFunc read FLib3MFToolpath_DeleteCustomDataFunc; - property Lib3MFToolpath_RegisterCustomIntegerAttributeFunc: TLib3MFToolpath_RegisterCustomIntegerAttributeFunc read FLib3MFToolpath_RegisterCustomIntegerAttributeFunc; - property Lib3MFToolpath_RegisterCustomDoubleAttributeFunc: TLib3MFToolpath_RegisterCustomDoubleAttributeFunc read FLib3MFToolpath_RegisterCustomDoubleAttributeFunc; + property Lib3MFToolpath_RegisterCustomIntegerSegmentAttributeFunc: TLib3MFToolpath_RegisterCustomIntegerSegmentAttributeFunc read FLib3MFToolpath_RegisterCustomIntegerSegmentAttributeFunc; + property Lib3MFToolpath_RegisterCustomDoubleSegmentAttributeFunc: TLib3MFToolpath_RegisterCustomDoubleSegmentAttributeFunc read FLib3MFToolpath_RegisterCustomDoubleSegmentAttributeFunc; property Lib3MFToolpathIterator_GetCurrentToolpathFunc: TLib3MFToolpathIterator_GetCurrentToolpathFunc read FLib3MFToolpathIterator_GetCurrentToolpathFunc; property Lib3MFSliceStack_GetBottomZFunc: TLib3MFSliceStack_GetBottomZFunc read FLib3MFSliceStack_GetBottomZFunc; property Lib3MFSliceStack_GetSliceCountFunc: TLib3MFSliceStack_GetSliceCountFunc read FLib3MFSliceStack_GetSliceCountFunc; @@ -8815,6 +8983,9 @@ implementation LIB3MF_ERROR_EMPTYNAMESPACE: ADescription := 'Empty namespace.'; LIB3MF_ERROR_INVALIDNAMESPACEPREFIX: ADescription := 'Invalid namespace prefix.'; LIB3MF_ERROR_WRITERDOESNOTSUPPORTNAMESPACES: ADescription := 'Writer does not support namespaces.'; + LIB3MF_ERROR_TOOLPATH_INVALIDHATCHCOORDINATE: ADescription := 'Invalid hatch coordinate.'; + LIB3MF_ERROR_TOOLPATH_INVALIDPOINTCOORDINATE: ADescription := 'Invalid point coordinate.'; + LIB3MF_ERROR_TOOLPATH_INVALIDHATCHCOUNT: ADescription := 'Invalid hatch count'; else ADescription := 'unknown'; end; @@ -12172,16 +12343,28 @@ implementation Result := StrPas(@bufferPartUUID[0]); end; - procedure TLib3MFToolpathLayerReader.GetSegmentPointData(const AIndex: Cardinal; out APointData: ArrayOfLib3MFPosition2D); + procedure TLib3MFToolpathLayerReader.GetSegmentPointDataInModelUnits(const AIndex: Cardinal; out APointData: ArrayOfLib3MFPosition2D); var countNeededPointData: QWord; countWrittenPointData: QWord; begin countNeededPointData:= 0; countWrittenPointData:= 0; - FWrapper.CheckError(Self, FWrapper.Lib3MFToolpathLayerReader_GetSegmentPointDataFunc(FHandle, AIndex, 0, countNeededPointData, nil)); + FWrapper.CheckError(Self, FWrapper.Lib3MFToolpathLayerReader_GetSegmentPointDataInModelUnitsFunc(FHandle, AIndex, 0, countNeededPointData, nil)); SetLength(APointData, countNeededPointData); - FWrapper.CheckError(Self, FWrapper.Lib3MFToolpathLayerReader_GetSegmentPointDataFunc(FHandle, AIndex, countNeededPointData, countWrittenPointData, @APointData[0])); + FWrapper.CheckError(Self, FWrapper.Lib3MFToolpathLayerReader_GetSegmentPointDataInModelUnitsFunc(FHandle, AIndex, countNeededPointData, countWrittenPointData, @APointData[0])); + end; + + procedure TLib3MFToolpathLayerReader.GetSegmentPointDataDiscrete(const AIndex: Cardinal; out APointData: ArrayOfLib3MFDiscretePosition2D); + var + countNeededPointData: QWord; + countWrittenPointData: QWord; + begin + countNeededPointData:= 0; + countWrittenPointData:= 0; + FWrapper.CheckError(Self, FWrapper.Lib3MFToolpathLayerReader_GetSegmentPointDataDiscreteFunc(FHandle, AIndex, 0, countNeededPointData, nil)); + SetLength(APointData, countNeededPointData); + FWrapper.CheckError(Self, FWrapper.Lib3MFToolpathLayerReader_GetSegmentPointDataDiscreteFunc(FHandle, AIndex, countNeededPointData, countWrittenPointData, @APointData[0])); end; procedure TLib3MFToolpathLayerReader.FindAttributeInfoByName(const ANameSpace: String; const AAttributeName: String; out AID: Cardinal; out AAttributeType: TLib3MFToolpathAttributeType); @@ -12324,7 +12507,60 @@ implementation FWrapper.CheckError(Self, FWrapper.Lib3MFToolpathLayerData_ClearSegmentAttributesFunc(FHandle)); end; - procedure TLib3MFToolpathLayerData.WriteHatchData(const AProfileID: Cardinal; const APartID: Cardinal; const APointData: ArrayOfLib3MFPosition2D); + procedure TLib3MFToolpathLayerData.AddCustomLineAttributes(const ANameSpace: String; const AAttributeName: String; const AValues: TIntegerDynArray); + var + PtrValues: PInteger; + LenValues: QWord; + begin + LenValues := Length(AValues); + if LenValues > $FFFFFFFF then + raise ELib3MFException.CreateCustomMessage(LIB3MF_ERROR_INVALIDPARAM, 'array has too many entries.'); + if LenValues > 0 then + PtrValues := @AValues[0] + else + PtrValues := nil; + + FWrapper.CheckError(Self, FWrapper.Lib3MFToolpathLayerData_AddCustomLineAttributesFunc(FHandle, PAnsiChar(ANameSpace), PAnsiChar(AAttributeName), QWord(LenValues), PtrValues)); + end; + + procedure TLib3MFToolpathLayerData.ClearCustomLineAttributes(); + begin + FWrapper.CheckError(Self, FWrapper.Lib3MFToolpathLayerData_ClearCustomLineAttributesFunc(FHandle)); + end; + + procedure TLib3MFToolpathLayerData.WriteHatchDataInModelUnits(const AProfileID: Cardinal; const APartID: Cardinal; const AWriteCustomLineAttributes: Boolean; const AHatchData: ArrayOfLib3MFHatch2D); + var + PtrHatchData: PLib3MFHatch2D; + LenHatchData: QWord; + begin + LenHatchData := Length(AHatchData); + if LenHatchData > $FFFFFFFF then + raise ELib3MFException.CreateCustomMessage(LIB3MF_ERROR_INVALIDPARAM, 'array has too many entries.'); + if LenHatchData > 0 then + PtrHatchData := @AHatchData[0] + else + PtrHatchData := nil; + + FWrapper.CheckError(Self, FWrapper.Lib3MFToolpathLayerData_WriteHatchDataInModelUnitsFunc(FHandle, AProfileID, APartID, Ord(AWriteCustomLineAttributes), QWord(LenHatchData), PtrHatchData)); + end; + + procedure TLib3MFToolpathLayerData.WriteHatchDataDiscrete(const AProfileID: Cardinal; const APartID: Cardinal; const AWriteCustomLineAttributes: Boolean; const AHatchData: ArrayOfLib3MFDiscreteHatch2D); + var + PtrHatchData: PLib3MFDiscreteHatch2D; + LenHatchData: QWord; + begin + LenHatchData := Length(AHatchData); + if LenHatchData > $FFFFFFFF then + raise ELib3MFException.CreateCustomMessage(LIB3MF_ERROR_INVALIDPARAM, 'array has too many entries.'); + if LenHatchData > 0 then + PtrHatchData := @AHatchData[0] + else + PtrHatchData := nil; + + FWrapper.CheckError(Self, FWrapper.Lib3MFToolpathLayerData_WriteHatchDataDiscreteFunc(FHandle, AProfileID, APartID, Ord(AWriteCustomLineAttributes), QWord(LenHatchData), PtrHatchData)); + end; + + procedure TLib3MFToolpathLayerData.WriteLoopInModelUnits(const AProfileID: Cardinal; const APartID: Cardinal; const AWriteCustomLineAttributes: Boolean; const APointData: ArrayOfLib3MFPosition2D); var PtrPointData: PLib3MFPosition2D; LenPointData: QWord; @@ -12337,12 +12573,12 @@ implementation else PtrPointData := nil; - FWrapper.CheckError(Self, FWrapper.Lib3MFToolpathLayerData_WriteHatchDataFunc(FHandle, AProfileID, APartID, QWord(LenPointData), PtrPointData)); + FWrapper.CheckError(Self, FWrapper.Lib3MFToolpathLayerData_WriteLoopInModelUnitsFunc(FHandle, AProfileID, APartID, Ord(AWriteCustomLineAttributes), QWord(LenPointData), PtrPointData)); end; - procedure TLib3MFToolpathLayerData.WriteLoop(const AProfileID: Cardinal; const APartID: Cardinal; const APointData: ArrayOfLib3MFPosition2D); + procedure TLib3MFToolpathLayerData.WriteLoopDiscrete(const AProfileID: Cardinal; const APartID: Cardinal; const AWriteCustomLineAttributes: Boolean; const APointData: ArrayOfLib3MFDiscretePosition2D); var - PtrPointData: PLib3MFPosition2D; + PtrPointData: PLib3MFDiscretePosition2D; LenPointData: QWord; begin LenPointData := Length(APointData); @@ -12353,10 +12589,10 @@ implementation else PtrPointData := nil; - FWrapper.CheckError(Self, FWrapper.Lib3MFToolpathLayerData_WriteLoopFunc(FHandle, AProfileID, APartID, QWord(LenPointData), PtrPointData)); + FWrapper.CheckError(Self, FWrapper.Lib3MFToolpathLayerData_WriteLoopDiscreteFunc(FHandle, AProfileID, APartID, Ord(AWriteCustomLineAttributes), QWord(LenPointData), PtrPointData)); end; - procedure TLib3MFToolpathLayerData.WritePolyline(const AProfileID: Cardinal; const APartID: Cardinal; const APointData: ArrayOfLib3MFPosition2D); + procedure TLib3MFToolpathLayerData.WritePolylineInModelUnits(const AProfileID: Cardinal; const APartID: Cardinal; const AWriteCustomLineAttributes: Boolean; const APointData: ArrayOfLib3MFPosition2D); var PtrPointData: PLib3MFPosition2D; LenPointData: QWord; @@ -12369,7 +12605,23 @@ implementation else PtrPointData := nil; - FWrapper.CheckError(Self, FWrapper.Lib3MFToolpathLayerData_WritePolylineFunc(FHandle, AProfileID, APartID, QWord(LenPointData), PtrPointData)); + FWrapper.CheckError(Self, FWrapper.Lib3MFToolpathLayerData_WritePolylineInModelUnitsFunc(FHandle, AProfileID, APartID, Ord(AWriteCustomLineAttributes), QWord(LenPointData), PtrPointData)); + end; + + procedure TLib3MFToolpathLayerData.WritePolylineDiscrete(const AProfileID: Cardinal; const APartID: Cardinal; const AWriteCustomLineAttributes: Boolean; const APointData: ArrayOfLib3MFDiscretePosition2D); + var + PtrPointData: PLib3MFDiscretePosition2D; + LenPointData: QWord; + begin + LenPointData := Length(APointData); + if LenPointData > $FFFFFFFF then + raise ELib3MFException.CreateCustomMessage(LIB3MF_ERROR_INVALIDPARAM, 'array has too many entries.'); + if LenPointData > 0 then + PtrPointData := @APointData[0] + else + PtrPointData := nil; + + FWrapper.CheckError(Self, FWrapper.Lib3MFToolpathLayerData_WritePolylineDiscreteFunc(FHandle, AProfileID, APartID, Ord(AWriteCustomLineAttributes), QWord(LenPointData), PtrPointData)); end; function TLib3MFToolpathLayerData.AddCustomData(const ANameSpace: String; const ADataName: String): TLib3MFCustomDOMTree; @@ -12402,6 +12654,34 @@ implementation inherited; end; + function TLib3MFToolpath.GetUUID(): String; + var + bytesNeededUUID: Cardinal; + bytesWrittenUUID: Cardinal; + bufferUUID: array of Char; + begin + bytesNeededUUID:= 0; + bytesWrittenUUID:= 0; + FWrapper.CheckError(Self, FWrapper.Lib3MFToolpath_GetUUIDFunc(FHandle, 0, bytesNeededUUID, nil)); + SetLength(bufferUUID, bytesNeededUUID); + FWrapper.CheckError(Self, FWrapper.Lib3MFToolpath_GetUUIDFunc(FHandle, bytesNeededUUID, bytesWrittenUUID, @bufferUUID[0])); + Result := StrPas(@bufferUUID[0]); + end; + + function TLib3MFToolpath.ResetUUID(): String; + var + bytesNeededNewUUID: Cardinal; + bytesWrittenNewUUID: Cardinal; + bufferNewUUID: array of Char; + begin + bytesNeededNewUUID:= 0; + bytesWrittenNewUUID:= 0; + FWrapper.CheckError(Self, FWrapper.Lib3MFToolpath_ResetUUIDFunc(FHandle, 0, bytesNeededNewUUID, nil)); + SetLength(bufferNewUUID, bytesNeededNewUUID); + FWrapper.CheckError(Self, FWrapper.Lib3MFToolpath_ResetUUIDFunc(FHandle, bytesNeededNewUUID, bytesWrittenNewUUID, @bufferNewUUID[0])); + Result := StrPas(@bufferNewUUID[0]); + end; + function TLib3MFToolpath.GetUnits(): Double; begin FWrapper.CheckError(Self, FWrapper.Lib3MFToolpath_GetUnitsFunc(FHandle, Result)); @@ -12484,9 +12764,23 @@ implementation FWrapper.CheckError(Self, FWrapper.Lib3MFToolpath_GetLayerZMaxFunc(FHandle, AIndex, Result)); end; - function TLib3MFToolpath.GetLayerZ(const ALayerIndex: Cardinal): Cardinal; + function TLib3MFToolpath.GetLayerZMin(const AIndex: Cardinal): Cardinal; begin - FWrapper.CheckError(Self, FWrapper.Lib3MFToolpath_GetLayerZFunc(FHandle, ALayerIndex, Result)); + FWrapper.CheckError(Self, FWrapper.Lib3MFToolpath_GetLayerZMinFunc(FHandle, AIndex, Result)); + end; + + function TLib3MFToolpath.GetLayerThickness(const AIndex: Cardinal): Cardinal; + begin + FWrapper.CheckError(Self, FWrapper.Lib3MFToolpath_GetLayerThicknessFunc(FHandle, AIndex, Result)); + end; + + function TLib3MFToolpath.HasUniformThickness(): Boolean; + var + ResultUniformThickness: Byte; + begin + ResultUniformThickness := 0; + FWrapper.CheckError(Self, FWrapper.Lib3MFToolpath_HasUniformThicknessFunc(FHandle, ResultUniformThickness)); + Result := (ResultUniformThickness <> 0); end; function TLib3MFToolpath.AddProfile(const AName: String): TLib3MFToolpathProfile; @@ -12620,14 +12914,14 @@ implementation Result := (ResultSuccess <> 0); end; - procedure TLib3MFToolpath.RegisterCustomIntegerAttribute(const ANameSpace: String; const AAttributeName: String); + procedure TLib3MFToolpath.RegisterCustomIntegerSegmentAttribute(const ANameSpace: String; const AAttributeName: String); begin - FWrapper.CheckError(Self, FWrapper.Lib3MFToolpath_RegisterCustomIntegerAttributeFunc(FHandle, PAnsiChar(ANameSpace), PAnsiChar(AAttributeName))); + FWrapper.CheckError(Self, FWrapper.Lib3MFToolpath_RegisterCustomIntegerSegmentAttributeFunc(FHandle, PAnsiChar(ANameSpace), PAnsiChar(AAttributeName))); end; - procedure TLib3MFToolpath.RegisterCustomDoubleAttribute(const ANameSpace: String; const AAttributeName: String); + procedure TLib3MFToolpath.RegisterCustomDoubleSegmentAttribute(const ANameSpace: String; const AAttributeName: String); begin - FWrapper.CheckError(Self, FWrapper.Lib3MFToolpath_RegisterCustomDoubleAttributeFunc(FHandle, PAnsiChar(ANameSpace), PAnsiChar(AAttributeName))); + FWrapper.CheckError(Self, FWrapper.Lib3MFToolpath_RegisterCustomDoubleSegmentAttributeFunc(FHandle, PAnsiChar(ANameSpace), PAnsiChar(AAttributeName))); end; (************************************************************************************************************************* @@ -14369,7 +14663,8 @@ implementation FLib3MFToolpathLayerReader_GetSegmentPartUUIDFunc := LoadFunction('lib3mf_toolpathlayerreader_getsegmentpartuuid'); FLib3MFToolpathLayerReader_GetSegmentLocalPartIDFunc := LoadFunction('lib3mf_toolpathlayerreader_getsegmentlocalpartid'); FLib3MFToolpathLayerReader_GetPartUUIDByLocalPartIDFunc := LoadFunction('lib3mf_toolpathlayerreader_getpartuuidbylocalpartid'); - FLib3MFToolpathLayerReader_GetSegmentPointDataFunc := LoadFunction('lib3mf_toolpathlayerreader_getsegmentpointdata'); + FLib3MFToolpathLayerReader_GetSegmentPointDataInModelUnitsFunc := LoadFunction('lib3mf_toolpathlayerreader_getsegmentpointdatainmodelunits'); + FLib3MFToolpathLayerReader_GetSegmentPointDataDiscreteFunc := LoadFunction('lib3mf_toolpathlayerreader_getsegmentpointdatadiscrete'); FLib3MFToolpathLayerReader_FindAttributeInfoByNameFunc := LoadFunction('lib3mf_toolpathlayerreader_findattributeinfobyname'); FLib3MFToolpathLayerReader_FindAttributeIDByNameFunc := LoadFunction('lib3mf_toolpathlayerreader_findattributeidbyname'); FLib3MFToolpathLayerReader_FindAttributeValueByNameFunc := LoadFunction('lib3mf_toolpathlayerreader_findattributevaluebyname'); @@ -14385,11 +14680,18 @@ implementation FLib3MFToolpathLayerData_RegisterBuildItemFunc := LoadFunction('lib3mf_toolpathlayerdata_registerbuilditem'); FLib3MFToolpathLayerData_SetSegmentAttributeFunc := LoadFunction('lib3mf_toolpathlayerdata_setsegmentattribute'); FLib3MFToolpathLayerData_ClearSegmentAttributesFunc := LoadFunction('lib3mf_toolpathlayerdata_clearsegmentattributes'); - FLib3MFToolpathLayerData_WriteHatchDataFunc := LoadFunction('lib3mf_toolpathlayerdata_writehatchdata'); - FLib3MFToolpathLayerData_WriteLoopFunc := LoadFunction('lib3mf_toolpathlayerdata_writeloop'); - FLib3MFToolpathLayerData_WritePolylineFunc := LoadFunction('lib3mf_toolpathlayerdata_writepolyline'); + FLib3MFToolpathLayerData_AddCustomLineAttributesFunc := LoadFunction('lib3mf_toolpathlayerdata_addcustomlineattributes'); + FLib3MFToolpathLayerData_ClearCustomLineAttributesFunc := LoadFunction('lib3mf_toolpathlayerdata_clearcustomlineattributes'); + FLib3MFToolpathLayerData_WriteHatchDataInModelUnitsFunc := LoadFunction('lib3mf_toolpathlayerdata_writehatchdatainmodelunits'); + FLib3MFToolpathLayerData_WriteHatchDataDiscreteFunc := LoadFunction('lib3mf_toolpathlayerdata_writehatchdatadiscrete'); + FLib3MFToolpathLayerData_WriteLoopInModelUnitsFunc := LoadFunction('lib3mf_toolpathlayerdata_writeloopinmodelunits'); + FLib3MFToolpathLayerData_WriteLoopDiscreteFunc := LoadFunction('lib3mf_toolpathlayerdata_writeloopdiscrete'); + FLib3MFToolpathLayerData_WritePolylineInModelUnitsFunc := LoadFunction('lib3mf_toolpathlayerdata_writepolylineinmodelunits'); + FLib3MFToolpathLayerData_WritePolylineDiscreteFunc := LoadFunction('lib3mf_toolpathlayerdata_writepolylinediscrete'); FLib3MFToolpathLayerData_AddCustomDataFunc := LoadFunction('lib3mf_toolpathlayerdata_addcustomdata'); FLib3MFToolpathLayerData_FinishFunc := LoadFunction('lib3mf_toolpathlayerdata_finish'); + FLib3MFToolpath_GetUUIDFunc := LoadFunction('lib3mf_toolpath_getuuid'); + FLib3MFToolpath_ResetUUIDFunc := LoadFunction('lib3mf_toolpath_resetuuid'); FLib3MFToolpath_GetUnitsFunc := LoadFunction('lib3mf_toolpath_getunits'); FLib3MFToolpath_GetLayerCountFunc := LoadFunction('lib3mf_toolpath_getlayercount'); FLib3MFToolpath_GetProfileCountFunc := LoadFunction('lib3mf_toolpath_getprofilecount'); @@ -14400,7 +14702,9 @@ implementation FLib3MFToolpath_ReadLayerDataFunc := LoadFunction('lib3mf_toolpath_readlayerdata'); FLib3MFToolpath_GetLayerPathFunc := LoadFunction('lib3mf_toolpath_getlayerpath'); FLib3MFToolpath_GetLayerZMaxFunc := LoadFunction('lib3mf_toolpath_getlayerzmax'); - FLib3MFToolpath_GetLayerZFunc := LoadFunction('lib3mf_toolpath_getlayerz'); + FLib3MFToolpath_GetLayerZMinFunc := LoadFunction('lib3mf_toolpath_getlayerzmin'); + FLib3MFToolpath_GetLayerThicknessFunc := LoadFunction('lib3mf_toolpath_getlayerthickness'); + FLib3MFToolpath_HasUniformThicknessFunc := LoadFunction('lib3mf_toolpath_hasuniformthickness'); FLib3MFToolpath_AddProfileFunc := LoadFunction('lib3mf_toolpath_addprofile'); FLib3MFToolpath_GetProfileFunc := LoadFunction('lib3mf_toolpath_getprofile'); FLib3MFToolpath_GetProfileUUIDFunc := LoadFunction('lib3mf_toolpath_getprofileuuid'); @@ -14413,8 +14717,8 @@ implementation FLib3MFToolpath_AddCustomDataFunc := LoadFunction('lib3mf_toolpath_addcustomdata'); FLib3MFToolpath_ClearCustomDataFunc := LoadFunction('lib3mf_toolpath_clearcustomdata'); FLib3MFToolpath_DeleteCustomDataFunc := LoadFunction('lib3mf_toolpath_deletecustomdata'); - FLib3MFToolpath_RegisterCustomIntegerAttributeFunc := LoadFunction('lib3mf_toolpath_registercustomintegerattribute'); - FLib3MFToolpath_RegisterCustomDoubleAttributeFunc := LoadFunction('lib3mf_toolpath_registercustomdoubleattribute'); + FLib3MFToolpath_RegisterCustomIntegerSegmentAttributeFunc := LoadFunction('lib3mf_toolpath_registercustomintegersegmentattribute'); + FLib3MFToolpath_RegisterCustomDoubleSegmentAttributeFunc := LoadFunction('lib3mf_toolpath_registercustomdoublesegmentattribute'); FLib3MFToolpathIterator_GetCurrentToolpathFunc := LoadFunction('lib3mf_toolpathiterator_getcurrenttoolpath'); FLib3MFSliceStack_GetBottomZFunc := LoadFunction('lib3mf_slicestack_getbottomz'); FLib3MFSliceStack_GetSliceCountFunc := LoadFunction('lib3mf_slicestack_getslicecount'); @@ -15513,7 +15817,10 @@ implementation AResult := ALookupMethod(PAnsiChar('lib3mf_toolpathlayerreader_getpartuuidbylocalpartid'), @FLib3MFToolpathLayerReader_GetPartUUIDByLocalPartIDFunc); if AResult <> LIB3MF_SUCCESS then raise ELib3MFException.CreateCustomMessage(LIB3MF_ERROR_COULDNOTLOADLIBRARY, ''); - AResult := ALookupMethod(PAnsiChar('lib3mf_toolpathlayerreader_getsegmentpointdata'), @FLib3MFToolpathLayerReader_GetSegmentPointDataFunc); + AResult := ALookupMethod(PAnsiChar('lib3mf_toolpathlayerreader_getsegmentpointdatainmodelunits'), @FLib3MFToolpathLayerReader_GetSegmentPointDataInModelUnitsFunc); + 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_findattributeinfobyname'), @FLib3MFToolpathLayerReader_FindAttributeInfoByNameFunc); @@ -15561,19 +15868,40 @@ implementation AResult := ALookupMethod(PAnsiChar('lib3mf_toolpathlayerdata_clearsegmentattributes'), @FLib3MFToolpathLayerData_ClearSegmentAttributesFunc); if AResult <> LIB3MF_SUCCESS then raise ELib3MFException.CreateCustomMessage(LIB3MF_ERROR_COULDNOTLOADLIBRARY, ''); - AResult := ALookupMethod(PAnsiChar('lib3mf_toolpathlayerdata_writehatchdata'), @FLib3MFToolpathLayerData_WriteHatchDataFunc); + AResult := ALookupMethod(PAnsiChar('lib3mf_toolpathlayerdata_addcustomlineattributes'), @FLib3MFToolpathLayerData_AddCustomLineAttributesFunc); + if AResult <> LIB3MF_SUCCESS then + raise ELib3MFException.CreateCustomMessage(LIB3MF_ERROR_COULDNOTLOADLIBRARY, ''); + AResult := ALookupMethod(PAnsiChar('lib3mf_toolpathlayerdata_clearcustomlineattributes'), @FLib3MFToolpathLayerData_ClearCustomLineAttributesFunc); + if AResult <> LIB3MF_SUCCESS then + raise ELib3MFException.CreateCustomMessage(LIB3MF_ERROR_COULDNOTLOADLIBRARY, ''); + AResult := ALookupMethod(PAnsiChar('lib3mf_toolpathlayerdata_writehatchdatainmodelunits'), @FLib3MFToolpathLayerData_WriteHatchDataInModelUnitsFunc); + if AResult <> LIB3MF_SUCCESS then + raise ELib3MFException.CreateCustomMessage(LIB3MF_ERROR_COULDNOTLOADLIBRARY, ''); + AResult := ALookupMethod(PAnsiChar('lib3mf_toolpathlayerdata_writehatchdatadiscrete'), @FLib3MFToolpathLayerData_WriteHatchDataDiscreteFunc); + if AResult <> LIB3MF_SUCCESS then + raise ELib3MFException.CreateCustomMessage(LIB3MF_ERROR_COULDNOTLOADLIBRARY, ''); + AResult := ALookupMethod(PAnsiChar('lib3mf_toolpathlayerdata_writeloopinmodelunits'), @FLib3MFToolpathLayerData_WriteLoopInModelUnitsFunc); if AResult <> LIB3MF_SUCCESS then raise ELib3MFException.CreateCustomMessage(LIB3MF_ERROR_COULDNOTLOADLIBRARY, ''); - AResult := ALookupMethod(PAnsiChar('lib3mf_toolpathlayerdata_writeloop'), @FLib3MFToolpathLayerData_WriteLoopFunc); + AResult := ALookupMethod(PAnsiChar('lib3mf_toolpathlayerdata_writeloopdiscrete'), @FLib3MFToolpathLayerData_WriteLoopDiscreteFunc); if AResult <> LIB3MF_SUCCESS then raise ELib3MFException.CreateCustomMessage(LIB3MF_ERROR_COULDNOTLOADLIBRARY, ''); - AResult := ALookupMethod(PAnsiChar('lib3mf_toolpathlayerdata_writepolyline'), @FLib3MFToolpathLayerData_WritePolylineFunc); + AResult := ALookupMethod(PAnsiChar('lib3mf_toolpathlayerdata_writepolylineinmodelunits'), @FLib3MFToolpathLayerData_WritePolylineInModelUnitsFunc); + if AResult <> LIB3MF_SUCCESS then + raise ELib3MFException.CreateCustomMessage(LIB3MF_ERROR_COULDNOTLOADLIBRARY, ''); + AResult := ALookupMethod(PAnsiChar('lib3mf_toolpathlayerdata_writepolylinediscrete'), @FLib3MFToolpathLayerData_WritePolylineDiscreteFunc); if AResult <> LIB3MF_SUCCESS then raise ELib3MFException.CreateCustomMessage(LIB3MF_ERROR_COULDNOTLOADLIBRARY, ''); AResult := ALookupMethod(PAnsiChar('lib3mf_toolpathlayerdata_addcustomdata'), @FLib3MFToolpathLayerData_AddCustomDataFunc); if AResult <> LIB3MF_SUCCESS then raise ELib3MFException.CreateCustomMessage(LIB3MF_ERROR_COULDNOTLOADLIBRARY, ''); AResult := ALookupMethod(PAnsiChar('lib3mf_toolpathlayerdata_finish'), @FLib3MFToolpathLayerData_FinishFunc); + if AResult <> LIB3MF_SUCCESS then + raise ELib3MFException.CreateCustomMessage(LIB3MF_ERROR_COULDNOTLOADLIBRARY, ''); + AResult := ALookupMethod(PAnsiChar('lib3mf_toolpath_getuuid'), @FLib3MFToolpath_GetUUIDFunc); + if AResult <> LIB3MF_SUCCESS then + raise ELib3MFException.CreateCustomMessage(LIB3MF_ERROR_COULDNOTLOADLIBRARY, ''); + AResult := ALookupMethod(PAnsiChar('lib3mf_toolpath_resetuuid'), @FLib3MFToolpath_ResetUUIDFunc); if AResult <> LIB3MF_SUCCESS then raise ELib3MFException.CreateCustomMessage(LIB3MF_ERROR_COULDNOTLOADLIBRARY, ''); AResult := ALookupMethod(PAnsiChar('lib3mf_toolpath_getunits'), @FLib3MFToolpath_GetUnitsFunc); @@ -15606,7 +15934,13 @@ implementation AResult := ALookupMethod(PAnsiChar('lib3mf_toolpath_getlayerzmax'), @FLib3MFToolpath_GetLayerZMaxFunc); if AResult <> LIB3MF_SUCCESS then raise ELib3MFException.CreateCustomMessage(LIB3MF_ERROR_COULDNOTLOADLIBRARY, ''); - AResult := ALookupMethod(PAnsiChar('lib3mf_toolpath_getlayerz'), @FLib3MFToolpath_GetLayerZFunc); + AResult := ALookupMethod(PAnsiChar('lib3mf_toolpath_getlayerzmin'), @FLib3MFToolpath_GetLayerZMinFunc); + if AResult <> LIB3MF_SUCCESS then + raise ELib3MFException.CreateCustomMessage(LIB3MF_ERROR_COULDNOTLOADLIBRARY, ''); + AResult := ALookupMethod(PAnsiChar('lib3mf_toolpath_getlayerthickness'), @FLib3MFToolpath_GetLayerThicknessFunc); + if AResult <> LIB3MF_SUCCESS then + raise ELib3MFException.CreateCustomMessage(LIB3MF_ERROR_COULDNOTLOADLIBRARY, ''); + AResult := ALookupMethod(PAnsiChar('lib3mf_toolpath_hasuniformthickness'), @FLib3MFToolpath_HasUniformThicknessFunc); if AResult <> LIB3MF_SUCCESS then raise ELib3MFException.CreateCustomMessage(LIB3MF_ERROR_COULDNOTLOADLIBRARY, ''); AResult := ALookupMethod(PAnsiChar('lib3mf_toolpath_addprofile'), @FLib3MFToolpath_AddProfileFunc); @@ -15645,10 +15979,10 @@ implementation AResult := ALookupMethod(PAnsiChar('lib3mf_toolpath_deletecustomdata'), @FLib3MFToolpath_DeleteCustomDataFunc); if AResult <> LIB3MF_SUCCESS then raise ELib3MFException.CreateCustomMessage(LIB3MF_ERROR_COULDNOTLOADLIBRARY, ''); - AResult := ALookupMethod(PAnsiChar('lib3mf_toolpath_registercustomintegerattribute'), @FLib3MFToolpath_RegisterCustomIntegerAttributeFunc); + AResult := ALookupMethod(PAnsiChar('lib3mf_toolpath_registercustomintegersegmentattribute'), @FLib3MFToolpath_RegisterCustomIntegerSegmentAttributeFunc); if AResult <> LIB3MF_SUCCESS then raise ELib3MFException.CreateCustomMessage(LIB3MF_ERROR_COULDNOTLOADLIBRARY, ''); - AResult := ALookupMethod(PAnsiChar('lib3mf_toolpath_registercustomdoubleattribute'), @FLib3MFToolpath_RegisterCustomDoubleAttributeFunc); + AResult := ALookupMethod(PAnsiChar('lib3mf_toolpath_registercustomdoublesegmentattribute'), @FLib3MFToolpath_RegisterCustomDoubleSegmentAttributeFunc); if AResult <> LIB3MF_SUCCESS then raise ELib3MFException.CreateCustomMessage(LIB3MF_ERROR_COULDNOTLOADLIBRARY, ''); AResult := ALookupMethod(PAnsiChar('lib3mf_toolpathiterator_getcurrenttoolpath'), @FLib3MFToolpathIterator_GetCurrentToolpathFunc); diff --git a/Autogenerated/Bindings/Python/Lib3MF.py b/Autogenerated/Bindings/Python/Lib3MF.py index 8f12c7f90..5105d89ad 100644 --- a/Autogenerated/Bindings/Python/Lib3MF.py +++ b/Autogenerated/Bindings/Python/Lib3MF.py @@ -121,6 +121,9 @@ class ErrorCodes(enum.IntEnum): EMPTYNAMESPACE = 4007 INVALIDNAMESPACEPREFIX = 4008 WRITERDOESNOTSUPPORTNAMESPACES = 4009 + TOOLPATH_INVALIDHATCHCOORDINATE = 4010 + TOOLPATH_INVALIDPOINTCOORDINATE = 4011 + TOOLPATH_INVALIDHATCHCOUNT = 4012 '''Definition of Function Table ''' @@ -461,7 +464,8 @@ class FunctionTable: lib3mf_toolpathlayerreader_getsegmentpartuuid = None lib3mf_toolpathlayerreader_getsegmentlocalpartid = None lib3mf_toolpathlayerreader_getpartuuidbylocalpartid = None - lib3mf_toolpathlayerreader_getsegmentpointdata = None + lib3mf_toolpathlayerreader_getsegmentpointdatainmodelunits = None + lib3mf_toolpathlayerreader_getsegmentpointdatadiscrete = None lib3mf_toolpathlayerreader_findattributeinfobyname = None lib3mf_toolpathlayerreader_findattributeidbyname = None lib3mf_toolpathlayerreader_findattributevaluebyname = None @@ -477,11 +481,18 @@ class FunctionTable: lib3mf_toolpathlayerdata_registerbuilditem = None lib3mf_toolpathlayerdata_setsegmentattribute = None lib3mf_toolpathlayerdata_clearsegmentattributes = None - lib3mf_toolpathlayerdata_writehatchdata = None - lib3mf_toolpathlayerdata_writeloop = None - lib3mf_toolpathlayerdata_writepolyline = None + lib3mf_toolpathlayerdata_addcustomlineattributes = None + lib3mf_toolpathlayerdata_clearcustomlineattributes = None + lib3mf_toolpathlayerdata_writehatchdatainmodelunits = None + lib3mf_toolpathlayerdata_writehatchdatadiscrete = None + lib3mf_toolpathlayerdata_writeloopinmodelunits = None + lib3mf_toolpathlayerdata_writeloopdiscrete = None + lib3mf_toolpathlayerdata_writepolylineinmodelunits = None + lib3mf_toolpathlayerdata_writepolylinediscrete = None lib3mf_toolpathlayerdata_addcustomdata = None lib3mf_toolpathlayerdata_finish = None + lib3mf_toolpath_getuuid = None + lib3mf_toolpath_resetuuid = None lib3mf_toolpath_getunits = None lib3mf_toolpath_getlayercount = None lib3mf_toolpath_getprofilecount = None @@ -492,7 +503,9 @@ class FunctionTable: lib3mf_toolpath_readlayerdata = None lib3mf_toolpath_getlayerpath = None lib3mf_toolpath_getlayerzmax = None - lib3mf_toolpath_getlayerz = None + lib3mf_toolpath_getlayerzmin = None + lib3mf_toolpath_getlayerthickness = None + lib3mf_toolpath_hasuniformthickness = None lib3mf_toolpath_addprofile = None lib3mf_toolpath_getprofile = None lib3mf_toolpath_getprofileuuid = None @@ -505,8 +518,8 @@ class FunctionTable: lib3mf_toolpath_addcustomdata = None lib3mf_toolpath_clearcustomdata = None lib3mf_toolpath_deletecustomdata = None - lib3mf_toolpath_registercustomintegerattribute = None - lib3mf_toolpath_registercustomdoubleattribute = None + lib3mf_toolpath_registercustomintegersegmentattribute = None + lib3mf_toolpath_registercustomdoublesegmentattribute = None lib3mf_toolpathiterator_getcurrenttoolpath = None lib3mf_slicestack_getbottomz = None lib3mf_slicestack_getslicecount = None @@ -817,6 +830,29 @@ class Position2D(ctypes.Structure): _fields_ = [ ("Coordinates", ctypes.c_float * 2) ] +'''Definition of DiscretePosition2D +''' +class DiscretePosition2D(ctypes.Structure): + _pack_ = 1 + _fields_ = [ + ("Coordinates", ctypes.c_int32 * 2) + ] +'''Definition of Hatch2D +''' +class Hatch2D(ctypes.Structure): + _pack_ = 1 + _fields_ = [ + ("Point1Coordinates", ctypes.c_float * 2), + ("Point2Coordinates", ctypes.c_float * 2) + ] +'''Definition of DiscreteHatch2D +''' +class DiscreteHatch2D(ctypes.Structure): + _pack_ = 1 + _fields_ = [ + ("Point1Coordinates", ctypes.c_int32 * 2), + ("Point2Coordinates", ctypes.c_int32 * 2) + ] '''Definition of CompositeConstituent ''' class CompositeConstituent(ctypes.Structure): @@ -2973,11 +3009,17 @@ 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_getpartuuidbylocalpartid = methodType(int(methodAddress.value)) - err = symbolLookupMethod(ctypes.c_char_p(str.encode("lib3mf_toolpathlayerreader_getsegmentpointdata")), methodAddress) + err = symbolLookupMethod(ctypes.c_char_p(str.encode("lib3mf_toolpathlayerreader_getsegmentpointdatainmodelunits")), methodAddress) if err != 0: raise ELib3MFException(ErrorCodes.COULDNOTLOADLIBRARY, str(err)) methodType = ctypes.CFUNCTYPE(ctypes.c_int32, ctypes.c_void_p, ctypes.c_uint32, ctypes.c_uint64, ctypes.POINTER(ctypes.c_uint64), ctypes.POINTER(Position2D)) - self.lib.lib3mf_toolpathlayerreader_getsegmentpointdata = methodType(int(methodAddress.value)) + self.lib.lib3mf_toolpathlayerreader_getsegmentpointdatainmodelunits = methodType(int(methodAddress.value)) + + err = symbolLookupMethod(ctypes.c_char_p(str.encode("lib3mf_toolpathlayerreader_getsegmentpointdatadiscrete")), methodAddress) + if err != 0: + raise ELib3MFException(ErrorCodes.COULDNOTLOADLIBRARY, str(err)) + methodType = ctypes.CFUNCTYPE(ctypes.c_int32, ctypes.c_void_p, ctypes.c_uint32, ctypes.c_uint64, ctypes.POINTER(ctypes.c_uint64), ctypes.POINTER(DiscretePosition2D)) + self.lib.lib3mf_toolpathlayerreader_getsegmentpointdatadiscrete = methodType(int(methodAddress.value)) err = symbolLookupMethod(ctypes.c_char_p(str.encode("lib3mf_toolpathlayerreader_findattributeinfobyname")), methodAddress) if err != 0: @@ -3069,23 +3111,53 @@ def _loadFunctionTableFromMethod(self, symbolLookupMethodAddress): methodType = ctypes.CFUNCTYPE(ctypes.c_int32, ctypes.c_void_p) self.lib.lib3mf_toolpathlayerdata_clearsegmentattributes = methodType(int(methodAddress.value)) - err = symbolLookupMethod(ctypes.c_char_p(str.encode("lib3mf_toolpathlayerdata_writehatchdata")), methodAddress) + err = symbolLookupMethod(ctypes.c_char_p(str.encode("lib3mf_toolpathlayerdata_addcustomlineattributes")), methodAddress) if err != 0: raise ELib3MFException(ErrorCodes.COULDNOTLOADLIBRARY, str(err)) - methodType = ctypes.CFUNCTYPE(ctypes.c_int32, ctypes.c_void_p, ctypes.c_uint32, ctypes.c_uint32, ctypes.c_uint64, ctypes.POINTER(Position2D)) - self.lib.lib3mf_toolpathlayerdata_writehatchdata = methodType(int(methodAddress.value)) + methodType = ctypes.CFUNCTYPE(ctypes.c_int32, ctypes.c_void_p, ctypes.c_char_p, ctypes.c_char_p, ctypes.c_uint64, ctypes.POINTER(ctypes.c_int32)) + self.lib.lib3mf_toolpathlayerdata_addcustomlineattributes = methodType(int(methodAddress.value)) - err = symbolLookupMethod(ctypes.c_char_p(str.encode("lib3mf_toolpathlayerdata_writeloop")), methodAddress) + err = symbolLookupMethod(ctypes.c_char_p(str.encode("lib3mf_toolpathlayerdata_clearcustomlineattributes")), methodAddress) if err != 0: raise ELib3MFException(ErrorCodes.COULDNOTLOADLIBRARY, str(err)) - methodType = ctypes.CFUNCTYPE(ctypes.c_int32, ctypes.c_void_p, ctypes.c_uint32, ctypes.c_uint32, ctypes.c_uint64, ctypes.POINTER(Position2D)) - self.lib.lib3mf_toolpathlayerdata_writeloop = methodType(int(methodAddress.value)) + methodType = ctypes.CFUNCTYPE(ctypes.c_int32, ctypes.c_void_p) + self.lib.lib3mf_toolpathlayerdata_clearcustomlineattributes = methodType(int(methodAddress.value)) - err = symbolLookupMethod(ctypes.c_char_p(str.encode("lib3mf_toolpathlayerdata_writepolyline")), methodAddress) + err = symbolLookupMethod(ctypes.c_char_p(str.encode("lib3mf_toolpathlayerdata_writehatchdatainmodelunits")), methodAddress) if err != 0: raise ELib3MFException(ErrorCodes.COULDNOTLOADLIBRARY, str(err)) - methodType = ctypes.CFUNCTYPE(ctypes.c_int32, ctypes.c_void_p, ctypes.c_uint32, ctypes.c_uint32, ctypes.c_uint64, ctypes.POINTER(Position2D)) - self.lib.lib3mf_toolpathlayerdata_writepolyline = methodType(int(methodAddress.value)) + methodType = ctypes.CFUNCTYPE(ctypes.c_int32, ctypes.c_void_p, ctypes.c_uint32, ctypes.c_uint32, ctypes.c_bool, ctypes.c_uint64, ctypes.POINTER(Hatch2D)) + self.lib.lib3mf_toolpathlayerdata_writehatchdatainmodelunits = methodType(int(methodAddress.value)) + + err = symbolLookupMethod(ctypes.c_char_p(str.encode("lib3mf_toolpathlayerdata_writehatchdatadiscrete")), methodAddress) + if err != 0: + raise ELib3MFException(ErrorCodes.COULDNOTLOADLIBRARY, str(err)) + methodType = ctypes.CFUNCTYPE(ctypes.c_int32, ctypes.c_void_p, ctypes.c_uint32, ctypes.c_uint32, ctypes.c_bool, ctypes.c_uint64, ctypes.POINTER(DiscreteHatch2D)) + self.lib.lib3mf_toolpathlayerdata_writehatchdatadiscrete = methodType(int(methodAddress.value)) + + err = symbolLookupMethod(ctypes.c_char_p(str.encode("lib3mf_toolpathlayerdata_writeloopinmodelunits")), methodAddress) + if err != 0: + raise ELib3MFException(ErrorCodes.COULDNOTLOADLIBRARY, str(err)) + methodType = ctypes.CFUNCTYPE(ctypes.c_int32, ctypes.c_void_p, ctypes.c_uint32, ctypes.c_uint32, ctypes.c_bool, ctypes.c_uint64, ctypes.POINTER(Position2D)) + self.lib.lib3mf_toolpathlayerdata_writeloopinmodelunits = methodType(int(methodAddress.value)) + + err = symbolLookupMethod(ctypes.c_char_p(str.encode("lib3mf_toolpathlayerdata_writeloopdiscrete")), methodAddress) + if err != 0: + raise ELib3MFException(ErrorCodes.COULDNOTLOADLIBRARY, str(err)) + methodType = ctypes.CFUNCTYPE(ctypes.c_int32, ctypes.c_void_p, ctypes.c_uint32, ctypes.c_uint32, ctypes.c_bool, ctypes.c_uint64, ctypes.POINTER(DiscretePosition2D)) + self.lib.lib3mf_toolpathlayerdata_writeloopdiscrete = methodType(int(methodAddress.value)) + + err = symbolLookupMethod(ctypes.c_char_p(str.encode("lib3mf_toolpathlayerdata_writepolylineinmodelunits")), methodAddress) + if err != 0: + raise ELib3MFException(ErrorCodes.COULDNOTLOADLIBRARY, str(err)) + methodType = ctypes.CFUNCTYPE(ctypes.c_int32, ctypes.c_void_p, ctypes.c_uint32, ctypes.c_uint32, ctypes.c_bool, ctypes.c_uint64, ctypes.POINTER(Position2D)) + self.lib.lib3mf_toolpathlayerdata_writepolylineinmodelunits = methodType(int(methodAddress.value)) + + err = symbolLookupMethod(ctypes.c_char_p(str.encode("lib3mf_toolpathlayerdata_writepolylinediscrete")), methodAddress) + if err != 0: + raise ELib3MFException(ErrorCodes.COULDNOTLOADLIBRARY, str(err)) + methodType = ctypes.CFUNCTYPE(ctypes.c_int32, ctypes.c_void_p, ctypes.c_uint32, ctypes.c_uint32, ctypes.c_bool, ctypes.c_uint64, ctypes.POINTER(DiscretePosition2D)) + self.lib.lib3mf_toolpathlayerdata_writepolylinediscrete = methodType(int(methodAddress.value)) err = symbolLookupMethod(ctypes.c_char_p(str.encode("lib3mf_toolpathlayerdata_addcustomdata")), methodAddress) if err != 0: @@ -3099,6 +3171,18 @@ def _loadFunctionTableFromMethod(self, symbolLookupMethodAddress): methodType = ctypes.CFUNCTYPE(ctypes.c_int32, ctypes.c_void_p) self.lib.lib3mf_toolpathlayerdata_finish = methodType(int(methodAddress.value)) + err = symbolLookupMethod(ctypes.c_char_p(str.encode("lib3mf_toolpath_getuuid")), methodAddress) + if err != 0: + raise ELib3MFException(ErrorCodes.COULDNOTLOADLIBRARY, str(err)) + methodType = ctypes.CFUNCTYPE(ctypes.c_int32, ctypes.c_void_p, ctypes.c_uint64, ctypes.POINTER(ctypes.c_uint64), ctypes.c_char_p) + self.lib.lib3mf_toolpath_getuuid = methodType(int(methodAddress.value)) + + err = symbolLookupMethod(ctypes.c_char_p(str.encode("lib3mf_toolpath_resetuuid")), methodAddress) + if err != 0: + raise ELib3MFException(ErrorCodes.COULDNOTLOADLIBRARY, str(err)) + methodType = ctypes.CFUNCTYPE(ctypes.c_int32, ctypes.c_void_p, ctypes.c_uint64, ctypes.POINTER(ctypes.c_uint64), ctypes.c_char_p) + self.lib.lib3mf_toolpath_resetuuid = methodType(int(methodAddress.value)) + err = symbolLookupMethod(ctypes.c_char_p(str.encode("lib3mf_toolpath_getunits")), methodAddress) if err != 0: raise ELib3MFException(ErrorCodes.COULDNOTLOADLIBRARY, str(err)) @@ -3159,11 +3243,23 @@ def _loadFunctionTableFromMethod(self, symbolLookupMethodAddress): methodType = ctypes.CFUNCTYPE(ctypes.c_int32, ctypes.c_void_p, ctypes.c_uint32, ctypes.POINTER(ctypes.c_uint32)) self.lib.lib3mf_toolpath_getlayerzmax = methodType(int(methodAddress.value)) - err = symbolLookupMethod(ctypes.c_char_p(str.encode("lib3mf_toolpath_getlayerz")), methodAddress) + err = symbolLookupMethod(ctypes.c_char_p(str.encode("lib3mf_toolpath_getlayerzmin")), methodAddress) if err != 0: raise ELib3MFException(ErrorCodes.COULDNOTLOADLIBRARY, str(err)) methodType = ctypes.CFUNCTYPE(ctypes.c_int32, ctypes.c_void_p, ctypes.c_uint32, ctypes.POINTER(ctypes.c_uint32)) - self.lib.lib3mf_toolpath_getlayerz = methodType(int(methodAddress.value)) + self.lib.lib3mf_toolpath_getlayerzmin = methodType(int(methodAddress.value)) + + err = symbolLookupMethod(ctypes.c_char_p(str.encode("lib3mf_toolpath_getlayerthickness")), methodAddress) + if err != 0: + raise ELib3MFException(ErrorCodes.COULDNOTLOADLIBRARY, str(err)) + methodType = ctypes.CFUNCTYPE(ctypes.c_int32, ctypes.c_void_p, ctypes.c_uint32, ctypes.POINTER(ctypes.c_uint32)) + self.lib.lib3mf_toolpath_getlayerthickness = methodType(int(methodAddress.value)) + + err = symbolLookupMethod(ctypes.c_char_p(str.encode("lib3mf_toolpath_hasuniformthickness")), methodAddress) + if err != 0: + raise ELib3MFException(ErrorCodes.COULDNOTLOADLIBRARY, str(err)) + methodType = ctypes.CFUNCTYPE(ctypes.c_int32, ctypes.c_void_p, ctypes.POINTER(ctypes.c_bool)) + self.lib.lib3mf_toolpath_hasuniformthickness = methodType(int(methodAddress.value)) err = symbolLookupMethod(ctypes.c_char_p(str.encode("lib3mf_toolpath_addprofile")), methodAddress) if err != 0: @@ -3237,17 +3333,17 @@ def _loadFunctionTableFromMethod(self, symbolLookupMethodAddress): methodType = ctypes.CFUNCTYPE(ctypes.c_int32, ctypes.c_void_p, ctypes.c_void_p, ctypes.POINTER(ctypes.c_bool)) self.lib.lib3mf_toolpath_deletecustomdata = methodType(int(methodAddress.value)) - err = symbolLookupMethod(ctypes.c_char_p(str.encode("lib3mf_toolpath_registercustomintegerattribute")), methodAddress) + err = symbolLookupMethod(ctypes.c_char_p(str.encode("lib3mf_toolpath_registercustomintegersegmentattribute")), methodAddress) if err != 0: raise ELib3MFException(ErrorCodes.COULDNOTLOADLIBRARY, str(err)) methodType = ctypes.CFUNCTYPE(ctypes.c_int32, ctypes.c_void_p, ctypes.c_char_p, ctypes.c_char_p) - self.lib.lib3mf_toolpath_registercustomintegerattribute = methodType(int(methodAddress.value)) + self.lib.lib3mf_toolpath_registercustomintegersegmentattribute = methodType(int(methodAddress.value)) - err = symbolLookupMethod(ctypes.c_char_p(str.encode("lib3mf_toolpath_registercustomdoubleattribute")), methodAddress) + err = symbolLookupMethod(ctypes.c_char_p(str.encode("lib3mf_toolpath_registercustomdoublesegmentattribute")), methodAddress) if err != 0: raise ELib3MFException(ErrorCodes.COULDNOTLOADLIBRARY, str(err)) methodType = ctypes.CFUNCTYPE(ctypes.c_int32, ctypes.c_void_p, ctypes.c_char_p, ctypes.c_char_p) - self.lib.lib3mf_toolpath_registercustomdoubleattribute = methodType(int(methodAddress.value)) + self.lib.lib3mf_toolpath_registercustomdoublesegmentattribute = methodType(int(methodAddress.value)) err = symbolLookupMethod(ctypes.c_char_p(str.encode("lib3mf_toolpathiterator_getcurrenttoolpath")), methodAddress) if err != 0: @@ -4964,8 +5060,11 @@ def _loadFunctionTable(self): self.lib.lib3mf_toolpathlayerreader_getpartuuidbylocalpartid.restype = ctypes.c_int32 self.lib.lib3mf_toolpathlayerreader_getpartuuidbylocalpartid.argtypes = [ctypes.c_void_p, ctypes.c_uint32, ctypes.c_uint64, ctypes.POINTER(ctypes.c_uint64), ctypes.c_char_p] - self.lib.lib3mf_toolpathlayerreader_getsegmentpointdata.restype = ctypes.c_int32 - self.lib.lib3mf_toolpathlayerreader_getsegmentpointdata.argtypes = [ctypes.c_void_p, ctypes.c_uint32, ctypes.c_uint64, ctypes.POINTER(ctypes.c_uint64), ctypes.POINTER(Position2D)] + self.lib.lib3mf_toolpathlayerreader_getsegmentpointdatainmodelunits.restype = ctypes.c_int32 + self.lib.lib3mf_toolpathlayerreader_getsegmentpointdatainmodelunits.argtypes = [ctypes.c_void_p, ctypes.c_uint32, ctypes.c_uint64, ctypes.POINTER(ctypes.c_uint64), ctypes.POINTER(Position2D)] + + 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_findattributeinfobyname.restype = ctypes.c_int32 self.lib.lib3mf_toolpathlayerreader_findattributeinfobyname.argtypes = [ctypes.c_void_p, ctypes.c_char_p, ctypes.c_char_p, ctypes.POINTER(ctypes.c_uint32), ctypes.POINTER(ctypes.c_int32)] @@ -5012,14 +5111,29 @@ def _loadFunctionTable(self): self.lib.lib3mf_toolpathlayerdata_clearsegmentattributes.restype = ctypes.c_int32 self.lib.lib3mf_toolpathlayerdata_clearsegmentattributes.argtypes = [ctypes.c_void_p] - self.lib.lib3mf_toolpathlayerdata_writehatchdata.restype = ctypes.c_int32 - self.lib.lib3mf_toolpathlayerdata_writehatchdata.argtypes = [ctypes.c_void_p, ctypes.c_uint32, ctypes.c_uint32, ctypes.c_uint64, ctypes.POINTER(Position2D)] + self.lib.lib3mf_toolpathlayerdata_addcustomlineattributes.restype = ctypes.c_int32 + self.lib.lib3mf_toolpathlayerdata_addcustomlineattributes.argtypes = [ctypes.c_void_p, ctypes.c_char_p, ctypes.c_char_p, ctypes.c_uint64, ctypes.POINTER(ctypes.c_int32)] + + self.lib.lib3mf_toolpathlayerdata_clearcustomlineattributes.restype = ctypes.c_int32 + self.lib.lib3mf_toolpathlayerdata_clearcustomlineattributes.argtypes = [ctypes.c_void_p] + + self.lib.lib3mf_toolpathlayerdata_writehatchdatainmodelunits.restype = ctypes.c_int32 + self.lib.lib3mf_toolpathlayerdata_writehatchdatainmodelunits.argtypes = [ctypes.c_void_p, ctypes.c_uint32, ctypes.c_uint32, ctypes.c_bool, ctypes.c_uint64, ctypes.POINTER(Hatch2D)] + + self.lib.lib3mf_toolpathlayerdata_writehatchdatadiscrete.restype = ctypes.c_int32 + self.lib.lib3mf_toolpathlayerdata_writehatchdatadiscrete.argtypes = [ctypes.c_void_p, ctypes.c_uint32, ctypes.c_uint32, ctypes.c_bool, ctypes.c_uint64, ctypes.POINTER(DiscreteHatch2D)] - self.lib.lib3mf_toolpathlayerdata_writeloop.restype = ctypes.c_int32 - self.lib.lib3mf_toolpathlayerdata_writeloop.argtypes = [ctypes.c_void_p, ctypes.c_uint32, ctypes.c_uint32, ctypes.c_uint64, ctypes.POINTER(Position2D)] + self.lib.lib3mf_toolpathlayerdata_writeloopinmodelunits.restype = ctypes.c_int32 + self.lib.lib3mf_toolpathlayerdata_writeloopinmodelunits.argtypes = [ctypes.c_void_p, ctypes.c_uint32, ctypes.c_uint32, ctypes.c_bool, ctypes.c_uint64, ctypes.POINTER(Position2D)] - self.lib.lib3mf_toolpathlayerdata_writepolyline.restype = ctypes.c_int32 - self.lib.lib3mf_toolpathlayerdata_writepolyline.argtypes = [ctypes.c_void_p, ctypes.c_uint32, ctypes.c_uint32, ctypes.c_uint64, ctypes.POINTER(Position2D)] + self.lib.lib3mf_toolpathlayerdata_writeloopdiscrete.restype = ctypes.c_int32 + self.lib.lib3mf_toolpathlayerdata_writeloopdiscrete.argtypes = [ctypes.c_void_p, ctypes.c_uint32, ctypes.c_uint32, ctypes.c_bool, ctypes.c_uint64, ctypes.POINTER(DiscretePosition2D)] + + self.lib.lib3mf_toolpathlayerdata_writepolylineinmodelunits.restype = ctypes.c_int32 + self.lib.lib3mf_toolpathlayerdata_writepolylineinmodelunits.argtypes = [ctypes.c_void_p, ctypes.c_uint32, ctypes.c_uint32, ctypes.c_bool, ctypes.c_uint64, ctypes.POINTER(Position2D)] + + self.lib.lib3mf_toolpathlayerdata_writepolylinediscrete.restype = ctypes.c_int32 + self.lib.lib3mf_toolpathlayerdata_writepolylinediscrete.argtypes = [ctypes.c_void_p, ctypes.c_uint32, ctypes.c_uint32, ctypes.c_bool, ctypes.c_uint64, ctypes.POINTER(DiscretePosition2D)] self.lib.lib3mf_toolpathlayerdata_addcustomdata.restype = ctypes.c_int32 self.lib.lib3mf_toolpathlayerdata_addcustomdata.argtypes = [ctypes.c_void_p, ctypes.c_char_p, ctypes.c_char_p, ctypes.POINTER(ctypes.c_void_p)] @@ -5027,6 +5141,12 @@ def _loadFunctionTable(self): self.lib.lib3mf_toolpathlayerdata_finish.restype = ctypes.c_int32 self.lib.lib3mf_toolpathlayerdata_finish.argtypes = [ctypes.c_void_p] + self.lib.lib3mf_toolpath_getuuid.restype = ctypes.c_int32 + self.lib.lib3mf_toolpath_getuuid.argtypes = [ctypes.c_void_p, ctypes.c_uint64, ctypes.POINTER(ctypes.c_uint64), ctypes.c_char_p] + + self.lib.lib3mf_toolpath_resetuuid.restype = ctypes.c_int32 + self.lib.lib3mf_toolpath_resetuuid.argtypes = [ctypes.c_void_p, ctypes.c_uint64, ctypes.POINTER(ctypes.c_uint64), ctypes.c_char_p] + self.lib.lib3mf_toolpath_getunits.restype = ctypes.c_int32 self.lib.lib3mf_toolpath_getunits.argtypes = [ctypes.c_void_p, ctypes.POINTER(ctypes.c_double)] @@ -5057,8 +5177,14 @@ def _loadFunctionTable(self): self.lib.lib3mf_toolpath_getlayerzmax.restype = ctypes.c_int32 self.lib.lib3mf_toolpath_getlayerzmax.argtypes = [ctypes.c_void_p, ctypes.c_uint32, ctypes.POINTER(ctypes.c_uint32)] - self.lib.lib3mf_toolpath_getlayerz.restype = ctypes.c_int32 - self.lib.lib3mf_toolpath_getlayerz.argtypes = [ctypes.c_void_p, ctypes.c_uint32, ctypes.POINTER(ctypes.c_uint32)] + self.lib.lib3mf_toolpath_getlayerzmin.restype = ctypes.c_int32 + self.lib.lib3mf_toolpath_getlayerzmin.argtypes = [ctypes.c_void_p, ctypes.c_uint32, ctypes.POINTER(ctypes.c_uint32)] + + self.lib.lib3mf_toolpath_getlayerthickness.restype = ctypes.c_int32 + self.lib.lib3mf_toolpath_getlayerthickness.argtypes = [ctypes.c_void_p, ctypes.c_uint32, ctypes.POINTER(ctypes.c_uint32)] + + self.lib.lib3mf_toolpath_hasuniformthickness.restype = ctypes.c_int32 + self.lib.lib3mf_toolpath_hasuniformthickness.argtypes = [ctypes.c_void_p, ctypes.POINTER(ctypes.c_bool)] self.lib.lib3mf_toolpath_addprofile.restype = ctypes.c_int32 self.lib.lib3mf_toolpath_addprofile.argtypes = [ctypes.c_void_p, ctypes.c_char_p, ctypes.POINTER(ctypes.c_void_p)] @@ -5096,11 +5222,11 @@ def _loadFunctionTable(self): self.lib.lib3mf_toolpath_deletecustomdata.restype = ctypes.c_int32 self.lib.lib3mf_toolpath_deletecustomdata.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.POINTER(ctypes.c_bool)] - self.lib.lib3mf_toolpath_registercustomintegerattribute.restype = ctypes.c_int32 - self.lib.lib3mf_toolpath_registercustomintegerattribute.argtypes = [ctypes.c_void_p, ctypes.c_char_p, ctypes.c_char_p] + self.lib.lib3mf_toolpath_registercustomintegersegmentattribute.restype = ctypes.c_int32 + self.lib.lib3mf_toolpath_registercustomintegersegmentattribute.argtypes = [ctypes.c_void_p, ctypes.c_char_p, ctypes.c_char_p] - self.lib.lib3mf_toolpath_registercustomdoubleattribute.restype = ctypes.c_int32 - self.lib.lib3mf_toolpath_registercustomdoubleattribute.argtypes = [ctypes.c_void_p, ctypes.c_char_p, ctypes.c_char_p] + self.lib.lib3mf_toolpath_registercustomdoublesegmentattribute.restype = ctypes.c_int32 + self.lib.lib3mf_toolpath_registercustomdoublesegmentattribute.argtypes = [ctypes.c_void_p, ctypes.c_char_p, ctypes.c_char_p] self.lib.lib3mf_toolpathiterator_getcurrenttoolpath.restype = ctypes.c_int32 self.lib.lib3mf_toolpathiterator_getcurrenttoolpath.argtypes = [ctypes.c_void_p, ctypes.POINTER(ctypes.c_void_p)] @@ -8506,15 +8632,27 @@ def GetPartUUIDByLocalPartID(self, LocalPartID): return pPartUUIDBuffer.value.decode() - def GetSegmentPointData(self, Index): + def GetSegmentPointDataInModelUnits(self, Index): nIndex = ctypes.c_uint32(Index) nPointDataCount = ctypes.c_uint64(0) nPointDataNeededCount = ctypes.c_uint64(0) pPointDataBuffer = (Position2D*0)() - self._wrapper.checkError(self, self._wrapper.lib.lib3mf_toolpathlayerreader_getsegmentpointdata(self._handle, nIndex, nPointDataCount, nPointDataNeededCount, pPointDataBuffer)) + self._wrapper.checkError(self, self._wrapper.lib.lib3mf_toolpathlayerreader_getsegmentpointdatainmodelunits(self._handle, nIndex, nPointDataCount, nPointDataNeededCount, pPointDataBuffer)) nPointDataCount = ctypes.c_uint64(nPointDataNeededCount.value) pPointDataBuffer = (Position2D * nPointDataNeededCount.value)() - self._wrapper.checkError(self, self._wrapper.lib.lib3mf_toolpathlayerreader_getsegmentpointdata(self._handle, nIndex, nPointDataCount, nPointDataNeededCount, pPointDataBuffer)) + self._wrapper.checkError(self, self._wrapper.lib.lib3mf_toolpathlayerreader_getsegmentpointdatainmodelunits(self._handle, nIndex, nPointDataCount, nPointDataNeededCount, pPointDataBuffer)) + + return [pPointDataBuffer[i] for i in range(nPointDataNeededCount.value)] + + def GetSegmentPointDataDiscrete(self, Index): + nIndex = ctypes.c_uint32(Index) + nPointDataCount = ctypes.c_uint64(0) + nPointDataNeededCount = ctypes.c_uint64(0) + pPointDataBuffer = (DiscretePosition2D*0)() + self._wrapper.checkError(self, self._wrapper.lib.lib3mf_toolpathlayerreader_getsegmentpointdatadiscrete(self._handle, nIndex, nPointDataCount, nPointDataNeededCount, pPointDataBuffer)) + nPointDataCount = ctypes.c_uint64(nPointDataNeededCount.value) + pPointDataBuffer = (DiscretePosition2D * nPointDataNeededCount.value)() + self._wrapper.checkError(self, self._wrapper.lib.lib3mf_toolpathlayerreader_getsegmentpointdatadiscrete(self._handle, nIndex, nPointDataCount, nPointDataNeededCount, pPointDataBuffer)) return [pPointDataBuffer[i] for i in range(nPointDataNeededCount.value)] @@ -8662,28 +8800,70 @@ def ClearSegmentAttributes(self): self._wrapper.checkError(self, self._wrapper.lib.lib3mf_toolpathlayerdata_clearsegmentattributes(self._handle)) - def WriteHatchData(self, ProfileID, PartID, PointData): + def AddCustomLineAttributes(self, NameSpace, AttributeName, Values): + pNameSpace = ctypes.c_char_p(str.encode(NameSpace)) + pAttributeName = ctypes.c_char_p(str.encode(AttributeName)) + nValuesCount = ctypes.c_uint64(len(Values)) + pValuesBuffer = (ctypes.c_int32*len(Values))(*Values) + self._wrapper.checkError(self, self._wrapper.lib.lib3mf_toolpathlayerdata_addcustomlineattributes(self._handle, pNameSpace, pAttributeName, nValuesCount, pValuesBuffer)) + + + def ClearCustomLineAttributes(self): + self._wrapper.checkError(self, self._wrapper.lib.lib3mf_toolpathlayerdata_clearcustomlineattributes(self._handle)) + + + def WriteHatchDataInModelUnits(self, ProfileID, PartID, WriteCustomLineAttributes, HatchData): nProfileID = ctypes.c_uint32(ProfileID) nPartID = ctypes.c_uint32(PartID) + bWriteCustomLineAttributes = ctypes.c_bool(WriteCustomLineAttributes) + nHatchDataCount = ctypes.c_uint64(len(HatchData)) + pHatchDataBuffer = (Hatch2D*len(HatchData))(*HatchData) + self._wrapper.checkError(self, self._wrapper.lib.lib3mf_toolpathlayerdata_writehatchdatainmodelunits(self._handle, nProfileID, nPartID, bWriteCustomLineAttributes, nHatchDataCount, pHatchDataBuffer)) + + + def WriteHatchDataDiscrete(self, ProfileID, PartID, WriteCustomLineAttributes, HatchData): + nProfileID = ctypes.c_uint32(ProfileID) + nPartID = ctypes.c_uint32(PartID) + bWriteCustomLineAttributes = ctypes.c_bool(WriteCustomLineAttributes) + nHatchDataCount = ctypes.c_uint64(len(HatchData)) + pHatchDataBuffer = (DiscreteHatch2D*len(HatchData))(*HatchData) + self._wrapper.checkError(self, self._wrapper.lib.lib3mf_toolpathlayerdata_writehatchdatadiscrete(self._handle, nProfileID, nPartID, bWriteCustomLineAttributes, nHatchDataCount, pHatchDataBuffer)) + + + def WriteLoopInModelUnits(self, ProfileID, PartID, WriteCustomLineAttributes, PointData): + nProfileID = ctypes.c_uint32(ProfileID) + nPartID = ctypes.c_uint32(PartID) + bWriteCustomLineAttributes = ctypes.c_bool(WriteCustomLineAttributes) nPointDataCount = ctypes.c_uint64(len(PointData)) pPointDataBuffer = (Position2D*len(PointData))(*PointData) - self._wrapper.checkError(self, self._wrapper.lib.lib3mf_toolpathlayerdata_writehatchdata(self._handle, nProfileID, nPartID, nPointDataCount, pPointDataBuffer)) + self._wrapper.checkError(self, self._wrapper.lib.lib3mf_toolpathlayerdata_writeloopinmodelunits(self._handle, nProfileID, nPartID, bWriteCustomLineAttributes, nPointDataCount, pPointDataBuffer)) - def WriteLoop(self, ProfileID, PartID, PointData): + def WriteLoopDiscrete(self, ProfileID, PartID, WriteCustomLineAttributes, PointData): nProfileID = ctypes.c_uint32(ProfileID) nPartID = ctypes.c_uint32(PartID) + bWriteCustomLineAttributes = ctypes.c_bool(WriteCustomLineAttributes) nPointDataCount = ctypes.c_uint64(len(PointData)) - pPointDataBuffer = (Position2D*len(PointData))(*PointData) - self._wrapper.checkError(self, self._wrapper.lib.lib3mf_toolpathlayerdata_writeloop(self._handle, nProfileID, nPartID, nPointDataCount, pPointDataBuffer)) + pPointDataBuffer = (DiscretePosition2D*len(PointData))(*PointData) + self._wrapper.checkError(self, self._wrapper.lib.lib3mf_toolpathlayerdata_writeloopdiscrete(self._handle, nProfileID, nPartID, bWriteCustomLineAttributes, nPointDataCount, pPointDataBuffer)) - def WritePolyline(self, ProfileID, PartID, PointData): + def WritePolylineInModelUnits(self, ProfileID, PartID, WriteCustomLineAttributes, PointData): nProfileID = ctypes.c_uint32(ProfileID) nPartID = ctypes.c_uint32(PartID) + bWriteCustomLineAttributes = ctypes.c_bool(WriteCustomLineAttributes) nPointDataCount = ctypes.c_uint64(len(PointData)) pPointDataBuffer = (Position2D*len(PointData))(*PointData) - self._wrapper.checkError(self, self._wrapper.lib.lib3mf_toolpathlayerdata_writepolyline(self._handle, nProfileID, nPartID, nPointDataCount, pPointDataBuffer)) + self._wrapper.checkError(self, self._wrapper.lib.lib3mf_toolpathlayerdata_writepolylineinmodelunits(self._handle, nProfileID, nPartID, bWriteCustomLineAttributes, nPointDataCount, pPointDataBuffer)) + + + def WritePolylineDiscrete(self, ProfileID, PartID, WriteCustomLineAttributes, PointData): + nProfileID = ctypes.c_uint32(ProfileID) + nPartID = ctypes.c_uint32(PartID) + bWriteCustomLineAttributes = ctypes.c_bool(WriteCustomLineAttributes) + nPointDataCount = ctypes.c_uint64(len(PointData)) + pPointDataBuffer = (DiscretePosition2D*len(PointData))(*PointData) + self._wrapper.checkError(self, self._wrapper.lib.lib3mf_toolpathlayerdata_writepolylinediscrete(self._handle, nProfileID, nPartID, bWriteCustomLineAttributes, nPointDataCount, pPointDataBuffer)) def AddCustomData(self, NameSpace, DataName): @@ -8709,6 +8889,28 @@ def Finish(self): class Toolpath(Resource): def __init__(self, handle, wrapper): Resource.__init__(self, handle, wrapper) + def GetUUID(self): + nUUIDBufferSize = ctypes.c_uint64(0) + nUUIDNeededChars = ctypes.c_uint64(0) + pUUIDBuffer = ctypes.c_char_p(None) + self._wrapper.checkError(self, self._wrapper.lib.lib3mf_toolpath_getuuid(self._handle, nUUIDBufferSize, nUUIDNeededChars, pUUIDBuffer)) + nUUIDBufferSize = ctypes.c_uint64(nUUIDNeededChars.value) + pUUIDBuffer = (ctypes.c_char * (nUUIDNeededChars.value))() + self._wrapper.checkError(self, self._wrapper.lib.lib3mf_toolpath_getuuid(self._handle, nUUIDBufferSize, nUUIDNeededChars, pUUIDBuffer)) + + return pUUIDBuffer.value.decode() + + def ResetUUID(self): + nNewUUIDBufferSize = ctypes.c_uint64(0) + nNewUUIDNeededChars = ctypes.c_uint64(0) + pNewUUIDBuffer = ctypes.c_char_p(None) + self._wrapper.checkError(self, self._wrapper.lib.lib3mf_toolpath_resetuuid(self._handle, nNewUUIDBufferSize, nNewUUIDNeededChars, pNewUUIDBuffer)) + nNewUUIDBufferSize = ctypes.c_uint64(nNewUUIDNeededChars.value) + pNewUUIDBuffer = (ctypes.c_char * (nNewUUIDNeededChars.value))() + self._wrapper.checkError(self, self._wrapper.lib.lib3mf_toolpath_resetuuid(self._handle, nNewUUIDBufferSize, nNewUUIDNeededChars, pNewUUIDBuffer)) + + return pNewUUIDBuffer.value.decode() + def GetUnits(self): pUnits = ctypes.c_double() self._wrapper.checkError(self, self._wrapper.lib.lib3mf_toolpath_getunits(self._handle, pUnits)) @@ -8796,12 +8998,25 @@ def GetLayerZMax(self, Index): return pZMax.value - def GetLayerZ(self, LayerIndex): - nLayerIndex = ctypes.c_uint32(LayerIndex) - pZValue = ctypes.c_uint32() - self._wrapper.checkError(self, self._wrapper.lib.lib3mf_toolpath_getlayerz(self._handle, nLayerIndex, pZValue)) + def GetLayerZMin(self, Index): + nIndex = ctypes.c_uint32(Index) + pZMin = ctypes.c_uint32() + self._wrapper.checkError(self, self._wrapper.lib.lib3mf_toolpath_getlayerzmin(self._handle, nIndex, pZMin)) + + return pZMin.value + + def GetLayerThickness(self, Index): + nIndex = ctypes.c_uint32(Index) + pZThickness = ctypes.c_uint32() + self._wrapper.checkError(self, self._wrapper.lib.lib3mf_toolpath_getlayerthickness(self._handle, nIndex, pZThickness)) + + return pZThickness.value + + def HasUniformThickness(self): + pUniformThickness = ctypes.c_bool() + self._wrapper.checkError(self, self._wrapper.lib.lib3mf_toolpath_hasuniformthickness(self._handle, pUniformThickness)) - return pZValue.value + return pUniformThickness.value def AddProfile(self, Name): pName = ctypes.c_char_p(str.encode(Name)) @@ -8930,16 +9145,16 @@ def DeleteCustomData(self, DataObject): return pSuccess.value - def RegisterCustomIntegerAttribute(self, NameSpace, AttributeName): + def RegisterCustomIntegerSegmentAttribute(self, NameSpace, AttributeName): pNameSpace = ctypes.c_char_p(str.encode(NameSpace)) pAttributeName = ctypes.c_char_p(str.encode(AttributeName)) - self._wrapper.checkError(self, self._wrapper.lib.lib3mf_toolpath_registercustomintegerattribute(self._handle, pNameSpace, pAttributeName)) + self._wrapper.checkError(self, self._wrapper.lib.lib3mf_toolpath_registercustomintegersegmentattribute(self._handle, pNameSpace, pAttributeName)) - def RegisterCustomDoubleAttribute(self, NameSpace, AttributeName): + def RegisterCustomDoubleSegmentAttribute(self, NameSpace, AttributeName): pNameSpace = ctypes.c_char_p(str.encode(NameSpace)) pAttributeName = ctypes.c_char_p(str.encode(AttributeName)) - self._wrapper.checkError(self, self._wrapper.lib.lib3mf_toolpath_registercustomdoubleattribute(self._handle, pNameSpace, pAttributeName)) + self._wrapper.checkError(self, self._wrapper.lib.lib3mf_toolpath_registercustomdoublesegmentattribute(self._handle, pNameSpace, pAttributeName)) diff --git a/Autogenerated/Source/lib3mf_abi.hpp b/Autogenerated/Source/lib3mf_abi.hpp index a412a816f..0e27cd813 100644 --- a/Autogenerated/Source/lib3mf_abi.hpp +++ b/Autogenerated/Source/lib3mf_abi.hpp @@ -3363,10 +3363,22 @@ LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerreader_getpartuuidbylocalpartid * @param[in] nIndex - Index. Must be between 0 and Count - 1. * @param[in] nPointDataBufferSize - Number of elements in buffer * @param[out] pPointDataNeededCount - will be filled with the count of the written elements, or needed buffer size. -* @param[out] pPointDataBuffer - Position2D buffer of The point data array +* @param[out] pPointDataBuffer - Position2D buffer of The point data array. The point coordinates are in model units. * @return error code or 0 (success) */ -LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerreader_getsegmentpointdata(Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nIndex, const Lib3MF_uint64 nPointDataBufferSize, Lib3MF_uint64* pPointDataNeededCount, Lib3MF::sPosition2D * pPointDataBuffer); +LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerreader_getsegmentpointdatainmodelunits(Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nIndex, const Lib3MF_uint64 nPointDataBufferSize, Lib3MF_uint64* pPointDataNeededCount, Lib3MF::sPosition2D * pPointDataBuffer); + +/** +* Retrieves the assigned segment point list in units. For type hatch, the points are taken pairwise. +* +* @param[in] pToolpathLayerReader - ToolpathLayerReader instance. +* @param[in] nIndex - Index. Must be between 0 and Count - 1. +* @param[in] nPointDataBufferSize - Number of elements in buffer +* @param[out] pPointDataNeededCount - will be filled with the count of the written elements, or needed buffer size. +* @param[out] pPointDataBuffer - DiscretePosition2D buffer of The point data array. The point coordinates are in toolpath units. +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerreader_getsegmentpointdatadiscrete(Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nIndex, const Lib3MF_uint64 nPointDataBufferSize, Lib3MF_uint64* pPointDataNeededCount, Lib3MF::sDiscretePosition2D * pPointDataBuffer); /** * Retrieves a segment attribute Information by Attribute Name. Will fail if Attribute does not exist. @@ -3537,28 +3549,76 @@ LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerdata_setsegmentattribute(Lib3MF LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerdata_clearsegmentattributes(Lib3MF_ToolpathLayerData pToolpathLayerData); /** -* writes hatch data to the layer. +* Stores custom line attributes for the next WriteLoop, WritePolyline or WriteHatchData call. +* +* @param[in] pToolpathLayerData - ToolpathLayerData instance. +* @param[in] pNameSpace - The namespace of the attribute to register. +* @param[in] pAttributeName - The name of the attribute to register. +* @param[in] nValuesBufferSize - Number of elements in buffer +* @param[in] pValuesBuffer - int32 buffer of Custom Values to store on segment lines. Array MUST NOT be empty. If custom attributes had been already defined, the error cardinality MUST match, or an error will be thrown. +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerdata_addcustomlineattributes(Lib3MF_ToolpathLayerData pToolpathLayerData, const char * pNameSpace, const char * pAttributeName, Lib3MF_uint64 nValuesBufferSize, const Lib3MF_int32 * pValuesBuffer); + +/** +* Clears all custom line attributes. Any call to WriteLoop, WritePolyline or WriteHatchData will do this implicitely. +* +* @param[in] pToolpathLayerData - ToolpathLayerData instance. +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerdata_clearcustomlineattributes(Lib3MF_ToolpathLayerData pToolpathLayerData); + +/** +* writes hatch data to the layer in model units. +* +* @param[in] pToolpathLayerData - ToolpathLayerData instance. +* @param[in] nProfileID - The toolpath profile to use +* @param[in] nPartID - The toolpath part to use +* @param[in] bWriteCustomLineAttributes - If true, custom line attributes are written. The cardinality of each custom attribute MUST be equal to the number of hatches in the hatchdata array. In any case, stored custom attributes will be cleared after the call. +* @param[in] nHatchDataBufferSize - Number of elements in buffer +* @param[in] pHatchDataBuffer - Hatch2D buffer of The hatch data in model units. Array MUST NOT be empty. +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerdata_writehatchdatainmodelunits(Lib3MF_ToolpathLayerData pToolpathLayerData, Lib3MF_uint32 nProfileID, Lib3MF_uint32 nPartID, bool bWriteCustomLineAttributes, Lib3MF_uint64 nHatchDataBufferSize, const Lib3MF::sHatch2D * pHatchDataBuffer); + +/** +* writes hatch data to the layer in toolpath units. +* +* @param[in] pToolpathLayerData - ToolpathLayerData instance. +* @param[in] nProfileID - The toolpath profile to use +* @param[in] nPartID - The toolpath part to use +* @param[in] bWriteCustomLineAttributes - If true, custom line attributes are written. The cardinality of each custom attribute MUST be equal to the number of hatches in the hatchdata array. In any case, stored custom attributes will be cleared after the call. +* @param[in] nHatchDataBufferSize - Number of elements in buffer +* @param[in] pHatchDataBuffer - DiscreteHatch2D buffer of The hatch data in toolpath units. Array MUST NOT be empty. +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerdata_writehatchdatadiscrete(Lib3MF_ToolpathLayerData pToolpathLayerData, Lib3MF_uint32 nProfileID, Lib3MF_uint32 nPartID, bool bWriteCustomLineAttributes, Lib3MF_uint64 nHatchDataBufferSize, const Lib3MF::sDiscreteHatch2D * pHatchDataBuffer); + +/** +* writes loop data to the layer in model units. * * @param[in] pToolpathLayerData - ToolpathLayerData instance. * @param[in] nProfileID - The toolpath profile to use * @param[in] nPartID - The toolpath part to use +* @param[in] bWriteCustomLineAttributes - If true, custom line attributes are written. The cardinality of each custom attribute MUST be equal to the number of points in the pointdata array. In any case, stored custom attributes will be cleared after the call. * @param[in] nPointDataBufferSize - Number of elements in buffer -* @param[in] pPointDataBuffer - Position2D buffer of The point data +* @param[in] pPointDataBuffer - Position2D buffer of The point data in model units. Array MUST NOT be empty. * @return error code or 0 (success) */ -LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerdata_writehatchdata(Lib3MF_ToolpathLayerData pToolpathLayerData, Lib3MF_uint32 nProfileID, Lib3MF_uint32 nPartID, Lib3MF_uint64 nPointDataBufferSize, const Lib3MF::sPosition2D * pPointDataBuffer); +LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerdata_writeloopinmodelunits(Lib3MF_ToolpathLayerData pToolpathLayerData, Lib3MF_uint32 nProfileID, Lib3MF_uint32 nPartID, bool bWriteCustomLineAttributes, Lib3MF_uint64 nPointDataBufferSize, const Lib3MF::sPosition2D * pPointDataBuffer); /** -* writes loop data to the layer. +* writes loop data to the layer in toolpath units. * * @param[in] pToolpathLayerData - ToolpathLayerData instance. * @param[in] nProfileID - The toolpath profile to use * @param[in] nPartID - The toolpath part to use +* @param[in] bWriteCustomLineAttributes - If true, custom line attributes are written. The cardinality of each custom attribute MUST be equal to the number of points in the pointdata array. In any case, stored custom attributes will be cleared after the call. * @param[in] nPointDataBufferSize - Number of elements in buffer -* @param[in] pPointDataBuffer - Position2D buffer of The point data +* @param[in] pPointDataBuffer - DiscretePosition2D buffer of The point data in toolpath units. Array MUST NOT be empty. * @return error code or 0 (success) */ -LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerdata_writeloop(Lib3MF_ToolpathLayerData pToolpathLayerData, Lib3MF_uint32 nProfileID, Lib3MF_uint32 nPartID, Lib3MF_uint64 nPointDataBufferSize, const Lib3MF::sPosition2D * pPointDataBuffer); +LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerdata_writeloopdiscrete(Lib3MF_ToolpathLayerData pToolpathLayerData, Lib3MF_uint32 nProfileID, Lib3MF_uint32 nPartID, bool bWriteCustomLineAttributes, Lib3MF_uint64 nPointDataBufferSize, const Lib3MF::sDiscretePosition2D * pPointDataBuffer); /** * writes polyline data to the layer. @@ -3566,11 +3626,25 @@ LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerdata_writeloop(Lib3MF_ToolpathL * @param[in] pToolpathLayerData - ToolpathLayerData instance. * @param[in] nProfileID - The toolpath profile to use * @param[in] nPartID - The toolpath part to use +* @param[in] bWriteCustomLineAttributes - If true, custom line attributes are written. The cardinality of each custom attribute MUST be equal to the number of points in the pointdata array. In any case, stored custom attributes will be cleared after the call. * @param[in] nPointDataBufferSize - Number of elements in buffer -* @param[in] pPointDataBuffer - Position2D buffer of The point data +* @param[in] pPointDataBuffer - Position2D buffer of The point data in model units. Array MUST NOT be empty. * @return error code or 0 (success) */ -LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerdata_writepolyline(Lib3MF_ToolpathLayerData pToolpathLayerData, Lib3MF_uint32 nProfileID, Lib3MF_uint32 nPartID, Lib3MF_uint64 nPointDataBufferSize, const Lib3MF::sPosition2D * pPointDataBuffer); +LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerdata_writepolylineinmodelunits(Lib3MF_ToolpathLayerData pToolpathLayerData, Lib3MF_uint32 nProfileID, Lib3MF_uint32 nPartID, bool bWriteCustomLineAttributes, Lib3MF_uint64 nPointDataBufferSize, const Lib3MF::sPosition2D * pPointDataBuffer); + +/** +* writes polyline data to the layer. +* +* @param[in] pToolpathLayerData - ToolpathLayerData instance. +* @param[in] nProfileID - The toolpath profile to use +* @param[in] nPartID - The toolpath part to use +* @param[in] bWriteCustomLineAttributes - If true, custom line attributes are written. The cardinality of each custom attribute MUST be equal to the number of points in the pointdata array. In any case, stored custom attributes will be cleared after the call. +* @param[in] nPointDataBufferSize - Number of elements in buffer +* @param[in] pPointDataBuffer - DiscretePosition2D buffer of The point data in toolpath units. Array MUST NOT be empty. +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerdata_writepolylinediscrete(Lib3MF_ToolpathLayerData pToolpathLayerData, Lib3MF_uint32 nProfileID, Lib3MF_uint32 nPartID, bool bWriteCustomLineAttributes, Lib3MF_uint64 nPointDataBufferSize, const Lib3MF::sDiscretePosition2D * pPointDataBuffer); /** * Adds a custom data DOM tree to the layer. Layer MUST not be finished when changing the DOM tree. @@ -3596,7 +3670,29 @@ LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpathlayerdata_finish(Lib3MF_ToolpathLaye **************************************************************************************************************************/ /** -* Retrieves the unit factor +* Retrieves the UUID of the toolpath +* +* @param[in] pToolpath - Toolpath instance. +* @param[in] nUUIDBufferSize - size of the buffer (including trailing 0) +* @param[out] pUUIDNeededChars - will be filled with the count of the written bytes, or needed buffer size. +* @param[out] pUUIDBuffer - buffer of UUID Value., may be NULL +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpath_getuuid(Lib3MF_Toolpath pToolpath, const Lib3MF_uint32 nUUIDBufferSize, Lib3MF_uint32* pUUIDNeededChars, char * pUUIDBuffer); + +/** +* Generates a new unique identifier for this toolpath and sets its value. +* +* @param[in] pToolpath - Toolpath instance. +* @param[in] nNewUUIDBufferSize - size of the buffer (including trailing 0) +* @param[out] pNewUUIDNeededChars - will be filled with the count of the written bytes, or needed buffer size. +* @param[out] pNewUUIDBuffer - buffer of Newly created UUID Value., may be NULL +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpath_resetuuid(Lib3MF_Toolpath pToolpath, const Lib3MF_uint32 nNewUUIDBufferSize, Lib3MF_uint32* pNewUUIDNeededChars, char * pNewUUIDBuffer); + +/** +* Retrieves the unit factor, i.e. how many model units are one toolpath unit. * * @param[in] pToolpath - Toolpath instance. * @param[out] pUnits - Returns the unit factor. @@ -3626,7 +3722,7 @@ LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpath_getprofilecount(Lib3MF_Toolpath pTo * Adds a new toolpath layer * * @param[in] pToolpath - Toolpath instance. -* @param[in] nZMax - ZMax value of the layer. MUST be larger than the last layer added, as well as larger as BottomZ. +* @param[in] nZMax - ZMax value of the layer in toolpath units. MUST be larger than the last layer added, as well as larger as BottomZ. * @param[in] pPath - Package Path * @param[in] pModelWriter - The model writer that writes out the 3MF. * @param[out] pLayerData - Returns the layerdata object to write the layer content into. @@ -3638,7 +3734,7 @@ LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpath_addlayer(Lib3MF_Toolpath pToolpath, * Returns the bottom Z Value of the toolpath. * * @param[in] pToolpath - Toolpath instance. -* @param[out] pBottomZ - BottomZ value +* @param[out] pBottomZ - BottomZ value in Toolpath units * @return error code or 0 (success) */ LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpath_getbottomz(Lib3MF_Toolpath pToolpath, Lib3MF_uint32 * pBottomZ); @@ -3647,13 +3743,13 @@ LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpath_getbottomz(Lib3MF_Toolpath pToolpat * Sets the bottom Z Value of the toolpath. Will fail if a layer is already existing. * * @param[in] pToolpath - Toolpath instance. -* @param[in] nBottomZ - BottomZ value +* @param[in] nBottomZ - BottomZ value in Toolpath units * @return error code or 0 (success) */ LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpath_setbottomz(Lib3MF_Toolpath pToolpath, Lib3MF_uint32 nBottomZ); /** -* Retrieves the Attachment of a layer +* Retrieves the Attachment that contains the layer data. * * @param[in] pToolpath - Toolpath instance. * @param[in] nIndex - Layer Index @@ -3689,20 +3785,39 @@ LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpath_getlayerpath(Lib3MF_Toolpath pToolp * * @param[in] pToolpath - Toolpath instance. * @param[in] nIndex - Layer Index -* @param[out] pZMax - ZMax value +* @param[out] pZMax - ZMax value in toolpath units * @return error code or 0 (success) */ LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpath_getlayerzmax(Lib3MF_Toolpath pToolpath, Lib3MF_uint32 nIndex, Lib3MF_uint32 * pZMax); /** -* Return the z value of a layer in units. +* Retrieves the Minimum Z of a layer +* +* @param[in] pToolpath - Toolpath instance. +* @param[in] nIndex - Layer Index +* @param[out] pZMin - ZMin value in toolpath units +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpath_getlayerzmin(Lib3MF_Toolpath pToolpath, Lib3MF_uint32 nIndex, Lib3MF_uint32 * pZMin); + +/** +* Retrieves the Thickness of a layer +* +* @param[in] pToolpath - Toolpath instance. +* @param[in] nIndex - Layer Index +* @param[out] pZThickness - Thickness value in toolpath units +* @return error code or 0 (success) +*/ +LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpath_getlayerthickness(Lib3MF_Toolpath pToolpath, Lib3MF_uint32 nIndex, Lib3MF_uint32 * pZThickness); + +/** +* Checks if the toolpath has a uniform thickness value, i.e. each layer has the same thickness. * * @param[in] pToolpath - Toolpath instance. -* @param[in] nLayerIndex - Layer Index. -* @param[out] pZValue - Z Value in Units. +* @param[out] pUniformThickness - Returns true if the layer thicknesses are uniform, returns false otherwise. * @return error code or 0 (success) */ -LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpath_getlayerz(Lib3MF_Toolpath pToolpath, Lib3MF_uint32 nLayerIndex, Lib3MF_uint32 * pZValue); +LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpath_hasuniformthickness(Lib3MF_Toolpath pToolpath, bool * pUniformThickness); /** * Adds a new profile to the toolpath. @@ -3838,7 +3953,7 @@ LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpath_deletecustomdata(Lib3MF_Toolpath pT * @param[in] pAttributeName - Attribute name. MUST not be empty. * @return error code or 0 (success) */ -LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpath_registercustomintegerattribute(Lib3MF_Toolpath pToolpath, const char * pNameSpace, const char * pAttributeName); +LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpath_registercustomintegersegmentattribute(Lib3MF_Toolpath pToolpath, const char * pNameSpace, const char * pAttributeName); /** * Registers a Double Attribute that each segment holds. Registering only applies to reader or writer objects created after the call. @@ -3848,7 +3963,7 @@ LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpath_registercustomintegerattribute(Lib3 * @param[in] pAttributeName - Attribute name. MUST not be empty. * @return error code or 0 (success) */ -LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpath_registercustomdoubleattribute(Lib3MF_Toolpath pToolpath, const char * pNameSpace, const char * pAttributeName); +LIB3MF_DECLSPEC Lib3MFResult lib3mf_toolpath_registercustomdoublesegmentattribute(Lib3MF_Toolpath pToolpath, const char * pNameSpace, const char * pAttributeName); /************************************************************************************************************************* Class definition for ToolpathIterator diff --git a/Autogenerated/Source/lib3mf_interfaces.hpp b/Autogenerated/Source/lib3mf_interfaces.hpp index d21eff691..441a13f0e 100644 --- a/Autogenerated/Source/lib3mf_interfaces.hpp +++ b/Autogenerated/Source/lib3mf_interfaces.hpp @@ -3228,13 +3228,22 @@ class IToolpathLayerReader : public virtual IBase { virtual std::string GetPartUUIDByLocalPartID(const Lib3MF_uint32 nLocalPartID) = 0; /** - * IToolpathLayerReader::GetSegmentPointData - Retrieves the assigned segment point list. For type hatch, the points are taken pairwise. + * IToolpathLayerReader::GetSegmentPointDataInModelUnits - Retrieves the assigned segment point list. For type hatch, the points are taken pairwise. * @param[in] nIndex - Index. Must be between 0 and Count - 1. * @param[in] nPointDataBufferSize - Number of elements in buffer * @param[out] pPointDataNeededCount - will be filled with the count of the written structs, or needed buffer size. - * @param[out] pPointDataBuffer - Position2D buffer of The point data array + * @param[out] pPointDataBuffer - Position2D buffer of The point data array. The point coordinates are in model units. */ - virtual void GetSegmentPointData(const Lib3MF_uint32 nIndex, Lib3MF_uint64 nPointDataBufferSize, Lib3MF_uint64* pPointDataNeededCount, Lib3MF::sPosition2D * pPointDataBuffer) = 0; + virtual void GetSegmentPointDataInModelUnits(const Lib3MF_uint32 nIndex, Lib3MF_uint64 nPointDataBufferSize, Lib3MF_uint64* pPointDataNeededCount, Lib3MF::sPosition2D * pPointDataBuffer) = 0; + + /** + * IToolpathLayerReader::GetSegmentPointDataDiscrete - Retrieves the assigned segment point list in units. For type hatch, the points are taken pairwise. + * @param[in] nIndex - Index. Must be between 0 and Count - 1. + * @param[in] nPointDataBufferSize - Number of elements in buffer + * @param[out] pPointDataNeededCount - will be filled with the count of the written structs, or needed buffer size. + * @param[out] pPointDataBuffer - DiscretePosition2D buffer of The point data array. The point coordinates are in toolpath units. + */ + virtual void GetSegmentPointDataDiscrete(const Lib3MF_uint32 nIndex, Lib3MF_uint64 nPointDataBufferSize, Lib3MF_uint64* pPointDataNeededCount, Lib3MF::sDiscretePosition2D * pPointDataBuffer) = 0; /** * IToolpathLayerReader::FindAttributeInfoByName - Retrieves a segment attribute Information by Attribute Name. Will fail if Attribute does not exist. @@ -3370,31 +3379,78 @@ class IToolpathLayerData : public virtual IBase { virtual void ClearSegmentAttributes() = 0; /** - * IToolpathLayerData::WriteHatchData - writes hatch data to the layer. + * IToolpathLayerData::AddCustomLineAttributes - Stores custom line attributes for the next WriteLoop, WritePolyline or WriteHatchData call. + * @param[in] sNameSpace - The namespace of the attribute to register. + * @param[in] sAttributeName - The name of the attribute to register. + * @param[in] nValuesBufferSize - Number of elements in buffer + * @param[in] pValuesBuffer - Custom Values to store on segment lines. Array MUST NOT be empty. If custom attributes had been already defined, the error cardinality MUST match, or an error will be thrown. + */ + virtual void AddCustomLineAttributes(const std::string & sNameSpace, const std::string & sAttributeName, const Lib3MF_uint64 nValuesBufferSize, const Lib3MF_int32 * pValuesBuffer) = 0; + + /** + * IToolpathLayerData::ClearCustomLineAttributes - Clears all custom line attributes. Any call to WriteLoop, WritePolyline or WriteHatchData will do this implicitely. + */ + virtual void ClearCustomLineAttributes() = 0; + + /** + * IToolpathLayerData::WriteHatchDataInModelUnits - writes hatch data to the layer in model units. * @param[in] nProfileID - The toolpath profile to use * @param[in] nPartID - The toolpath part to use + * @param[in] bWriteCustomLineAttributes - If true, custom line attributes are written. The cardinality of each custom attribute MUST be equal to the number of hatches in the hatchdata array. In any case, stored custom attributes will be cleared after the call. + * @param[in] nHatchDataBufferSize - Number of elements in buffer + * @param[in] pHatchDataBuffer - The hatch data in model units. Array MUST NOT be empty. + */ + virtual void WriteHatchDataInModelUnits(const Lib3MF_uint32 nProfileID, const Lib3MF_uint32 nPartID, const bool bWriteCustomLineAttributes, const Lib3MF_uint64 nHatchDataBufferSize, const Lib3MF::sHatch2D * pHatchDataBuffer) = 0; + + /** + * IToolpathLayerData::WriteHatchDataDiscrete - writes hatch data to the layer in toolpath units. + * @param[in] nProfileID - The toolpath profile to use + * @param[in] nPartID - The toolpath part to use + * @param[in] bWriteCustomLineAttributes - If true, custom line attributes are written. The cardinality of each custom attribute MUST be equal to the number of hatches in the hatchdata array. In any case, stored custom attributes will be cleared after the call. + * @param[in] nHatchDataBufferSize - Number of elements in buffer + * @param[in] pHatchDataBuffer - The hatch data in toolpath units. Array MUST NOT be empty. + */ + virtual void WriteHatchDataDiscrete(const Lib3MF_uint32 nProfileID, const Lib3MF_uint32 nPartID, const bool bWriteCustomLineAttributes, const Lib3MF_uint64 nHatchDataBufferSize, const Lib3MF::sDiscreteHatch2D * pHatchDataBuffer) = 0; + + /** + * IToolpathLayerData::WriteLoopInModelUnits - writes loop data to the layer in model units. + * @param[in] nProfileID - The toolpath profile to use + * @param[in] nPartID - The toolpath part to use + * @param[in] bWriteCustomLineAttributes - If true, custom line attributes are written. The cardinality of each custom attribute MUST be equal to the number of points in the pointdata array. In any case, stored custom attributes will be cleared after the call. * @param[in] nPointDataBufferSize - Number of elements in buffer - * @param[in] pPointDataBuffer - The point data + * @param[in] pPointDataBuffer - The point data in model units. Array MUST NOT be empty. */ - virtual void WriteHatchData(const Lib3MF_uint32 nProfileID, const Lib3MF_uint32 nPartID, const Lib3MF_uint64 nPointDataBufferSize, const Lib3MF::sPosition2D * pPointDataBuffer) = 0; + virtual void WriteLoopInModelUnits(const Lib3MF_uint32 nProfileID, const Lib3MF_uint32 nPartID, const bool bWriteCustomLineAttributes, const Lib3MF_uint64 nPointDataBufferSize, const Lib3MF::sPosition2D * pPointDataBuffer) = 0; /** - * IToolpathLayerData::WriteLoop - writes loop data to the layer. + * IToolpathLayerData::WriteLoopDiscrete - writes loop data to the layer in toolpath units. * @param[in] nProfileID - The toolpath profile to use * @param[in] nPartID - The toolpath part to use + * @param[in] bWriteCustomLineAttributes - If true, custom line attributes are written. The cardinality of each custom attribute MUST be equal to the number of points in the pointdata array. In any case, stored custom attributes will be cleared after the call. * @param[in] nPointDataBufferSize - Number of elements in buffer - * @param[in] pPointDataBuffer - The point data + * @param[in] pPointDataBuffer - The point data in toolpath units. Array MUST NOT be empty. */ - virtual void WriteLoop(const Lib3MF_uint32 nProfileID, const Lib3MF_uint32 nPartID, const Lib3MF_uint64 nPointDataBufferSize, const Lib3MF::sPosition2D * pPointDataBuffer) = 0; + virtual void WriteLoopDiscrete(const Lib3MF_uint32 nProfileID, const Lib3MF_uint32 nPartID, const bool bWriteCustomLineAttributes, const Lib3MF_uint64 nPointDataBufferSize, const Lib3MF::sDiscretePosition2D * pPointDataBuffer) = 0; /** - * IToolpathLayerData::WritePolyline - writes polyline data to the layer. + * IToolpathLayerData::WritePolylineInModelUnits - writes polyline data to the layer. * @param[in] nProfileID - The toolpath profile to use * @param[in] nPartID - The toolpath part to use + * @param[in] bWriteCustomLineAttributes - If true, custom line attributes are written. The cardinality of each custom attribute MUST be equal to the number of points in the pointdata array. In any case, stored custom attributes will be cleared after the call. * @param[in] nPointDataBufferSize - Number of elements in buffer - * @param[in] pPointDataBuffer - The point data + * @param[in] pPointDataBuffer - The point data in model units. Array MUST NOT be empty. */ - virtual void WritePolyline(const Lib3MF_uint32 nProfileID, const Lib3MF_uint32 nPartID, const Lib3MF_uint64 nPointDataBufferSize, const Lib3MF::sPosition2D * pPointDataBuffer) = 0; + virtual void WritePolylineInModelUnits(const Lib3MF_uint32 nProfileID, const Lib3MF_uint32 nPartID, const bool bWriteCustomLineAttributes, const Lib3MF_uint64 nPointDataBufferSize, const Lib3MF::sPosition2D * pPointDataBuffer) = 0; + + /** + * IToolpathLayerData::WritePolylineDiscrete - writes polyline data to the layer. + * @param[in] nProfileID - The toolpath profile to use + * @param[in] nPartID - The toolpath part to use + * @param[in] bWriteCustomLineAttributes - If true, custom line attributes are written. The cardinality of each custom attribute MUST be equal to the number of points in the pointdata array. In any case, stored custom attributes will be cleared after the call. + * @param[in] nPointDataBufferSize - Number of elements in buffer + * @param[in] pPointDataBuffer - The point data in toolpath units. Array MUST NOT be empty. + */ + virtual void WritePolylineDiscrete(const Lib3MF_uint32 nProfileID, const Lib3MF_uint32 nPartID, const bool bWriteCustomLineAttributes, const Lib3MF_uint64 nPointDataBufferSize, const Lib3MF::sDiscretePosition2D * pPointDataBuffer) = 0; /** * IToolpathLayerData::AddCustomData - Adds a custom data DOM tree to the layer. Layer MUST not be finished when changing the DOM tree. @@ -3430,7 +3486,19 @@ class IToolpath : public virtual IResource { } /** - * IToolpath::GetUnits - Retrieves the unit factor + * IToolpath::GetUUID - Retrieves the UUID of the toolpath + * @return UUID Value. + */ + virtual std::string GetUUID() = 0; + + /** + * IToolpath::ResetUUID - Generates a new unique identifier for this toolpath and sets its value. + * @return Newly created UUID Value. + */ + virtual std::string ResetUUID() = 0; + + /** + * IToolpath::GetUnits - Retrieves the unit factor, i.e. how many model units are one toolpath unit. * @return Returns the unit factor. */ virtual Lib3MF_double GetUnits() = 0; @@ -3449,7 +3517,7 @@ class IToolpath : public virtual IResource { /** * IToolpath::AddLayer - Adds a new toolpath layer - * @param[in] nZMax - ZMax value of the layer. MUST be larger than the last layer added, as well as larger as BottomZ. + * @param[in] nZMax - ZMax value of the layer in toolpath units. MUST be larger than the last layer added, as well as larger as BottomZ. * @param[in] sPath - Package Path * @param[in] pModelWriter - The model writer that writes out the 3MF. * @return Returns the layerdata object to write the layer content into. @@ -3458,18 +3526,18 @@ class IToolpath : public virtual IResource { /** * IToolpath::GetBottomZ - Returns the bottom Z Value of the toolpath. - * @return BottomZ value + * @return BottomZ value in Toolpath units */ virtual Lib3MF_uint32 GetBottomZ() = 0; /** * IToolpath::SetBottomZ - Sets the bottom Z Value of the toolpath. Will fail if a layer is already existing. - * @param[in] nBottomZ - BottomZ value + * @param[in] nBottomZ - BottomZ value in Toolpath units */ virtual void SetBottomZ(const Lib3MF_uint32 nBottomZ) = 0; /** - * IToolpath::GetLayerAttachment - Retrieves the Attachment of a layer + * IToolpath::GetLayerAttachment - Retrieves the Attachment that contains the layer data. * @param[in] nIndex - Layer Index * @return Attachment */ @@ -3492,16 +3560,29 @@ class IToolpath : public virtual IResource { /** * IToolpath::GetLayerZMax - Retrieves the ZMax of a layer * @param[in] nIndex - Layer Index - * @return ZMax value + * @return ZMax value in toolpath units */ virtual Lib3MF_uint32 GetLayerZMax(const Lib3MF_uint32 nIndex) = 0; /** - * IToolpath::GetLayerZ - Return the z value of a layer in units. - * @param[in] nLayerIndex - Layer Index. - * @return Z Value in Units. + * IToolpath::GetLayerZMin - Retrieves the Minimum Z of a layer + * @param[in] nIndex - Layer Index + * @return ZMin value in toolpath units + */ + virtual Lib3MF_uint32 GetLayerZMin(const Lib3MF_uint32 nIndex) = 0; + + /** + * IToolpath::GetLayerThickness - Retrieves the Thickness of a layer + * @param[in] nIndex - Layer Index + * @return Thickness value in toolpath units + */ + virtual Lib3MF_uint32 GetLayerThickness(const Lib3MF_uint32 nIndex) = 0; + + /** + * IToolpath::HasUniformThickness - Checks if the toolpath has a uniform thickness value, i.e. each layer has the same thickness. + * @return Returns true if the layer thicknesses are uniform, returns false otherwise. */ - virtual Lib3MF_uint32 GetLayerZ(const Lib3MF_uint32 nLayerIndex) = 0; + virtual bool HasUniformThickness() = 0; /** * IToolpath::AddProfile - Adds a new profile to the toolpath. @@ -3590,18 +3671,18 @@ class IToolpath : public virtual IResource { virtual bool DeleteCustomData(ICustomDOMTree* pData) = 0; /** - * IToolpath::RegisterCustomIntegerAttribute - Registers an Integer Attribute that each segment holds. + * IToolpath::RegisterCustomIntegerSegmentAttribute - Registers an Integer Attribute that each segment holds. * @param[in] sNameSpace - Namespace of the custom data tree. MUST not be empty. * @param[in] sAttributeName - Attribute name. MUST not be empty. */ - virtual void RegisterCustomIntegerAttribute(const std::string & sNameSpace, const std::string & sAttributeName) = 0; + virtual void RegisterCustomIntegerSegmentAttribute(const std::string & sNameSpace, const std::string & sAttributeName) = 0; /** - * IToolpath::RegisterCustomDoubleAttribute - Registers a Double Attribute that each segment holds. Registering only applies to reader or writer objects created after the call. + * IToolpath::RegisterCustomDoubleSegmentAttribute - Registers a Double Attribute that each segment holds. Registering only applies to reader or writer objects created after the call. * @param[in] sNameSpace - Namespace of the custom data tree. MUST not be empty. * @param[in] sAttributeName - Attribute name. MUST not be empty. */ - virtual void RegisterCustomDoubleAttribute(const std::string & sNameSpace, const std::string & sAttributeName) = 0; + virtual void RegisterCustomDoubleSegmentAttribute(const std::string & sNameSpace, const std::string & sAttributeName) = 0; }; diff --git a/Autogenerated/Source/lib3mf_interfacewrapper.cpp b/Autogenerated/Source/lib3mf_interfacewrapper.cpp index 46e67b59d..7012dcf34 100644 --- a/Autogenerated/Source/lib3mf_interfacewrapper.cpp +++ b/Autogenerated/Source/lib3mf_interfacewrapper.cpp @@ -12188,14 +12188,14 @@ Lib3MFResult lib3mf_toolpathlayerreader_getpartuuidbylocalpartid(Lib3MF_Toolpath } } -Lib3MFResult lib3mf_toolpathlayerreader_getsegmentpointdata(Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nIndex, const Lib3MF_uint64 nPointDataBufferSize, Lib3MF_uint64* pPointDataNeededCount, sLib3MFPosition2D * pPointDataBuffer) +Lib3MFResult lib3mf_toolpathlayerreader_getsegmentpointdatainmodelunits(Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nIndex, const Lib3MF_uint64 nPointDataBufferSize, Lib3MF_uint64* pPointDataNeededCount, sLib3MFPosition2D * pPointDataBuffer) { IBase* pIBaseClass = (IBase *)pToolpathLayerReader; PLib3MFInterfaceJournalEntry pJournalEntry; try { if (m_GlobalJournal.get() != nullptr) { - pJournalEntry = m_GlobalJournal->beginClassMethod(pToolpathLayerReader, "ToolpathLayerReader", "GetSegmentPointData"); + pJournalEntry = m_GlobalJournal->beginClassMethod(pToolpathLayerReader, "ToolpathLayerReader", "GetSegmentPointDataInModelUnits"); pJournalEntry->addUInt32Parameter("Index", nIndex); } if ((!pPointDataBuffer) && !(pPointDataNeededCount)) @@ -12204,7 +12204,41 @@ Lib3MFResult lib3mf_toolpathlayerreader_getsegmentpointdata(Lib3MF_ToolpathLayer if (!pIToolpathLayerReader) throw ELib3MFInterfaceException(LIB3MF_ERROR_INVALIDCAST); - pIToolpathLayerReader->GetSegmentPointData(nIndex, nPointDataBufferSize, pPointDataNeededCount, pPointDataBuffer); + pIToolpathLayerReader->GetSegmentPointDataInModelUnits(nIndex, nPointDataBufferSize, pPointDataNeededCount, pPointDataBuffer); + + 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_getsegmentpointdatadiscrete(Lib3MF_ToolpathLayerReader pToolpathLayerReader, Lib3MF_uint32 nIndex, const Lib3MF_uint64 nPointDataBufferSize, Lib3MF_uint64* pPointDataNeededCount, sLib3MFDiscretePosition2D * pPointDataBuffer) +{ + IBase* pIBaseClass = (IBase *)pToolpathLayerReader; + + PLib3MFInterfaceJournalEntry pJournalEntry; + try { + if (m_GlobalJournal.get() != nullptr) { + pJournalEntry = m_GlobalJournal->beginClassMethod(pToolpathLayerReader, "ToolpathLayerReader", "GetSegmentPointDataDiscrete"); + pJournalEntry->addUInt32Parameter("Index", nIndex); + } + if ((!pPointDataBuffer) && !(pPointDataNeededCount)) + throw ELib3MFInterfaceException (LIB3MF_ERROR_INVALIDPARAM); + IToolpathLayerReader* pIToolpathLayerReader = dynamic_cast(pIBaseClass); + if (!pIToolpathLayerReader) + throw ELib3MFInterfaceException(LIB3MF_ERROR_INVALIDCAST); + + pIToolpathLayerReader->GetSegmentPointDataDiscrete(nIndex, nPointDataBufferSize, pPointDataNeededCount, pPointDataBuffer); if (pJournalEntry.get() != nullptr) { pJournalEntry->writeSuccess(); @@ -12864,16 +12898,161 @@ Lib3MFResult lib3mf_toolpathlayerdata_clearsegmentattributes(Lib3MF_ToolpathLaye } } -Lib3MFResult lib3mf_toolpathlayerdata_writehatchdata(Lib3MF_ToolpathLayerData pToolpathLayerData, Lib3MF_uint32 nProfileID, Lib3MF_uint32 nPartID, Lib3MF_uint64 nPointDataBufferSize, const sLib3MFPosition2D * pPointDataBuffer) +Lib3MFResult lib3mf_toolpathlayerdata_addcustomlineattributes(Lib3MF_ToolpathLayerData pToolpathLayerData, const char * pNameSpace, const char * pAttributeName, Lib3MF_uint64 nValuesBufferSize, const Lib3MF_int32 * pValuesBuffer) +{ + IBase* pIBaseClass = (IBase *)pToolpathLayerData; + + PLib3MFInterfaceJournalEntry pJournalEntry; + try { + if (m_GlobalJournal.get() != nullptr) { + pJournalEntry = m_GlobalJournal->beginClassMethod(pToolpathLayerData, "ToolpathLayerData", "AddCustomLineAttributes"); + pJournalEntry->addStringParameter("NameSpace", pNameSpace); + pJournalEntry->addStringParameter("AttributeName", pAttributeName); + } + if (pNameSpace == nullptr) + throw ELib3MFInterfaceException (LIB3MF_ERROR_INVALIDPARAM); + if (pAttributeName == nullptr) + throw ELib3MFInterfaceException (LIB3MF_ERROR_INVALIDPARAM); + if ( (!pValuesBuffer) && (nValuesBufferSize>0)) + throw ELib3MFInterfaceException (LIB3MF_ERROR_INVALIDPARAM); + std::string sNameSpace(pNameSpace); + std::string sAttributeName(pAttributeName); + IToolpathLayerData* pIToolpathLayerData = dynamic_cast(pIBaseClass); + if (!pIToolpathLayerData) + throw ELib3MFInterfaceException(LIB3MF_ERROR_INVALIDCAST); + + pIToolpathLayerData->AddCustomLineAttributes(sNameSpace, sAttributeName, nValuesBufferSize, pValuesBuffer); + + 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_toolpathlayerdata_clearcustomlineattributes(Lib3MF_ToolpathLayerData pToolpathLayerData) +{ + IBase* pIBaseClass = (IBase *)pToolpathLayerData; + + PLib3MFInterfaceJournalEntry pJournalEntry; + try { + if (m_GlobalJournal.get() != nullptr) { + pJournalEntry = m_GlobalJournal->beginClassMethod(pToolpathLayerData, "ToolpathLayerData", "ClearCustomLineAttributes"); + } + IToolpathLayerData* pIToolpathLayerData = dynamic_cast(pIBaseClass); + if (!pIToolpathLayerData) + throw ELib3MFInterfaceException(LIB3MF_ERROR_INVALIDCAST); + + pIToolpathLayerData->ClearCustomLineAttributes(); + + 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_toolpathlayerdata_writehatchdatainmodelunits(Lib3MF_ToolpathLayerData pToolpathLayerData, Lib3MF_uint32 nProfileID, Lib3MF_uint32 nPartID, bool bWriteCustomLineAttributes, Lib3MF_uint64 nHatchDataBufferSize, const sLib3MFHatch2D * pHatchDataBuffer) +{ + IBase* pIBaseClass = (IBase *)pToolpathLayerData; + + PLib3MFInterfaceJournalEntry pJournalEntry; + try { + if (m_GlobalJournal.get() != nullptr) { + pJournalEntry = m_GlobalJournal->beginClassMethod(pToolpathLayerData, "ToolpathLayerData", "WriteHatchDataInModelUnits"); + pJournalEntry->addUInt32Parameter("ProfileID", nProfileID); + pJournalEntry->addUInt32Parameter("PartID", nPartID); + pJournalEntry->addBooleanParameter("WriteCustomLineAttributes", bWriteCustomLineAttributes); + } + if ( (!pHatchDataBuffer) && (nHatchDataBufferSize>0)) + throw ELib3MFInterfaceException (LIB3MF_ERROR_INVALIDPARAM); + IToolpathLayerData* pIToolpathLayerData = dynamic_cast(pIBaseClass); + if (!pIToolpathLayerData) + throw ELib3MFInterfaceException(LIB3MF_ERROR_INVALIDCAST); + + pIToolpathLayerData->WriteHatchDataInModelUnits(nProfileID, nPartID, bWriteCustomLineAttributes, nHatchDataBufferSize, pHatchDataBuffer); + + 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_toolpathlayerdata_writehatchdatadiscrete(Lib3MF_ToolpathLayerData pToolpathLayerData, Lib3MF_uint32 nProfileID, Lib3MF_uint32 nPartID, bool bWriteCustomLineAttributes, Lib3MF_uint64 nHatchDataBufferSize, const sLib3MFDiscreteHatch2D * pHatchDataBuffer) +{ + IBase* pIBaseClass = (IBase *)pToolpathLayerData; + + PLib3MFInterfaceJournalEntry pJournalEntry; + try { + if (m_GlobalJournal.get() != nullptr) { + pJournalEntry = m_GlobalJournal->beginClassMethod(pToolpathLayerData, "ToolpathLayerData", "WriteHatchDataDiscrete"); + pJournalEntry->addUInt32Parameter("ProfileID", nProfileID); + pJournalEntry->addUInt32Parameter("PartID", nPartID); + pJournalEntry->addBooleanParameter("WriteCustomLineAttributes", bWriteCustomLineAttributes); + } + if ( (!pHatchDataBuffer) && (nHatchDataBufferSize>0)) + throw ELib3MFInterfaceException (LIB3MF_ERROR_INVALIDPARAM); + IToolpathLayerData* pIToolpathLayerData = dynamic_cast(pIBaseClass); + if (!pIToolpathLayerData) + throw ELib3MFInterfaceException(LIB3MF_ERROR_INVALIDCAST); + + pIToolpathLayerData->WriteHatchDataDiscrete(nProfileID, nPartID, bWriteCustomLineAttributes, nHatchDataBufferSize, pHatchDataBuffer); + + 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_toolpathlayerdata_writeloopinmodelunits(Lib3MF_ToolpathLayerData pToolpathLayerData, Lib3MF_uint32 nProfileID, Lib3MF_uint32 nPartID, bool bWriteCustomLineAttributes, Lib3MF_uint64 nPointDataBufferSize, const sLib3MFPosition2D * pPointDataBuffer) { IBase* pIBaseClass = (IBase *)pToolpathLayerData; PLib3MFInterfaceJournalEntry pJournalEntry; try { if (m_GlobalJournal.get() != nullptr) { - pJournalEntry = m_GlobalJournal->beginClassMethod(pToolpathLayerData, "ToolpathLayerData", "WriteHatchData"); + pJournalEntry = m_GlobalJournal->beginClassMethod(pToolpathLayerData, "ToolpathLayerData", "WriteLoopInModelUnits"); pJournalEntry->addUInt32Parameter("ProfileID", nProfileID); pJournalEntry->addUInt32Parameter("PartID", nPartID); + pJournalEntry->addBooleanParameter("WriteCustomLineAttributes", bWriteCustomLineAttributes); } if ( (!pPointDataBuffer) && (nPointDataBufferSize>0)) throw ELib3MFInterfaceException (LIB3MF_ERROR_INVALIDPARAM); @@ -12881,7 +13060,7 @@ Lib3MFResult lib3mf_toolpathlayerdata_writehatchdata(Lib3MF_ToolpathLayerData pT if (!pIToolpathLayerData) throw ELib3MFInterfaceException(LIB3MF_ERROR_INVALIDCAST); - pIToolpathLayerData->WriteHatchData(nProfileID, nPartID, nPointDataBufferSize, pPointDataBuffer); + pIToolpathLayerData->WriteLoopInModelUnits(nProfileID, nPartID, bWriteCustomLineAttributes, nPointDataBufferSize, pPointDataBuffer); if (pJournalEntry.get() != nullptr) { pJournalEntry->writeSuccess(); @@ -12899,16 +13078,17 @@ Lib3MFResult lib3mf_toolpathlayerdata_writehatchdata(Lib3MF_ToolpathLayerData pT } } -Lib3MFResult lib3mf_toolpathlayerdata_writeloop(Lib3MF_ToolpathLayerData pToolpathLayerData, Lib3MF_uint32 nProfileID, Lib3MF_uint32 nPartID, Lib3MF_uint64 nPointDataBufferSize, const sLib3MFPosition2D * pPointDataBuffer) +Lib3MFResult lib3mf_toolpathlayerdata_writeloopdiscrete(Lib3MF_ToolpathLayerData pToolpathLayerData, Lib3MF_uint32 nProfileID, Lib3MF_uint32 nPartID, bool bWriteCustomLineAttributes, Lib3MF_uint64 nPointDataBufferSize, const sLib3MFDiscretePosition2D * pPointDataBuffer) { IBase* pIBaseClass = (IBase *)pToolpathLayerData; PLib3MFInterfaceJournalEntry pJournalEntry; try { if (m_GlobalJournal.get() != nullptr) { - pJournalEntry = m_GlobalJournal->beginClassMethod(pToolpathLayerData, "ToolpathLayerData", "WriteLoop"); + pJournalEntry = m_GlobalJournal->beginClassMethod(pToolpathLayerData, "ToolpathLayerData", "WriteLoopDiscrete"); pJournalEntry->addUInt32Parameter("ProfileID", nProfileID); pJournalEntry->addUInt32Parameter("PartID", nPartID); + pJournalEntry->addBooleanParameter("WriteCustomLineAttributes", bWriteCustomLineAttributes); } if ( (!pPointDataBuffer) && (nPointDataBufferSize>0)) throw ELib3MFInterfaceException (LIB3MF_ERROR_INVALIDPARAM); @@ -12916,7 +13096,7 @@ Lib3MFResult lib3mf_toolpathlayerdata_writeloop(Lib3MF_ToolpathLayerData pToolpa if (!pIToolpathLayerData) throw ELib3MFInterfaceException(LIB3MF_ERROR_INVALIDCAST); - pIToolpathLayerData->WriteLoop(nProfileID, nPartID, nPointDataBufferSize, pPointDataBuffer); + pIToolpathLayerData->WriteLoopDiscrete(nProfileID, nPartID, bWriteCustomLineAttributes, nPointDataBufferSize, pPointDataBuffer); if (pJournalEntry.get() != nullptr) { pJournalEntry->writeSuccess(); @@ -12934,16 +13114,17 @@ Lib3MFResult lib3mf_toolpathlayerdata_writeloop(Lib3MF_ToolpathLayerData pToolpa } } -Lib3MFResult lib3mf_toolpathlayerdata_writepolyline(Lib3MF_ToolpathLayerData pToolpathLayerData, Lib3MF_uint32 nProfileID, Lib3MF_uint32 nPartID, Lib3MF_uint64 nPointDataBufferSize, const sLib3MFPosition2D * pPointDataBuffer) +Lib3MFResult lib3mf_toolpathlayerdata_writepolylineinmodelunits(Lib3MF_ToolpathLayerData pToolpathLayerData, Lib3MF_uint32 nProfileID, Lib3MF_uint32 nPartID, bool bWriteCustomLineAttributes, Lib3MF_uint64 nPointDataBufferSize, const sLib3MFPosition2D * pPointDataBuffer) { IBase* pIBaseClass = (IBase *)pToolpathLayerData; PLib3MFInterfaceJournalEntry pJournalEntry; try { if (m_GlobalJournal.get() != nullptr) { - pJournalEntry = m_GlobalJournal->beginClassMethod(pToolpathLayerData, "ToolpathLayerData", "WritePolyline"); + pJournalEntry = m_GlobalJournal->beginClassMethod(pToolpathLayerData, "ToolpathLayerData", "WritePolylineInModelUnits"); pJournalEntry->addUInt32Parameter("ProfileID", nProfileID); pJournalEntry->addUInt32Parameter("PartID", nPartID); + pJournalEntry->addBooleanParameter("WriteCustomLineAttributes", bWriteCustomLineAttributes); } if ( (!pPointDataBuffer) && (nPointDataBufferSize>0)) throw ELib3MFInterfaceException (LIB3MF_ERROR_INVALIDPARAM); @@ -12951,7 +13132,43 @@ Lib3MFResult lib3mf_toolpathlayerdata_writepolyline(Lib3MF_ToolpathLayerData pTo if (!pIToolpathLayerData) throw ELib3MFInterfaceException(LIB3MF_ERROR_INVALIDCAST); - pIToolpathLayerData->WritePolyline(nProfileID, nPartID, nPointDataBufferSize, pPointDataBuffer); + pIToolpathLayerData->WritePolylineInModelUnits(nProfileID, nPartID, bWriteCustomLineAttributes, nPointDataBufferSize, pPointDataBuffer); + + 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_toolpathlayerdata_writepolylinediscrete(Lib3MF_ToolpathLayerData pToolpathLayerData, Lib3MF_uint32 nProfileID, Lib3MF_uint32 nPartID, bool bWriteCustomLineAttributes, Lib3MF_uint64 nPointDataBufferSize, const sLib3MFDiscretePosition2D * pPointDataBuffer) +{ + IBase* pIBaseClass = (IBase *)pToolpathLayerData; + + PLib3MFInterfaceJournalEntry pJournalEntry; + try { + if (m_GlobalJournal.get() != nullptr) { + pJournalEntry = m_GlobalJournal->beginClassMethod(pToolpathLayerData, "ToolpathLayerData", "WritePolylineDiscrete"); + pJournalEntry->addUInt32Parameter("ProfileID", nProfileID); + pJournalEntry->addUInt32Parameter("PartID", nPartID); + pJournalEntry->addBooleanParameter("WriteCustomLineAttributes", bWriteCustomLineAttributes); + } + if ( (!pPointDataBuffer) && (nPointDataBufferSize>0)) + throw ELib3MFInterfaceException (LIB3MF_ERROR_INVALIDPARAM); + IToolpathLayerData* pIToolpathLayerData = dynamic_cast(pIBaseClass); + if (!pIToolpathLayerData) + throw ELib3MFInterfaceException(LIB3MF_ERROR_INVALIDCAST); + + pIToolpathLayerData->WritePolylineDiscrete(nProfileID, nPartID, bWriteCustomLineAttributes, nPointDataBufferSize, pPointDataBuffer); if (pJournalEntry.get() != nullptr) { pJournalEntry->writeSuccess(); @@ -13048,6 +13265,118 @@ Lib3MFResult lib3mf_toolpathlayerdata_finish(Lib3MF_ToolpathLayerData pToolpathL /************************************************************************************************************************* Class implementation for Toolpath **************************************************************************************************************************/ +Lib3MFResult lib3mf_toolpath_getuuid(Lib3MF_Toolpath pToolpath, const Lib3MF_uint32 nUUIDBufferSize, Lib3MF_uint32* pUUIDNeededChars, char * pUUIDBuffer) +{ + IBase* pIBaseClass = (IBase *)pToolpath; + + PLib3MFInterfaceJournalEntry pJournalEntry; + try { + if (m_GlobalJournal.get() != nullptr) { + pJournalEntry = m_GlobalJournal->beginClassMethod(pToolpath, "Toolpath", "GetUUID"); + } + if ( (!pUUIDBuffer) && !(pUUIDNeededChars) ) + throw ELib3MFInterfaceException (LIB3MF_ERROR_INVALIDPARAM); + std::string sUUID(""); + IToolpath* pIToolpath = dynamic_cast(pIBaseClass); + if (!pIToolpath) + throw ELib3MFInterfaceException(LIB3MF_ERROR_INVALIDCAST); + + bool isCacheCall = (pUUIDBuffer == nullptr); + if (isCacheCall) { + sUUID = pIToolpath->GetUUID(); + + pIToolpath->_setCache (new ParameterCache_1 (sUUID)); + } + else { + auto cache = dynamic_cast*> (pIToolpath->_getCache ()); + if (cache == nullptr) + throw ELib3MFInterfaceException(LIB3MF_ERROR_INVALIDCAST); + cache->retrieveData (sUUID); + pIToolpath->_setCache (nullptr); + } + + if (pUUIDNeededChars) + *pUUIDNeededChars = (Lib3MF_uint32) (sUUID.size()+1); + if (pUUIDBuffer) { + if (sUUID.size() >= nUUIDBufferSize) + throw ELib3MFInterfaceException (LIB3MF_ERROR_BUFFERTOOSMALL); + for (size_t iUUID = 0; iUUID < sUUID.size(); iUUID++) + pUUIDBuffer[iUUID] = sUUID[iUUID]; + pUUIDBuffer[sUUID.size()] = 0; + } + if (pJournalEntry.get() != nullptr) { + pJournalEntry->addStringResult("UUID", sUUID.c_str()); + pJournalEntry->writeSuccess(); + } + return LIB3MF_SUCCESS; + } + catch (ELib3MFInterfaceException & Exception) { + return handleLib3MFException(pIBaseClass, Exception, pJournalEntry.get()); + } + catch (std::exception & StdException) { + return handleStdException(pIBaseClass, StdException, pJournalEntry.get()); + } + catch (...) { + return handleUnhandledException(pIBaseClass, pJournalEntry.get()); + } +} + +Lib3MFResult lib3mf_toolpath_resetuuid(Lib3MF_Toolpath pToolpath, const Lib3MF_uint32 nNewUUIDBufferSize, Lib3MF_uint32* pNewUUIDNeededChars, char * pNewUUIDBuffer) +{ + IBase* pIBaseClass = (IBase *)pToolpath; + + PLib3MFInterfaceJournalEntry pJournalEntry; + try { + if (m_GlobalJournal.get() != nullptr) { + pJournalEntry = m_GlobalJournal->beginClassMethod(pToolpath, "Toolpath", "ResetUUID"); + } + if ( (!pNewUUIDBuffer) && !(pNewUUIDNeededChars) ) + throw ELib3MFInterfaceException (LIB3MF_ERROR_INVALIDPARAM); + std::string sNewUUID(""); + IToolpath* pIToolpath = dynamic_cast(pIBaseClass); + if (!pIToolpath) + throw ELib3MFInterfaceException(LIB3MF_ERROR_INVALIDCAST); + + bool isCacheCall = (pNewUUIDBuffer == nullptr); + if (isCacheCall) { + sNewUUID = pIToolpath->ResetUUID(); + + pIToolpath->_setCache (new ParameterCache_1 (sNewUUID)); + } + else { + auto cache = dynamic_cast*> (pIToolpath->_getCache ()); + if (cache == nullptr) + throw ELib3MFInterfaceException(LIB3MF_ERROR_INVALIDCAST); + cache->retrieveData (sNewUUID); + pIToolpath->_setCache (nullptr); + } + + if (pNewUUIDNeededChars) + *pNewUUIDNeededChars = (Lib3MF_uint32) (sNewUUID.size()+1); + if (pNewUUIDBuffer) { + if (sNewUUID.size() >= nNewUUIDBufferSize) + throw ELib3MFInterfaceException (LIB3MF_ERROR_BUFFERTOOSMALL); + for (size_t iNewUUID = 0; iNewUUID < sNewUUID.size(); iNewUUID++) + pNewUUIDBuffer[iNewUUID] = sNewUUID[iNewUUID]; + pNewUUIDBuffer[sNewUUID.size()] = 0; + } + if (pJournalEntry.get() != nullptr) { + pJournalEntry->addStringResult("NewUUID", sNewUUID.c_str()); + pJournalEntry->writeSuccess(); + } + return LIB3MF_SUCCESS; + } + catch (ELib3MFInterfaceException & Exception) { + return handleLib3MFException(pIBaseClass, Exception, pJournalEntry.get()); + } + catch (std::exception & StdException) { + return handleStdException(pIBaseClass, StdException, pJournalEntry.get()); + } + catch (...) { + return handleUnhandledException(pIBaseClass, pJournalEntry.get()); + } +} + Lib3MFResult lib3mf_toolpath_getunits(Lib3MF_Toolpath pToolpath, Lib3MF_double * pUnits) { IBase* pIBaseClass = (IBase *)pToolpath; @@ -13429,26 +13758,95 @@ Lib3MFResult lib3mf_toolpath_getlayerzmax(Lib3MF_Toolpath pToolpath, Lib3MF_uint } } -Lib3MFResult lib3mf_toolpath_getlayerz(Lib3MF_Toolpath pToolpath, Lib3MF_uint32 nLayerIndex, Lib3MF_uint32 * pZValue) +Lib3MFResult lib3mf_toolpath_getlayerzmin(Lib3MF_Toolpath pToolpath, Lib3MF_uint32 nIndex, Lib3MF_uint32 * pZMin) { IBase* pIBaseClass = (IBase *)pToolpath; PLib3MFInterfaceJournalEntry pJournalEntry; try { if (m_GlobalJournal.get() != nullptr) { - pJournalEntry = m_GlobalJournal->beginClassMethod(pToolpath, "Toolpath", "GetLayerZ"); - pJournalEntry->addUInt32Parameter("LayerIndex", nLayerIndex); + pJournalEntry = m_GlobalJournal->beginClassMethod(pToolpath, "Toolpath", "GetLayerZMin"); + pJournalEntry->addUInt32Parameter("Index", nIndex); + } + if (pZMin == nullptr) + throw ELib3MFInterfaceException (LIB3MF_ERROR_INVALIDPARAM); + IToolpath* pIToolpath = dynamic_cast(pIBaseClass); + if (!pIToolpath) + throw ELib3MFInterfaceException(LIB3MF_ERROR_INVALIDCAST); + + *pZMin = pIToolpath->GetLayerZMin(nIndex); + + if (pJournalEntry.get() != nullptr) { + pJournalEntry->addUInt32Result("ZMin", *pZMin); + 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_toolpath_getlayerthickness(Lib3MF_Toolpath pToolpath, Lib3MF_uint32 nIndex, Lib3MF_uint32 * pZThickness) +{ + IBase* pIBaseClass = (IBase *)pToolpath; + + PLib3MFInterfaceJournalEntry pJournalEntry; + try { + if (m_GlobalJournal.get() != nullptr) { + pJournalEntry = m_GlobalJournal->beginClassMethod(pToolpath, "Toolpath", "GetLayerThickness"); + pJournalEntry->addUInt32Parameter("Index", nIndex); + } + if (pZThickness == nullptr) + throw ELib3MFInterfaceException (LIB3MF_ERROR_INVALIDPARAM); + IToolpath* pIToolpath = dynamic_cast(pIBaseClass); + if (!pIToolpath) + throw ELib3MFInterfaceException(LIB3MF_ERROR_INVALIDCAST); + + *pZThickness = pIToolpath->GetLayerThickness(nIndex); + + if (pJournalEntry.get() != nullptr) { + pJournalEntry->addUInt32Result("ZThickness", *pZThickness); + 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_toolpath_hasuniformthickness(Lib3MF_Toolpath pToolpath, bool * pUniformThickness) +{ + IBase* pIBaseClass = (IBase *)pToolpath; + + PLib3MFInterfaceJournalEntry pJournalEntry; + try { + if (m_GlobalJournal.get() != nullptr) { + pJournalEntry = m_GlobalJournal->beginClassMethod(pToolpath, "Toolpath", "HasUniformThickness"); } - if (pZValue == nullptr) + if (pUniformThickness == nullptr) throw ELib3MFInterfaceException (LIB3MF_ERROR_INVALIDPARAM); IToolpath* pIToolpath = dynamic_cast(pIBaseClass); if (!pIToolpath) throw ELib3MFInterfaceException(LIB3MF_ERROR_INVALIDCAST); - *pZValue = pIToolpath->GetLayerZ(nLayerIndex); + *pUniformThickness = pIToolpath->HasUniformThickness(); if (pJournalEntry.get() != nullptr) { - pJournalEntry->addUInt32Result("ZValue", *pZValue); + pJournalEntry->addBooleanResult("UniformThickness", *pUniformThickness); pJournalEntry->writeSuccess(); } return LIB3MF_SUCCESS; @@ -13966,14 +14364,14 @@ Lib3MFResult lib3mf_toolpath_deletecustomdata(Lib3MF_Toolpath pToolpath, Lib3MF_ } } -Lib3MFResult lib3mf_toolpath_registercustomintegerattribute(Lib3MF_Toolpath pToolpath, const char * pNameSpace, const char * pAttributeName) +Lib3MFResult lib3mf_toolpath_registercustomintegersegmentattribute(Lib3MF_Toolpath pToolpath, const char * pNameSpace, const char * pAttributeName) { IBase* pIBaseClass = (IBase *)pToolpath; PLib3MFInterfaceJournalEntry pJournalEntry; try { if (m_GlobalJournal.get() != nullptr) { - pJournalEntry = m_GlobalJournal->beginClassMethod(pToolpath, "Toolpath", "RegisterCustomIntegerAttribute"); + pJournalEntry = m_GlobalJournal->beginClassMethod(pToolpath, "Toolpath", "RegisterCustomIntegerSegmentAttribute"); pJournalEntry->addStringParameter("NameSpace", pNameSpace); pJournalEntry->addStringParameter("AttributeName", pAttributeName); } @@ -13987,7 +14385,7 @@ Lib3MFResult lib3mf_toolpath_registercustomintegerattribute(Lib3MF_Toolpath pToo if (!pIToolpath) throw ELib3MFInterfaceException(LIB3MF_ERROR_INVALIDCAST); - pIToolpath->RegisterCustomIntegerAttribute(sNameSpace, sAttributeName); + pIToolpath->RegisterCustomIntegerSegmentAttribute(sNameSpace, sAttributeName); if (pJournalEntry.get() != nullptr) { pJournalEntry->writeSuccess(); @@ -14005,14 +14403,14 @@ Lib3MFResult lib3mf_toolpath_registercustomintegerattribute(Lib3MF_Toolpath pToo } } -Lib3MFResult lib3mf_toolpath_registercustomdoubleattribute(Lib3MF_Toolpath pToolpath, const char * pNameSpace, const char * pAttributeName) +Lib3MFResult lib3mf_toolpath_registercustomdoublesegmentattribute(Lib3MF_Toolpath pToolpath, const char * pNameSpace, const char * pAttributeName) { IBase* pIBaseClass = (IBase *)pToolpath; PLib3MFInterfaceJournalEntry pJournalEntry; try { if (m_GlobalJournal.get() != nullptr) { - pJournalEntry = m_GlobalJournal->beginClassMethod(pToolpath, "Toolpath", "RegisterCustomDoubleAttribute"); + pJournalEntry = m_GlobalJournal->beginClassMethod(pToolpath, "Toolpath", "RegisterCustomDoubleSegmentAttribute"); pJournalEntry->addStringParameter("NameSpace", pNameSpace); pJournalEntry->addStringParameter("AttributeName", pAttributeName); } @@ -14026,7 +14424,7 @@ Lib3MFResult lib3mf_toolpath_registercustomdoubleattribute(Lib3MF_Toolpath pTool if (!pIToolpath) throw ELib3MFInterfaceException(LIB3MF_ERROR_INVALIDCAST); - pIToolpath->RegisterCustomDoubleAttribute(sNameSpace, sAttributeName); + pIToolpath->RegisterCustomDoubleSegmentAttribute(sNameSpace, sAttributeName); if (pJournalEntry.get() != nullptr) { pJournalEntry->writeSuccess(); @@ -19196,8 +19594,10 @@ Lib3MFResult Lib3MF::Impl::Lib3MF_GetProcAddress (const char * pProcName, void * *ppProcAddress = (void*) &lib3mf_toolpathlayerreader_getsegmentlocalpartid; if (sProcName == "lib3mf_toolpathlayerreader_getpartuuidbylocalpartid") *ppProcAddress = (void*) &lib3mf_toolpathlayerreader_getpartuuidbylocalpartid; - if (sProcName == "lib3mf_toolpathlayerreader_getsegmentpointdata") - *ppProcAddress = (void*) &lib3mf_toolpathlayerreader_getsegmentpointdata; + if (sProcName == "lib3mf_toolpathlayerreader_getsegmentpointdatainmodelunits") + *ppProcAddress = (void*) &lib3mf_toolpathlayerreader_getsegmentpointdatainmodelunits; + if (sProcName == "lib3mf_toolpathlayerreader_getsegmentpointdatadiscrete") + *ppProcAddress = (void*) &lib3mf_toolpathlayerreader_getsegmentpointdatadiscrete; if (sProcName == "lib3mf_toolpathlayerreader_findattributeinfobyname") *ppProcAddress = (void*) &lib3mf_toolpathlayerreader_findattributeinfobyname; if (sProcName == "lib3mf_toolpathlayerreader_findattributeidbyname") @@ -19228,16 +19628,30 @@ Lib3MFResult Lib3MF::Impl::Lib3MF_GetProcAddress (const char * pProcName, void * *ppProcAddress = (void*) &lib3mf_toolpathlayerdata_setsegmentattribute; if (sProcName == "lib3mf_toolpathlayerdata_clearsegmentattributes") *ppProcAddress = (void*) &lib3mf_toolpathlayerdata_clearsegmentattributes; - if (sProcName == "lib3mf_toolpathlayerdata_writehatchdata") - *ppProcAddress = (void*) &lib3mf_toolpathlayerdata_writehatchdata; - if (sProcName == "lib3mf_toolpathlayerdata_writeloop") - *ppProcAddress = (void*) &lib3mf_toolpathlayerdata_writeloop; - if (sProcName == "lib3mf_toolpathlayerdata_writepolyline") - *ppProcAddress = (void*) &lib3mf_toolpathlayerdata_writepolyline; + if (sProcName == "lib3mf_toolpathlayerdata_addcustomlineattributes") + *ppProcAddress = (void*) &lib3mf_toolpathlayerdata_addcustomlineattributes; + if (sProcName == "lib3mf_toolpathlayerdata_clearcustomlineattributes") + *ppProcAddress = (void*) &lib3mf_toolpathlayerdata_clearcustomlineattributes; + if (sProcName == "lib3mf_toolpathlayerdata_writehatchdatainmodelunits") + *ppProcAddress = (void*) &lib3mf_toolpathlayerdata_writehatchdatainmodelunits; + if (sProcName == "lib3mf_toolpathlayerdata_writehatchdatadiscrete") + *ppProcAddress = (void*) &lib3mf_toolpathlayerdata_writehatchdatadiscrete; + if (sProcName == "lib3mf_toolpathlayerdata_writeloopinmodelunits") + *ppProcAddress = (void*) &lib3mf_toolpathlayerdata_writeloopinmodelunits; + if (sProcName == "lib3mf_toolpathlayerdata_writeloopdiscrete") + *ppProcAddress = (void*) &lib3mf_toolpathlayerdata_writeloopdiscrete; + if (sProcName == "lib3mf_toolpathlayerdata_writepolylineinmodelunits") + *ppProcAddress = (void*) &lib3mf_toolpathlayerdata_writepolylineinmodelunits; + if (sProcName == "lib3mf_toolpathlayerdata_writepolylinediscrete") + *ppProcAddress = (void*) &lib3mf_toolpathlayerdata_writepolylinediscrete; if (sProcName == "lib3mf_toolpathlayerdata_addcustomdata") *ppProcAddress = (void*) &lib3mf_toolpathlayerdata_addcustomdata; if (sProcName == "lib3mf_toolpathlayerdata_finish") *ppProcAddress = (void*) &lib3mf_toolpathlayerdata_finish; + if (sProcName == "lib3mf_toolpath_getuuid") + *ppProcAddress = (void*) &lib3mf_toolpath_getuuid; + if (sProcName == "lib3mf_toolpath_resetuuid") + *ppProcAddress = (void*) &lib3mf_toolpath_resetuuid; if (sProcName == "lib3mf_toolpath_getunits") *ppProcAddress = (void*) &lib3mf_toolpath_getunits; if (sProcName == "lib3mf_toolpath_getlayercount") @@ -19258,8 +19672,12 @@ Lib3MFResult Lib3MF::Impl::Lib3MF_GetProcAddress (const char * pProcName, void * *ppProcAddress = (void*) &lib3mf_toolpath_getlayerpath; if (sProcName == "lib3mf_toolpath_getlayerzmax") *ppProcAddress = (void*) &lib3mf_toolpath_getlayerzmax; - if (sProcName == "lib3mf_toolpath_getlayerz") - *ppProcAddress = (void*) &lib3mf_toolpath_getlayerz; + if (sProcName == "lib3mf_toolpath_getlayerzmin") + *ppProcAddress = (void*) &lib3mf_toolpath_getlayerzmin; + if (sProcName == "lib3mf_toolpath_getlayerthickness") + *ppProcAddress = (void*) &lib3mf_toolpath_getlayerthickness; + if (sProcName == "lib3mf_toolpath_hasuniformthickness") + *ppProcAddress = (void*) &lib3mf_toolpath_hasuniformthickness; if (sProcName == "lib3mf_toolpath_addprofile") *ppProcAddress = (void*) &lib3mf_toolpath_addprofile; if (sProcName == "lib3mf_toolpath_getprofile") @@ -19284,10 +19702,10 @@ Lib3MFResult Lib3MF::Impl::Lib3MF_GetProcAddress (const char * pProcName, void * *ppProcAddress = (void*) &lib3mf_toolpath_clearcustomdata; if (sProcName == "lib3mf_toolpath_deletecustomdata") *ppProcAddress = (void*) &lib3mf_toolpath_deletecustomdata; - if (sProcName == "lib3mf_toolpath_registercustomintegerattribute") - *ppProcAddress = (void*) &lib3mf_toolpath_registercustomintegerattribute; - if (sProcName == "lib3mf_toolpath_registercustomdoubleattribute") - *ppProcAddress = (void*) &lib3mf_toolpath_registercustomdoubleattribute; + if (sProcName == "lib3mf_toolpath_registercustomintegersegmentattribute") + *ppProcAddress = (void*) &lib3mf_toolpath_registercustomintegersegmentattribute; + if (sProcName == "lib3mf_toolpath_registercustomdoublesegmentattribute") + *ppProcAddress = (void*) &lib3mf_toolpath_registercustomdoublesegmentattribute; if (sProcName == "lib3mf_toolpathiterator_getcurrenttoolpath") *ppProcAddress = (void*) &lib3mf_toolpathiterator_getcurrenttoolpath; if (sProcName == "lib3mf_slicestack_getbottomz") diff --git a/Autogenerated/Source/lib3mf_types.hpp b/Autogenerated/Source/lib3mf_types.hpp index d7b8241ca..1388fa59f 100644 --- a/Autogenerated/Source/lib3mf_types.hpp +++ b/Autogenerated/Source/lib3mf_types.hpp @@ -150,6 +150,9 @@ typedef void * Lib3MF_pvoid; #define LIB3MF_ERROR_EMPTYNAMESPACE 4007 /** Empty namespace. */ #define LIB3MF_ERROR_INVALIDNAMESPACEPREFIX 4008 /** Invalid namespace prefix. */ #define LIB3MF_ERROR_WRITERDOESNOTSUPPORTNAMESPACES 4009 /** Writer does not support namespaces. */ +#define LIB3MF_ERROR_TOOLPATH_INVALIDHATCHCOORDINATE 4010 /** Invalid hatch coordinate. */ +#define LIB3MF_ERROR_TOOLPATH_INVALIDPOINTCOORDINATE 4011 /** Invalid point coordinate. */ +#define LIB3MF_ERROR_TOOLPATH_INVALIDHATCHCOUNT 4012 /** Invalid hatch count */ /************************************************************************************************************************* Error strings for Lib3MF @@ -215,6 +218,9 @@ inline const char * LIB3MF_GETERRORSTRING (Lib3MFResult nErrorCode) { case LIB3MF_ERROR_EMPTYNAMESPACE: return "Empty namespace."; case LIB3MF_ERROR_INVALIDNAMESPACEPREFIX: return "Invalid namespace prefix."; case LIB3MF_ERROR_WRITERDOESNOTSUPPORTNAMESPACES: return "Writer does not support namespaces."; + case LIB3MF_ERROR_TOOLPATH_INVALIDHATCHCOORDINATE: return "Invalid hatch coordinate."; + case LIB3MF_ERROR_TOOLPATH_INVALIDPOINTCOORDINATE: return "Invalid point coordinate."; + case LIB3MF_ERROR_TOOLPATH_INVALIDHATCHCOUNT: return "Invalid hatch count"; default: return "unknown error"; } } @@ -457,6 +463,20 @@ namespace Lib3MF { Lib3MF_single m_Coordinates[2]; } sPosition2D; + typedef struct sDiscretePosition2D { + Lib3MF_int32 m_Coordinates[2]; + } sDiscretePosition2D; + + typedef struct sHatch2D { + Lib3MF_single m_Point1Coordinates[2]; + Lib3MF_single m_Point2Coordinates[2]; + } sHatch2D; + + typedef struct sDiscreteHatch2D { + Lib3MF_int32 m_Point1Coordinates[2]; + Lib3MF_int32 m_Point2Coordinates[2]; + } sDiscreteHatch2D; + typedef struct sCompositeConstituent { Lib3MF_uint32 m_PropertyID; Lib3MF_double m_MixingRatio; @@ -607,6 +627,9 @@ typedef Lib3MF::sTriangle sLib3MFTriangle; typedef Lib3MF::sTriangleProperties sLib3MFTriangleProperties; typedef Lib3MF::sPosition sLib3MFPosition; typedef Lib3MF::sPosition2D sLib3MFPosition2D; +typedef Lib3MF::sDiscretePosition2D sLib3MFDiscretePosition2D; +typedef Lib3MF::sHatch2D sLib3MFHatch2D; +typedef Lib3MF::sDiscreteHatch2D sLib3MFDiscreteHatch2D; typedef Lib3MF::sCompositeConstituent sLib3MFCompositeConstituent; typedef Lib3MF::sMultiPropertyLayer sLib3MFMultiPropertyLayer; typedef Lib3MF::sTex2Coord sLib3MFTex2Coord; diff --git a/AutomaticComponentToolkit/lib3mf.xml b/AutomaticComponentToolkit/lib3mf.xml index 41b094a58..e95b1c185 100644 --- a/AutomaticComponentToolkit/lib3mf.xml +++ b/AutomaticComponentToolkit/lib3mf.xml @@ -97,11 +97,17 @@ + + + + + + @@ -250,6 +256,20 @@ + + + + + + + + + + + + + + @@ -1675,9 +1695,14 @@ - + + + + + + - + @@ -1770,22 +1795,55 @@ - + + + + + + + + + + + + + + + + + + + + + + + + - + + - + - + + - + + + + + + + + - + + @@ -1802,7 +1860,15 @@ - + + + + + + + + + @@ -1815,21 +1881,21 @@ - + - + - + - + @@ -1847,14 +1913,23 @@ - + - - - + + + + + + + + + + + + @@ -1917,12 +1992,12 @@ - + - + diff --git a/Include/Common/NMR_ErrorConst.h b/Include/Common/NMR_ErrorConst.h index 4a21fb5e1..ddb3554f8 100644 --- a/Include/Common/NMR_ErrorConst.h +++ b/Include/Common/NMR_ErrorConst.h @@ -1592,4 +1592,7 @@ Toolpath errors (0xBXXX) // Cannot set bottom Z if layers exist #define NMR_ERROR_CANNOTSETBOTTOMZIFLAYERSEXIST 0xB00B +// Layer has not positive thickness +#define NMR_ERROR_LAYERHASNOTPOSITIVETHICKNESS 0XB00C + #endif // __NMR_ERRORCONST diff --git a/Include/Model/Classes/NMR_ModelToolpath.h b/Include/Model/Classes/NMR_ModelToolpath.h index d7eccc605..d1b96b4ae 100644 --- a/Include/Model/Classes/NMR_ModelToolpath.h +++ b/Include/Model/Classes/NMR_ModelToolpath.h @@ -89,6 +89,7 @@ namespace NMR { double getUnitFactor (); CUUID getUUID (); + void resetUUID(); uint32_t getCustomXMLDataCount(); PCustomXMLTree getCustomXMLData(uint32_t nIndex); diff --git a/Include/Model/Classes/NMR_ModelToolpathLayerReadData.h b/Include/Model/Classes/NMR_ModelToolpathLayerReadData.h index fd20ca677..9d0602dca 100644 --- a/Include/Model/Classes/NMR_ModelToolpathLayerReadData.h +++ b/Include/Model/Classes/NMR_ModelToolpathLayerReadData.h @@ -94,7 +94,7 @@ namespace NMR { int64_t* allocAttributeBuffer(uint32_t nEntryCount); - CPagedVector m_Points; + CPagedVector m_Points; TOOLPATHREADSEGMENT * m_pCurrentSegment; std::map m_UUIDMap; @@ -111,11 +111,11 @@ namespace NMR { void beginSegment(eModelToolpathSegmentType eType, nfUint32 nProfileID, nfUint32 nPartID); void endSegment(); - void addPoint (nfFloat fX, nfFloat fY); + void addDiscretePoint (nfInt32 nX, nfInt32 nY); nfUint32 getSegmentCount(); void getSegmentInfo (nfUint32 nSegmentIndex, eModelToolpathSegmentType & eType, nfUint32 & nProfileID, nfUint32 & nPartID, nfUint32 & nPointCount); - NVEC2 getSegmentPoint (nfUint32 nSegmentIndex, nfUint32 nPointIndex); + NVEC2I getSegmentPoint (nfUint32 nSegmentIndex, nfUint32 nPointIndex); void registerUUID (nfUint32 nID, std::string sUUID); std::string mapIDtoUUID(nfUint32 nID); @@ -132,7 +132,7 @@ namespace NMR { double getSegmentDoubleAttribute(nfUint32 nSegmentIndex, uint32_t nAttributeID); std::pair findAttribute(const std::string& sNameSpace, const std::string& sAttributeName, bool bMustExist); - + double getUnits(); }; diff --git a/Include/Model/ToolpathReader/NMR_ToolpathReaderNode_Hatch.h b/Include/Model/ToolpathReader/NMR_ToolpathReaderNode_Hatch.h index c96fa4daa..600335e5d 100644 --- a/Include/Model/ToolpathReader/NMR_ToolpathReaderNode_Hatch.h +++ b/Include/Model/ToolpathReader/NMR_ToolpathReaderNode_Hatch.h @@ -38,10 +38,10 @@ namespace NMR { class CToolpathReaderNode_Hatch : public CModelReaderNode { protected: - nfDouble m_dX1; - nfDouble m_dY1; - nfDouble m_dX2; - nfDouble m_dY2; + nfInt32 m_nX1; + nfInt32 m_nY1; + nfInt32 m_nX2; + nfInt32 m_nY2; nfBool m_bHasX1; nfBool m_bHasY1; @@ -60,10 +60,10 @@ namespace NMR { virtual void parseXML(_In_ CXmlReader * pXMLReader); - nfDouble getX1(); - nfDouble getY1(); - nfDouble getX2(); - nfDouble getY2(); + nfInt32 getX1(); + nfInt32 getY1(); + nfInt32 getX2(); + nfInt32 getY2(); }; typedef std::shared_ptr PToolpathReaderNode_Hatch; diff --git a/Include/Model/ToolpathReader/NMR_ToolpathReaderNode_Point.h b/Include/Model/ToolpathReader/NMR_ToolpathReaderNode_Point.h index 33f5ce6de..81935ceb0 100644 --- a/Include/Model/ToolpathReader/NMR_ToolpathReaderNode_Point.h +++ b/Include/Model/ToolpathReader/NMR_ToolpathReaderNode_Point.h @@ -39,8 +39,8 @@ namespace NMR { class CToolpathReaderNode_Point : public CModelReaderNode { protected: - nfDouble m_dX; - nfDouble m_dY; + nfInt32 m_nX; + nfInt32 m_nY; nfBool m_bHasX; nfBool m_bHasY; @@ -56,8 +56,8 @@ namespace NMR { virtual void parseXML(_In_ CXmlReader * pXMLReader); - nfDouble getX(); - nfDouble getY(); + nfInt32 getX(); + nfInt32 getY(); }; diff --git a/Source/API/lib3mf_toolpath.cpp b/Source/API/lib3mf_toolpath.cpp index ebf174a18..65a6d058f 100644 --- a/Source/API/lib3mf_toolpath.cpp +++ b/Source/API/lib3mf_toolpath.cpp @@ -58,6 +58,17 @@ CToolpath::CToolpath(NMR::PModelToolpath pToolpath) } +std::string CToolpath::GetUUID() +{ + return m_pToolpath->getUUID().toString (); +} + +std::string CToolpath::ResetUUID() +{ + m_pToolpath->resetUUID(); + return GetUUID(); +} + Lib3MF_double CToolpath::GetUnits() { @@ -74,11 +85,6 @@ Lib3MF_uint32 CToolpath::GetProfileCount() return m_pToolpath->getProfileCount(); } -Lib3MF_uint32 CToolpath::GetLayerZ(const Lib3MF_uint32 nLayerIndex) -{ - auto pLayer = m_pToolpath->getLayer(nLayerIndex); - return pLayer->getMaxZ(); -} Lib3MF_uint32 CToolpath::GetBottomZ() { @@ -169,6 +175,41 @@ Lib3MF_uint32 CToolpath::GetLayerZMax(const Lib3MF_uint32 nIndex) return pLayer->getMaxZ(); } +Lib3MF_uint32 CToolpath::GetLayerZMin(const Lib3MF_uint32 nIndex) +{ + if (nIndex > 0) { + auto pLayer = m_pToolpath->getLayer(nIndex - 1); + return pLayer->getMaxZ(); + } + else + return m_pToolpath->getBottomZ(); +} + +Lib3MF_uint32 CToolpath::GetLayerThickness(const Lib3MF_uint32 nIndex) +{ + uint32_t nZMax = GetLayerZMax(nIndex); + uint32_t nZMin = GetLayerZMin(nIndex); + + if (nZMin >= nZMax) + throw NMR::CNMRException(NMR_ERROR_LAYERHASNOTPOSITIVETHICKNESS); + + return (uint32_t)(nZMax - nZMin); +} + +bool CToolpath::HasUniformThickness() +{ + uint32_t nLayerCount = m_pToolpath->getLayerCount(); + if (nLayerCount == 0) + return false; + + uint32_t nLayerThickness = GetLayerThickness(0); + for (uint32_t nLayerIndex = 1; nLayerIndex < nLayerCount; nLayerIndex++) + if (nLayerThickness != GetLayerThickness(nLayerIndex)) + return false; + + return true; +} + IToolpathLayerReader* CToolpath::ReadLayerData(const Lib3MF_uint32 nIndex) { @@ -278,7 +319,7 @@ bool CToolpath::DeleteCustomData(ICustomDOMTree* pData) return m_pToolpath->deleteCustomXMLData (pDataInstance->getXMLTreeInstance ().get ()); } -void CToolpath::RegisterCustomIntegerAttribute(const std::string& sNameSpace, const std::string& sAttributeName) +void CToolpath::RegisterCustomIntegerSegmentAttribute(const std::string& sNameSpace, const std::string& sAttributeName) { auto key = std::make_pair(sNameSpace, sAttributeName); auto iIter = m_RegisteredAttributes.find (key); @@ -289,7 +330,7 @@ void CToolpath::RegisterCustomIntegerAttribute(const std::string& sNameSpace, co m_RegisteredAttributes.insert(std::make_pair (key, NMR::eModelToolpathSegmentAttributeType::SegmentAttributeInt64)); } -void CToolpath::RegisterCustomDoubleAttribute(const std::string& sNameSpace, const std::string& sAttributeName) +void CToolpath::RegisterCustomDoubleSegmentAttribute(const std::string& sNameSpace, const std::string& sAttributeName) { auto key = std::make_pair(sNameSpace, sAttributeName); auto iIter = m_RegisteredAttributes.find(key); @@ -300,3 +341,4 @@ void CToolpath::RegisterCustomDoubleAttribute(const std::string& sNameSpace, con m_RegisteredAttributes.insert(std::make_pair(key, NMR::eModelToolpathSegmentAttributeType::SegmentAttributeDouble)); } + diff --git a/Source/API/lib3mf_toolpath.hpp b/Source/API/lib3mf_toolpath.hpp index bc4238167..ac7409a18 100644 --- a/Source/API/lib3mf_toolpath.hpp +++ b/Source/API/lib3mf_toolpath.hpp @@ -62,6 +62,9 @@ class CToolpath : public virtual IToolpath, public virtual CResource { public: CToolpath(NMR::PModelToolpath pToolpath); + std::string GetUUID() override; + + std::string ResetUUID() override; Lib3MF_double GetUnits() override; @@ -83,7 +86,11 @@ class CToolpath : public virtual IToolpath, public virtual CResource { Lib3MF_uint32 GetLayerZMax(const Lib3MF_uint32 nIndex) override; - Lib3MF_uint32 GetLayerZ(const Lib3MF_uint32 nLayerIndex) override; + Lib3MF_uint32 GetLayerZMin(const Lib3MF_uint32 nIndex) override; + + Lib3MF_uint32 GetLayerThickness(const Lib3MF_uint32 nIndex) override; + + bool HasUniformThickness() override; IToolpathProfile * AddProfile(const std::string & sName) override; @@ -109,9 +116,9 @@ class CToolpath : public virtual IToolpath, public virtual CResource { bool DeleteCustomData(ICustomDOMTree* pData) override; - void RegisterCustomIntegerAttribute(const std::string& sNameSpace, const std::string& sAttributeName) override; + void RegisterCustomIntegerSegmentAttribute(const std::string& sNameSpace, const std::string& sAttributeName) override; - void RegisterCustomDoubleAttribute(const std::string& sNameSpace, const std::string& sAttributeName) override; + void RegisterCustomDoubleSegmentAttribute(const std::string& sNameSpace, const std::string& sAttributeName) override; }; diff --git a/Source/API/lib3mf_toolpathlayerdata.cpp b/Source/API/lib3mf_toolpathlayerdata.cpp index 6d4fce4be..9c0165b43 100644 --- a/Source/API/lib3mf_toolpathlayerdata.cpp +++ b/Source/API/lib3mf_toolpathlayerdata.cpp @@ -43,12 +43,16 @@ Abstract: This is a stub class definition of CToolpathLayerData #include "Common/Platform/NMR_XmlWriter_Native.h" #include "Model/Classes/NMR_ModelConstants.h" +#include + using namespace Lib3MF::Impl; /************************************************************************************************************************* Class definition of CToolpathLayerData **************************************************************************************************************************/ +#define LIB3MF_MINDISCRETECOORDINATE (-1024*1024*1024) +#define LIB3MF_MAXDISCRETECOORDINATE (+1024*1024*1024) #define LIB3MF_MAXTOOLPATHHATCHCOUNT 1024*1024*1024 #define LIB3MF_MAXTOOLPATHPOINTCOUNT 1024*1024*1024 @@ -106,23 +110,32 @@ ICustomDOMTree* CToolpathLayerData::AddCustomData(const std::string& sNameSpace, } -void CToolpathLayerData::WriteHatchData(const Lib3MF_uint32 nProfileID, const Lib3MF_uint32 nPartID, const Lib3MF_uint64 nPointDataBufferSize, const Lib3MF::sPosition2D* pPointDataBuffer) +void CToolpathLayerData::AddCustomLineAttributes(const std::string& sNameSpace, const std::string& sAttributeName, const Lib3MF_uint64 nValuesBufferSize, const Lib3MF_int32* pValuesBuffer) +{ + +} + +void CToolpathLayerData::ClearCustomLineAttributes() { - if (nPointDataBufferSize == 0) - throw ELib3MFInterfaceException(LIB3MF_ERROR_TOOLPATH_INVALIDPOINTCOUNT); - if (nPointDataBufferSize % 2 != 0) - throw ELib3MFInterfaceException(LIB3MF_ERROR_TOOLPATH_INVALIDPOINTCOUNT); - if (nPointDataBufferSize / 2 > LIB3MF_MAXTOOLPATHHATCHCOUNT) - throw ELib3MFInterfaceException(LIB3MF_ERROR_TOOLPATH_INVALIDPOINTCOUNT); - unsigned int nHatchCount = (unsigned int)nPointDataBufferSize / 2; +} + +void CToolpathLayerData::WriteHatchDataInModelUnits(const Lib3MF_uint32 nProfileID, const Lib3MF_uint32 nPartID, const bool bWriteCustomLineAttributes, const Lib3MF_uint64 nHatchDataBufferSize, const Lib3MF::sHatch2D* pHatchDataBuffer) +{ + if (nHatchDataBufferSize == 0) + throw ELib3MFInterfaceException(LIB3MF_ERROR_TOOLPATH_INVALIDHATCHCOUNT); + + if (nHatchDataBufferSize > LIB3MF_MAXTOOLPATHHATCHCOUNT) + throw ELib3MFInterfaceException(LIB3MF_ERROR_TOOLPATH_INVALIDHATCHCOUNT); + + unsigned int nHatchCount = (unsigned int)nHatchDataBufferSize; double dUnits = m_pLayerData->getUnits(); // If we have a streamwriter, write all points into a binary stream - std::vector X1Values; - std::vector Y1Values; - std::vector X2Values; - std::vector Y2Values; + std::vector X1Values; + std::vector Y1Values; + std::vector X2Values; + std::vector Y2Values; X1Values.resize(nHatchCount); Y1Values.resize(nHatchCount); @@ -130,21 +143,84 @@ void CToolpathLayerData::WriteHatchData(const Lib3MF_uint32 nProfileID, const Li Y2Values.resize(nHatchCount); unsigned nIndex; - const Lib3MF::sPosition2D* pPointData = pPointDataBuffer; + const Lib3MF::sHatch2D* pHatchData = pHatchDataBuffer; for (nIndex = 0; nIndex < nHatchCount; nIndex++) { - X1Values[nIndex] = (int)(pPointData->m_Coordinates[0] / dUnits); - Y1Values[nIndex] = (int)(pPointData->m_Coordinates[1] / dUnits); - pPointData++; - X2Values[nIndex] = (int)(pPointData->m_Coordinates[0] / dUnits); - Y2Values[nIndex] = (int)(pPointData->m_Coordinates[1] / dUnits); - pPointData++; + double dX1 = pHatchData->m_Point1Coordinates[0] / dUnits; + double dY1 = pHatchData->m_Point1Coordinates[1] / dUnits; + double dX2 = pHatchData->m_Point2Coordinates[0] / dUnits; + double dY2 = pHatchData->m_Point2Coordinates[1] / dUnits; + + if ((dX1 < LIB3MF_MINDISCRETECOORDINATE) || (dX1 > LIB3MF_MAXDISCRETECOORDINATE)) + throw ELib3MFInterfaceException(LIB3MF_ERROR_TOOLPATH_INVALIDHATCHCOORDINATE, "invalid hatch coordinate: " + std::to_string (pHatchData->m_Point1Coordinates[0]) + "/" + std::to_string(pHatchData->m_Point1Coordinates[1])); + if ((dY1 < LIB3MF_MINDISCRETECOORDINATE) || (dY1 > LIB3MF_MAXDISCRETECOORDINATE)) + throw ELib3MFInterfaceException(LIB3MF_ERROR_TOOLPATH_INVALIDHATCHCOORDINATE, "invalid hatch coordinate: " + std::to_string(pHatchData->m_Point1Coordinates[0]) + "/" + std::to_string(pHatchData->m_Point1Coordinates[1])); + if ((dX2 < LIB3MF_MINDISCRETECOORDINATE) || (dX2 > LIB3MF_MAXDISCRETECOORDINATE)) + throw ELib3MFInterfaceException(LIB3MF_ERROR_TOOLPATH_INVALIDHATCHCOORDINATE, "invalid hatch coordinate: " + std::to_string(pHatchData->m_Point2Coordinates[0]) + "/" + std::to_string(pHatchData->m_Point2Coordinates[1])); + if ((dY2 < LIB3MF_MINDISCRETECOORDINATE) || (dY2 > LIB3MF_MAXDISCRETECOORDINATE)) + throw ELib3MFInterfaceException(LIB3MF_ERROR_TOOLPATH_INVALIDHATCHCOORDINATE, "invalid hatch coordinate: " + std::to_string(pHatchData->m_Point2Coordinates[0]) + "/" + std::to_string(pHatchData->m_Point2Coordinates[1])); + + X1Values[nIndex] = (int32_t)round (dX1); + Y1Values[nIndex] = (int32_t)round (dY1); + X2Values[nIndex] = (int32_t)round (dX2); + Y2Values[nIndex] = (int32_t)round (dY2); + pHatchData++; + } + + m_pLayerData->WriteHatchData(nProfileID, nPartID, nHatchCount, X1Values.data(), Y1Values.data(), X2Values.data(), Y2Values.data()); + +} + +void CToolpathLayerData::WriteHatchDataDiscrete(const Lib3MF_uint32 nProfileID, const Lib3MF_uint32 nPartID, const bool bWriteCustomLineAttributes, const Lib3MF_uint64 nHatchDataBufferSize, const Lib3MF::sDiscreteHatch2D* pHatchDataBuffer) +{ + if (nHatchDataBufferSize == 0) + throw ELib3MFInterfaceException(LIB3MF_ERROR_TOOLPATH_INVALIDHATCHCOUNT); + + if (nHatchDataBufferSize > LIB3MF_MAXTOOLPATHHATCHCOUNT) + throw ELib3MFInterfaceException(LIB3MF_ERROR_TOOLPATH_INVALIDHATCHCOUNT); + + unsigned int nHatchCount = (unsigned int)nHatchDataBufferSize; + + // If we have a streamwriter, write all points into a binary stream + std::vector X1Values; + std::vector Y1Values; + std::vector X2Values; + std::vector Y2Values; + + X1Values.resize(nHatchCount); + Y1Values.resize(nHatchCount); + X2Values.resize(nHatchCount); + Y2Values.resize(nHatchCount); + + unsigned nIndex; + const Lib3MF::sDiscreteHatch2D* pHatchData = pHatchDataBuffer; + for (nIndex = 0; nIndex < nHatchCount; nIndex++) { + + int32_t nX1 = pHatchData->m_Point1Coordinates[0]; + int32_t nY1 = pHatchData->m_Point1Coordinates[1]; + int32_t nX2 = pHatchData->m_Point2Coordinates[0]; + int32_t nY2 = pHatchData->m_Point2Coordinates[1]; + + if ((nX1 < LIB3MF_MINDISCRETECOORDINATE) || (nX1 > LIB3MF_MAXDISCRETECOORDINATE)) + throw ELib3MFInterfaceException(LIB3MF_ERROR_TOOLPATH_INVALIDHATCHCOORDINATE, "invalid hatch coordinate: " + std::to_string(nX1) + "/" + std::to_string(nY1)); + if ((nY1 < LIB3MF_MINDISCRETECOORDINATE) || (nY1 > LIB3MF_MAXDISCRETECOORDINATE)) + throw ELib3MFInterfaceException(LIB3MF_ERROR_TOOLPATH_INVALIDHATCHCOORDINATE, "invalid hatch coordinate: " + std::to_string(nX1) + "/" + std::to_string(nY1)); + if ((nX2 < LIB3MF_MINDISCRETECOORDINATE) || (nX2 > LIB3MF_MAXDISCRETECOORDINATE)) + throw ELib3MFInterfaceException(LIB3MF_ERROR_TOOLPATH_INVALIDHATCHCOORDINATE, "invalid hatch coordinate: " + std::to_string(nX2) + "/" + std::to_string(nY2)); + if ((nY2 < LIB3MF_MINDISCRETECOORDINATE) || (nY2 > LIB3MF_MAXDISCRETECOORDINATE)) + throw ELib3MFInterfaceException(LIB3MF_ERROR_TOOLPATH_INVALIDHATCHCOORDINATE, "invalid hatch coordinate: " + std::to_string(nX2) + "/" + std::to_string(nY2)); + + X1Values[nIndex] = nX1; + Y1Values[nIndex] = nY1; + X2Values[nIndex] = nX2; + Y2Values[nIndex] = nY2; + pHatchData++; } m_pLayerData->WriteHatchData(nProfileID, nPartID, nHatchCount, X1Values.data(), Y1Values.data(), X2Values.data(), Y2Values.data()); } -void CToolpathLayerData::WriteLoop(const Lib3MF_uint32 nProfileID, const Lib3MF_uint32 nPartID, const Lib3MF_uint64 nPointDataBufferSize, const Lib3MF::sPosition2D* pPointDataBuffer) +void CToolpathLayerData::WriteLoopInModelUnits(const Lib3MF_uint32 nProfileID, const Lib3MF_uint32 nPartID, const bool bWriteCustomLineAttributes, const Lib3MF_uint64 nPointDataBufferSize, const Lib3MF::sPosition2D* pPointDataBuffer) { if (nPointDataBufferSize == 0) throw ELib3MFInterfaceException(LIB3MF_ERROR_TOOLPATH_INVALIDPOINTCOUNT); @@ -154,8 +230,8 @@ void CToolpathLayerData::WriteLoop(const Lib3MF_uint32 nProfileID, const Lib3MF_ unsigned int nPointCount = (unsigned int)nPointDataBufferSize; double dUnits = m_pLayerData->getUnits(); - std::vector XValues; - std::vector YValues; + std::vector XValues; + std::vector YValues; XValues.resize(nPointCount); YValues.resize(nPointCount); @@ -163,8 +239,16 @@ void CToolpathLayerData::WriteLoop(const Lib3MF_uint32 nProfileID, const Lib3MF_ unsigned nIndex; const Lib3MF::sPosition2D* pPointData = pPointDataBuffer; for (nIndex = 0; nIndex < nPointCount; nIndex++) { - XValues[nIndex] = (int)(pPointData->m_Coordinates[0] / dUnits); - YValues[nIndex] = (int)(pPointData->m_Coordinates[1] / dUnits); + double dX = pPointData->m_Coordinates[0] / dUnits; + double dY = pPointData->m_Coordinates[1] / dUnits; + + if ((dX < LIB3MF_MINDISCRETECOORDINATE) || (dX > LIB3MF_MAXDISCRETECOORDINATE)) + throw ELib3MFInterfaceException(LIB3MF_ERROR_TOOLPATH_INVALIDPOINTCOORDINATE, "invalid hatch coordinate: " + std::to_string(pPointData->m_Coordinates[0]) + "/" + std::to_string(pPointData->m_Coordinates[1])); + if ((dY < LIB3MF_MINDISCRETECOORDINATE) || (dY > LIB3MF_MAXDISCRETECOORDINATE)) + throw ELib3MFInterfaceException(LIB3MF_ERROR_TOOLPATH_INVALIDPOINTCOORDINATE, "invalid hatch coordinate: " + std::to_string(pPointData->m_Coordinates[0]) + "/" + std::to_string(pPointData->m_Coordinates[1])); + + XValues[nIndex] = (int32_t)round(dX); + YValues[nIndex] = (int32_t)round(dY); pPointData++; } @@ -172,7 +256,44 @@ void CToolpathLayerData::WriteLoop(const Lib3MF_uint32 nProfileID, const Lib3MF_ } -void CToolpathLayerData::WritePolyline(const Lib3MF_uint32 nProfileID, const Lib3MF_uint32 nPartID, const Lib3MF_uint64 nPointDataBufferSize, const Lib3MF::sPosition2D* pPointDataBuffer) +void CToolpathLayerData::WriteLoopDiscrete(const Lib3MF_uint32 nProfileID, const Lib3MF_uint32 nPartID, const bool bWriteCustomLineAttributes, const Lib3MF_uint64 nPointDataBufferSize, const Lib3MF::sDiscretePosition2D* pPointDataBuffer) +{ + if (nPointDataBufferSize == 0) + throw ELib3MFInterfaceException(LIB3MF_ERROR_TOOLPATH_INVALIDPOINTCOUNT); + if (nPointDataBufferSize > LIB3MF_MAXTOOLPATHPOINTCOUNT) + throw ELib3MFInterfaceException(LIB3MF_ERROR_TOOLPATH_INVALIDPOINTCOUNT); + + unsigned int nPointCount = (unsigned int)nPointDataBufferSize; + double dUnits = m_pLayerData->getUnits(); + + std::vector XValues; + std::vector YValues; + + XValues.resize(nPointCount); + YValues.resize(nPointCount); + + unsigned nIndex; + const Lib3MF::sDiscretePosition2D* pPointData = pPointDataBuffer; + for (nIndex = 0; nIndex < nPointCount; nIndex++) { + + int32_t nX = pPointData->m_Coordinates[0]; + int32_t nY = pPointData->m_Coordinates[1]; + + if ((nX < LIB3MF_MINDISCRETECOORDINATE) || (nX > LIB3MF_MAXDISCRETECOORDINATE)) + throw ELib3MFInterfaceException(LIB3MF_ERROR_TOOLPATH_INVALIDPOINTCOORDINATE, "invalid hatch coordinate: " + std::to_string(nX) + "/" + std::to_string(nY)); + if ((nY < LIB3MF_MINDISCRETECOORDINATE) || (nY > LIB3MF_MAXDISCRETECOORDINATE)) + throw ELib3MFInterfaceException(LIB3MF_ERROR_TOOLPATH_INVALIDPOINTCOORDINATE, "invalid hatch coordinate: " + std::to_string(nX) + "/" + std::to_string(nY)); + + XValues[nIndex] = nX; + YValues[nIndex] = nY; + pPointData++; + } + + m_pLayerData->WriteLoop(nProfileID, nPartID, nPointCount, XValues.data(), YValues.data()); + +} + +void CToolpathLayerData::WritePolylineInModelUnits(const Lib3MF_uint32 nProfileID, const Lib3MF_uint32 nPartID, const bool bWriteCustomLineAttributes, const Lib3MF_uint64 nPointDataBufferSize, const Lib3MF::sPosition2D* pPointDataBuffer) { if (nPointDataBufferSize == 0) @@ -183,8 +304,8 @@ void CToolpathLayerData::WritePolyline(const Lib3MF_uint32 nProfileID, const Lib unsigned int nPointCount = (unsigned int)nPointDataBufferSize; double dUnits = m_pLayerData->getUnits(); - std::vector XValues; - std::vector YValues; + std::vector XValues; + std::vector YValues; XValues.resize(nPointCount); YValues.resize(nPointCount); @@ -192,8 +313,53 @@ void CToolpathLayerData::WritePolyline(const Lib3MF_uint32 nProfileID, const Lib unsigned nIndex; const Lib3MF::sPosition2D* pPointData = pPointDataBuffer; for (nIndex = 0; nIndex < nPointCount; nIndex++) { - XValues[nIndex] = (int)(pPointData->m_Coordinates[0] / dUnits); - YValues[nIndex] = (int)(pPointData->m_Coordinates[1] / dUnits); + double dX = pPointData->m_Coordinates[0] / dUnits; + double dY = pPointData->m_Coordinates[1] / dUnits; + + if ((dX < LIB3MF_MINDISCRETECOORDINATE) || (dX > LIB3MF_MAXDISCRETECOORDINATE)) + throw ELib3MFInterfaceException(LIB3MF_ERROR_TOOLPATH_INVALIDPOINTCOORDINATE, "invalid hatch coordinate: " + std::to_string(pPointData->m_Coordinates[0]) + "/" + std::to_string(pPointData->m_Coordinates[1])); + if ((dY < LIB3MF_MINDISCRETECOORDINATE) || (dY > LIB3MF_MAXDISCRETECOORDINATE)) + throw ELib3MFInterfaceException(LIB3MF_ERROR_TOOLPATH_INVALIDPOINTCOORDINATE, "invalid hatch coordinate: " + std::to_string(pPointData->m_Coordinates[0]) + "/" + std::to_string(pPointData->m_Coordinates[1])); + + XValues[nIndex] = (int32_t)round(dX); + YValues[nIndex] = (int32_t)round(dY); + pPointData++; + } + + m_pLayerData->WritePolyline(nProfileID, nPartID, nPointCount, XValues.data(), YValues.data()); +} + + +void CToolpathLayerData::WritePolylineDiscrete(const Lib3MF_uint32 nProfileID, const Lib3MF_uint32 nPartID, const bool bWriteCustomLineAttributes, const Lib3MF_uint64 nPointDataBufferSize, const Lib3MF::sDiscretePosition2D* pPointDataBuffer) +{ + + if (nPointDataBufferSize == 0) + throw ELib3MFInterfaceException(LIB3MF_ERROR_TOOLPATH_INVALIDPOINTCOUNT); + if (nPointDataBufferSize > LIB3MF_MAXTOOLPATHPOINTCOUNT) + throw ELib3MFInterfaceException(LIB3MF_ERROR_TOOLPATH_INVALIDPOINTCOUNT); + + unsigned int nPointCount = (unsigned int)nPointDataBufferSize; + + std::vector XValues; + std::vector YValues; + + XValues.resize(nPointCount); + YValues.resize(nPointCount); + + unsigned nIndex; + const Lib3MF::sDiscretePosition2D* pPointData = pPointDataBuffer; + for (nIndex = 0; nIndex < nPointCount; nIndex++) { + int32_t nX = pPointData->m_Coordinates[0]; + int32_t nY = pPointData->m_Coordinates[1]; + + if ((nX < LIB3MF_MINDISCRETECOORDINATE) || (nX > LIB3MF_MAXDISCRETECOORDINATE)) + throw ELib3MFInterfaceException(LIB3MF_ERROR_TOOLPATH_INVALIDPOINTCOORDINATE, "invalid hatch coordinate: " + std::to_string(nX) + "/" + std::to_string(nY)); + if ((nY < LIB3MF_MINDISCRETECOORDINATE) || (nY > LIB3MF_MAXDISCRETECOORDINATE)) + throw ELib3MFInterfaceException(LIB3MF_ERROR_TOOLPATH_INVALIDPOINTCOORDINATE, "invalid hatch coordinate: " + std::to_string(nX) + "/" + std::to_string(nY)); + + XValues[nIndex] = nX; + YValues[nIndex] = nY; + pPointData++; } diff --git a/Source/API/lib3mf_toolpathlayerdata.hpp b/Source/API/lib3mf_toolpathlayerdata.hpp index ce1e79b1a..597542999 100644 --- a/Source/API/lib3mf_toolpathlayerdata.hpp +++ b/Source/API/lib3mf_toolpathlayerdata.hpp @@ -79,11 +79,21 @@ class CToolpathLayerData : public virtual IToolpathLayerData, public virtual CBa Lib3MF_uint32 RegisterBuildItem(IBuildItem* pBuildItem) override; - void WriteHatchData(const Lib3MF_uint32 nProfileID, const Lib3MF_uint32 nPartID, const Lib3MF_uint64 nPointDataBufferSize, const Lib3MF::sPosition2D * pPointDataBuffer) override; + void AddCustomLineAttributes(const std::string& sNameSpace, const std::string& sAttributeName, const Lib3MF_uint64 nValuesBufferSize, const Lib3MF_int32* pValuesBuffer) override; - void WriteLoop(const Lib3MF_uint32 nProfileID, const Lib3MF_uint32 nPartID, const Lib3MF_uint64 nPointDataBufferSize, const Lib3MF::sPosition2D * pPointDataBuffer) override; + void ClearCustomLineAttributes() override; - void WritePolyline(const Lib3MF_uint32 nProfileID, const Lib3MF_uint32 nPartID, const Lib3MF_uint64 nPointDataBufferSize, const Lib3MF::sPosition2D * pPointDataBuffer) override; + void WriteHatchDataInModelUnits(const Lib3MF_uint32 nProfileID, const Lib3MF_uint32 nPartID, const bool bWriteCustomLineAttributes, const Lib3MF_uint64 nHatchDataBufferSize, const Lib3MF::sHatch2D* pHatchDataBuffer) override; + + void WriteHatchDataDiscrete(const Lib3MF_uint32 nProfileID, const Lib3MF_uint32 nPartID, const bool bWriteCustomLineAttributes, const Lib3MF_uint64 nHatchDataBufferSize, const Lib3MF::sDiscreteHatch2D* pHatchDataBuffer) override; + + void WriteLoopInModelUnits(const Lib3MF_uint32 nProfileID, const Lib3MF_uint32 nPartID, const bool bWriteCustomLineAttributes, const Lib3MF_uint64 nPointDataBufferSize, const Lib3MF::sPosition2D* pPointDataBuffer) override; + + void WriteLoopDiscrete(const Lib3MF_uint32 nProfileID, const Lib3MF_uint32 nPartID, const bool bWriteCustomLineAttributes, const Lib3MF_uint64 nPointDataBufferSize, const Lib3MF::sDiscretePosition2D* pPointDataBuffer) override; + + void WritePolylineInModelUnits(const Lib3MF_uint32 nProfileID, const Lib3MF_uint32 nPartID, const bool bWriteCustomLineAttributes, const Lib3MF_uint64 nPointDataBufferSize, const Lib3MF::sPosition2D* pPointDataBuffer) override; + + void WritePolylineDiscrete(const Lib3MF_uint32 nProfileID, const Lib3MF_uint32 nPartID, const bool bWriteCustomLineAttributes, const Lib3MF_uint64 nPointDataBufferSize, const Lib3MF::sDiscretePosition2D* pPointDataBuffer) override; void Finish() override; diff --git a/Source/API/lib3mf_toolpathlayerreader.cpp b/Source/API/lib3mf_toolpathlayerreader.cpp index d2c98cff8..845d35916 100644 --- a/Source/API/lib3mf_toolpathlayerreader.cpp +++ b/Source/API/lib3mf_toolpathlayerreader.cpp @@ -126,7 +126,7 @@ std::string CToolpathLayerReader::GetPartUUIDByLocalPartID(const Lib3MF_uint32 n } -void CToolpathLayerReader::GetSegmentPointData(const Lib3MF_uint32 nIndex, Lib3MF_uint64 nPointDataBufferSize, Lib3MF_uint64* pPointDataNeededCount, Lib3MF::sPosition2D* pPointDataBuffer) +void CToolpathLayerReader::GetSegmentPointDataInModelUnits(const Lib3MF_uint32 nIndex, Lib3MF_uint64 nPointDataBufferSize, Lib3MF_uint64* pPointDataNeededCount, Lib3MF::sPosition2D* pPointDataBuffer) { NMR::eModelToolpathSegmentType eNMRType; uint32_t nProfileID; @@ -134,6 +134,8 @@ void CToolpathLayerReader::GetSegmentPointData(const Lib3MF_uint32 nIndex, Lib3M uint32_t nPointCount; m_pReadData->getSegmentInfo(nIndex, eNMRType, nProfileID, nPartID, nPointCount); + double dUnits = m_pReadData->getUnits(); + if (pPointDataNeededCount != nullptr) { *pPointDataNeededCount = nPointCount; } @@ -147,7 +149,37 @@ void CToolpathLayerReader::GetSegmentPointData(const Lib3MF_uint32 nIndex, Lib3M uint32_t nPointIndex; Lib3MF::sPosition2D* pPoint = pPointDataBuffer; for (nPointIndex = 0; nPointIndex < nPointCount; nPointIndex++) { - NMR::NVEC2 position = m_pReadData->getSegmentPoint(nIndex, nPointIndex); + NMR::NVEC2I position = m_pReadData->getSegmentPoint(nIndex, nPointIndex); + pPoint->m_Coordinates[0] = (float) (position.m_values.x * dUnits); + pPoint->m_Coordinates[1] = (float) (position.m_values.y * dUnits); + pPoint++; + } + } + } +} + +void CToolpathLayerReader::GetSegmentPointDataDiscrete(const Lib3MF_uint32 nIndex, Lib3MF_uint64 nPointDataBufferSize, Lib3MF_uint64* pPointDataNeededCount, Lib3MF::sDiscretePosition2D* pPointDataBuffer) +{ + NMR::eModelToolpathSegmentType eNMRType; + uint32_t nProfileID; + uint32_t nPartID; + uint32_t nPointCount; + m_pReadData->getSegmentInfo(nIndex, eNMRType, nProfileID, nPartID, nPointCount); + + if (pPointDataNeededCount != nullptr) { + *pPointDataNeededCount = nPointCount; + } + + if (pPointDataBuffer != nullptr) { + if (nPointDataBufferSize < nPointCount) + throw ELib3MFInterfaceException(LIB3MF_ERROR_BUFFERTOOSMALL); + + if (nPointCount > 0) { + + uint32_t nPointIndex; + Lib3MF::sDiscretePosition2D* pPoint = pPointDataBuffer; + for (nPointIndex = 0; nPointIndex < nPointCount; nPointIndex++) { + NMR::NVEC2I position = m_pReadData->getSegmentPoint(nIndex, nPointIndex); pPoint->m_Coordinates[0] = position.m_values.x; pPoint->m_Coordinates[1] = position.m_values.y; pPoint++; @@ -156,6 +188,7 @@ void CToolpathLayerReader::GetSegmentPointData(const Lib3MF_uint32 nIndex, Lib3M } } + Lib3MF_uint32 CToolpathLayerReader::GetCustomDataCount() { return m_pReadData->getCustomXMLDataCount(); diff --git a/Source/API/lib3mf_toolpathlayerreader.hpp b/Source/API/lib3mf_toolpathlayerreader.hpp index b127f135d..ed0155df9 100644 --- a/Source/API/lib3mf_toolpathlayerreader.hpp +++ b/Source/API/lib3mf_toolpathlayerreader.hpp @@ -84,7 +84,9 @@ class CToolpathLayerReader : public virtual IToolpathLayerReader, public virtual std::string GetPartUUIDByLocalPartID(const Lib3MF_uint32 nLocalPartID) override; - void GetSegmentPointData(const Lib3MF_uint32 nIndex, Lib3MF_uint64 nPointDataBufferSize, Lib3MF_uint64* pPointDataNeededCount, Lib3MF::sPosition2D * pPointDataBuffer) 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; Lib3MF_uint32 GetCustomDataCount() override; diff --git a/Source/Common/NMR_Exception.cpp b/Source/Common/NMR_Exception.cpp index 4a031efa2..767d21fd5 100644 --- a/Source/Common/NMR_Exception.cpp +++ b/Source/Common/NMR_Exception.cpp @@ -557,6 +557,7 @@ namespace NMR { case NMR_ERROR_INVALIDPARAMETERINDEX: return "Invalid parameter index"; case NMR_ERROR_TOOLPATHLAYERSARENOTINCREMENTING: return "Toolpath layers are not incrementing"; case NMR_ERROR_CANNOTSETBOTTOMZIFLAYERSEXIST: return "Cannot set bottom Z if layers exist"; + case NMR_ERROR_LAYERHASNOTPOSITIVETHICKNESS: return "Layer has not positive thickness"; default: return "unknown error"; diff --git a/Source/Model/Classes/NMR_ModelToolpath.cpp b/Source/Model/Classes/NMR_ModelToolpath.cpp index c823fa733..7c3a1cb30 100644 --- a/Source/Model/Classes/NMR_ModelToolpath.cpp +++ b/Source/Model/Classes/NMR_ModelToolpath.cpp @@ -104,6 +104,13 @@ namespace NMR { return m_UUID; } + void CModelToolpath::resetUUID() + { + CUUID newUUID; + m_UUID = newUUID; + } + + PModelToolpathProfile CModelToolpath::addProfile(const std::string & sName) { diff --git a/Source/Model/Classes/NMR_ModelToolpathLayerReadData.cpp b/Source/Model/Classes/NMR_ModelToolpathLayerReadData.cpp index c557b8698..c43a54571 100644 --- a/Source/Model/Classes/NMR_ModelToolpathLayerReadData.cpp +++ b/Source/Model/Classes/NMR_ModelToolpathLayerReadData.cpp @@ -97,14 +97,14 @@ namespace NMR { m_pCurrentSegment = nullptr; } - void CModelToolpathLayerReadData::addPoint(nfFloat fX, nfFloat fY) + void CModelToolpathLayerReadData::addDiscretePoint(nfInt32 nX, nfInt32 nY) { if (m_pCurrentSegment == nullptr) throw CNMRException(NMR_ERROR_LAYERSEGMENTNOTOPEN); - NVEC2 * pVec = m_Points.allocData(); - pVec->m_values.x = fX; - pVec->m_values.y = fY; + NVEC2I * pVec = m_Points.allocData(); + pVec->m_values.x = nX; + pVec->m_values.y = nY; } nfUint32 CModelToolpathLayerReadData::getSegmentCount() @@ -122,7 +122,7 @@ namespace NMR { nPointCount = pSegment->m_nPointCount; } - NVEC2 CModelToolpathLayerReadData::getSegmentPoint(nfUint32 nSegmentIndex, nfUint32 nPointIndex) + NVEC2I CModelToolpathLayerReadData::getSegmentPoint(nfUint32 nSegmentIndex, nfUint32 nPointIndex) { TOOLPATHREADSEGMENT * pSegment = m_Segments.getData(nSegmentIndex); __NMRASSERT(pSegment != nullptr); @@ -313,5 +313,9 @@ namespace NMR { return std::make_pair (0, eModelToolpathSegmentAttributeType::Unknown); } + double CModelToolpathLayerReadData::getUnits() + { + return m_pModelToolpath->getUnitFactor(); + } } diff --git a/Source/Model/ToolpathReader/NMR_ToolpathReaderNode_Hatch.cpp b/Source/Model/ToolpathReader/NMR_ToolpathReaderNode_Hatch.cpp index 7a3d4f01e..3eba81ebd 100644 --- a/Source/Model/ToolpathReader/NMR_ToolpathReaderNode_Hatch.cpp +++ b/Source/Model/ToolpathReader/NMR_ToolpathReaderNode_Hatch.cpp @@ -44,10 +44,10 @@ namespace NMR { CToolpathReaderNode_Hatch::CToolpathReaderNode_Hatch(_In_ PModelWarnings pWarnings, _In_ PProgressMonitor pProgressMonitor, CModelToolpathLayerReadData * pReadData) : CModelReaderNode(pWarnings, pProgressMonitor), m_pReadData (pReadData), - m_dX1 (0.0), - m_dY1(0.0), - m_dX2(0.0), - m_dY2(0.0), + m_nX1 (0), + m_nY1(0), + m_nX2(0), + m_nY2(0), m_bHasX1 (false), m_bHasY1 (false), m_bHasX2 (false), @@ -81,41 +81,26 @@ namespace NMR { if (strcmp(pAttributeName, XML_3MF_TOOLPATHATTRIBUTE_X1) == 0) { if (m_bHasX1) throw CNMRException(NMR_ERROR_INVALIDMODELCOORDINATES); - m_dX1 = strtod(pAttributeValue, nullptr); - if (std::isnan(m_dX1)) - throw CNMRException(NMR_ERROR_INVALIDMODELCOORDINATES); - if (fabs(m_dX1) > XML_3MF_MAXIMUMCOORDINATEVALUE) - throw CNMRException(NMR_ERROR_INVALIDMODELCOORDINATES); + + m_nX1 = fnStringToInt32(pAttributeValue); m_bHasX1 = true; } else if (strcmp(pAttributeName, XML_3MF_TOOLPATHATTRIBUTE_Y1) == 0) { if (m_bHasY1) throw CNMRException(NMR_ERROR_INVALIDMODELCOORDINATES); - m_dY1 = strtod(pAttributeValue, nullptr); - if (std::isnan(m_dY1)) - throw CNMRException(NMR_ERROR_INVALIDMODELCOORDINATES); - if (fabs(m_dY1) > XML_3MF_MAXIMUMCOORDINATEVALUE) - throw CNMRException(NMR_ERROR_INVALIDMODELCOORDINATES); + m_nY1 = fnStringToInt32(pAttributeValue); m_bHasY1 = true; } else if (strcmp(pAttributeName, XML_3MF_TOOLPATHATTRIBUTE_X2) == 0) { if (m_bHasX2) throw CNMRException(NMR_ERROR_INVALIDMODELCOORDINATES); - m_dX2 = strtod(pAttributeValue, nullptr); - if (std::isnan(m_dX2)) - throw CNMRException(NMR_ERROR_INVALIDMODELCOORDINATES); - if (fabs(m_dX2) > XML_3MF_MAXIMUMCOORDINATEVALUE) - throw CNMRException(NMR_ERROR_INVALIDMODELCOORDINATES); + m_nX2 = fnStringToInt32(pAttributeValue); m_bHasX2 = true; } else if (strcmp(pAttributeName, XML_3MF_TOOLPATHATTRIBUTE_Y2) == 0) { if (m_bHasY2) throw CNMRException(NMR_ERROR_INVALIDMODELCOORDINATES); - m_dY2 = strtod(pAttributeValue, nullptr); - if (std::isnan(m_dY2)) - throw CNMRException(NMR_ERROR_INVALIDMODELCOORDINATES); - if (fabs(m_dY2) > XML_3MF_MAXIMUMCOORDINATEVALUE) - throw CNMRException(NMR_ERROR_INVALIDMODELCOORDINATES); + m_nY2 = fnStringToInt32(pAttributeValue); m_bHasY2 = true; } else @@ -132,32 +117,32 @@ namespace NMR { { } - nfDouble CToolpathReaderNode_Hatch::getX1() + nfInt32 CToolpathReaderNode_Hatch::getX1() { if (!m_bHasX1) throw CNMRException(NMR_ERROR_MISSINGCOORDINATE); - return m_dX1; + return m_nX1; } - nfDouble CToolpathReaderNode_Hatch::getY1() + nfInt32 CToolpathReaderNode_Hatch::getY1() { if (!m_bHasY1) throw CNMRException(NMR_ERROR_MISSINGCOORDINATE); - return m_dY1; + return m_nY1; } - nfDouble CToolpathReaderNode_Hatch::getX2() + nfInt32 CToolpathReaderNode_Hatch::getX2() { if (!m_bHasX2) throw CNMRException(NMR_ERROR_MISSINGCOORDINATE); - return m_dX2; + return m_nX2; } - nfDouble CToolpathReaderNode_Hatch::getY2() + nfInt32 CToolpathReaderNode_Hatch::getY2() { if (!m_bHasY2) throw CNMRException(NMR_ERROR_MISSINGCOORDINATE); - return m_dY2; + return m_nY2; } diff --git a/Source/Model/ToolpathReader/NMR_ToolpathReaderNode_Point.cpp b/Source/Model/ToolpathReader/NMR_ToolpathReaderNode_Point.cpp index 2af8302b4..a5216c17e 100644 --- a/Source/Model/ToolpathReader/NMR_ToolpathReaderNode_Point.cpp +++ b/Source/Model/ToolpathReader/NMR_ToolpathReaderNode_Point.cpp @@ -46,8 +46,8 @@ namespace NMR { m_pReadData(pReadData), m_bHasX (false), m_bHasY (false), - m_dX (0.0), - m_dY (0.0) + m_nX (0), + m_nY (0) { if (pReadData == nullptr) throw CNMRException(NMR_ERROR_INVALIDPARAM); @@ -79,21 +79,13 @@ namespace NMR { if (strcmp(pAttributeName, XML_3MF_TOOLPATHATTRIBUTE_X) == 0) { if (m_bHasX) throw CNMRException(NMR_ERROR_INVALIDMODELCOORDINATES); - m_dX = strtod(pAttributeValue, nullptr); - if (std::isnan(m_dX)) - throw CNMRException(NMR_ERROR_INVALIDMODELCOORDINATES); - if (fabs(m_dX) > XML_3MF_MAXIMUMCOORDINATEVALUE) - throw CNMRException(NMR_ERROR_INVALIDMODELCOORDINATES); + m_nX = fnStringToInt32(pAttributeValue); m_bHasX = true; } else if (strcmp(pAttributeName, XML_3MF_TOOLPATHATTRIBUTE_Y) == 0) { if (m_bHasY) throw CNMRException(NMR_ERROR_INVALIDMODELCOORDINATES); - m_dY = strtod(pAttributeValue, nullptr); - if (std::isnan(m_dY)) - throw CNMRException(NMR_ERROR_INVALIDMODELCOORDINATES); - if (fabs(m_dY) > XML_3MF_MAXIMUMCOORDINATEVALUE) - throw CNMRException(NMR_ERROR_INVALIDMODELCOORDINATES); + m_nY = fnStringToInt32(pAttributeValue); m_bHasY = true; } else @@ -110,18 +102,18 @@ namespace NMR { { } - nfDouble CToolpathReaderNode_Point::getX() + nfInt32 CToolpathReaderNode_Point::getX() { if (!m_bHasX) throw CNMRException(NMR_ERROR_MISSINGCOORDINATE); - return m_dX; + return m_nX; } - nfDouble CToolpathReaderNode_Point::getY() + nfInt32 CToolpathReaderNode_Point::getY() { if (!m_bHasY) throw CNMRException(NMR_ERROR_MISSINGCOORDINATE); - return m_dY; + return m_nY; } } diff --git a/Source/Model/ToolpathReader/NMR_ToolpathReaderNode_Segment.cpp b/Source/Model/ToolpathReader/NMR_ToolpathReaderNode_Segment.cpp index 743b7c166..8f0ad365a 100644 --- a/Source/Model/ToolpathReader/NMR_ToolpathReaderNode_Segment.cpp +++ b/Source/Model/ToolpathReader/NMR_ToolpathReaderNode_Segment.cpp @@ -158,8 +158,8 @@ namespace NMR { PToolpathReaderNode_Hatch pXMLNode = std::make_shared(m_pWarnings, m_pProgressMonitor, m_pReadData); pXMLNode->parseXML(pXMLReader); - m_pReadData->addPoint((nfFloat)pXMLNode->getX1(), (nfFloat)pXMLNode->getY1()); - m_pReadData->addPoint((nfFloat)pXMLNode->getX2(), (nfFloat)pXMLNode->getY2()); + m_pReadData->addDiscretePoint(pXMLNode->getX1(), pXMLNode->getY1()); + m_pReadData->addDiscretePoint(pXMLNode->getX2(), pXMLNode->getY2()); } else if (strcmp(pChildName, XML_3MF_TOOLPATHELEMENT_POINT) == 0) { @@ -170,7 +170,7 @@ namespace NMR { PToolpathReaderNode_Point pXMLNode = std::make_shared(m_pWarnings, m_pProgressMonitor, m_pReadData); pXMLNode->parseXML(pXMLReader); - m_pReadData->addPoint((nfFloat)pXMLNode->getX(), (nfFloat)pXMLNode->getY()); + m_pReadData->addDiscretePoint(pXMLNode->getX(), pXMLNode->getY()); } else