Fix pb with number of points

This commit is contained in:
jfa 2022-07-08 11:54:18 +03:00
parent e5c1402a68
commit f861041473
2 changed files with 5 additions and 1 deletions

View 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); }

View 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");