# Building a Brep in RhinoCommon

**URL:** <https://discourse.mcneel.com/t/building-a-brep-in-rhinocommon/11484>\
**Category:** Scripting\
**Created:** [September 8, 2014, 11:10am UTC](https://discourse.mcneel.com/t/building-a-brep-in-rhinocommon/11484 "2014-09-08T11:10:46Z")\
**Posts on this page:** 1\
**Showing post:** 11

<div class="post-metadata">

**Author:** ![dale](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/dale/32/772741_2.png) [@dale](https://discourse.mcneel.com/u/dale)\
**Post date:** [December 3, 2016, 12:15am UTC](https://discourse.mcneel.com/t/building-a-brep-in-rhinocommon/11484/11 "2016-12-03T00:15:39Z")

</div>

> [@bdidier](#):
>
> But I assume that the index of the resulting brep faces is still somewhat unpredictable

Yes, probably. You could always loop through the list of curves one at a time. But that would be slow.

Rolling your own `Brep` isn’t for the faint of heart. There is quite a bit of work in putting together the most basic shapes, let alone a patched face with a bunch of holes.

The famous `Brep` data structure:

> **[Brep Data Structure](https://developer.rhino3d.com/guides/cpp/brep-data-structure/)**
>
> This guide discusses the Boundary Representation (B-rep) in the context of openNURBS.

Here are a couple of samples, in C#, to chew on:

[SampleCsFaceWithHole.cs](https://github.com/mcneel/rhino-developer-samples/blob/6/rhinocommon/cs/SampleCsCommands/SampleCsFaceWithHole.cs)

[SampleCsTrimmedPlane.cs](https://github.com/mcneel/rhino-developer-samples/blob/6/rhinocommon/cs/SampleCsCommands/SampleCsTrimmedPlane.cs)

Now if you really want to trim, not split, then it is possible to create a disjoint Brep, with a bunch of extruded surfaces, and then use `Brep.Trim`. I can work up a sample if you want…

– Dale

---

_[View the full topic](https://discourse.mcneel.com/t/building-a-brep-in-rhinocommon/11484)._
