Hello, I have a closed polysurface like this and I want to merge all coplanar faces. When I use the standard command (merge all coplanar faces), the faces get merged as expected, but when I use ‘MergeCoplanarFaces’ in rhinocommon using c#, it doesn’t work as expected.
Here is some additional info, and the file with the geometry (at the end of the screenshots). Any help is greatly appreciated as I have no idea why this is occuring.
The script if longer than this, but I’ll share the most relevant part.
The basic idea of the script is to create a simple wall and floor schema. The idea is to get a simple polysurface that would show the walls of the room with the floor, like this:
I further conceptually divide these boxes into ‘lower’ part (where the floor will be) and ‘upper part’ (where walls will be). I basically use plane intersections to get the curves that I’ll use to construct the final schema - in this example the curves are the red bottom one (for the floor) and blue ones (for the walls). Each of the parts will get extruded up a specific height (in this case the floor will get extruded 20 cm, walls 260 cm).
When I get the curves (called BDsAndClusterCuts below), I than extrude the curves to first form the vertical surfaces for both the ‘upper’ and the ‘lower’ part respectively.
var BDsAndClusterCuts = new List<Curve>();
BDsAndClusterCuts.AddRange(BDAcuts); // BDAcuts are cuts with the yellow box
BDsAndClusterCuts.AddRange(clusterCuts); //clusterCuts are cuts with green box
List<Surface> surfaces = new List<Surface>();
Vector3d v = new Vector3d(0, 0, height);
foreach (var crv in BDsAndClusterCuts)
{
var s = Extrusion.CreateExtrusion(crv, v);
surfaces.Add(s);
}
foreach (var s in surfaces)
{
var sToBrep = s.ToBrep();
breps.Add(sToBrep); // this breps collection collects breps from both lower and upper parts
}