6.0 Views and PMI

In HOOPS Exchange, markup refers to PMI and all the supporting infrastructure related to displaying it with the model. HOOPS Exchange groups this data into the markup module. Most markup is represented as tessellation, although certain instances can be represented as either tessellation or semantic data.

A model containing PMI

Despite being an important part of the PRC standard, markup is not represented by an entity type. Instead, one of three annotation entities are used. Annotation entities are represented by A3DMkpAnnotationEntity structures, and the structure can be one of three types:

Annotation entities may be present on product occurrences or part definitions.

6.1 Parsing annotation entities

The A3DMkpAnnotationItemData structure references an A3DMkpMarkup. This markup contains tessellation, leaders, and linked item information that is available by using the function A3DMkpMarkupGet. In addition, this markup can also contain definition (type information) data and specific (type, leader, linked items, etc.) data. Those data are stored in a common structure, A3DMarkupDefinitionData, and in a specific structure corresponding to the type returned by the function A3DEntityGetType. For the structures corresponding to markup with a definition, only access functions are defined. In other words, the customer can only create A3DMkpMarkup.

6.1.1 Parsing tessellation of markup

Not all files contain semantic PMI, but PMI in tessellated form is always available, so you are guaranteed to at least get a A3DMkpMarkup structure. For an illustration of the related type hierarchy, see the diagram in the detailed description of this page.

This is an example of getting the PMI tessellation:

A3DMkpMarkupData markupNodeData;
A3DMkpMarkupGet(markupNode, &markupNodeData);
// since tessellation is always available, you can get it from the markupNodeData
A3DTessMarkupData tessMarkupData;
A3DTessMarkupGet(markupNodeData.m_pTessellation, &tessMarkupData);

6.1.2 Parsing markup types

