Cylinder

Renders the 3D model in your browser. The first run downloads the Python runtime (≈30 MB).
from cadbuildr.foundation import *


class CylinderPart(Part):
    def __init__(self, radius=5, height=20):
        s = Sketch(self.xy())
        # Cylinder(center, radius, height) — height runs along sketch Y.
        self.add_operation(Cylinder(s.origin, radius=radius, height=height))
        self.paint("light_green")


show(CylinderPart())

Cylinder(center, radius, height) is a solid of revolution. Height runs along the sketch’s Y axis; radius along its X. The cylinder is centered on center (height extends ±height/2 in sketch Y).

def __init__(self, radius=5, height=20):
        s = Sketch(self.xy())
        # Cylinder(center, radius, height) — height runs along sketch Y.
        self.add_operation(Cylinder(s.origin, radius=radius, height=height))
        self.paint("light_green")

Cylinder desugars to a Lathe of a thin rectangle around the sketch Y axis. For oriented cylinders (along Z, or at an angle) anchor center on the appropriate sketch plane.