// Pipe with bend
// A tubular section or hollow cylinder, usually but not necessarily of circular cross-section, used mainly to convey substances that can flow.

// Set units
@settings(defaultLengthUnit = in, kclVersion = 1.0)

// Define parameters
innerDiameter = 10
outerDiameter = 20
bendRadius = 30
bendAngle = 90

// Create a sketch in the XZ plane
sketch000 = startSketchOn(XZ)

// Create a profile for the outer diameter
outerProfile = circle(sketch000, center = [bendRadius, 0], radius = outerDiameter / 2)

// Create a profile for the inner diameter
innerProfile = circle(sketch000, center = [bendRadius, 0], radius = innerDiameter / 2)

// Create the profile of the pipe
pipeProfile = outerProfile
  |> subtract2d(tool = innerProfile)

// Revolve the pipe profile at the desired angle
pipe = revolve(pipeProfile, axis = Y, angle = bendAngle)
