A3DSDKMisc.h

Header file for tools used with structure and geometry.

Author

Tech Soft 3D

Version

23.0

Date

January 2023

Copyright (c) 2010 - 2023 by Tech Soft 3D, Inc. All rights reserved.

Content

Data Structures

A3DMiscGeneralTransformationData

Structure that specifies a 4x4 matrix for use in the A3DMiscGeneralTransformation entity.

A3DMiscCartesianTransformationData

Structure for defining an A3DMiscCartesianTransformation entity.

A3DMiscEntityReferenceData

Structure that identifies the referenced entity and that provides a new coordinate system.

A3DMiscReferenceOnTopologyData

Structure that identifies the referenced topology entity and that specifies globally-defined attributes.

A3DMiscReferenceOnTessData

Structure that identifies the referenced tesselation entity and that specifies globally-defined attributes.

A3DMiscReferenceOnCsysItemData

Reference on coordinate system item.

A3DMiscPhysicMaterialData

Physical properties.

A3DMiscMaterialFiberData

Fiber physical properties.

A3DMiscMaterialHoneyCombData

HoneyComb physical properties.

A3DMiscMaterialIsotropicData

Isotropic physical properties.

A3DMiscMaterialOrthotropic2DData

Orthotropic2D physical properties.

A3DMiscMaterialOrthotropic3DData

Orthotropic3D physical properties.

A3DMiscMaterialAnisotropicData

Anisotropic physical properties.

A3DMiscMaterialPropertiesData

Material properties, like density.

Functions

A3DMiscGeneralTransformationGet()

Populates the A3DMiscGeneralTransformationData structure.

A3DMiscGeneralTransformationCreate()

Creates an A3DMiscGeneralTransformation from an A3DMiscGeneralTransformationData structure.

A3DMiscCartesianTransformationGet()

Populates the A3DMiscCartesianTransformationData structure.

A3DMiscCartesianTransformationCreate()

Creates an A3DMiscCartesianTransformation from an A3DMiscCartesianTransformationData structure.

A3DMiscEntityReferenceGet()

Populates the A3DMiscEntityReferenceData structure.

A3DMiscEntityReferenceCreate()

Creates an A3DMiscEntityReference from an A3DMiscEntityReferenceData structure.

A3DMiscEntityReferenceSet()

Function to set the entity reference from A3DMiscEntityReferenceData structure in a previously created object.

A3DMiscReferenceOnTopologyGet()

Populates the A3DMiscReferenceOnTopologyData structure.

A3DMiscReferenceOnTessGet()

Populates the A3DMiscReferenceOnTessData structure for PolyBrepModel.

A3DMiscReferenceOnTessCreate()

Creates an A3DMiscReferenceOnTess from an A3DMiscReferenceOnTessData structure.

A3DMiscReferenceOnTopologyCreate()

Creates an A3DMiscReferenceOnTopology from an A3DMiscReferenceOnTopologyData structure.

A3DMiscReferenceOnCsysItemGet()

Populates the A3DMiscReferenceOnCsysItemData structure.

A3DMiscReferenceOnCsysItemCreate()

Creates an A3DMiscReferenceOnCsysItem from an A3DMiscReferenceOnCsysItemData structure.

A3DMiscUTF8ToUnicode()

Converts UTF-8 encoded characters to UTF-16 strings on Windows.

A3DMiscUnicodeToUTF8()

Converts UTF-16 strings to an array UTF-8 encoded characters on Windows.

A3DMiscUTF8ToUTF16()

Converts a UTF-8 string to a UTF-16 string on Windows.

A3DMiscUTF16ToUTF8()

Converts a UTF-16 string to a UTF-8 string on Windows.

A3DMiscGetErrorMsg()

Returns the text description of an error code.

A3DMiscGetEntityTypeMsg()

Returns the name of the entity type.

A3DMiscGetMaterialProperties()

Get density in kg/m3 read from the file.

A3DMiscGetBoundingBox()

