Add Brep problem

Hi all,

I have 4 curves, I create a brep from these curves, then add it to doc Object, but it returns Guid == 0000
Here is my code:

Brep rectangleBrep = new Brep();
Guid rbGuid = doc.Objects.AddBrep(rectangleBrep);
RhinoObject rhoRB = doc.Objects.Find(rbGuid);

rbGuid is null (and a Null Exception occurred). How to correct it?

Help me please,

Creating a Brep from scratch is quite difficult, but fortunately there are many static helper methods. In this case you may want to use Brep.CreateEdgeSurface using the four edges you have.

Thank you very much!

I’ve done, it was very good!