Split face



I want split this BrepFace into 3 BrepFaces

I can get the vertical split curve from the wired model.

I’ve tried split using BrepFace.Split function, but I can’t get the result that I need.

I’m working with rhinoCommon and c#


(Menno Deij - van Rijswijk) #2

It would help if you could post the code you use that is not working for you…


I try split the face three ways:

if (!face.IsPlanar())
    // 1
    // split is empty
    Surface[] split = face.Split(0, 1);
    // 2
    // wired contains all vertical curves from face model 
    Curve[] wired = face.ToBrep().GetWireframe(1).Where(c => c.PointAtStart.Z != c.PointAtEnd.Z).ToArray<Curve>();
    // The brep is a horizontal brep
    Brep split2 = face.Split(wired, 1);

    // 3
    // idem case 2
    Curve[] iso = face.TrimAwareIsoCurve(0, 1);
    Brep split3 = face.Split(iso, RhinoDoc.ActiveDoc.ModelAbsoluteTolerance);

(Menno Deij - van Rijswijk) #4

In case 1 you use the split along isocurve at parameter value of 1. Maybe the value of 1 is not in the domain of the surface underlying the face, or parameter of 1 only available outside trimmed regions.

In case 2, you use a tolerance of 1, which may be a bit large.

In case 3, again you use an iso curve at parameter value 1. Are you sure that the curve is on the surface?


Sorry, but I don’t understand your responses:

Case 1: How Can I get the correct second parameter?

Case 2: I try with lower tolerance values but not get the desired result

Can you give me an example of how Split the face into 3 segments?



any idea?

(Menno Deij - van Rijswijk) #7

A surface has two parameters: U and V (0 and 1). These parameters have domains, within which they describe the surface.

If you say face.Split(0,1) you split the face at U-parameter value of 1. But, it is not at all clear that the value of 1 is inside the U-domain, and if it is in the U-domain that it is “visible” (i.e. not trimmed).

You must first determine the value of the parameter at which you want to split.


But, how I can set the value parameter?

In the next image

I can get the vertical curve to split the surface in two parts, but I don’t know how call the split function

(Menno Deij - van Rijswijk) #9

The command below works on the file attached. Can you share your file with the surface that does not want to be split?

ObjRef sRef;
Result res = RhinoGet.GetOneObject("Select brep-face to split", false, ObjectType.Surface, out sRef);
if (res != Result.Success)
    return res;

BrepFace face = sRef.Surface() as BrepFace;
if (null == face)
    return Result.Failure;

Curve[] wired = face.ToBrep().GetWireframe(1).Where(c => c.PointAtStart.Z != c.PointAtEnd.Z).ToArray();

Brep splitted = face.Split(wired, doc.ModelAbsoluteTolerance);
if (null != splitted)

return Result.Success;

FaceSplit.3dm (29.3 KB)


Can you explain this row for me?
What does it do and how does it work? :slight_smile:

I do it differently like extruding the curve first so i have a srf that splits them but a crv would be way better and faster.
I’m using vb.net but I dont understand the Where(c =&gt; c.PointAtStart.Z != c.PointAtEnd.Z) part.

Just see you dont use curves to split but use the wireframe. Its still early i Guess xD

(Menno Deij - van Rijswijk) #11

This is taken exactly from the OP’s code, where for this specific case he was interested in the vertical lines.


Hi menno.

Brep splitted = face.Split(wired, doc.ModelAbsoluteTolerance);

Brep splitted is a polysurface, and from rhino, if I exec explode command, splitted is divided in 3 segments. The result that I need

But,from code, I don’t know how explode splitted

and jordy1989, the line

Curve[] wired = face.ToBrep().GetWireframe(1).Where(c => c.PointAtStart.Z != c.PointAtEnd.Z).ToArray();

returns an array with all vertical curves that composing the face model.

(Menno Deij - van Rijswijk) #13

Ah, I see.

Try this:

foreach(BrepFace f in splitted.Faces)
    doc.Objects.AddBrep(f.DuplicateFace(false)); // duplicate face will create a separate brep of each face


Yeah!! it works!!!

Thank you very much!

I owe you a beer … or several !! =)

EDIT: the bucle is:

foreach(BrepFace f in splitted.Faces)
    doc.Objects.AddBrep(f.DuplicateFace(false)); // duplicate face will create a separate brep of each face

(Menno Deij - van Rijswijk) #15

Excellent. Glad I could help - it took a while for me to understand your needs.