diff --git a/Geo/GModelIO_OCC.cpp b/Geo/GModelIO_OCC.cpp index d4e5b41e72aa49caac18d6ecd6979120e11311e1..e3fb65ccf27396544fc17f42b15cf662bd06c560 100644 --- a/Geo/GModelIO_OCC.cpp +++ b/Geo/GModelIO_OCC.cpp @@ -1344,6 +1344,10 @@ bool OCC_Internals::_makeSphere(TopoDS_Solid &result, double xc, double yc, doub Msg::Error("Sphere radius should be positive"); return false; } + if(angle3 <= 0 || angle3 > 2 * M_PI){ + Msg::Error("Cannot build sphere with angle <= 0 or angle > 2*Pi"); + return false; + } try{ gp_Pnt p(xc, yc, zc); BRepPrimAPI_MakeSphere s(p, radius, angle1, angle2, angle3); @@ -1425,6 +1429,10 @@ bool OCC_Internals::_makeCylinder(TopoDS_Solid &result, double x, double y, doub Msg::Error("Cannot build cylinder of zero height"); return false; } + if(angle <= 0 || angle > 2 * M_PI){ + Msg::Error("Cannot build cylinder with angle <= 0 or angle > 2*Pi"); + return false; + } try{ gp_Pnt aP(x, y, z); gp_Vec aV(dx / H, dy / H, dz / H);