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