Read the axis-aligned bounding box (AABB) of the given A3DEntity directly from the CAD data.

A3DMiscComputeBoundingBox()

Use the tessellation to compute the axis-aligned bounding box (AABB) of the given entity.

Functions

A3DStatus A3DMiscGeneralTransformationGet(const A3DMiscGeneralTransformation *pGeneralTransformation3d, A3DMiscGeneralTransformationData *pData)

Populates the A3DMiscGeneralTransformationData structure.

Return values
  • A3D_INITIALIZE_NOT_CALLED

  • A3D_INVALID_DATA_STRUCT_SIZE

  • A3D_INVALID_DATA_STRUCT_NULL

  • A3D_INVALID_ENTITY_NULL

  • A3D_INVALID_ENTITY_TYPE

  • A3D_SUCCESS

Returns

A3D_SUCCESS in case of success or an error code

A3DStatus A3DMiscGeneralTransformationCreate(const A3DMiscGeneralTransformationData *pData, A3DMiscGeneralTransformation **ppGeneralTransformation3d)

Creates an A3DMiscGeneralTransformation from an A3DMiscGeneralTransformationData structure.

Return values
  • A3D_INVALID_DATA_STRUCT_SIZE

  • A3D_INVALID_DATA_STRUCT_NULL

  • A3D_SUCCESS

Returns

A3D_SUCCESS in case of success or an error code

A3DStatus A3DMiscCartesianTransformationGet(const A3DMiscCartesianTransformation *pCartesianTransformation3d, A3DMiscCartesianTransformationData *pData)

Populates the A3DMiscCartesianTransformationData structure.

Return values
  • A3D_INITIALIZE_NOT_CALLED

  • A3D_INVALID_DATA_STRUCT_SIZE

  • A3D_INVALID_DATA_STRUCT_NULL

  • A3D_INVALID_ENTITY_NULL

  • A3D_INVALID_ENTITY_TYPE

  • A3D_SUCCESS

Returns

A3D_SUCCESS in case of success or an error code

A3DStatus A3DMiscCartesianTransformationCreate(const A3DMiscCartesianTransformationData *pData, A3DMiscCartesianTransformation **ppCartesianTransformation3d)

Creates an A3DMiscCartesianTransformation from an A3DMiscCartesianTransformationData structure.

Return values
  • A3D_INVALID_DATA_STRUCT_SIZE

  • A3D_INVALID_DATA_STRUCT_NULL

  • A3D_POINTSET_BADSIZE

  • A3D_TRANSFORMATION3D_INCONSISTENT

  • A3D_SUCCESS

Returns

A3D_SUCCESS in case of success or an error code

A3DStatus A3DMiscEntityReferenceGet(const A3DMiscEntityReference *pEntityReference, A3DMiscEntityReferenceData *pData)

Populates the A3DMiscEntityReferenceData structure.

Version

2.0

Return values
  • A3D_INITIALIZE_NOT_CALLED

  • A3D_INVALID_DATA_STRUCT_SIZE

  • A3D_INVALID_DATA_STRUCT_NULL

  • A3D_INVALID_ENTITY_NULL

  • A3D_INVALID_ENTITY_TYPE

  • A3D_SUCCESS

Returns

A3D_SUCCESS in case of success or an error code

A3DStatus A3DMiscEntityReferenceCreate(const A3DMiscEntityReferenceData *pData, A3DMiscEntityReference **ppEntityReference)

Creates an A3DMiscEntityReference from an A3DMiscEntityReferenceData structure.

Version

2.0

Return values
  • A3D_INVALID_DATA_STRUCT_SIZE

  • A3D_INVALID_DATA_STRUCT_NULL

  • A3D_ENTITYREFERENCE_INCONSISTENT_REFERENCE

  • A3D_SUCCESS

Returns

A3D_SUCCESS in case of success or an error code

A3DStatus A3DMiscEntityReferenceSet(A3DMiscEntityReference *pEntityReference, const A3DMiscEntityReferenceData *pData)

Function to set the entity reference from A3DMiscEntityReferenceData structure in a previously created object.

