KCL (KITTYCAD LANGUAGE)SOURCE
✓ executed/*
Generated by Text-to-CAD:
A 90-degree pipe elbow: 15mm inner diameter, 2mm wall thickness, with 25mm-long straight sections on each end of the bend. The bend centerline radius is 20mm.
*/
@settings(defaultLengthUnit = mm, kclVersion = 1.0)
// Parameters
bendAngleDegrees = 90
bendCenterlineRadius = 20
innerDiameter = 15
wallThickness = 2
straightLength = 25
// Derived
outerDiameter = innerDiameter + 2 * wallThickness
outerRadius = outerDiameter / 2
innerRadius = innerDiameter / 2
// Pipe section profile (annulus) on XY
ringSketchPlane = startSketchOn(XY)
outerCircle = circle(ringSketchPlane, center = [0, 0], radius = outerRadius)
innerCircle = circle(ringSketchPlane, center = [0, 0], radius = innerRadius)
ringProfile = subtract2d(outerCircle, tool = innerCircle)
// Centerline path with straight tangents and 90° bend on YZ
pathPlane = startSketchOn(YZ)
sweepPath = pathPlane
|> startProfile(at = [0, 0])
|> yLine(length = straightLength)
|> tangentialArc(radius = bendCenterlineRadius, angle = -bendAngleDegrees)
|> xLine(length = straightLength)
// Sweep the annulus along the path to form the elbow with straight ends
elbowWithTangents = sweep(ringProfile, path = sweepPath)