Using Common Data Access with BimRv SDK (Part 2 of 2)

Ilya Kovaldov

December 12, 2019

This is the second article in a series about using Common Data Access (CDA) with BimRv SDK. For the first article, click here.

ODA Common Data Access (CDA) is a platform-neutral framework for accessing model structure and property information in a common manner for all ODA-supported formats. As an example, this two-part series focuses on using CDA with BimRv SDK.

Database Hierarchy and Properties Cache Examples

To get the whole database element properties cache and structural information in a hierarchy tree, use the RxCommonDataAccessModule library. The next example demonstrates how to get the database hierarchy tree with the object properties cache:

#include "RxModelHierarchyTreeBase.h"
::odrxDynamicLinker()->loadModule(RxCommonDataAccessModuleName);
OdRxModelHierarchyTreeBasePtr pTreeBase = OdRxModelHierarchyTreeBase::createObject();
pTreeBase->createDatabaseHierarchyTree(m_pDatabase, true);

To navigate the database structural tree, use the node methods OdRxModelTreeBaseNode::getChildren() and OdRxModelTreeBaseNode::getParents():

#include "RxModelTreeBaseNode.h"
OdRxModelTreeBaseNodePtr pDBNode = pTreeBase->getDatabaseNode();
  // getting db childes
OdRxModelTreeBaseNodePtrArray pChildes = pDBNode->getChildren();

OdRxModelTreeBaseNodePtr pSomeNode = pChildes.at(0);
OdRxModelTreeBaseNodePtrArray pParents = pSomeNode->getParents();

To get information about the nodes, use:

  • OdRxModelTreeBaseNode::getNodeName() to get the Node name.
  • OdRxModelTreeBaseNode::getUniqueSourceID() to get the ODAUniqueID object’s property value. This property returns an ID. Currently this handle links tree nodes to the geometry, e.g. for selection purposes.
  • OdRxModelTreeBaseNode::getNodeType() to get the node type. The type identifier is the “hierarchy level” of that node from the structural point of view. It can describe an object as a database, block, model, block reference, or single entity in the hierarchy tree.
  • OdRxModelTreeBaseNode::getProperties() to get the cached properties of the node in the PropertyInfo structures array.
// node methods example
OdString strNodeName = pSomeNode->getNodeName();
OdUInt64 uId = pSomeNode->getUniqueSourceID();
HierarchyTreeObjectType nodeType = pSomeNode->getNodeType();
OdArraypropInfo =  pSomeNode->getProperties();

For more information about the CDA hierarchy tree system, see the following header files:

  • Kernel\Include\RxModelHierarchyTreeBase.h
  • Kernel\Include\RxModelTreeBaseNode.h

BmElements Properties Representation

The TB_CDAProperties module supports two BmElements parameter representation templates: Customer and BuiltIn. The BuiltIn properties representation template is switched off by default. To turn it on, add the next preprocessor definition: BUILTINPROPENABLE.

Application Example (ODA Viewer)

The following example demonstrates using the module in the ODA Viewer application. The Object Explorer on the left represents the structure of the database formed using RxCommonDataAccessModule and TB_CDAProperties. The Properties panel on the right shows a single Window BmElement property representation in BuiltIn and default Customer templates.