point and clickify flange assembly

This commit is contained in:
Kurt Hutten Irev-Dev
2025-05-30 17:24:57 +10:00
parent 80e3dc9095
commit ab966423ac
6 changed files with 98 additions and 121 deletions

View File

@ -7,17 +7,13 @@
// Import parameters // Import parameters
import pipeInnerDiameter, pipeOuterDiameter, pipeLength from "parameters.kcl" import pipeInnerDiameter, pipeOuterDiameter, pipeLength from "parameters.kcl"
// Create a function to make the pipe. Export // Create the pipe base
export fn pipe() { pipeBase = startSketchOn(XZ)
// Create the pipe base
pipeBase = startSketchOn(XZ)
|> circle(%, center = [0, 0], radius = pipeOuterDiameter / 2) |> circle(%, center = [0, 0], radius = pipeOuterDiameter / 2)
|> extrude(%, length = pipeLength) |> extrude(%, length = pipeLength)
// Extrude a hole through the length of the pipe // Extrude a hole through the length of the pipe
pipe = startSketchOn(pipeBase, face = END) startSketchOn(pipeBase, face = END)
|> circle(center = [0, 0], radius = pipeInnerDiameter / 2) |> circle(center = [0, 0], radius = pipeInnerDiameter / 2)
|> extrude(%, length = -pipeLength) |> extrude(%, length = -pipeLength)
|> appearance(color = "#a24ed0") |> appearance(color = "#a24ed0")
return pipe
}

View File

