Close

Relief for ODA Team in Ukraine

Learn more
ODA BimRv SDK
Example of Work with B-Rep Objects

Working with Faces and Edges

Each edge has two next pointers and two previous pointers to the OdBmGEdge object; it also has two pointers to the faces that are bound by the edge. To work with edges, you need to call the face, loop, then edge. Find the "active" face in the array of faces of the edge. After, select pointers and points at the same position in the arrays. Next, in the edge, find the correct next/prev pointer for continuing the loop or select the correct points. For example:

Edge points must be used in a forward direction if using the forward direction is used for the loop, and edge points must be reversed if a reversed loop is in use. There are two exceptions:

  • Edge points with index 0 have a forward direction, but points with index 1 must be reversed.
  • First bit of the edge flag is 'flipped'. If it is 'true', points must be reversed.

Useful Methods of BimRv B-Rep Classes

OdBmGeometry class:

  • getEdges() method — Returns array of edges through its argument.
  • getFaces() method — Returns array of faces through its argument.
  • getGInfo() method — Returns geometry information as an object of the OdBmGInfo class.

OdBmFace class:

OdBmGEdgeLoop class:

  • getNextLoop() method — Returns a pointer to the next edge loop on the surface.
  • getFace() method — Returns a pointer to the face connected with the loop.
  • getNext() method — Returns a pointer to the start edge of the loop. Forward loop direction.
  • getPrev() method — Returns a pointer to the start edge of the loop. Reverse loop direction.

OdBmGEdge class:

  • getFacesItem() method — Returns array of pointers to faces connected with the edge.
  • getNextItem() method — Returns array of pointers to the next edges in a loop. If it is the last edge in a loop, next will be a pointer to the loop.
  • getPrevItem() method — Returns array of pointers to the previous edges in a loop. If it is the last edge in a loop, prev will be a pointer to the loop.
  • getInteriorEdgeGePnts() method — Returns points of the edge on the surface, except for the start and and points.
  • getFirstAndLastEdgeGePntsItem() method — Returns start and end points of the edge on the surface.

Example of Work with B-rep Objects

The following example describes working with B-Rep objects by getting an object using its ID, passing through its faces and loops of edges, and displaying exterior points of each edge.


// Get object
OdBmElementPtr pElem = pDb->getObjectId(OdDbHandle(OdUInt64(iHandle))).safeOpenObject();
// Get object's geometry
OdBmObjectPtr pGeom = pElem->getGeometry();
if (pGeom->isA() == OdBmGElement::desc())
{
  OdBmGElement* pGElem = dynamic_cast<OdBmGElement*>(pGeom.get());
  //Get nodes
  OdBmGNodePtrArray nodes;
  pGElem->getAllSubNodes(nodes);
  //Test all nodes until OdBmGeometry found or all nodes verified
  dumpGGroup(pIO, nodes);
}//if (pGeom->isA() == OdBmGElement::desc())
    

To see the full sample find Examples/TB_Commands/Dump/BmBrepCmd sample command inside your ODA BimRv SDK installation folder.

See Also

Work with Boundary Representation Objects

Overview of B-Rep in .rfa/.rvt Files

Copyright © 2002 – 2022. Open Design Alliance. All rights reserved.