Sketcher: Fix bug in curvature graph

====================================

https://forum.freecadweb.org/viewtopic.php?f=3&t=34979&p=295324#p295324
This commit is contained in:
Abdullah Tahiri
2019-03-20 13:54:35 +01:00
committed by wmayer
parent c0aac1e038
commit bbdbcc487b

View File

@@ -3796,7 +3796,18 @@ void ViewProviderSketch::draw(bool temp /*=false*/, bool rebuildinformationlayer
for(int i = 0; i < ndiv; i++) {
paramlist[i] = firstparam + i * step;
pointatcurvelist[i] = spline->pointAtParameter(paramlist[i]);
curvaturelist[i] = spline->curvatureAt(paramlist[i]);
try {
curvaturelist[i] = spline->curvatureAt(paramlist[i]);
}
catch(Base::CADKernelError &e) {
// it is "just" a visualisation matter OCC could not calculate the curvature
// terminating here would mean that the other shapes would not be drawed.
// Solution: Report the issue and set dummy curvature to 0
e.ReportException();
Base::Console().Error("Curvature graph for B-Spline with GeoId=%d could not be calculated.\n", GeoId);
curvaturelist[i] = 0;
}
if(curvaturelist[i] > maxcurv)
maxcurv = curvaturelist[i];
@@ -3997,7 +4008,18 @@ void ViewProviderSketch::draw(bool temp /*=false*/, bool rebuildinformationlayer
for(int i = 0; i < ndiv; i++) {
paramlist[i] = firstparam + i * step;
pointatcurvelist[i] = spline->pointAtParameter(paramlist[i]);
curvaturelist[i] = spline->curvatureAt(paramlist[i]);
try {
curvaturelist[i] = spline->curvatureAt(paramlist[i]);
}
catch(Base::CADKernelError &e) {
// it is "just" a visualisation matter OCC could not calculate the curvature
// terminating here would mean that the other shapes would not be drawed.
// Solution: Report the issue and set dummy curvature to 0
e.ReportException();
Base::Console().Error("Curvature graph for B-Spline with GeoId=%d could not be calculated.\n", GeoId);
curvaturelist[i] = 0;
}
try {
spline->normalAt(paramlist[i],normallist[i]);