###
PRC
###

.. toctree::
   :hidden:

   /guide/persistent_ids

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.

.. image:: /_assets/images/prc-structure.png

The list below describes the hierarchy starting at the root:

* **Model file**  is the root PRC entity, represented by :struct:`A3DAsmModelFile`.
  There is only one model file per assembly tree.
  The model file structure contains references to the product occurrences as well as global information such as the unit scale and the modeling system used to create the file.
* **Product occurrence**  is a logical group of geometric information.
  These nodes are the building blocks of the PRC assembly tree and represent the root data structure for an assembly and all the information contained within.
  A product occurrence node may contain many child product occurrences, or it could represent just a single part.
  It can also be used to instance other geometry by referencing other product occurrences.
  The class name is :struct:`A3DAsmProductOccurrence`
* **Part definitions**  contain metadata about the geometry such as as annotations, views, the bounding box, as well as a reference to the part's geometric representation.
  The class name is :struct:`A3DAsmPartDefinition`.
  A product occurrence may only contain a single part definition.
* **Representation items**  encapsulate information about how to draw the geometry.
  This includes the model transform, tessellation data, and B-rep information, if available.
  Particularly complex parts in the model may consist of multiple representation items. The class name is :func:`A3DRiRepresentationItem`.

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 :doc:`here </guide/start/api-conventions>`.

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 :download:`PRC format specifications </_assets/SC2N570-PRC-WD.pdf>` document.

Units
=====

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.

The more direct way to retrieve the unit used for scaling a model file is by calling :cpp:func:`A3DAsmModelFileGetUnit`.
See :doc:`/guide/units` for more information.

Compatibility With Different PRC Format Versions
================================================

HOOPS Exchange provides backward compatibility with other PRC format versions.
In a major release, the HOOPS Exchange support for PRC is backward compatible.
Each new version of the software can read PRC files that conform to an earlier PRC format version.

