You should post something by the way.
Other than that:
- If your Brep is a polySurface (R is a surface modeller) then you should decompose into the BrepFaces that compose the Brep. Kinda like a Mesh is a collection of MeshFaces (quads or triangles).
- Get the BrepFaces Normals according some rational way: i.e. a Normal that could identify the orientation that you want. That said (general case) this MAY be quite tricky. That said if the Brep is closed and is valid then Normals point outwards (in most of “normal” cases, that is).
- Compare the Normals against a Vector (say Z+ or some other). This means either measure the angle or use the DotProduct (this works in some specific cases). You can use other filters as well (general case) like planarity, connectivity, a bounding box and other.
- If the angle is greater than some value reject the donor BrepFace (or get it if the angle is less than some value).
BTW: A BrepFace is a thing that using an underlying Surface (as “template”) applies Trim(s) (inner[holes] or outer[boundary] - with regard their content [curves] these are called Loops) that define the “portion” of the Surface that is visible to you. This means that in most of cases - and with regard what you see - a Brep has no Surfaces (it has BrepFaces).
BTW: The general case of that puzzle is addressed by hard flat Clustering the BrepFaces according various criteria: but that requires code and is far beyond the scope of this thread.