Different types of markup are possible, such as dimensions, GDT, datum, or text. All markup will have different information depending on its type, and each type must be parsed accordly. Get the type of the markup, and then get the corresponding information (if the markup is a dimension, use A3DMarkupDimensionGet to retrieve the information about the dimension:

A3DStatus iRet = A3DEntityGetType(pMarkup, &eType);
iRet = A3DMarkupDefinitionGet((A3DMarkupDefinition*)pMarkup, &sMarkupData);
if(iRet != A3D_SUCCESS)
{
A3DMarkupDefinitionGet(NULL, &sMarkupData);
return A3D_ERROR;
}
if(eType == kA3DTypeMarkupText)
{
iRet = A3DMarkupTextGet(pMarkup, &sMarkupData);
}
else if(eType == kA3DTypeMarkupRichText)
{
iRet = A3DMarkupRichTextGet(pMarkup, &sMarkupData);
}
else if(eType == kA3DTypeMarkupDatum)
{
iRet = A3DMarkupDatumGet(pMarkup, &sMarkupData);
}
else if(eType == kA3DTypeMarkupGDT)
{
iRet = A3DMarkupGDTGet(pMarkup, &sMarkupData);
}
else if(eType == kA3DTypeMarkupDimension)
{
iRet = A3DMarkupDimensionGet(pMarkup, &sMarkupData);
}
else
{
}

Semantic PMI

If the markup is a GDT and has been created in a semantic way in the native CAD software, you can retrieve the semantic information for the Feature Control Frame, using the function A3DMDSemanticFeatureControlFrameGet. If there is no semantic information associated to the GDT, you can still retrieve non-semantic information as texts(in A3DMDFCFDraftingRowData) using the function A3DMDFeatureControlFrameGet. Note that A3DMarkupDimension represents semantic markup.

6.1.3 Parsing leader lines

If the markup has leader lines, you can retrieve the tessellation of the leaders and, in some case, linked items associated to the leaders. Parse it like you parse linked items (see below: 6.1.4 Linked item associated to markup) or tessellation (see 6.1.1 Parsing tessellation of markup).

6.1.4 Linked item associated to markup

A linked item represents a link between a markup object and an entity such as a solid, a topological entity, a construction entity, a coordinate system, or even another markup. For example, if you have a dimension line which indicates the distance between two planes, the dimension is a markup object. It will have two A3DMiscMarkupLinkedItem references, and each reference will define a link to a plane.

Show and delete behaviors

In A3DMiscMarkupLinkedItem, note the boolean fields such as m_bMarkupDeleteControl and m_bLeaderShowControl, which enable you to control what happens when a referenced entity is deleted, hidden, or shown. For example, if the m_bMarkupDeleteControl flag is enabled, then the markup will be deleted when the entity is deleted. Similarly, if the m_bLeaderShowControl is enabled, then the markup is shown when the associated entity is shown.

6.2 Parsing views

PMI items are often organized under PMI views. A PMI view includes a camera and defines a particular model state - often including visibility for particular parts, certain PMI items, highlighted parts, or even has some parts arranged in an exploded view. All of these things are managed by linked items.

The purpose of a PMI view is to arrange the model to convey a certain idea. The HOOPS Exchange type for a PMI view is A3DMkpViewData. This object can be part of a product occurrence or a part definition.

6.2.1 Parsing annotations

The annotations associated to the views will be displayed in the view.

6.2.2 Parsing the display scene parameters

In the structure A3DGraphSceneDisplayParametersData, you will find information about the graph scene. Here is a code snippet to retrieve graph scene data:

Camera, lights, styles

With the A3DGraphCameraData, you will be able to retrieve information about the position of your camera in the view. The graph scene parameters also contains information about style, background color, etc.

Cutting planes

In the A3DGraphSceneDisplayParametersData, you can find the information related to the clipping planes in the field m_ppClippingPlanes. Here is a snippet code to retrieve the cutting planes of a view:

A3DInt32 iRet = A3DGraphSceneDisplayParametersGet(pGraphSceneParam, &sData);
for (int ui=0; ui < sData.m_uiPlaneSize; ui++)
traverseSrfPlane(sData.m_ppClippingPlanes[ui);

6.2.3 Parsing linked item associated to the view

Linked items will define the view as a particular model state – for example, visibility for particular parts, display of certain PMI items, highlighted parts, or even with some parts arranged in an exploded view.

Visibility of items and PMI using linked items

For files in an assembly context, it is possible that some markup associated with a product occurrence can be displayed in a view associated with another product occurrence. Markup or geometry not associated with a particular view can also be displayed or hidden in that view. The item referenced by A3DMiscMarkupLinkedItemData::m_pReference will have its visibility changed by default in the view. If the item was displayed by default, it will be hidden (and if hidden, will be displayed).

A3DMiscMarkupLinkedItemData::m_pTargetProductOccurrence will specify the product occurrence to which this item belongs, or it can be NULL if the item is at the same level.

Markup and bodies are not the only items you can reference with a linked item - you can also manage the position of the items in a view. To do this, you would define a new coordinate system for the entity you want to be modified, and set this entity in A3DMiscMarkupLinkedItemData::m_pReference. Don't forget to specify the product occurrence to which the item belongs (or set to NULL if the item is at the same level).

Here we are creating an exploded view, one of the two PO of the model will be "exploded":

// creating the linked item
A3DMiscMarkupLinkedItem* pMarkupLinkedItem = NULL;
// setting the target ProductOccurrence to NULL if the reference is at the same level as the PO,
// or to the level above if the PO tree has several levels
sLinkedItemData.m_pTargetProductOccurrence = NULL;
// setting a non-null reference to create the LI
sLinkedItemData.m_pReference = sData.m_ppPOccurrences[0];
CHECK_RET(A3DMiscMarkupLinkedItemCreate(&sLinkedItemData, &pMarkupLinkedItem));
// creating the entity reference containing the new coordinate system
A3DMiscEntityReferenceData sEntityReferenceData;
// applying the new coordinate system on the first ProductOccurrence
sEntityReferenceData.m_pEntity = sData.m_ppPOccurrences[0];
sEntityReferenceData.m_pCoordinateSystem = psRiCoordinateSystem;
// setting the linked item with the new entity reference
CHECK_RET(A3DMiscEntityReferenceSet(pMarkupLinkedItem, &sEntityReferenceData));
// adding the linked item to the view and creating of the view
mkpViewData.m_uiLinkedItemsSize = 1;
mkpViewData.m_ppLinkedItems = (A3DMiscMarkupLinkedItem**)
malloc(size_t(mkpViewData.m_uiLinkedItemsSize) * sizeof(A3DMiscMarkupLinkedItem*));
mkpViewData.m_ppLinkedItems[0] = pMarkupLinkedItem;

To summarize, when determining how a view should be arranged, you must consider three things:

Not all CAD model files have markup, linked items, or filters in their views. Some file formats do not support these entities, so your application must decide how to handle each situation based on the type of file you are parsing.

6.2.4 Parsing filters

A filter (A3DAsmLayerFilterItemData)can be associated with a view. To this filter will be associated one or more layer indexes. Moreover, there is a flag that defines whether the layers are inclusive or exclusive:

Each object is associated to a layer in the GraphicsData. In the view, we retrieve the layer indices and determine if they are inclusive or exclusive. All the objects associated to these layer indices will be filtered (if the layer is inclusive) or unfiltered (and all the objects not associated to the view will be filtered) if the layer is exclusive.

Note that filters are not found in all CAD files, and some file formats don't support them at all.