From f8610414739d1eb97176629c79164468e89dd34d Mon Sep 17 00:00:00 2001 From: jfa Date: Fri, 8 Jul 2022 11:54:18 +0300 Subject: [PATCH] Fix pb with number of points --- src/GEOMImpl/GEOMImpl_IPoint.hxx | 2 +- src/GEOMImpl/GEOMImpl_PointDriver.cxx | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/GEOMImpl/GEOMImpl_IPoint.hxx b/src/GEOMImpl/GEOMImpl_IPoint.hxx index 437b71499..eb2a70d42 100644 --- a/src/GEOMImpl/GEOMImpl_IPoint.hxx +++ b/src/GEOMImpl/GEOMImpl_IPoint.hxx @@ -74,7 +74,7 @@ class GEOMImpl_IPoint void SetParameter(double theParam) { _func->SetReal(ARG_PARAM, theParam); } void SetParameter2(double theParam) { _func->SetReal(ARG_PARAM2, theParam); } - void SetNumberOfPoints(double theNumberOfPnts) { _func->SetReal(ARG_NBPNTS, theNumberOfPnts); } + void SetNumberOfPoints(int theNumberOfPnts) { _func->SetInteger(ARG_NBPNTS, theNumberOfPnts); } void SetLength(double theLength) { _func->SetReal(ARG_LENGTH, theLength); } void SetTakeOrientationIntoAccount(bool takeOrientationIntoAccount) { _func->SetInteger(ARG_USE_ORIENTATION, takeOrientationIntoAccount); } diff --git a/src/GEOMImpl/GEOMImpl_PointDriver.cxx b/src/GEOMImpl/GEOMImpl_PointDriver.cxx index e0b8db17d..313661168 100644 --- a/src/GEOMImpl/GEOMImpl_PointDriver.cxx +++ b/src/GEOMImpl/GEOMImpl_PointDriver.cxx @@ -302,6 +302,10 @@ Standard_Integer GEOMImpl_PointDriver::Execute(Handle(TFunction_Logbook)& log) c Handle(GEOM_Function) aRefFunc = aPI.GetSurface(); TopoDS_Shape aRefShape = aRefFunc->GetValue(); int aNbPnts = aPI.GetNumberOfPoints(); + if (aNbPnts < 1) { + Standard_TypeMismatch::Raise + ("Point On Surface creation aborted : number of points is zero or negative"); + } if (aRefShape.ShapeType() != TopAbs_FACE) { Standard_TypeMismatch::Raise ("Point On Surface creation aborted : surface shape is not a face"); -- 2.39.2