BrepEdge.AdjacentFaces() equivalent in C++

Hello,

Seems pretty hard to find, but what’s the equivalent of BrepEdge.AdjacentFaces() in the C++ SDK ?
Thanks

Hi,

I don’t know if there is an equivalent method but you can find the adjacent faces by Walking through the topology: face->loop->trim->edge->trim->…

Best
Thomas

Hi @blondbeer,

Something like this should do it:

int ON_Brep_EdgeFaceIndices(
  const ON_Brep* pBrep, 
  int edge_index, 
  ON_SimpleArray<int>& face_indices
)
{
  int rc = 0;
  if (pBrep)
  {
    const ON_BrepEdge* pEdge = pBrep->Edge(edge_index);
    if (pEdge)
    {
      const int trim_count = pEdge->TrimCount();
      for (int i = 0; i < trim_count; i++)
      {
        const ON_BrepTrim* pTrim = pEdge->Trim(i);
        if (pTrim)
        {
          const ON_BrepFace* pFace = pTrim->Face();
          if (pFace)
            face_indices.Append(pFace->m_face_index);
        }
      }
    }
    rc = face_indices.Count();
  }
  return rc;
}

– Dale

Thank you so much!