create face from curves/wires

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

Marco Matt's picture

Any suggestions?

Mauro Mariotti's picture

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

Marco Matt's picture

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?

Marco Matt's picture

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 < points.size();++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?

Marco Matt's picture

*push*

still unsolved

Alexander Luger's picture

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

Timo Roth's picture

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.

Ivy Monteiro's picture

I am having similar query. I have set of points in 3D space from which I want to create closed bSpline face. The CreateFace api only returns planar faces. if the points make up a curved face like a bspline it eturns null?

How can i achieve this? any help would be appreciated.

Julien Cloute's picture

Hi,

If this is still a matter to you, you should check out the MakeApprox API with the example given there: https://dev.opencascade.org/doc/overview/html/occt_user_guides__modeling_algos.html#occt_modalg_2_5_5. It gave me acceptable results to fill a face constrained by a loop of 4 B-splines curves.

Regards,

Julien