How to create a surface?

Hi all,


I have a simple question. I tried to find out few materials over internet. But I could not gather much information on this. How can I build/construct a surface based on a set of 3D points and edges connecting these points? I tried the example shown in this link here:


This is what I have done so far, without positive results. Experienced people kindly give some information on this and let me know what is it that I am missing.


//constants for algorithm

    const Standard_Integer aNbIter = 5; //number of algorithm iterations

    const Standard_Integer aNbPnts = 10; //sample points per each constraint

    const Standard_Integer aDeg = 3; //requested surface degree ? const Standard_Integer aMaxDeg = theMaxDeg;

    const Standard_Integer aMaxSeg = 10000;

    const Standard_Real aTol3d = 1.e-04;

    const Standard_Real aTol2d = 1.e-05;

    const Standard_Real anAngTol = 1.e-02; //angular

    const Standard_Real aCurvTol = 1.e-01; //curvature


    gp_Pnt p1(0, 0, 0);

    gp_Pnt p2(0, 10, 10);

    gp_Pnt p3(10, 10, 5);

    gp_Pnt p4(10, 0, -5);


    Handle(Geom_TrimmedCurve) aSegment1 = GC_MakeSegment(p1, p2);

    Handle(Geom_TrimmedCurve) aSegment2 = GC_MakeSegment(p2, p3);

    Handle(Geom_TrimmedCurve) aSegment3 = GC_MakeSegment(p3, p4);

    Handle(Geom_TrimmedCurve) aSegment4 = GC_MakeSegment(p4, p1);


    TopoDS_Edge anEdge1 = BRepBuilderAPI_MakeEdge(aSegment1);

    TopoDS_Edge anEdge2 = BRepBuilderAPI_MakeEdge(aSegment2);

    TopoDS_Edge anEdge3 = BRepBuilderAPI_MakeEdge(aSegment3);

    TopoDS_Edge anEdge4 = BRepBuilderAPI_MakeEdge(aSegment4);


    TopoDS_Face myFace;


    Handle(GeomAdaptor_HCurve) aCurve1 = new GeomAdaptor_HCurve(


    Handle(GeomAdaptor_HCurve) aCurve2 = new GeomAdaptor_HCurve(


    Handle(GeomAdaptor_HCurve) aCurve3 = new GeomAdaptor_HCurve(


    Handle(GeomAdaptor_HCurve) aCurve4 = new GeomAdaptor_HCurve(



    TColStd_ListOfTransient theBoundaries;






    Handle(Geom_Surface) aRes;


    GeomPlate_BuildPlateSurface aPlateBuilder;


    TColStd_ListIteratorOfListOfTransient anIt (theBoundaries);

    if (anIt.More())


        int i = 1;

        for (; anIt.More(); anIt.Next(), i++)


            const Handle(Standard_Transient)& aCur = anIt.Value();

            if (aCur.IsNull())


                std::cout << "IS NULL" << std::endl;

                Standard_ConstructionError::Raise ("ACISAlgo::MakeSurface()");



            else if (aCur->IsKind (STANDARD_TYPE (Adaptor3d_HCurveOnSurface)))


                //G1 constraint

                const Handle(Adaptor3d_HCurveOnSurface)& aHCOS = Handle(Adaptor3d_HCurveOnSurface)::DownCast (aCur);

                Handle (GeomPlate_CurveConstraint) aConst =

                        new GeomPlate_CurveConstraint (aHCOS, 1 /*GeomAbs_G1*/, aNbPnts, aTol3d, anAngTol, aCurvTol);

                aPlateBuilder.Add (aConst);


            else if (aCur->IsKind (STANDARD_TYPE (GeomAdaptor_HCurve)))


                //G0 constraint

                const Handle(GeomAdaptor_HCurve)& aHC = Handle(GeomAdaptor_HCurve)::DownCast (aCur);

                Handle (GeomPlate_CurveConstraint) aConst =

                        new GeomPlate_CurveConstraint (aHC, 0 /*GeomAbs_G0*/, aNbPnts, aTol3d);

                aPlateBuilder.Add (aConst);




                Standard_TypeMismatch::Raise ("ACISAlgo::MakeSurface()");






        Standard_ConstructionError::Raise ("ACISAlgo::MakeSurface()");




    if (!aPlateBuilder.IsDone())


        // return aRes;

        std::cout << "Failed building plate" << std::endl;




    const Handle(GeomPlate_Surface)& aPlate = aPlateBuilder.Surface(); //approximation (see BRepFill_Filling - when no initial surface was given)

    TopoDS_Shape resShape = BRepBuilderAPI_MakeFace(aPlateBuilder.SurfInit(), 0.00001);

    BRepTools::Write(resShape, "makeFace1.brep");


I am not yet sure whether I am on the right path or not.


Thanks in advance

Rakesh Patil

Rakesh Patil's picture


Forgot to mention that the geometry in the above example is the closed polygon in 3D space.

Rakesh Patil's picture


I am still trying to get the surface from the set of outline points. The above piece of code did not give me expected output. May be I am doing something really wrong. Is there anything else in OCCT which I am not aware and help me to achieve my goal? Kindly guide me to build a surface from the set of points.

Thanks & Regards

Rakesh Patil

qa qa's picture

Hello Rakesh,

I think that you should convert GeomPlate_Surface object to the standard spline geometry. It can be performed using GeomPlate_MakeApprox class. After that, you can convert a result to a face.


Guido van Hilst not specified's picture

Hi I have made an online OCC Explorer:

Here is an example that uses BRepFill_Filling:

Rakesh Patil's picture


I see that my application crashes when GeomPlate_MakeApprox is called. Below is my updated code:

gp_Pnt ph[9];

ph[0] = gp_Pnt(11.76, -25.57, 0);

ph[1] = gp_Pnt(14.38, -16.54, 2);

ph[2] = gp_Pnt(16.55, -17.12, 4);

ph[3] = gp_Pnt(25.35, -13.21, 1.5);

ph[4] = gp_Pnt(26.89, -8.92, 3);

ph[5] = gp_Pnt(34.87, -17.44, 5);

ph[6] = gp_Pnt(26.78, -33.18, 2);

ph[7] = gp_Pnt(19.25, -33.06, 1);

ph[8] = gp_Pnt(20.32, -26.19, 1);

GeomPlate_BuildPlateSurface BPSurf(3, 16, 5);

for(Standard_Integer i=0; i< 9; ++i)


//add point constraint

Handle(GeomPlate_PointConstraint) PCont = new GeomPlate_PointConstraint(ph[i], 0);




if(BPSurf.IsDone() == true)


std::cout << "Is done" << std::endl;




std::cout << "Not done" << std::endl;


Standard_Integer MaxSeg=8;

Standard_Integer MaxDegree=7;

Standard_Integer CritOrder=0;

Standard_Real dmax, Tol;

dmax = Max(0.0001,10*BPSurf.G0Error());


GeomPlate_MakeApprox mapp(BPSurf.Surface(),Tol,MaxSeg,MaxDegree,dmax,CritOrder);

Handle(Geom_BSplineSurface) surf = mapp.Surface();

I thought the problem might be with my own code. So I tried executing the example given in the PDF below:

Page number 34.

This sample example also crashes when the approximation class is instantiated. I am working on MAC OSX with clang 64. What might be causing the crash issue?