From 60f304bf15539df156069b3f44755c1a01c6af2a Mon Sep 17 00:00:00 2001 From: sliptonic Date: Sun, 16 Jan 2022 18:46:47 -0600 Subject: [PATCH] Added another test to drill generator and corresponding test case --- src/Mod/Path/Generators/drill_generator.py | 3 +++ src/Mod/Path/PathTests/TestPathDrillGenerator.py | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/src/Mod/Path/Generators/drill_generator.py b/src/Mod/Path/Generators/drill_generator.py index 84adf233a6..550b678a67 100644 --- a/src/Mod/Path/Generators/drill_generator.py +++ b/src/Mod/Path/Generators/drill_generator.py @@ -67,6 +67,9 @@ def generate(edge, dwelltime=0.0, peckdepth=0.0, repeat=1): ): raise ValueError("edge is not aligned with Z axis") + if startPoint.z < endPoint.z: + raise ValueError("start point is below end point") + cmdParams = {} cmdParams["X"] = startPoint.x cmdParams["Y"] = startPoint.y diff --git a/src/Mod/Path/PathTests/TestPathDrillGenerator.py b/src/Mod/Path/PathTests/TestPathDrillGenerator.py index 8414c5d2e6..78837b1965 100644 --- a/src/Mod/Path/PathTests/TestPathDrillGenerator.py +++ b/src/Mod/Path/PathTests/TestPathDrillGenerator.py @@ -64,7 +64,11 @@ class TestPathDrillGenerator(PathTestUtils.PathTestBase): """Test edge alignment check""" v1 = FreeCAD.Vector(0, 10, 10) v2 = FreeCAD.Vector(0, 0, 0) + e = Part.makeLine(v1, v2) + self.assertRaises(ValueError, generator.generate, e) + v1 = FreeCAD.Vector(0, 0, 0) + v2 = FreeCAD.Vector(0, 0, 10) e = Part.makeLine(v1, v2) self.assertRaises(ValueError, generator.generate, e)