diff --git a/src/Mod/Part/App/TopoShapePy.xml b/src/Mod/Part/App/TopoShapePy.xml index 07d9b67d38..cdac9edc92 100644 --- a/src/Mod/Part/App/TopoShapePy.xml +++ b/src/Mod/Part/App/TopoShapePy.xml @@ -784,7 +784,7 @@ proximity(shape,[tolerance]) -> (selfFaces, shapeFaces) Find the minimum distance to another shape. -distToShape(shape) -> (dist, vectors, infos) +distToShape(shape, tol=1e-7) -> (dist, vectors, infos) -- dist is the minimum distance, in mm (float value). diff --git a/src/Mod/Part/App/TopoShapePyImp.cpp b/src/Mod/Part/App/TopoShapePyImp.cpp index 0b768ebce6..41c18a2c3f 100644 --- a/src/Mod/Part/App/TopoShapePyImp.cpp +++ b/src/Mod/Part/App/TopoShapePyImp.cpp @@ -2605,8 +2605,9 @@ PyObject* TopoShapePy::distToShape(PyObject *args) BRepExtrema_SupportType supportType1, supportType2; TopoDS_Shape suppS1, suppS2; Standard_Real minDist = -1, t1, t2, u1, v1, u2, v2; + Standard_Real tol = Precision::Confusion(); - if (!PyArg_ParseTuple(args, "O!",&(TopoShapePy::Type), &ps2)) + if (!PyArg_ParseTuple(args, "O!|d",&(TopoShapePy::Type), &ps2, &tol)) return nullptr; const TopoDS_Shape& s1 = getTopoShapePtr()->getShape(); @@ -2619,6 +2620,7 @@ PyObject* TopoShapePy::distToShape(PyObject *args) return nullptr; } BRepExtrema_DistShapeShape extss; + extss.SetDeflection(tol); extss.LoadS1(s1); extss.LoadS2(s2); try {