PD: Add test for helix (#11601)

Co-authored-by: Chris Hennes <chennes@pioneerlibrarysystem.org>
This commit is contained in:
wwmayer
2024-01-10 14:26:18 +01:00
committed by GitHub
parent f5b4fc9a0b
commit d3049deaa9
3 changed files with 49 additions and 13 deletions

View File

@@ -38,6 +38,7 @@ set(PartDesign_TestScripts
PartDesignTests/TestShapeBinder.py
PartDesignTests/TestPad.py
PartDesignTests/TestPocket.py
PartDesignTests/TestHelix.py
PartDesignTests/TestHole.py
PartDesignTests/TestRevolve.py
PartDesignTests/TestLoft.py

View File

@@ -1,21 +1,22 @@
#***************************************************************************
#* Copyright (c) 2023 Werner Mayer <wmayer[at]users.sourceforge.net> *
#* Copyright (c) 2023 <bgbsww@gmail.com> *
#* *
#* This program is free software; you can redistribute it and/or modify *
#* it under the terms of the GNU Lesser General Public License (LGPL) *
#* as published by the Free Software Foundation; either version 2 of *
#* the License, or (at your option) any later version. *
#* for detail see the LICENCE text file. *
#* This file is part of FreeCAD. *
#* *
#* This program is distributed in the hope that it will be useful, *
#* but WITHOUT ANY WARRANTY; without even the implied warranty of *
#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
#* GNU Library General Public License for more details. *
#* FreeCAD is free software: you can redistribute it and/or modify it *
#* under the terms of the GNU Lesser General Public License as *
#* published by the Free Software Foundation, either version 2.1 of the *
#* License, or (at your option) any later version. *
#* *
#* You should have received a copy of the GNU Library General Public *
#* License along with this program; if not, write to the Free Software *
#* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 *
#* USA *
#* FreeCAD is distributed in the hope that it will be useful, but *
#* WITHOUT ANY WARRANTY; without even the implied warranty of *
#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
#* Lesser General Public License for more details. *
#* *
#* You should have received a copy of the GNU Lesser General Public *
#* License along with FreeCAD. If not, see *
#* <https://www.gnu.org/licenses/>. *
#* *
#***************************************************************************
@@ -23,6 +24,7 @@ from math import pi
import unittest
import FreeCAD
from FreeCAD import Base
import Part
import Sketcher
import TestSketcherApp
@@ -33,6 +35,38 @@ class TestHelix(unittest.TestCase):
def setUp(self):
self.Doc = FreeCAD.newDocument("PartDesignTestHelix")
def testHelicalTubeCase(self):
body = self.Doc.addObject('PartDesign::Body','Body')
sketch = body.newObject('Sketcher::SketchObject','Sketch')
sketch.Support = (self.Doc.getObject('XY_Plane'),[''])
sketch.MapMode = 'FlatFace'
geoList = []
geoList.append(Part.Circle(Base.Vector(-40.0, 0.0, 0.0), Base.Vector(0.0, 0.0, 1.0), 7.5))
geoList.append(Part.Circle(Base.Vector(-40.0, 0.0, 0.0), Base.Vector(0.0, 0.0, 1.0), 10.0))
sketch.addGeometry(geoList, False)
del geoList
sketch.addConstraint(Sketcher.Constraint('PointOnObject', 0, 3, -1))
sketch.addConstraint(Sketcher.Constraint('Coincident', 1, 3, 0, 3))
self.Doc.recompute()
helix = body.newObject('PartDesign::AdditiveHelix','AdditiveHelix')
helix.Profile = sketch
helix.ReferenceAxis = (sketch, ['V_Axis'])
helix.Mode = 0
helix.Pitch = 35
helix.Height = 100
helix.Turns = 3
helix.Angle = 0
helix.Growth = 0
helix.LeftHanded = 0
helix.Reversed = 0
self.Doc.recompute()
self.assertEqual(len(helix.Shape.Solids), 1)
def testCircleQ1(self):
""" Test helix based on circle in Quadrant 1 """
body = self.Doc.addObject('PartDesign::Body','Body')

View File

@@ -32,6 +32,7 @@ from PartDesignTests.TestShapeBinder import TestSubShapeBinder
# additive/subtractive features & primitives
from PartDesignTests.TestPad import TestPad
from PartDesignTests.TestPocket import TestPocket
from PartDesignTests.TestHelix import TestHelix
from PartDesignTests.TestHole import TestHole
from PartDesignTests.TestRevolve import TestRevolve
from PartDesignTests.TestPipe import TestPipe