Distorted result surface with BRepOffsetAPI_ThruSections

I Construct a loft pipe with BRepOffsetAPI_ThruSections, but get a distorted result, as displayed in the picture.

the sections are Geom_Curve object from somewhere in my project.

It looks like the Geom_Curve should be modifyed in some way to get nice result, but how to do it?

the code is as below

std::vector<Handle(Geom_Curve)> curves = ....;

BRepOffsetAPI_ThruSections thrusection(solid, Standard_False);
for (Standard_Integer i = 0; i<discretenum; ++i)
{
    TopoDS_Wire wirei = BRepBuilderAPI_MakeWire(BRepBuilderAPI_MakeEdge(curves.at(i)));
    BRepLib::BuildCurves3d(wirei);
    thrusection.AddWire(wirei);
}
thrusection.Build();
TopoDS_Shape wshape = thrusection.Shape();

 

Attachments: