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 constants
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({
center = [bendRadius, 0],
radius = outerDiameter / 2
}, sketch000)
// create a profile for the inner diameter
innerProfile = circle({
center = [bendRadius, 0],
radius = innerDiameter / 2
}, sketch000)
// create the profile of the pipe
pipeProfile = outerProfile
|> hole(innerProfile, %)
// revolve the pipe profile at the desired angle
pipe = revolve({ axis = "Y", angle = bendAngle }, pipeProfile)