Picking a face in a brep

Hi guys,

I have a brep with many faces, when I pick the brep, is there an easy way to find out which face is picked from the brep? I certainly can find out the picking point to search for the face, but I think there should be a easy way to find out the face what user pick in the brep. I want the whole brep being picked, but I need to find face where the user select.

Regards
Eric

You can monitor the mouse press event(MouseCallback), convert the screen coordinates to world coordinates, and find the corresponding BrepFace through the RhinoBrepClosestPoint
.I think of the method is like this, for reference only, there may be a better way.
–Easy

Hi @renyu_teng,
If you don’t want to use the ObjRef.SelectionPoint() and then search for the face, you could set the filter to choose a BrepFace itself, and then get the main Brep out of it. For example

GetObject go = new GetObject();
go.SetCommandPrompt("Select brep face");
go.GeometryFilter = ObjectType.Surface;
go.SubObjectSelect = true;
go.Get();
if (go.CommandResult() != Result.Success)
    return go.CommandResult();
var objref = go.Object(0);

BrepFace face = objref.Face();
Brep brep = objref.Brep();
//Alternatively
//Brep brep = face.Brep;

good idea. Thank you.