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'.
Archived discussion
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
Posts are displayed in their archived order.
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'.
Thanks.