From b140f621eee0f3ddada18cc8f642201e086c887b Mon Sep 17 00:00:00 2001 From: looooo Date: Thu, 4 Jan 2024 20:05:39 +0100 Subject: [PATCH] add test for helical extrusion --- tests/tests.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 tests/tests.py diff --git a/tests/tests.py b/tests/tests.py new file mode 100644 index 0000000..8f49d31 --- /dev/null +++ b/tests/tests.py @@ -0,0 +1,28 @@ +import unittest + +from freecad import app +from freecad import part +from freecad.gears.basegear import helicalextrusion + + + +class GearTests(unittest.TestCase): + def test_helical_extrusion(self): + """check if helical extrusion is working correctly""" + n = app.Vector(0, 0, 1) + m = app.Vector(0, 0, 0) + r = 10 + h = 10 + degree = 3.1415926535 / 4 + + a = part.Circle(m, n, r) + face = part.Face(part.Wire(a.toShape())) + s = helicalextrusion(face, h, 1) + + # face 0 is the cylinder + # face 1 is pointing in positive z direction + # face 2 is pointing in negative z direction + self.asserTrue((s.Faces[1].normalAt(0,0) - n).Length < 10e-15) + self.asserTrue((s.Faces[2].normalAt(0,0) + n).Length < 10e-15) + self.asserTrue(s.Faces[1].valueAt(0,0)[2] - h < 10e-15) + self.asserTrue(s.Faces[2].valueAt(0,0)[2] - 0. < 10e-15) \ No newline at end of file