TopoShapePy: add optional tolerance to function distToShape

This commit is contained in:
tomate44
2024-03-25 17:12:44 +01:00
committed by wwmayer
parent 7256e1c827
commit a32e67c85e
2 changed files with 4 additions and 2 deletions

View File

@@ -784,7 +784,7 @@ proximity(shape,[tolerance]) -> (selfFaces, shapeFaces)
<Methode Name="distToShape" Const="true">
<Documentation>
<UserDocu>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).

View File

@@ -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 {