Skip to content

Commit 498f5d7

Browse files
committed
Changed to use Solid.makeCylinder.
1 parent 2efa1f0 commit 498f5d7

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

cadquery/cq.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3804,18 +3804,23 @@ def cylinder(
38043804
self: T,
38053805
radius: float,
38063806
height: float,
3807+
direct: Vector = Vector(0, 0, 1),
3808+
angle: float = 360,
38073809
centered: Union[bool, Tuple[bool, bool, bool]] = True,
38083810
combine: bool = True,
38093811
clean: bool = True,
38103812
) -> T:
3811-
38123813
"""
38133814
Returns a cylinder with the specified radius and height for each point on the stack
38143815
38153816
:param radius: The radius of the cylinder
38163817
:type radius: float > 0
38173818
:param height: The height of the cylinder
38183819
:type height: float > 0
3820+
:param direct: The direction axis for the creation of the cylinder
3821+
:type direct: A three-tuple
3822+
:param angle: The angle to sweep the cylinder arc through
3823+
:type angle: float > 0
38193824
:param centered: If True, the cylinder will be centered around the reference point. If False,
38203825
the corner of a bounding box around the cylinder will be on the reference point and it
38213826
will extend in the positive x, y and z directions. Can also use a 3-tuple to specify
@@ -3845,12 +3850,12 @@ def cylinder(
38453850
if not centered[1]:
38463851
offset += Vector(0, radius, 0)
38473852
if centered[2]:
3848-
offset += Vector(0, 0, -height/2)
3853+
offset += Vector(0, 0, -height / 2)
38493854

3850-
c = self.circle(radius)._extrude(height).move(Location(offset))
3855+
s = Solid.makeCylinder(radius, height, offset, direct, angle)
38513856

38523857
# We want a cylinder for each point on the workplane
3853-
cylinders = self.eachpoint(lambda loc: c.moved(loc), True)
3858+
cylinders = self.eachpoint(lambda loc: s.moved(loc), True)
38543859

38553860
# If we don't need to combine everything, just return the created cylinders
38563861
if not combine:

0 commit comments

Comments
 (0)