Version

2.0

Return values
  • A3D_INVALID_DATA_STRUCT_SIZE

  • A3D_INVALID_DATA_STRUCT_NULL

  • A3D_ENTITYREFERENCE_INCONSISTENT_REFERENCE

  • A3D_SUCCESS

Returns

A3D_SUCCESS in case of success or an error code

A3DStatus A3DMiscReferenceOnTopologyGet(const A3DMiscReferenceOnTopology *pReferenceOnTopoItem, A3DMiscReferenceOnTopologyData *pData)

Populates the A3DMiscReferenceOnTopologyData structure.

Version

2.0

Return values
  • A3D_INITIALIZE_NOT_CALLED

  • A3D_INVALID_DATA_STRUCT_SIZE

  • A3D_INVALID_DATA_STRUCT_NULL

  • A3D_INVALID_ENTITY_NULL

  • A3D_INVALID_ENTITY_TYPE

  • A3D_SUCCESS

Returns

A3D_SUCCESS in case of success or an error code

A3DStatus A3DMiscReferenceOnTessGet(const A3DMiscReferenceOnTess *pReferenceOnTess, A3DMiscReferenceOnTessData *pData)

Populates the A3DMiscReferenceOnTessData structure for PolyBrepModel.

Version

9.2

Return values
  • A3D_INITIALIZE_NOT_CALLED

  • A3D_INVALID_DATA_STRUCT_SIZE

  • A3D_INVALID_DATA_STRUCT_NULL

  • A3D_INVALID_ENTITY_NULL

  • A3D_INVALID_ENTITY_TYPE

  • A3D_SUCCESS

Returns

A3D_SUCCESS in case of success or an error code

A3DStatus A3DMiscReferenceOnTessCreate(const A3DMiscReferenceOnTessData *pData, A3DMiscReferenceOnTess **ppReferenceOnTess)

Creates an A3DMiscReferenceOnTess from an A3DMiscReferenceOnTessData structure.

If m_eTopoItemType is kA3DTypeTessEdge, m_uiSize must be 3 and:

  • m_puiAdditionalIndexes[0] is the face index in m_pPolyBrepModel

  • m_puiAdditionalIndexes[1] is the loop index in the face

  • m_puiAdditionalIndexes[2] is the edge index in the loop

Version

11.0

Edge and Vertex references

If m_eTopoItemType is kA3DTypeTessVertex, m_uiSize must be 4 and

  • m_puiAdditionalIndexes[0] is the face index in m_pPolyBrepModel

  • m_puiAdditionalIndexes[1] is the loop index in the face

  • m_puiAdditionalIndexes[2] is the edge index in the loop

  • m_puiAdditionalIndexes[3] is the vertex index in the edge

Parameters
  • pData[in] The A3DMiscReferenceOnTessData instance to create reference from

  • ppReferenceOnTess[out] A pointer to the resulting A3DMiscReferenceOnTess entity

Return values
  • A3D_INVALID_DATA_STRUCT_SIZE – if pData is null

  • A3D_INVALID_DATA_STRUCT_NULL – if pData is incorrectly initialized

  • A3D_ENTITYREFERENCE_INCONSISTENT_REFERENCE

  • A3D_INVALID_ENTITY_NULL

  • A3D_INVALID_ENTITY_TYPE

  • A3D_SUCCESS

Returns

A3D_SUCCESS in case of success or an error code

A3DStatus A3DMiscReferenceOnTopologyCreate(const A3DMiscReferenceOnTopologyData *pData, A3DMiscReferenceOnTopology **ppReferenceOnTopoItem)

Creates an A3DMiscReferenceOnTopology from an A3DMiscReferenceOnTopologyData structure.

Version

2.0

