Non-planar polygons

I need to be able to create a model built up from a large number of rectangular patches. These patches are non-planar. I can create a polygon using BRepBuilderAPI_MakePolygon but when I attempt to create a face using BRepBuilderAPI_MakeFace I get an error (BRepBuilderAPI_NotPlanar).

Does anyone know how I can create the face without resorting to splitting the rectangle into two triangles?

Even better, add the polygon to a shape to make a single surface?

Thanks...Mark

Deelip's picture

I am faced with the same problem. Does anyone have a solution?

n-southall's picture

This is particularly annoying as some of the old versions of Cascade (pre- open source) allowed the use of non-planar polygons in BRepBuilderAPI_MakeFace. This worked fine, but from (I think) Version 3.0 non-planar polygons were not tolerated. I'm afraid to admit that for my 4-sided polygons I simply split them into two triangular faces, but it isn't very satisfactory.

Neil

Deelip's picture

I found a solution for a 4 sided non planar polygon (if I may call it that)

TColgp_Array2OfPnt Array(1,2,1,2);
Array.SetValue(1,1,gp_Pnt(Point1.x,Point1.y,Point1.z));
Array.SetValue(2,1,gp_Pnt(Point2.x,Point2.y,Point2.z));
Array.SetValue(1,2,gp_Pnt(Point4.x,Point4.y,Point4.z));
Array.SetValue(2,2,gp_Pnt(Point3.x,Point3.y,Point3.z));

Handle (Geom_BSplineSurface) pSurface = GeomAPI_PointsToBSplineSurface(Array);
Face = BRepBuilderAPI_MakeFace(pSurface);

This gives a smooth curved "rectangular" surface. Hope this helps.