Creating pCurve from 3d curves

Hi all,
I'm starting to use OCC and I need to build a model starting from
another geometric kernel. In particular, I need to build edges starting from 3D curves.
My problem is how to define p-curves for all the edges, I'm using the following loop

TopExp_Explorer edgeExp(face.Oriented(TopAbs_FORWARD), TopAbs_EDGE);
for (; edgeExp.More(); edgeExp.Next()){
TopoDS_Edge E = TopoDS::Edge(edgeExp.Current());

Standard_Real first, last;
Handle_Geom_Curve edgeCurve = BRep_Tool::Curve(E,first,last);
Handle_Geom_Surface faceSurface = BRep_Tool::Surface(face);
Handle_Geom2d_Curve pCurve;

ShapeConstruct_ProjectCurveOnSurface * projector = new ShapeConstruct_ProjectCurveOnSurface();
projector->Init(faceSurface,0.001);
Standard_Boolean success = projector->PerformAdvanced(edgeCurve,first,last,pCurve);

if (!success){
cout }
BRep_Builder B;
B.UpdateEdge(E,pCurve,face,0.001);

}

I always get "success" but when I analyze the shape in order to establish if it is valid, I get a

BRepCheck_InvalidCurveOnSurface

for edge built on BSpline curves.

Is there a better way to do this?

Thanks for your attention and help.

Alexander Luger's picture

I think the function FixAddPCurve in the class ShapeFix_Edge does the job for you!

Alex

Silvia's picture

Thank you very much Alex,
you are right, calling fixshape() (which then calls methods in ShapeFix_Face, ShapeFix_Wire and ShapeFix_Edge) defined in ShapeProcess_OperLibrary I can "correct" my shape so that it is a valid OCC shape and in particular pCurves are computed.

Thanks, cheers

Silvia