Return values
  • A3D_INVALID_ENTITY_NULL – if pData->m_pBrepData is NULL

  • A3D_INVALID_ENTITY_TYPE – if pData->m_pBrepData is not a A3DTopoBrepData

  • Until – version 2018 it was possible to pass A3DRiPolyBrepModel for pData->m_pBrepData which was not valid.

  • Use – A3DMiscReferenceOnTessCreate for that case (see CreatePRCCubes sample).

  • A3D_INVALID_DATA_STRUCT_SIZE

  • A3D_INVALID_DATA_STRUCT_NULL

  • A3D_ENTITYREFERENCE_INCONSISTENT_REFERENCE

  • A3D_SUCCESS

Returns

A3D_SUCCESS in case of success or an error code

A3DStatus A3DMiscReferenceOnCsysItemGet(const A3DMiscReferenceOnCsysItem *pReferenceOnCSYSItem, A3DMiscReferenceOnCsysItemData *pData)

Populates the A3DMiscReferenceOnCsysItemData structure.

Version

6.0

Return values
  • A3D_INITIALIZE_NOT_CALLED

  • A3D_INVALID_DATA_STRUCT_SIZE

  • A3D_INVALID_DATA_STRUCT_NULL

  • A3D_INVALID_ENTITY_NULL

  • A3D_INVALID_ENTITY_TYPE

  • A3D_SUCCESS

Returns

A3D_SUCCESS in case of success or an error code

A3DStatus A3DMiscReferenceOnCsysItemCreate(const A3DMiscReferenceOnCsysItemData *pData, A3DMiscReferenceOnCsysItem **ppReferenceOnCSYSItem)

Creates an A3DMiscReferenceOnCsysItem from an A3DMiscReferenceOnCsysItemData structure.

Version

6.0

Return values
  • A3D_INVALID_DATA_STRUCT_SIZE

  • A3D_INVALID_DATA_STRUCT_NULL

  • A3D_ENTITYREFERENCE_INCONSISTENT_REFERENCE

  • A3D_SUCCESS

Returns

A3D_SUCCESS in case of success or an error code

A3DStatus A3DMiscUTF8ToUnicode(const A3DUTF8Char *pcInputBuffer, A3DUTF8Char acOutputBuffer[])

Converts UTF-8 encoded characters to UTF-16 strings on Windows.

This function returns a UTF-16 string on Windows.

Version

2.0

You must cast the string to a wide char pointer (wchar_t*) depending on the target computer’s characteristics.

Warning

On Linux, this API simply copies the input A3DUTF8Char* string into the output A3DUTF8Char* string.

Return values
  • A3D_SUCCESS

  • A3D_INVALID_ENTITY_NULL

  • A3D_INITIALIZE_NOT_CALLED

Returns

A3D_SUCCESS in case of success or an error code

A3DStatus A3DMiscUnicodeToUTF8(const A3DUTF8Char *pcInputBuffer, A3DUTF8Char acOutputBuffer[])

Converts UTF-16 strings to an array UTF-8 encoded characters on Windows.

This function returns an array of UTF-8 encoded characters.

Version

2.0

The input buffer is cast and interpreted as a Unicode string (wchar_t*).

Warning

On Linux, this API simply copies the input A3DUTF8Char* string into the output A3DUTF8Char* string.

Return values
  • A3D_SUCCESS

  • A3D_INVALID_ENTITY_NULL

  • A3D_INITIALIZE_NOT_CALLED

Returns

A3D_SUCCESS in case of success or an error code

A3DStatus A3DMiscUTF8ToUTF16(const A3DUTF8Char *pcInputBuffer, A3DUniChar acOutputBuffer[])

Converts a UTF-8 string to a UTF-16 string on Windows.

This function returns a UTF-16 string.

Version

7.0

Warning

On Linux, this API simply returns A3D_ERROR.

Return values
  • A3D_SUCCESS

  • A3D_ERROR

  • A3D_INVALID_ENTITY_NULL

  • A3D_INITIALIZE_NOT_CALLED

Returns

A3D_SUCCESS in case of success or an error code

A3DStatus A3DMiscUTF16ToUTF8(const A3DUniChar *pcInputBuffer, A3DUTF8Char acOutputBuffer[])

