From 1c0cfd896599d010ebddbbd639405b84d220c757 Mon Sep 17 00:00:00 2001 From: shirnschall Date: Fri, 13 Aug 2021 16:00:12 +0200 Subject: [PATCH] checking arc and arcto input for invalid function arguments --- libsrc/occ/python_occ_shapes.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libsrc/occ/python_occ_shapes.cpp b/libsrc/occ/python_occ_shapes.cpp index 6b5e6519..a0ee60b5 100644 --- a/libsrc/occ/python_occ_shapes.cpp +++ b/libsrc/occ/python_occ_shapes.cpp @@ -160,6 +160,10 @@ public: { gp_Pnt2d P1 = localpos.Location(); + //check input + if(P1.X() == h && P1.Y() == v) + throw Exception("points P1 and P2 must not be congruent"); + localpos.SetLocation (gp_Pnt2d(h,v)); gp_Pnt2d P2 = localpos.Location(); @@ -231,6 +235,10 @@ public: { double newAngle = fmod(angle,360)*M_PI/180; + //check input + if(newAngle<1e-16 && newAngle>-1e-16) + throw Exception("angle must not be an integer multiple of 360"); + gp_Dir2d dir = localpos.Direction(); gp_Dir2d dirn; //compute center point of arc