CadQuery Shape primitives
Workplane.box
result = cq.Workplane("XY" ).box(3, 3, 3)

Solid.makeCone
result = cq.Solid.makeCone(3, 1, 3)

Workplane.cylinder
result = cq.Workplane("XY" ).cylinder(3, 2)

Workplane.sphere
result = cq.Workplane("XY" ).sphere(3)
Solid.makeSphere
result = cq.Solid.makeSphere(3, angleDegrees1 = -90, angleDegrees2 =90, angleDegrees3 = 360)

Workplane.text
result = cq.Workplane("XY").text("Test",10, 2)

Solid.makeTorus
result = cq.Solid.makeTorus(3, 1.5)

Workplane.wedge
result = cq.Workplane("XY" ).wedge(3,3,3,1.5,1.5,1.5,1.5)

Sketch.arc
result = cq.Sketch().arc((0,3), (1.5,1.5), (0,0))

Sketch.circle
result = cq.Sketch().circle(4)

Sketch.ellipse
result = cq.Sketch().ellipse(4,5)

Sketch.polygon
pts = [(0,0),(0,4),(2,3) ,(4,4), (4,0)]
result = cq.Sketch().polygon(pts)

Sketch.rect
result = cq.Sketch().rect(4,4)

Sketch.regularPolygon
result = cq.Sketch().regularPolygon(3,5)

Sketch.slot
result = cq.Sketch().slot(1.5, 0.5, angle=90)

Sketch.spline
pts = [(0,0),(0,4),(2,3) ,(4,4)]
result = cq.Sketch().spline(pts)

Sketch.trapezoid
result = cq.Sketch().trapezoid(4,3,70)
2d operations
Workplane.circle
result = cq.Workplane("XY" ).circle(3)
result = cq.Edge.makeCircle(3)
Wire.makeCircle
result = cq.Wire.makeCircle(3, (0,0,0), (0,0,1))

Workplane.ellipse
result = cq.Workplane("XY" ).ellipse(3,4)
result = cq.Edge.makeEllipse(3,4)
Wire.makeEllipse
result = cq.Wire.makeEllipse(3, 4, (0,0,0),(0,0,1), (1,0))

Wire.makeHelix
result = cq.Wire.makeHelix(1, 4, 3)

Workplane.line
result = cq.Workplane("XY" ).line(1,3)

Workplane.lineTo

result = cq.Workplane("XY" ).lineTo(1,3)
Workplane.rect
result = cq.Workplane("XY" ).rect(3, 3)

Workplane.polygon
result = cq.Workplane("XY").polygon(6, 1)

Workplane.polyline
pts = [(0,0),(0,4),(2,3) ,(4,4), (4,0)]
result = cq.Workplane("XY").polyline(pts).close()

Workplane.slot2D
result = cq.Workplane("XY").slot2D(5,2)

Workplane.spline
pts = [(0,0),(0,4),(2,5) ]
path = cq.Workplane("XY").spline(pts)

Workplane.chamfer
origin = cq.Workplane("XY").polygon(6, 20).extrude(10).translate((0,0,-1*(10/2)))
result = origin.chamfer(1,2)

Workplane.extrude
result = cq.Workplane("XY" ).rect(3, 3).extrude(2)

Workplane.fillet
wikipedia
result = (
cq.Workplane("XY")
.box(10,10,10)
.edges()
.fillet(1)
)

- Fillet has specific tolerances; if the fillet is too large the code will fail.
result = (
cq.Workplane("XY")
.box(10,10,10)
.edges()
.fillet(5)
)

Workplane.hole
result = cq.Workplane("XY").box(2,2,1).faces(">Z").hole(1,2)

Workplane.loft
result = (cq.Workplane("front").circle(1.5).workplane(offset=3.0).rect(0.75, 0.5).loft(combine=True))

Workplane.rotate
result = cq.Workplane("XY" ).box(3, 3, 2).rotate((0,0,1), (0,0,0), 30)

Workplane.shell
result = cq.Workplane().box(10, 10, 10).faces("+Z").shell(-1)

result = cq.Workplane().box(10, 10, 10).faces("+Z").shell(-1)

Workplane.sweep
pts = [(0,0),(0,4),(2,5) ]
path = cq.Workplane("XZ").spline(pts)
rect = cq.Workplane("XY" ).rect(3, 3)
result = rect.sweep(path)

Workplane.translate
rect = cq.Workplane("XY" ).box(3, 3, 2).translate((5,5,1))

Workplane.twistExtrude
result = cq.Workplane("XY" ).rect(3, 3).twistExtrude(2,45)

Workplane.cboreHole
result = (
cq.Workplane("XY")
.box(10,10,5)
.faces(">Z")
.cboreHole(2,4,1.5)
)

Workplane.cskHole
result = (
cq.Workplane("XY")
.box(10,10,5)
.faces(">Z")
.cskHole(2, 4, 82, depth=None)
)
