Merge pull request #311 from CadQuery/adam-urbanczyk-helix-fix

Helix fix
This commit is contained in:
Jeremy Wright
2020-04-04 15:25:38 -04:00
committed by GitHub
2 changed files with 11 additions and 1 deletions

View File

@ -1030,7 +1030,7 @@ class Wire(Shape, Mixin1D):
# 3. put it together into a wire
n_turns = height / pitch
u_start = geom_line.Value(0.0)
u_stop = geom_line.Value(sqrt(n_turns * ((2 * pi) ** 2 + pitch ** 2)))
u_stop = geom_line.Value(n_turns * sqrt((2 * pi) ** 2 + pitch ** 2))
geom_seg = GCE2d_MakeSegment(u_start, u_stop).Value()
e = BRepBuilderAPI_MakeEdge(geom_seg, geom_surf).Edge()

View File

@ -3348,3 +3348,13 @@ class TestCadQuery(BaseTest):
part2._findFromEdge()
with self.assertRaises(RuntimeError):
part2._findFromEdge(useLocalCoords=True)
def testMakeHelix(self):
h = 10
pitch = 1.5
r = 1.2
obj = Wire.makeHelix(pitch, h, r)
bb = obj.BoundingBox()
self.assertAlmostEqual(bb.zlen, h, 1)