update all kcl-samples w/ format (#5999)

This commit is contained in:
Josh Gomez
2025-03-26 08:53:34 -07:00
committed by GitHub
parent 0677474097
commit fa16fcedff
194 changed files with 25580 additions and 25201 deletions

View File

@ -1,16 +1,16 @@
// 1120t74 Pipe
// import constants
import pipeInnerDiameter, pipeOuterDiameter, pipeLength from "globals.kcl"
// Pipe
// piping for the pipe flange assembly
// set units
@settings(defaultLengthUnit = in)
// import constants
import pipeInnerDiameter, pipeOuterDiameter, pipeLength from "globals.kcl"
// create a function to make the pipe
export fn pipe() {
// create the pipe base
pipeBase = startSketchOn('XZ')
pipeBase = startSketchOn(XZ)
|> circle(%, center = [0, 0], radius = pipeOuterDiameter / 2)
|> extrude(%, length = pipeLength)

View File

@ -1,16 +1,16 @@
// 68095k348 flange
// import constants
import pipeDiameter, mountingHoleDiameter, mountingHolePlacementDiameter, flangeDiameter, flangeTotalThickness, flangeBackHeight, flangeFrontHeight, flangeBaseThickness, flangeBackDiameter, flangeFrontDiameter from "globals.kcl"
// flange used for mating two pipes together in the pipe flange assembly.
// set units
@settings(defaultLengthUnit = in)
// import constants
import pipeDiameter, mountingHoleDiameter, mountingHolePlacementDiameter, flangeDiameter, flangeTotalThickness, flangeBackHeight, flangeFrontHeight, flangeBaseThickness, flangeBackDiameter, flangeFrontDiameter from "globals.kcl"
// create a function to create the flange
export fn flange() {
// sketch the mounting hole pattern
mountingHoles = startSketchOn("XY")
mountingHoles = startSketchOn(XY)
|> circle(%, center = [0, mountingHolePlacementDiameter / 2], radius = mountingHoleDiameter / 2)
|> patternCircular2d(
%,
@ -21,7 +21,7 @@ export fn flange() {
)
// create the flange base
flangeBase = startSketchOn("XY")
flangeBase = startSketchOn(XY)
|> circle(%, center = [0, 0], radius = flangeDiameter / 2)
|> hole(mountingHoles, %)
|> extrude(%, length = flangeBaseThickness)

View File

@ -1,16 +1,17 @@
// 91251A404 Socket Head Cap Screw
// import constants
import boltDiameter, boltLength, boltHeadLength, boltHeadDiameter, boltHexDrive, boltHexFlatLength, boltThreadLength from "globals.kcl"
// screw for mating the flanges together in the pipe flange assembly
// set units
@settings(defaultLengthUnit = in)
// import constants
import boltDiameter, boltLength, boltHeadLength, boltHeadDiameter, boltHexDrive, boltHexFlatLength, boltThreadLength from "globals.kcl"
// create a function to make a the bolt
export fn bolt() {
// Create the head of the cap screw
boltHead = startSketchOn('XZ')
boltHead = startSketchOn(XZ)
|> circle(center = [0, 0], radius = boltHeadDiameter / 2, tag = $topEdge)
|> extrude(length = -boltHeadLength)
|> fillet(radius = 0.020, tags = [topEdge, getOppositeEdge(topEdge)])

View File

@ -1,16 +1,16 @@
// 9472K188 Gasket
// import constants
import gasketOutsideDiameter, gasketInnerDiameter, gasketThickness from "globals.kcl"
// gasket for the pipe flange assembly. A gasket is a mechanical seal that fills the space between two or more mating surfaces, preventing leaks of liquids or gases under compression
// set units
@settings(defaultLengthUnit = in)
// import constants
import gasketOutsideDiameter, gasketInnerDiameter, gasketThickness from "globals.kcl"
// create a function to make the gasket
export fn gasket() {
// create the base of the gasket
gasketBase = startSketchOn("XY")
gasketBase = startSketchOn(XY)
|> circle(%, center = [0, 0], radius = gasketOutsideDiameter / 2)
|> extrude(%, length = gasketThickness)

View File

@ -1,16 +1,16 @@
// 95479A127 Hex Nut
// import constants
import hexNutDiameter, hexNutFlatToFlat, hexNutThickness, hexNutFlatLength from "globals.kcl"
// hex nut for the screws in the pipe flange assembly.
// set units
@settings(defaultLengthUnit = in)
// import constants
import hexNutDiameter, hexNutFlatToFlat, hexNutThickness, hexNutFlatLength from "globals.kcl"
// create a function to make the hex nut
export fn hexNut() {
// create the base of the hex nut
hexNutBase = startSketchOn('XY')
hexNutBase = startSketchOn(XY)
|> startProfileAt([
hexNutFlatToFlat / 2,
hexNutFlatLength / 2

View File

@ -1,16 +1,16 @@
// 98017A257 Washer
// import constants
import washerInnerDia, washerOuterDia, washerThickness from "globals.kcl"
// washer for the screws in the pipe flange assembly.
// set units
@settings(defaultLengthUnit = in)
// import constants
import washerInnerDia, washerOuterDia, washerThickness from "globals.kcl"
// create a function to make the washer
export fn washer() {
// create the base of the washer
washerBase = startSketchOn('XY')
washerBase = startSketchOn(XY)
|> circle(center = [0, 0], radius = washerOuterDia / 2)
|> extrude(length = washerThickness)

View File

@ -5,54 +5,120 @@
@settings(defaultLengthUnit = in)
// import constants
import * from 'globals.kcl'
import * from "globals.kcl"
// import parts
import flange from '68095k348-flange.kcl'
import gasket from '9472k188-gasket.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'
import flange from "68095k348-flange.kcl"
import gasket from "9472k188-gasket.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"
// place flanges
flange()
flange()
|> rotate(axis = [0, 1, 0], angle = 180)
|> translate(translate = [0, 0, flangeBackHeight*2 + gasketThickness])
|> translate(translate = [
0,
0,
flangeBackHeight * 2 + gasketThickness
])
// place gasket between the flanges
gasket()
|> translate(translate = [0, 0, -flangeBackHeight - gasketThickness])
|> translate(translate = [
0,
0,
-flangeBackHeight - gasketThickness
])
// place eight washers (four front, four back)
washer()
|> translate(translate = [
mountingHolePlacementDiameter/2,
0,
flangeBaseThickness
])
|> 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])
mountingHolePlacementDiameter / 2,
0,
flangeBaseThickness
])
|> 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],
)
// place four bolts
bolt()
|> translate(translate = [
mountingHolePlacementDiameter/2, 0, flangeBaseThickness + washerThickness
])
mountingHolePlacementDiameter / 2,
0,
flangeBaseThickness + washerThickness
])
|> rotate(roll = 90, pitch = 0, yaw = 0)
|> patternCircular3d(%, instances = 4, axis = [0, 0, 1], center = [0, 0, 0], arcDegrees = 360, rotateDuplicates = false)
|> patternCircular3d(
%,
instances = 4,
axis = [0, 0, 1],
center = [0, 0, 0],
arcDegrees = 360,
rotateDuplicates = false,
)
// place four hex nuts
hexNut()
|> translate(translate = [mountingHolePlacementDiameter/2, 0, -(flangeBackHeight * 2 + gasketThickness + flangeBaseThickness + washerThickness + hexNutThickness)])
|> patternCircular3d(%, instances = 4, axis = [0, 0, 1], center = [0, 0, 0], arcDegrees = 360, rotateDuplicates = false)
|> translate(translate = [
mountingHolePlacementDiameter / 2,
0,
-(flangeBackHeight * 2 + gasketThickness + flangeBaseThickness + washerThickness + hexNutThickness)
])
|> patternCircular3d(
%,
instances = 4,
axis = [0, 0, 1],
center = [0, 0, 0],
arcDegrees = 360,
rotateDuplicates = false,
)
// place both pieces of pipe
pipe()
|> rotate(%, roll = -90, pitch = 0, yaw = 0)
|> translate(%, translate = [0, 0, flangeBaseThickness + flangeFrontHeight - 0.5], global = true)
|> rotate(
%,
roll = -90,
pitch = 0,
yaw = 0,
)
|> translate(
%,
translate = [
0,
0,
flangeBaseThickness + flangeFrontHeight - 0.5
],
global = true,
)
pipe()
|> rotate(%, roll = 90, pitch = 0, yaw = 0)
|> translate(%, translate = [0, 0, -(flangeBackHeight * 2 + gasketThickness + flangeBaseThickness + flangeFrontHeight - 0.5)], global = true)
|> rotate(
%,
roll = 90,
pitch = 0,
yaw = 0,
)
|> translate(
%,
translate = [
0,
0,
-(flangeBackHeight * 2 + gasketThickness + flangeBaseThickness + flangeFrontHeight - 0.5)
],
global = true,
)