Skip to content

Commit 727ab27

Browse files
committed
Swapped cylinder height and radius parameters to match cone.
1 parent 498f5d7 commit 727ab27

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

cadquery/cq.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3802,8 +3802,8 @@ def sphere(
38023802

38033803
def cylinder(
38043804
self: T,
3805-
radius: float,
38063805
height: float,
3806+
radius: float,
38073807
direct: Vector = Vector(0, 0, 1),
38083808
angle: float = 360,
38093809
centered: Union[bool, Tuple[bool, bool, bool]] = True,
@@ -3813,10 +3813,10 @@ def cylinder(
38133813
"""
38143814
Returns a cylinder with the specified radius and height for each point on the stack
38153815
3816-
:param radius: The radius of the cylinder
3817-
:type radius: float > 0
38183816
:param height: The height of the cylinder
38193817
:type height: float > 0
3818+
:param radius: The radius of the cylinder
3819+
:type radius: float > 0
38203820
:param direct: The direction axis for the creation of the cylinder
38213821
:type direct: A three-tuple
38223822
:param angle: The angle to sweep the cylinder arc through

doc/roadmap.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,8 @@ rotation/transform that return a copy
8181
primitive creation
8282
Need primitive creation for:
8383
* cone
84-
* cylinder
8584
* torus
8685
* wedge
8786

8887
extrude/cut up to surface
89-
allow a cut or extrude to terminate at another surface, rather than either through all or a fixed distance
88+
allow a cut or extrude to terminate at another surface, rather than either through all or a fixed distance

tests/test_cadquery.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2444,7 +2444,7 @@ def testSphereCombine(self):
24442444
self.assertEqual(4, s.faces().size())
24452445

24462446
def testCylinderDefaults(self):
2447-
s = Workplane("XY").cylinder(10, 20)
2447+
s = Workplane("XY").cylinder(20, 10)
24482448
self.saveModel(s)
24492449
self.assertEqual(1, s.size())
24502450
self.assertEqual(1, s.solids().size())
@@ -2462,16 +2462,16 @@ def testCylinderCentering(self):
24622462
for (xopt, xval), (yopt, yval), (zopt, zval) in product(
24632463
zip(b, expected_x), zip(b, expected_y), zip(b, expected_z)
24642464
):
2465-
s = Workplane("XY").cylinder(radius, height, centered=(xopt, yopt, zopt))
2465+
s = Workplane("XY").cylinder(height, radius, centered=(xopt, yopt, zopt))
24662466
self.assertEqual(1, s.size())
24672467
self.assertTupleAlmostEquals(
24682468
s.val().Center().toTuple(), (xval, yval, zval), 3
24692469
)
24702470
# check centered=True produces the same result as centered=(True, True, True)
24712471
for val in b:
2472-
s0 = Workplane("XY").cylinder(radius, height, centered=val)
2472+
s0 = Workplane("XY").cylinder(height, radius, centered=val)
24732473
self.assertEqual(s0.size(), 1)
2474-
s1 = Workplane("XY").cylinder(radius, height, centered=(val, val, val))
2474+
s1 = Workplane("XY").cylinder(height, radius, centered=(val, val, val))
24752475
self.assertEqual(s1.size(), 1)
24762476
self.assertTupleAlmostEquals(
24772477
s0.val().Center().toTuple(), s1.val().Center().toTuple(), 3

0 commit comments

Comments
 (0)