DiscussionsIssue archiveOther usage issues

Archived discussion

Crash on BRep_Tool::Curve();

Other usage issuesSun, 10/06/2013 - 01:422 replies

Browse this forum
QuestionAuthor

OCC crashes when exploring the edges a simple surface. I send in the surface in attachment so you can reproduce the error.

for (TopExp_Explorer aSurfExp(aShape, TopAbs_FACE); aSurfExp.More(); aSurfExp.Next())
{

TopoDS_Face aFace = TopoDS::Face(aSurfExp.Current());

for (TopExp_Explorer aWireExp(aFace, TopAbs_WIRE); aWireExp.More(); aWireExp.Next())
{

TopoDS_Wire aWire = TopoDS::Wire(aWireExp.Current());

cout

for (TopExp_Explorer anEdgeExp(aWireExp.Current(), TopAbs_EDGE); anEdgeExp.More(); anEdgeExp.Next())
{

TopoDS_Edge anEdge = TopoDS::Edge(anEdgeExp.Current());

cout

double s0, s1;

Handle(Geom_Curve) aCurve = BRep_Tool::Curve(anEdge, s0, s1);

GeomLProp_CLProps props(aCurve, (s0 + s1)*0.5, 2, Precision::Confusion());
double aCurvature = props.Curvature();

cout

}
}
}

Discussion

2 archived replies

Posts are displayed in their archived order.

01Commenter-1

Dear Author.

Your 'simple surface' contains a face with degenerated edge. The degenerated edge has no 3D curve, so aCurve.IsNull() is True. Check the condition before trying to do something with 'aCurve'.

02Author

Thanks.