.. _group__a3d__rootbase:

###########
Entity Base
###########

Creates and accesses a hierarchy of descriptive names and modeller data that can be applied to any PRC entity.

Entity type is :c:enumerator:`~kA3DTypeRootBase`

This module lets you create a hierarchy of descriptive names and modeller data (called *root-level attributes*\ ) that can be applied to any PRC entity. These attributes are packaged as an :c:type:`~A3DRootBase` entity that is referenced from the PRC entity they describe.

The following sample code shows how to create root-level attributes for any PRC entity. In this case, the attributes include modeller data. For restrictions on specifying modeller data, see :c:struct:`~A3DMiscAttributeData`\ .

.. code-block:: cpp

   A3DVoid setAttributes(A3DEntity* p)
   {
       A3DMiscAttribute* pAttr[3];
   
       A3DMiscSingleAttributeData Single = A3D_MAKE_DATA(A3DMiscSingleAttributeData);
   
       Single.m_eType = kA3DModellerAttributeTypeString;
       Single.m_pcTitle = "Title";
       Single.m_pcData = "Simple B-rep building demonstration";
   
       A3DMiscAttributeData sAttribs = A3D_MAKE_DATA(A3DMiscAttributeData);
   
       sAttribs.m_pcTitle = Single.m_pcTitle;
       sAttribs.m_asSingleAttributesData = &Single;
       sAttribs.m_uiSize = 1;
       A3DInt32 iRet = A3DMiscAttributeCreate(&sAttribs, &pAttr[0]);
   
       Single.m_pcTitle = "Author";
       Single.m_pcData = "HOOPS Exchange";
       sAttribs.m_pcTitle = Single.m_pcTitle;
       iRet = A3DMiscAttributeCreate(&sAttribs, &pAttr[1]);
   
       Single.m_pcTitle = "Company";
       Single.m_pcData = "Tech Soft 3D";
       sAttribs.m_pcTitle = Single.m_pcTitle;
       iRet = A3DMiscAttributeCreate(&sAttribs, &pAttr[2]);
   
       A3DRootBaseData sRootData = A3D_MAKE_DATA(A3DRootBaseData);
   
       sRootData.m_pcName = "Trimmed surface";
       sRootData.m_ppAttributes = pAttr;
       sRootData.m_uiSize = 3;
       iRet = A3DRootBaseSet(p, &sRootData);
   
       // cleaning up the allocated attributes
       for(A3DUns32 i = 0; i < sRootData.m_uiSize; ++i)
       {
           A3DEntityDelete(sRootData.m_ppAttributes[i]);
       }
   }

The following illustration shows the result of the sample code.

The sample code creates an :c:type:`~A3DRootBase` entity that houses three :c:type:`~A3DMiscAttribute` entities, each of which reference an :c:struct:`~A3DMiscSingleAttributeData` structure. Each :c:struct:`~A3DMiscSingleAttributeData` structure provides modeller data of type :c:enumerator:`~kA3DModellerAttributeTypeString`\ .




   :ref:`Root Type Declarations <group__a3d__root__types>`


.. rst-class:: kind-group kind-function

.. rubric:: Functions
   :class: kind-group-title


.. rst-class:: api-xref-list


* :c:func:`~A3DRootBaseAttributeAdd`
* :c:func:`~A3DRootBaseAttributeAppend`
* :c:func:`~A3DRootBaseAttributeRemove`
* :c:func:`~A3DRootBaseAttributeRemoveAll`
* :c:func:`~A3DRootBaseAttributeRemoveAt`
* :c:func:`~A3DRootBaseGet`
* :c:func:`~A3DRootBaseSet`


