kcl-samples → pipe-with-bend →
pipe-with-bend

KCL
// 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)
// 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
|> hole(innerProfile, %)
// Revolve the pipe profile at the desired angle
pipe = revolve(pipeProfile, axis = Y, angle = bendAngle)