2.2 PRC

The complexity of PRC structures generally reflects the complexity of the original model file. Among other things, geometry is often instanced, materials are often referenced multiple times, and whole subassemblies can be nested hundreds of levels deep. As a result, parsing and interpreting the PRC structures is non-trivial. This section explains how to traverse the assembly tree and calculate the attributes of each entity.

After successfully loading a model file, you will have access to the model file pointer. This object grants access to the root product occurrences of the assembly tree. Be aware that throughout the tree, the way in which sibling nodes are ordered in their respective arrays is significant, as the attributes of the first node may affect sibling nodes.

PRC consists of four main types of entities which form a hierarchy.

The list below describes the hierarchy starting at the root:

Each entity exists as a single node in the assembly tree. In HOOPS Exchange, the nodes themselves contain no data - the developer must explicitly call for the actual data container to be filled. That process is described here.

Please note that in this section and throughout this manual, we will attempt to explain how to perform common tasks using HOOPS Exchange. The manual does not go into fine detail regarding the PRC file format. If you are planning a deep integration with HOOPS Exchange, you should familiarize yourself with the PRC standard. That standard can be found in the PRC Format Specification document.


Most model files provide the measurement units for the geometry contained within. The unit type may be global - meaning it is applied to all geometry - or it may be provided for each assembly or even for each individual part.

You can determine if the model you're loading uses a global scale by examining the A3DAsmModelFileData::m_bUnitFromCAD field. If the model uses a global scale, then this field will be true, and you can find the actual units in the A3DAsmModelFileData::m_dUnit field. The units are specified in multiples of millimeters. Accordingly, a value of '1' indicates millimeters, '10' indicates centimeters, and so on.

It is not possible to have more than one valid unit. When assemblies of multiple parts specify different units, HOOPS Exchange will scale all units into a single unit type for simplicity.

How to interpret non-global unit scale

If the m_bUnitFromCad field is false, then you must parse the assembly tree to find the unit scale. In this case, the unit value can be found on the first product occurrence encountered that has the flag A3DAsmProductOccurrenceData::m_bUnitFromCAD set to true. To better understand, consider the diagram below:

Although "Product Occurrence 4" is located higher in the assembly tree, and m_bUnitFromCAD is true, "Product Occurrence 3" will be parsed first - therefore, the unit scale that applies to the model is the one on "Product Occurrence 3".

In some cases, you can override any unit setting from the model by setting the read parameter A3DRWParamsLoadData::A3DRWParamsGeneralData::m_eDefaultUnit accordingly. By setting the value to kA3DUnitUnknown, you will guarantee the native unit of the CAD file is used. See this field's reference manual entry for details.

Dealing with B-rep units

When parsing a representation item with B-rep, you have to find the units in another way. The scale you need access to is stored in each A3DTopoContextData structure. The following code snippet demonstrates how you would get the unit scale in this case, in this case starting from a A3DRiCurveData structure:

A3DRiCurveData sDataRiCurve;
A3DRiCurveGet(pRiCrv, &sDataRiCurve);
A3DTopoSingleWireBodyData sDataTopoSingleWireBody;
A3DTopoSingleWireBodyGet(sDataRiCurve.m_pBody, &sDataTopoSingleWireBody);
A3DTopoBodyData sBodyData;
A3D_INITIALIZE_DATA(A3DTopoBodyData, sBodyData);
A3DTopoBodyGet(sDataRiCurve.m_pBody, &sBodyData);
A3DTopoContextData sContextData;
A3D_INITIALIZE_DATA(A3DTopoContextData, sContextData);
A3DTopoContextGet(sBodyData.m_pContext, &sContextData);
double scale = 1.0;
if (sContextData.m_bHaveScale)
scale = sContextData.m_dScale;

Additional notes regarding scale

In addition to the notes above regarding scale, you also need to consider any scale present on an entity's individual transformation.

top_level:1 prog_guide:1