2025-03-06 18:01:24 -05:00
// Pipe and Flange Assembly
// A crucial component in various piping systems, designed to facilitate the connection, disconnection, and access to piping for inspection, cleaning, and modifications. This assembly combines pipes (long cylindrical conduits) with flanges (plate-like fittings) to create a secure yet detachable joint.
2025-04-04 11:03:13 -07:00
// Set units
2025-05-06 08:44:03 +12:00
@settings(defaultLengthUnit = in, kclVersion = 1.0)
2025-03-06 18:01:24 -05:00
2025-04-04 11:03:13 -07:00
// Import parameters
import * from "parameters.kcl"
2025-03-19 23:49:06 -04:00
2025-04-04 11:03:13 -07:00
// Import parts
2025-04-04 12:55:21 -07:00
import "9472k188-gasket.kcl" as gasket
2025-03-26 08:53:34 -07:00
import flange from "68095k348-flange.kcl"
import washer from "98017a257-washer.kcl"
import bolt from "91251a404-bolt.kcl"
import hexNut from "95479a127-hex-nut.kcl"
import pipe from "1120t74-pipe.kcl"
2025-03-19 23:49:06 -04:00
2025-04-04 11:03:13 -07:00
// Place flanges
2025-03-19 23:49:06 -04:00
flange()
flange()
|> rotate(axis = [0, 1, 0], angle = 180)
2025-03-30 10:06:36 -07:00
|> translate(x = 0, y = 0, z = flangeBackHeight * 2 + gasketThickness)
2025-03-19 23:49:06 -04:00
2025-04-04 11:03:13 -07:00
// Place gasket between the flanges
gasket
2025-03-30 10:06:36 -07:00
|> translate(x = 0, y = 0, z = -flangeBackHeight - gasketThickness)
2025-03-19 23:49:06 -04:00
2025-04-04 11:03:13 -07:00
// Place eight washers (four front, four back)
2025-03-19 23:49:06 -04:00
washer()
2025-03-30 10:06:36 -07:00
|> translate(x = mountingHolePlacementDiameter / 2, y = 0, z = flangeBaseThickness)
2025-03-26 08:53:34 -07:00
|> patternCircular3d(
%,
instances = 4,
axis = [0, 0, 1],
center = [0, 0, 0],
arcDegrees = 360,
rotateDuplicates = false,
)
|> patternLinear3d(
%,
instances = 2,
distance = -(flangeBaseThickness * 2 + flangeBackHeight * 2 + gasketThickness + washerThickness),
axis = [0, 0, 1],
)
2025-03-19 23:49:06 -04:00
2025-04-04 11:03:13 -07:00
// Place four bolts
2025-03-19 23:49:06 -04:00
bolt()
2025-03-30 10:06:36 -07:00
|> translate(x = mountingHolePlacementDiameter / 2, y = 0, z = flangeBaseThickness + washerThickness)
2025-03-19 23:49:06 -04:00
|> rotate(roll = 90, pitch = 0, yaw = 0)
2025-03-26 08:53:34 -07:00
|> patternCircular3d(
%,
instances = 4,
axis = [0, 0, 1],
center = [0, 0, 0],
arcDegrees = 360,
rotateDuplicates = false,
)
2025-03-19 23:49:06 -04:00
2025-04-04 11:03:13 -07:00
// Place four hex nuts
2025-03-19 23:49:06 -04:00
hexNut()
2025-03-30 10:06:36 -07:00
|> translate(x = mountingHolePlacementDiameter / 2, y = 0, z = -(flangeBackHeight * 2 + gasketThickness + flangeBaseThickness + washerThickness + hexNutThickness))
2025-03-26 08:53:34 -07:00
|> patternCircular3d(
%,
instances = 4,
axis = [0, 0, 1],
center = [0, 0, 0],
arcDegrees = 360,
rotateDuplicates = false,
)
2025-03-19 23:49:06 -04:00
2025-04-04 11:03:13 -07:00
// Place both pieces of pipe
2025-03-19 23:49:06 -04:00
pipe()
2025-03-26 08:53:34 -07:00
|> rotate(
%,
roll = -90,
pitch = 0,
yaw = 0,
)
|> translate(
2025-03-30 10:06:36 -07:00
%,
x = 0,
y = 0,
z = flangeBaseThickness + flangeFrontHeight - 0.5,
global = true,
2025-03-26 08:53:34 -07:00
)
2025-03-19 23:49:06 -04:00
pipe()
2025-03-26 08:53:34 -07:00
|> rotate(
%,
roll = 90,
pitch = 0,
yaw = 0,
)
|> translate(
2025-03-30 10:06:36 -07:00
%,
x = 0,
y = 0,
z = -(flangeBackHeight * 2 + gasketThickness + flangeBaseThickness + flangeFrontHeight - 0.5),
global = true,
2025-03-26 08:53:34 -07:00
)