How to convert a GH_Brep to Brep? Custom C# component, working on VS

I want to create a component, as an input it takes a Brep.

I connect the Brep component to my CustomComponent, which reads the geometry with the DA.GetDataTree<GH_Brep>(0, out GH_Structure<GH_Brep> objectsBrep) command, as suggested from previous post.
Now I want to do a bunch of things with this Brep. But when I try I get the Brep following message:

Cannot convert from ‘System.Collections.Generic.List<Grasshopper.Kernel.Types.GH_Brep>’ to 'System.Collections.Generic.IEnumerable<Rhino.Geometry.Brep>

or anyhow, I cannot implicitly convert it, but even though I tried a few explicit conversion commands (ex GH_Brep.CastTo) I cannot seem to make it work.

I am aware of my lack of understanding wrappers and many more layers of how RhinoCommon is structured, sorry for the silly question. Any help would be immensely appreciated. :slight_smile:

1 Like

GH_Brep is Wrapper class, so all need to do is call the Value contained in it at the item level. something like this/

var branches = objectsBrep.Branches;
foreach(var ghBrep in branches)
{
Brep brepGeo = ghBrep.Value;
}
2 Likes

Thank you!