diff --git a/src/Mod/Inspection/App/InspectionFeature.cpp b/src/Mod/Inspection/App/InspectionFeature.cpp index 7783c6a091..3a3dde9c28 100644 --- a/src/Mod/Inspection/App/InspectionFeature.cpp +++ b/src/Mod/Inspection/App/InspectionFeature.cpp @@ -692,7 +692,7 @@ struct DistanceInspection // Helper internal class for QtConcurrent map operation. Holds sums-of-squares and counts for RMS calculation class DistanceInspectionRMS { public: - DistanceInspectionRMS() : m_numv(0), m_sumsq(0.0) {}; + DistanceInspectionRMS() : m_numv(0), m_sumsq(0.0) {} DistanceInspectionRMS& operator += (const DistanceInspectionRMS& rhs) { this->m_numv += rhs.m_numv; @@ -738,6 +738,8 @@ short Feature::mustExecute() const App::DocumentObjectExecReturn* Feature::execute(void) { + bool useMultithreading = true; + App::DocumentObject* pcActual = Actual.getValue(); if (!pcActual) throw Base::ValueError("No actual geometry to inspect specified"); @@ -752,6 +754,7 @@ App::DocumentObjectExecReturn* Feature::execute(void) actual = new InspectActualPoints(pts->Points.getValue()); } else if (pcActual->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId())) { + useMultithreading = false; Part::Feature* part = static_cast(pcActual); actual = new InspectActualShape(part->Shape.getShape()); } @@ -773,6 +776,7 @@ App::DocumentObjectExecReturn* Feature::execute(void) nominal = new InspectNominalPoints(pts->Points.getValue(), this->SearchRadius.getValue()); } else if ((*it)->getTypeId().isDerivedFrom(Part::Feature::getClassTypeId())) { + useMultithreading = false; Part::Feature* part = static_cast(*it); nominal = new InspectNominalShape(part->Shape.getValue(), this->SearchRadius.getValue()); } @@ -836,7 +840,6 @@ App::DocumentObjectExecReturn* Feature::execute(void) Base::Console().Message("RMS value for '%s' with search radius [%.4f,%.4f] is: %.4f\n", this->Label.getValue(), -this->SearchRadius.getValue(), this->SearchRadius.getValue(), fRMS); #else - bool useMultithreading = true; unsigned long count = actual->countPoints(); std::vector vals(count); std::function fMap = [&](unsigned int index) @@ -851,10 +854,12 @@ App::DocumentObjectExecReturn* Feature::execute(void) fMinDist = fDist; } - if (fMinDist > this->SearchRadius.getValue()) + if (fMinDist > this->SearchRadius.getValue()) { fMinDist = FLT_MAX; - else if (-fMinDist > this->SearchRadius.getValue()) + } + else if (-fMinDist > this->SearchRadius.getValue()) { fMinDist = -FLT_MAX; + } else { res.m_sumsq += fMinDist * fMinDist; res.m_numv++;