]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
Fix pb with number of points
authorjfa <jfa@opencascade.com>
Fri, 8 Jul 2022 08:54:18 +0000 (11:54 +0300)
committerjfa <jfa@opencascade.com>
Fri, 8 Jul 2022 08:54:18 +0000 (11:54 +0300)
src/GEOMImpl/GEOMImpl_IPoint.hxx
src/GEOMImpl/GEOMImpl_PointDriver.cxx

index 437b71499a856a4a626437313f926c29bec37c02..eb2a70d421e6679a837b0a196dd765abde450106 100644 (file)
@@ -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); }
index e0b8db17d3a24429fcf8d7466fa649b0c43d4044..313661168085ebe23c5d4e9fc0068f76cee6d2fb 100644 (file)
@@ -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");