Thanks for your response, Radovan.
I got it to work with Brep.CreatePlanarBrep and then extruding the faces. The only problem I have is that while the curves are closed as seen on this picture
There is a little overlap as seen on this picture. (which is a zoomed in version of the first picture)
This is a problem when I want to use CreatePlanarBrep as it won’t work when there is an overlapping piece as shown. What happens when using CreatePlanarBrep with a overlapping piece is that only the outer Brep is created, without the holes.
So what I do now is to go through each curve, and remove duplicate points to avoid this.
Do you know of a good way to make an “approximate” curve that avoids this in a good way?
Regarding the BooleanDifference method:
Here I also need to remove duplicate points, or the resulting brep will not be solid.
I did also not get it to work without adding them to document and retrieving them again. What I noticed is that on the documentation of BooleanDifference it says that solid orientation matters when calling the method. http://developer.rhino3d.com/api/RhinoCommon/html/M_Rhino_Geometry_Brep_CreateBooleanDifference.htm
In my test example I have three breps, one outer and two holes. When I create them the outer brep has an inward solid orientation, while the two others are outward. After adding and retrieving from doc they are all outward. Could this be the problem? And if so, can I ensure that they will have a certain solid orientation?
Also, I set tolerance for the boolean difference to be doc.ModelAbsoluteTolerance, Incase that can be a problem.