Problem with BRepAlgoAPI_Section


I am having problems extracting the PCurves from a BRepAlgoAPI_Section.

I have intersected two shapes (each has a b-spline surface as its underlying geometry) and when I explore the result, I can extract Edges for all the intersections and display them. I can also extract the PCurves on my first shape, but the call to PCurveOn2 results in a unhandled exception in TKBREP.DLL.

Is there anything wrong with my code listed below?

I am using the precompiled stable release 4.0 on Windows 2000, Visual C++ 6.0.



BRepAlgoAPI_Section mySection(myShape1, myShape2, false);

// build b-spline curves

// make sure we find the parametric curves


if (mySection.IsDone())
TopExp_Explorer anExp;

for ( anExp.Init(mySection.Shape(), TopAbs_EDGE); anExp.More(); anExp.Next())
TopoDS_Edge myEdge = TopoDS::Edge(anExp.Current());

Handle_AIS_Shape anAISShape=new AIS_Shape(myEdge);
myAISContext->SetColor(anAISShape, Quantity_NOC_GREEN1);

double rWFirst, rWLast;
Handle(Geom_Curve) aCurve = BRep_Tool::Curve (myEdge, rWFirst, rWLast);
Handle(Geom2d_Curve) myPCurveOn1 = mySection.PCurveOn1(myEdge);
Handle(Geom2d_Curve) myPCurveOn2 = mySection.PCurveOn2(myEdge); // this call results in an exception

n-southall's picture

I forgot to say - if I swap the order of the surfaces, i.e. my call becomes

BRepAlgoAPI_Section mySection(myShape2, myShape1, false);

it still fails on .PCurveOn2, not .PCurveOn1 as one would expect, so I don't think my geometries have anything to do with the problem.