@ -7,10 +7,8 @@
// Import parameters // Import parameters
import pipeDiameter, mountingHoleDiameter, mountingHolePlacementDiameter, flangeDiameter, flangeTotalThickness, flangeBackHeight, flangeFrontHeight, flangeBaseThickness, flangeBackDiameter, flangeFrontDiameter from "parameters.kcl" import pipeDiameter, mountingHoleDiameter, mountingHolePlacementDiameter, flangeDiameter, flangeTotalThickness, flangeBackHeight, flangeFrontHeight, flangeBaseThickness, flangeBackDiameter, flangeFrontDiameter from "parameters.kcl"
// Create a function to create the flange. We must create a function since we are using multiple flanges. // Sketch the mounting hole pattern
export fn flange() { mountingHoles = startSketchOn(XY)
// Sketch the mounting hole pattern
mountingHoles = startSketchOn(XY)
|> circle(%, center = [0, mountingHolePlacementDiameter / 2], radius = mountingHoleDiameter / 2) |> circle(%, center = [0, mountingHolePlacementDiameter / 2], radius = mountingHoleDiameter / 2)
|> patternCircular2d( |> patternCircular2d(
%, %,
@ -20,25 +18,22 @@ export fn flange() {
rotateDuplicates = false, rotateDuplicates = false,
) )
// Create the flange base // Create the flange base
flangeBase = startSketchOn(XY) flangeBase = startSketchOn(XY)
|> circle(%, center = [0, 0], radius = flangeDiameter / 2) |> circle(%, center = [0, 0], radius = flangeDiameter / 2)
|> subtract2d(tool = mountingHoles) |> subtract2d(tool = mountingHoles)
|> extrude(%, length = flangeBaseThickness) |> extrude(%, length = flangeBaseThickness)
// Create both the raised portions on the front and back of the flange base // Create both the raised portions on the front and back of the flange base
flangeBack = startSketchOn(flangeBase, face = START) flangeBack = startSketchOn(flangeBase, face = START)
|> circle(%, center = [0, 0], radius = flangeBackDiameter / 2) |> circle(%, center = [0, 0], radius = flangeBackDiameter / 2)
|> extrude(%, length = flangeBackHeight) |> extrude(%, length = flangeBackHeight)
flangeFront = startSketchOn(flangeBase, face = END) flangeFront = startSketchOn(flangeBase, face = END)
|> circle(%, center = [0, 0], radius = flangeFrontDiameter / 2) |> circle(%, center = [0, 0], radius = flangeFrontDiameter / 2)
|> extrude(%, length = flangeFrontHeight) |> extrude(%, length = flangeFrontHeight)
// Create the circular cut in the center for the pipe // Create the circular cut in the center for the pipe
pipeCut = startSketchOn(flangeFront, face = END) startSketchOn(flangeFront, face = END)
|> circle(%, center = [0, 0], radius = pipeDiameter / 2) |> circle(%, center = [0, 0], radius = pipeDiameter / 2)
|> extrude(%, length = -flangeTotalThickness) |> extrude(%, length = -flangeTotalThickness)
|> appearance(%, color = "#bab0b0") |> appearance(%, color = "#bab0b0")
return pipeCut
}

View File

@ -7,16 +7,14 @@
// Import parameters // Import parameters
import boltDiameter, boltLength, boltHeadLength, boltHeadDiameter, boltHexDrive, boltHexFlatLength, boltThreadLength from "parameters.kcl" import boltDiameter, boltLength, boltHeadLength, boltHeadDiameter, boltHexDrive, boltHexFlatLength, boltThreadLength from "parameters.kcl"
// Create a function to make a the bolt // Create the head of the cap screw
export fn bolt() { boltHead = startSketchOn(XZ)
// Create the head of the cap screw
boltHead = startSketchOn(XZ)
|> circle(center = [0, 0], radius = boltHeadDiameter / 2, tag = $topEdge) |> circle(center = [0, 0], radius = boltHeadDiameter / 2, tag = $topEdge)
|> extrude(length = -boltHeadLength) |> extrude(length = -boltHeadLength)
|> fillet(radius = 0.020, tags = [topEdge, getOppositeEdge(topEdge)]) |> fillet(radius = 0.020, tags = [topEdge, getOppositeEdge(topEdge)])
// Define the sketch of the hex pattern on the screw head and extrude into the head // Define the sketch of the hex pattern on the screw head and extrude into the head
hexPatternSketch = startSketchOn(boltHead, face = START) hexPatternSketch = startSketchOn(boltHead, face = START)
|> startProfile(at = [ |> startProfile(at = [
boltHexDrive / 2, boltHexDrive / 2,
boltHexFlatLength / 2 boltHexFlatLength / 2
@ -29,11 +27,8 @@ export fn bolt() {
|> close() |> close()
|> extrude(length = -boltHeadLength * 0.75) |> extrude(length = -boltHeadLength * 0.75)
// create the body of the bolt // create the body of the bolt
boltBody = startSketchOn(boltHead, face = END) startSketchOn(boltHead, face = END)
|> circle(center = [0, 0], radius = boltDiameter / 2, tag = $filletEdge) |> circle(center = [0, 0], radius = boltDiameter / 2, tag = $filletEdge)
|> extrude(length = boltLength) |> extrude(length = boltLength)
|> appearance(color = "#4dd043", metalness = 90, roughness = 90) |> appearance(color = "#4dd043", metalness = 90, roughness = 90)
return boltBody
}

View File

@ -7,10 +7,8 @@
// Import parameters // Import parameters
import hexNutDiameter, hexNutFlatToFlat, hexNutThickness, hexNutFlatLength from "parameters.kcl" import hexNutDiameter, hexNutFlatToFlat, hexNutThickness, hexNutFlatLength from "parameters.kcl"
// Create a function to make the hex nut. Must be a function since multiple hex nuts are used // Create the base of the hex nut
export fn hexNut() { hexNutBase = startSketchOn(XY)
// Create the base of the hex nut
hexNutBase = startSketchOn(XY)
|> startProfile(at = [ |> startProfile(at = [
hexNutFlatToFlat / 2, hexNutFlatToFlat / 2,
hexNutFlatLength / 2 hexNutFlatLength / 2
@ -23,11 +21,8 @@ export fn hexNut() {
|> close() |> close()
|> extrude(length = hexNutThickness) |> extrude(length = hexNutThickness)
// Create the hole in the center of the hex nut // Create the hole in the center of the hex nut
hexNut = startSketchOn(hexNutBase, face = END) startSketchOn(hexNutBase, face = END)
|> circle(center = [0, 0], radius = hexNutDiameter / 2) |> circle(center = [0, 0], radius = hexNutDiameter / 2)
|> extrude(%, length = -hexNutThickness) |> extrude(%, length = -hexNutThickness)
|> appearance(%, color = "#4edfd5") |> appearance(%, color = "#4edfd5")
return hexNut
}

View File

@ -7,8 +7,6 @@
// Import parameters // Import parameters
import washerInnerDia, washerOuterDia, washerThickness from "parameters.kcl" import washerInnerDia, washerOuterDia, washerThickness from "parameters.kcl"
// Create a function to make the washer. Must be a function since multiple washers are used.
export fn washer() {
// Create the base of the washer // Create the base of the washer
washerBase = startSketchOn(XY) washerBase = startSketchOn(XY)
|> circle(center = [0, 0], radius = washerOuterDia / 2) |> circle(center = [0, 0], radius = washerOuterDia / 2)
@ -20,5 +18,3 @@ export fn washer() {
|> extrude(%, length = -washerThickness) |> extrude(%, length = -washerThickness)
|> appearance(%, color = "#ee4f4f") |> appearance(%, color = "#ee4f4f")
return washer
}

View File

@ -9,16 +9,19 @@ import * from "parameters.kcl"
// Import parts // Import parts
import "9472k188-gasket.kcl" as gasket import "9472k188-gasket.kcl" as gasket
import flange from "68095k348-flange.kcl" import "68095k348-flange.kcl" as flange
import washer from "98017a257-washer.kcl" import "98017a257-washer.kcl" as washer
import bolt from "91251a404-bolt.kcl" import "91251a404-bolt.kcl" as bolt
import hexNut from "95479a127-hex-nut.kcl" import "95479a127-hex-nut.kcl" as hexNut
import pipe from "1120t74-pipe.kcl" import "1120t74-pipe.kcl" as pipe
// Place flanges // Place flange clone
flange() rotate(
flange() clone(flange),
|> rotate(axis = [0, 1, 0], angle = 180) roll = 180,
pitch = 0,
yaw = 0,
)
|> translate(x = 0, y = 0, z = flangeBackHeight * 2 + gasketThickness) |> translate(x = 0, y = 0, z = flangeBackHeight * 2 + gasketThickness)
// Place gasket between the flanges // Place gasket between the flanges
@ -26,7 +29,7 @@ gasket
|> translate(x = 0, y = 0, z = -flangeBackHeight - gasketThickness) |> translate(x = 0, y = 0, z = -flangeBackHeight - gasketThickness)
// Place eight washers (four front, four back) // Place eight washers (four front, four back)
washer() washer
|> translate(x = mountingHolePlacementDiameter / 2, y = 0, z = flangeBaseThickness) |> translate(x = mountingHolePlacementDiameter / 2, y = 0, z = flangeBaseThickness)
|> patternCircular3d( |> patternCircular3d(
%, %,
@ -44,7 +47,8 @@ washer()
) )
// Place four bolts // Place four bolts
bolt()
bolt
|> translate(x = mountingHolePlacementDiameter / 2, y = 0, z = flangeBaseThickness + washerThickness) |> translate(x = mountingHolePlacementDiameter / 2, y = 0, z = flangeBaseThickness + washerThickness)
|> rotate(roll = 90, pitch = 0, yaw = 0) |> rotate(roll = 90, pitch = 0, yaw = 0)
|> patternCircular3d( |> patternCircular3d(
@ -57,7 +61,7 @@ bolt()
) )
// Place four hex nuts // Place four hex nuts
hexNut() hexNut
|> translate(x = mountingHolePlacementDiameter / 2, y = 0, z = -(flangeBackHeight * 2 + gasketThickness + flangeBaseThickness + washerThickness + hexNutThickness)) |> translate(x = mountingHolePlacementDiameter / 2, y = 0, z = -(flangeBackHeight * 2 + gasketThickness + flangeBaseThickness + washerThickness + hexNutThickness))
|> patternCircular3d( |> patternCircular3d(
%, %,
@ -69,9 +73,8 @@ hexNut()
) )
// Place both pieces of pipe // Place both pieces of pipe
pipe() rotate(
|> rotate( pipe,
%,
roll = -90, roll = -90,
pitch = 0, pitch = 0,
yaw = 0, yaw = 0,
@ -83,16 +86,13 @@ pipe()
z = flangeBaseThickness + flangeFrontHeight - 0.5, z = flangeBaseThickness + flangeFrontHeight - 0.5,
global = true, global = true,
) )
rotate(
pipe() clone(pipe),
|> rotate( roll = 180,
%,
roll = 90,
pitch = 0, pitch = 0,
yaw = 0, yaw = 0,
) )
|> translate( |> translate(
%,
x = 0, x = 0,
y = 0, y = 0,
z = -(flangeBackHeight * 2 + gasketThickness + flangeBaseThickness + flangeFrontHeight - 0.5), z = -(flangeBackHeight * 2 + gasketThickness + flangeBaseThickness + flangeFrontHeight - 0.5),