Parsing representation items
Representation items describe objects present in the 3D image, such as a wheel or a bolt. The exception is the representation item set (type kA3DTypeRiSet), which is a container for other representation items.
Parse a generic representation item
- Parse the entity base, saving the entity name and other relevant data to your export structure. (See Parsing root-base entity data.)
- Create and push a miscellaneous cascaded attributes structure for the representation item, and then get the data for that structure (See Parsing PRC entities that specify graphics.) Record information from the miscellaneous cascaded attributes data structure that is meaningful to your representation.
- Invoke the A3DEntityGetType function to determine the type of representation item, providing the following arguments:
- The first argument (p in the following example) is a pointer to the representation item.
- The second argument (eType in the following example) is a pointer to a variable in which the function stores the type enumerator.
A3DEEntityType eType;
iRet = A3DEntityGetType(p, &eType);
- Parse the representation item depending on the type of representation item, as shown in the following example. (See Parse a representation item set (PRC entity A3DRiSet) or Parse a B-rep model representation item (PRC entity A3DRiBrepModel).)
switch(eType) {
case kA3DTypeRiBrepModel:
parseRiBrepModel(p, father);
break;
case kA3DTypeRiSet:
// ....
break;
case kA3DTypeRiPointSet:
// ....
break;
// ....
default:
// ....
}
- Get the representation item attributes by invoking the A3DRiRepresentationItemGet function.
A3DRiRepresentationItemData sData;
A3D_INITIALIZE_DATA(sData);
iRet = A3DRiRepresentationItemGet(p, &sData);
- Parse the tessellation base data referenced by the m_pTessBase member. (See Parsing tessellation PRC entities.)
parseTess(sData.m_pTessBase, p, pAttr);
- Parse the coordinate system referenced by the m_pCoordinateSystem member. (See Parse coordinate system data.)
parseRiCSys(sData.m_pCoordinateSystem);
- Delete the A3DRiRepresentationItemData created in Step 5 by invoking the A3DRiRepresentationItemGet function with the first argument set to NULL and the second argument set to the location of the structure (&sData in the following example).
A3DRiRepresentationItemGet(NULL, &sData);
Parse a representation item set (PRC entity A3DRiSet)
- Parse the entity base. (See Parsing root-base entity data.) Save the entity name and other relevant data to your export structure.
- Create and push a cascaded attributes structure for a product occurrence object, and push that structure onto the stack. (See Parsing graphic attributes using miscellaneous cascaded attributes.) Save relevant values to your export structure.
- Declare and initialize an A3DRiSetData structure, and then get the data from the representation PRC entity.
A3DRiSetData sData;
A3D_INITIALIZE_DATA(sData);
iRet = A3DRiSetGet(p, &sData);
- Parse each representation item in the representation item set. (See Parse a generic representation item.) The m_uiRepItemsSize field specifies the number of child representation items, and the m_ppRepItems[] field is an array of pointers to the child representation items.
- Delete the A3DRiSetGet function created in Step 3 by invoking the A3DAsmPartDefinitionGet function with the first argument set to NULL and the second argument pointing to the part definition data.
A3DRiSetGet(NULL, &sData);
Parse a B-rep model representation item (PRC entity A3DRiBrepModel)
- Parse the entity base. (See Parsing root-base entity data.) Save the entity name and other relevant data to your export structure.
- Get the B-rep model data by invoking the A3DRiBrepModelGet function. The first argument (p in the following example) is a pointer to the PRC entity, and the second argument (&sData in the following example) is the location of the A3DRiBrepModelData structure.
A3DRiBrepModelData sData;
A3D_INITIALIZE_DATA(sData);
ASInt32 iRet = A3DRiBrepModelGet(p, &sData);
- Parse the B-rep model's topology body data, referenced by the m_pBrepData member. (See Parse topology body data.)
- Parse the B-rep model's data, referenced by the m_pBrepData member. (See Parse the B-rep model's data.)
NOTE: The same member (m_pBrepData) is used to parse topology body data and topology model data. The B-rep model' topology body data is recast as the A3DTopoBody type, which is an abstract root type for any topological body. The A3DTopoBodyGet function takes an argument of type A3DTopoBody.
- Delete the A3DRiBrepModelData created in Step 2 by invoking the A3DRiBrepModelGet function with the first argument set to NULL and the second argument set to the location of the structure (&sData in the following example).
A3DRiBrepModelGet(NULL, &sData);
Parse coordinate system data
- Parse the entity base. (See Parsing root-base entity data.) Save the entity name and other relevant data to your export structure.
- Declare and initialize an A3DRiCoordinateSystemData structure.
A3DRiCoordinateSystemData sData;
A3D_INITIALIZE_DATA(sData);
- Get the coordinate system data by invoking the A3DRiCoordinateSystemGet function. The first argument (p in the following example) is a pointer to the A3DRiCoordinateSystem entity, and the second argument (&sData in the following example) is the location of the A3DRiCoordinateSystemData structure.
ASInt32 iRet = A3DRiCoordinateSystemGet(p, &sData);
- Parse the coordinate system transformation data referenced by the m_pTransformation member of the A3DRiCoordinateSystemData structure.
- Delete the A3DRiCoordinateSystemData structure created in Step 2 by invoking the A3DRiCoordinateSystemGet function with the first argument set to NULL and the second argument set to the location of the structure (&sData in the following example).
A3DRiCoordinateSystemGet(NULL, &sData);