Mistake in ON_BrepFace::SurfaceIndexOf()

Documentation states: “Returns: brep.m_S surface index of the 3d surface geometry used by this face or -1.”

However, the code actually returns 0 when m_si is out of range instead of -1:

int ON_BrepFace::SurfaceIndexOf() const
{
return (m_brep && m_si >= 0 && m_si < m_brep->m_S.Count()) ? m_si : 0;
}

Hi @stephen.banks,

Thanks, I’ve logged the issue.

https://mcneel.myjetbrains.com/youtrack/issue/RH-70623

– Dale