Converts a UTF-16 string to a UTF-8 string on Windows.

This function returns a UTF-8 string.

Version

7.0

Warning

On Linux, this API simply returns A3D_ERROR.

Return values
  • A3D_SUCCESS

  • A3D_ERROR

  • A3D_INVALID_ENTITY_NULL

  • A3D_INITIALIZE_NOT_CALLED

Returns

A3D_SUCCESS in case of success or an error code

const A3DUTF8Char *A3DMiscGetErrorMsg(A3DStatus)

Returns the text description of an error code.

This text is stored in a global array used also by A3DMiscGetEntityTypeMsg. This function returns a pointer to the global array and therefore it must not be desallocated. Each time the function is called, the global array is updated. For version 2.1, this method declaration was changed to use the same convention applied to all other HOOPS Exchange declarations. More specifically, the declaration was changed to A3D_API (A3DUTF8Char*, A3DMiscGetErrorMsg,(A3DInt32));. You will not be able to see this change because this reference simplifies all declarations to the more readable format shown in the declaration frame.

Remark

Because this function does not return A3DStatus the internal thread safety policy is to wait for the availability of the API.

Version

2.0

const A3DUTF8Char *A3DMiscGetEntityTypeMsg(A3DEEntityType eType)

Returns the name of the entity type.

This text is stored in a global array used also by A3DMiscGetErrorMsg. This function returns a pointer to the global array and therefore it must not be desallocated. Each time the function is called, the global array is updated. For version 2.1, this method declaration was changed to use the same convention applied to all other HOOPS Exchange declarations. For more information, see the description for A3DMiscGetErrorMsg.

Remark

Because this function does not return A3DStatus the internal thread safety policy is to wait for the availability of the API.

Version

2.0

A3DStatus A3DMiscGetMaterialProperties(const A3DEntity *pEntity, A3DMiscMaterialPropertiesData *pMaterialPropertiesData)

Get density in kg/m3 read from the file.

Equal to -1.0 if not set \ Can call it on product occurrences, part, and representation item

Version

8.2

A3DStatus A3DMiscGetBoundingBox(const A3DEntity *pEntity, A3DBoundingBoxData *pAABB)

Read the axis-aligned bounding box (AABB) of the given A3DEntity directly from the CAD data.

Version

8.2

Warning

This function does not compute any bounding box. To do so please check A3DMiscComputeBoundingBox.

Parameters
Return values
  • A3D_SUCCESS

  • A3D_BASE_BAD_ENTITY_TYPE

  • A3D_INITIALIZE_BAD_VALUES

Returns

A3D_SUCCESS in case of success or an error code

A3DStatus A3DMiscComputeBoundingBox(const A3DEntity *pEntity, A3DDouble const *pOptPlacement, A3DBoundingBoxData *pAABB)

Use the tessellation to compute the axis-aligned bounding box (AABB) of the given entity.

An invalid bouding box corresponds to those values:

Version

11.1

It can occur under following conditions:

  • The computation is done on infinite elements.

  • The CAD data do not contain any tessellation.

  • pEntity is of type A3DRiPlane.

Warning

This function computes the bounding box using tessellation data. If you want to read the actual bounding box from CAD data, see A3DMiscGetBoundingBox.

Parameters
  • pEntity[in] The Entity to get the bounding box from. It can be any of A3DAsmProductOccurrence, A3DAsmPartDefinition or A3DRiSet.

  • pOptPlacement[in] Reserved for future use. Must be set to 0.

  • pAABB[out] A pointer to a valid A3DBoundingBoxData which will be filled in with the computed bounding box. If not possible an invalid bounding box is filled in (see below).

Return values
  • A3D_INVALID_DATA_STRUCT_SIZE

  • A3D_INVALID_DATA_STRUCT_NULL

  • A3D_BASE_BAD_ENTITY_TYPE

  • A3D_SUCCESS – The bouding box computation is done on visible entities only. The unit used is the same as the given entity.

Returns

A3D_SUCCESS in case of success or an error code