fix occ - Nearest

This commit is contained in:
Joachim Schoeberl 2021-11-25 10:45:09 +01:00
parent 74192981cf
commit 8dfdfb9579

View File

@ -127,9 +127,11 @@ public:
for (auto shape : *this)
{
double dist = BRepExtrema_DistShapeShape(shape, vertex).Value();
// cout << "dist = " << dist << endl;
if (dist < mindist)
nearestshape = shape;
{
nearestshape = shape;
mindist = dist;
}
}
return nearestshape;
}
@ -1627,6 +1629,9 @@ DLL_HEADER void ExportNgOCCShapes(py::module &m)
.def("Nearest", [] (ListOfShapes & shapes, gp_Pnt pnt)
{ return CastShape(shapes.Nearest(pnt)); },
py::arg("p"), "returns shape nearest to point 'p'")
.def("Nearest", [] (ListOfShapes & shapes, gp_Pnt2d pnt)
{ return CastShape(shapes.Nearest( { pnt.X(), pnt.Y(), 0 })); },
py::arg("p"), "returns shape nearest to point 'p'")
.def_property("name", [](ListOfShapes& shapes)
{