
Fri, 07/26/2013 - 20:36
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.
Mon, 07/29/2013 - 19:07
I think the function FixAddPCurve in the class ShapeFix_Edge does the job for you!
Alex
Mon, 07/29/2013 - 21:06
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