handle also B-spline and Bezier curves in GeomCurve::closestParameter

This commit is contained in:
wmayer
2019-01-21 13:47:41 +01:00
parent 90fd3ae483
commit 041a550815
2 changed files with 5 additions and 6 deletions

View File

@@ -547,8 +547,7 @@ bool GeomCurve::closestParameter(const Base::Vector3d& point, double &u) const
}
}
catch (StdFail_NotDone& e) {
if (c->IsKind(STANDARD_TYPE(Geom_TrimmedCurve))){
if (c->IsKind(STANDARD_TYPE(Geom_BoundedCurve))){
Base::Vector3d firstpoint = this->pointAtParameter(c->FirstParameter());
Base::Vector3d lastpoint = this->pointAtParameter(c->LastParameter());

View File

@@ -483,13 +483,13 @@ PyObject* GeometryCurvePy::parameter(PyObject *args)
if (!PyArg_ParseTuple(args, "O!", &(Base::VectorPy::Type), &p))
return 0;
Base::Vector3d v = Py::Vector(p, false).toVector();
double u;
if(static_cast<Part::GeomCurve *>(getGeometryPtr())->closestParameter(v,u))
if (static_cast<Part::GeomCurve *>(getGeometryPtr())->closestParameter(v,u))
return Py::new_reference_to(Py::Float(u));
}
catch (Base::RuntimeError& e) {
catch (Base::CADKernelError& e) {
PyErr_SetString(PartExceptionOCCError, e.what());
return 0;
}