Merge pull request #311 from CadQuery/adam-urbanczyk-helix-fix
Helix fix
This commit is contained in:
@ -1030,7 +1030,7 @@ class Wire(Shape, Mixin1D):
|
|||||||
# 3. put it together into a wire
|
# 3. put it together into a wire
|
||||||
n_turns = height / pitch
|
n_turns = height / pitch
|
||||||
u_start = geom_line.Value(0.0)
|
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()
|
geom_seg = GCE2d_MakeSegment(u_start, u_stop).Value()
|
||||||
|
|
||||||
e = BRepBuilderAPI_MakeEdge(geom_seg, geom_surf).Edge()
|
e = BRepBuilderAPI_MakeEdge(geom_seg, geom_surf).Edge()
|
||||||
|
|||||||
@ -3348,3 +3348,13 @@ class TestCadQuery(BaseTest):
|
|||||||
part2._findFromEdge()
|
part2._findFromEdge()
|
||||||
with self.assertRaises(RuntimeError):
|
with self.assertRaises(RuntimeError):
|
||||||
part2._findFromEdge(useLocalCoords=True)
|
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)
|
||||||
|
|||||||
Reference in New Issue
Block a user