From ddfb4fe61e5f5b62ec65d7e8fb6f5dc135832d4c Mon Sep 17 00:00:00 2001 From: Eric Price Date: Sat, 12 Oct 2024 18:42:07 +0200 Subject: [PATCH] Add very basic tolerance Information to GeometryCheck --- src/Mod/Part/Gui/TaskCheckGeometry.cpp | 36 +++++++++++++++++++++----- 1 file changed, 29 insertions(+), 7 deletions(-) diff --git a/src/Mod/Part/Gui/TaskCheckGeometry.cpp b/src/Mod/Part/Gui/TaskCheckGeometry.cpp index 03ef606ce3..7197d11fc6 100644 --- a/src/Mod/Part/Gui/TaskCheckGeometry.cpp +++ b/src/Mod/Part/Gui/TaskCheckGeometry.cpp @@ -599,13 +599,35 @@ void TaskCheckGeometryResults::buildShapeContent(App::DocumentObject *pObject, c if (!module) { throw Py::Exception(); } - Py::Tuple args(3); - args.setItem(0, Py::asObject(pObject->getPyObject())); - args.setItem(1, Py::Long(decimals)); - args.setItem(2, Py::Boolean(advancedShapeContent)); - Py::Module shapecontent(module, true); - Py::String result(shapecontent.callMemberFunction("buildShapeContent", args)); - stream << result.as_std_string("utf-8"); + { + Py::Tuple args(3); + args.setItem(0, Py::asObject(pObject->getPyObject())); + args.setItem(1, Py::Long(decimals)); + args.setItem(2, Py::Boolean(advancedShapeContent)); + Py::Module shapecontent(module, true); + Py::String result(shapecontent.callMemberFunction("buildShapeContent", args)); + stream << result.as_std_string("utf-8"); + } + { + stream << std::endl << tr("Tolerance information").toStdString() << ": " << std::endl; + Py::Tuple args(1); + { + args.setItem(0, Py::Long(-1)); + Py::Float result(Py::asObject(Part::TopoShape(shape).getPyObject()).callMemberFunction("globalTolerance",args)); + stream << " " << tr("Global Minimum").toStdString() << ": " << result << std::endl; + } + { + args.setItem(0, Py::Long(0)); + Py::Float result(Py::asObject(Part::TopoShape(shape).getPyObject()).callMemberFunction("globalTolerance",args)); + stream << " " << tr("Global Average").toStdString() << ": " << result << std::endl; + } + { + args.setItem(0, Py::Long(1)); + Py::Float result(Py::asObject(Part::TopoShape(shape).getPyObject()).callMemberFunction("globalTolerance",args)); + stream << " " << tr("Global Maximum").toStdString() << ": " << result; + } + } + } catch (Py::Exception&) { Base::PyException e;