From: jfa Date: Fri, 8 Jul 2022 08:54:18 +0000 (+0300) Subject: Fix pb with number of points X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=f8610414739d1eb97176629c79164468e89dd34d;p=modules%2Fgeom.git Fix pb with number of points --- 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");