Layers

Up to version 24.4.0, a layer was simply a logical group of objects. It only contained a name and an ID.

These regrouped objects were not required to be related in any way, and an entity could only be linked to one layer, by specifying its layer indice on the A3DGraphicsData structure.

Since version 24.5.0, the layer object type has been extended with a note field and a display status. Moreover, since an entity can now be linked to several layers, a layer also maintains a list of referenced entities.

Typical Contents And Usages

Layers in a part file can include features like sketches, extrusions, holes, datum planes, axes, surfaces and annotations that belong to that specific part.

Layers help in controlling the visibility and selectability of features within a part. They can be used to simplify the part model view, focus on specific features, and prevent accidental modifications.

Common applications include:

  • Organizing different types of features (e.g., all holes on one layer, all datum planes on another).

  • Managing complex parts with many features by grouping related features together.

  • Controlling the display of reference geometry and construction elements separately from the solid geometry.

API Overview

A layer is structured as follows:

typedef struct
{
     A3DUTF8Char                  m_pcLayerName;
     A3DUns16                     m_usLayer;   // *deprecated*
     A3DUns32                     m_uiLayerID; // Layer ID
     A3DUTF8Char*                 m_pcNote;
     A3DMiscEntityReference**     m_ppReferenceEntities;
     A3DUns32                     m_uiReferenceEntitiesSize;
     A3DELayerDisplayStatus       m_eDisplayStatus;
} A3DAsmLayer;

The field m_usLayer identifies a layer by a 16-bit integer ID.

Note

Please note m_usLayer is now deprecated and will be removed in future versions.

The field m_uiLayerID has been added and will fully replace the above field in future HOOPS Exchange releases. It’s the layer ID (same as previous ID, but encoded on a 32-bit integer) coming from source internal format (e.g. Creo layer ID).

Field m_pcNote is a null-terminated UTF-8 string which may add some description to this layer.

The field m_ppReferenceEntities is an array of links to entities referenced by this layer (if the layer explicitly knows them). Its size is m_uiReferenceEntitiesSize.

Each link directly references a geometric entity or construction geometry participating in a feature element.

Important

An empty array doesn’t necessary mean that this layer is empty. In this case, you need to check the layerIndex field of an entity to know if it’s referenced by a layer.

The m_eDisplayStatus field is an enumerator specifying its display status:

  • kA3DLayerDisplayShow layer is shown

  • kA3DLayerDisplayHide layer is hidden

  • kA3DLayerDisplayIsolate layer is isolated

  • kA3DLayerDisplayUnknown layer display status is unknown

kA3DLayerDisplayIsolate status means that only this layer is visible.

Getting Layer List

Throughout the HOOPS Exchange API, a layer list to which a product occurrence belongs can be obtained by calling A3DAsmProductOccurrenceGetLayerList() as shown in the following code:

A3DAsmProductOccurrence* const m_productOccurrence;
A3DAsmLayer* m_layers = nullptr;
A3DUns32 m_numberLayer = 0;
A3DStatus m_productOccurrenceGetLayerListStatus = A3DAsmProductOccurrenceGetLayerList(m_productOccurrence, &m_numberLayer, &m_layers);

Each layer struct returned by this call will also be fully filled, and may contain, in turn, the list of all entities referenced by this layer.