Getting unique identifiers for PDF nodes

PDF 3D scene graph

In a 3D PDF, all entities in the 3D model are structured in a node tree representation called a 'scene graph'. The scene graph is visible in Adobe Reader in a dedicated navigation panel called "Model Tree". It can also be accessed programmatically using JavaScript. Thus, the scene graph is the accessible part of the 3D content from the PDF part of the document, and a key point is to understand the relationship between 3D entities and nodes in the scene graph.

Nodes identifier

Scene graph nodes are identified by a unique name, which may differ from the name displayed to the user. The situation is different depending on the format of the 3D stream inside the PDF:

PRC entities

Not all PRC entities are represented in the scene graph. Regarding the model structure, only two kind of entities have corresponding nodes:

Warning: Product Occurrence structure may define instances of a shared sub-product structure (see the documentation on product prototypes). This kind of structure defines a lot of product occurrences that won't lead to a node in the scene graph. It is important to have a good understanding of the prototype architecture to predict the scene graph representation of the structure.

Getting nodes' unique identifiers

HOOPS Publish contains functions to get the unique names defined by Adobe Reader from PRC entities. They are the function A3DPDF3DStreamCreateFromModelFileAsPRC, which takes a pointer to an important helper object A3DRWParamsPrcWriteHelper as its last parameter, and the two functions A3DEntityGetPDFNodeIdFromWrite and A3DRWParamsPrcWriteHelperFree.

First, the model file needs to be created and loaded into a stream via A3DPDF3DStreamCreateFromModelFileAsPRC with the A3DRWParamsPrcWriteHelper object. Then, the model file will be traversed and entities will be interrogated with the data from this helper object. Finally, the helper object will need to be deleted with A3DRWParamsPrcWriteHelperFree.

Here's a step-by-step rundown of the process: