When creating advanced surface, it can come handy to create a surface passing trough a set of curves. In the following code snippet I’ll show you how to get this kind of surface:Capture8Filling1


TColGeom_SequenceOfCurve curveSeq;

double l=100.;
gp_Dir zDir(0,0,1);

double rBaseCircle = 50.;
gp_Pnt cBaseCircle(0,0,0);
gp_Circ baseCircle(gp_Ax2(cBaseCircle,zDir),rBaseCircle);
curveSeq.Append( new Geom_TrimmedCurve(new Geom_Circle(baseCircle),0,M_PI) );

double r1MidElips = 30;
double r2MidElips = 5;
gp_Pnt cMidElips(0,0,l*0.75);
gp_Elips midElips(gp_Ax2(cMidElips,zDir),r1MidElips,r2MidElips);
curveSeq.Append( new Geom_TrimmedCurve(new Geom_Ellipse(midElips),0,M_PI) );
double r1TopElips = 20;
double r2TopElips = 5;
gp_Pnt cToplips(0,0,l);
gp_Elips topElips(gp_Ax2(cToplips,zDir),r1TopElips,r2TopElips);
curveSeq.Append( new Geom_TrimmedCurve(new Geom_Ellipse(topElips),0,M_PI) );

GeomFill_NSections fillOp(curveSeq);
fillOp.ComputeSurface();

auto aSurf = fillOp.BSplineSurface();

First 3 curves are created and then are passed to GeomFill_NSections in order to create a BPSplineSurface passing through these curves:

Capture7Filling1

This method is simple and can’t deals with composite curves, what is the subject of a next post! 😉