For all issues regarding the Forums use, please, refer to the Forum Rules.

### Our Solutions

Need professional assistance?
Consider our:

Need to speed up your development?
Have a look at our:

Need some functionality extending standard OCCT capabilities?
Check out our:

# create face from curves/wires

Forums:

Hi,

I have the following situation. I load some points which describes closed curves. I give the points to the PointsToBSpline algorithm to get the curve.

TColgp_Array1OfPnt arr(0,points.size()-1);
for(unsigned int i = 0;i {
arr.SetValue(i,gp_Pnt(points[i].X(),points[i].Y(),points[i].Z()));
}

auto spline = GeomAPI_PointsToBSpline(arr,3,8,GeomAbs_C2,0.00001);
spline.Curve()->SetPeriodic();

return spline;

Here I have a first question. Is it necessary that the last point is identical to the first point so that opencascade really makes a closed curve?

Then I create egdes and wires from the b spline curves. That works fine.

And now the more import question for me. I want co create a face (and later a solid) from these curves, the first step is to create a face which are limited by two of such closed curves. The MakeFace algorithm doesn't work because it works with planar edges.
SO, how can create a face from two given closed b spline curves?

Best regards

Marco

Any suggestions?

1. For sure to have a closed spline, the last point must be coincident with the first.

2. Maybe you can use BRepFill_Filling with the outer wire to create a face and then split it with the inner one, using BRepFeat_SplitShape.

Ciao.
Mauro

I tested a little bit with BRepFill_Filling, but it crashes.
Is there really no algorithm to get a surface from two curves? I read the pdf's from the documentation folder and also found nothing :(
Any other suggestions?

So, I tested it with GeomFill_BSplineCurves, that alorithm works better (see attached image)
As you can see there are some errors at the connecting line.
One problem is still left: the algorithm only works if the flag SetPeriodic isn't set.
If I use "spline.Curve()->SetPeriodic();" than the allgorithm crashes during runtime! Therefore, my resulting faces are not really periodic. It looks only so.

That is the code for the spline creation:

TColgp_Array1OfPnt arr(0,points.size()-1);
for(unsigned int i = 0;i {
arr.SetValue(i,gp_Pnt(points[i].X(),points[i].Y(),points[i].Z()));
}

auto spline = GeomAPI_PointsToBSpline(arr,2,7,GeomAbs_C1,0.00001);

First and last point in the array are identical! Did I something wrong?

*push*

still unsolved

I always used GeomAPI_Interpolate for my splines. The constructor of this class takes a periodic flag!

For creating a face from 2 curves you can also use

BRepFill.Face(const TopoDS_Edge &Edge1, const TopoDS_Edge &Edge2)

You might also have a look at BRepOffsetAPI_ThruSections.