Update bracket KCL variable syntax in onboarding (#4685)

This commit is contained in:
Jonathan Tran
2024-12-06 16:04:17 -05:00
committed by GitHub
parent 88b51da417
commit 32ce857119

View File

@ -3,27 +3,27 @@ export const bracket = `// Shelf Bracket
// Define constants
const sigmaAllow = 35000 // psi (6061-T6 aluminum)
const width = 6 // inch
const p = 300 // Force on shelf - lbs
const factorOfSafety = 1.2 // FOS of 1.2
const shelfMountL = 5 // inches
const wallMountL = 2 // inches
const shelfDepth = 12 // Shelf is 12 inches in depth from the wall
const moment = shelfDepth * p // assume the force is applied at the end of the shelf to be conservative (lb-in)
sigmaAllow = 35000 // psi (6061-T6 aluminum)
width = 6 // inch
p = 300 // Force on shelf - lbs
factorOfSafety = 1.2 // FOS of 1.2
shelfMountL = 5 // inches
wallMountL = 2 // inches
shelfDepth = 12 // Shelf is 12 inches in depth from the wall
moment = shelfDepth * p // assume the force is applied at the end of the shelf to be conservative (lb-in)
const filletRadius = .375 // inches
const extFilletRadius = .25 // inches
const mountingHoleDiameter = 0.5 // inches
filletRadius = .375 // inches
extFilletRadius = .25 // inches
mountingHoleDiameter = 0.5 // inches
// Calculate required thickness of bracket
const thickness = sqrt(moment * factorOfSafety * 6 / (sigmaAllow * width)) // this is the calculation of two brackets holding up the shelf (inches)
thickness = sqrt(moment * factorOfSafety * 6 / (sigmaAllow * width)) // this is the calculation of two brackets holding up the shelf (inches)
// Sketch the bracket body and fillet the inner and outer edges of the bend
const bracketLeg1Sketch = startSketchOn('XY')
bracketLeg1Sketch = startSketchOn('XY')
|> startProfileAt([0, 0], %)
|> line([shelfMountL - filletRadius, 0], %, $fillet1)
|> line([0, width], %, $fillet2)
@ -47,7 +47,7 @@ const bracketLeg1Sketch = startSketchOn('XY')
}, %), %)
// Extrude the leg 2 bracket sketch
const bracketLeg1Extrude = extrude(thickness, bracketLeg1Sketch)
bracketLeg1Extrude = extrude(thickness, bracketLeg1Sketch)
|> fillet({
radius = extFilletRadius,
tags = [
@ -57,7 +57,7 @@ const bracketLeg1Extrude = extrude(thickness, bracketLeg1Sketch)
}, %)
// Sketch the fillet arc
const filletSketch = startSketchOn('XZ')
filletSketch = startSketchOn('XZ')
|> startProfileAt([0, 0], %)
|> line([0, thickness], %)
|> arc({
@ -73,10 +73,10 @@ const filletSketch = startSketchOn('XZ')
}, %)
// Sketch the bend
const filletExtrude = extrude(-width, filletSketch)
filletExtrude = extrude(-width, filletSketch)
// Create a custom plane for the leg that sits on the wall
const customPlane = {
customPlane = {
plane = {
origin = { x = -filletRadius, y = 0, z = 0 },
xAxis = { x = 0, y = 1, z = 0 },
@ -86,7 +86,7 @@ const customPlane = {
}
// Create a sketch for the second leg
const bracketLeg2Sketch = startSketchOn(customPlane)
bracketLeg2Sketch = startSketchOn(customPlane)
|> startProfileAt([0, -filletRadius], %)
|> line([width, 0], %)
|> line([0, -wallMountL], %, $fillet3)
@ -102,7 +102,7 @@ const bracketLeg2Sketch = startSketchOn(customPlane)
}, %), %)
// Extrude the second leg
const bracketLeg2Extrude = extrude(-thickness, bracketLeg2Sketch)
bracketLeg2Extrude = extrude(-thickness, bracketLeg2Sketch)
|> fillet({
radius = extFilletRadius,
tags = [
@ -135,8 +135,8 @@ function findLineInExampleCode({
}
export const bracketWidthConstantLine = findLineInExampleCode({
searchText: 'const width',
searchText: 'width =',
})
export const bracketThicknessCalculationLine = findLineInExampleCode({
searchText: 'const thickness',
searchText: 'thickness =',
})