updating example kcl back to bracket with updated changes (#1743)

* updating example kcl

* parantheses error

* fix recast bug (#1746)

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* minor fix

* adding comment to kcl

---------

Signed-off-by: Jess Frazelle <github@jessfraz.com>
Co-authored-by: Jess Frazelle <jessfraz@users.noreply.github.com>
This commit is contained in:
Josh Gomez
2024-03-15 23:10:34 -07:00
committed by GitHub
parent 69ff651201
commit 47ff4623bd
2 changed files with 33 additions and 31 deletions

View File

@ -1,36 +1,38 @@
export const bracket = `// Mounting Plate export const bracket = `// Shelf Bracket
// A flat piece of material, often metal or plastic, that serves as a support or base for attaching, securing, or mounting various types of equipment, devices, or components. // This is a shelf bracket made out of 6061-T6 aluminum sheet metal. The required thickness is calculated based on a point load of 300 lbs applied to the end of the shelf. There are two brackets holding up the shelf, so the moment experienced is divided by 2. The shelf is 1 foot long from the wall.
// Create a function that defines the body width and length of the mounting plate. Tag the corners so they can be passed through the fillet function. const sigmaAllow = 35000 // psi
fn rectShape = (pos, w, l) => { const width = 6 // inch
const rr = startSketchOn('XY') const p = 300 // Force on shelf - lbs
|> startProfileAt([pos[0] - (w / 2), pos[1] - (l / 2)], %) const distance = 12 // inches
|> lineTo([pos[0] + w / 2, pos[1] - (l / 2)], %, 'edge1') const M = 12 * 300 / 2 // Moment experienced at fixed end of bracket
|> lineTo([pos[0] + w / 2, pos[1] + l / 2], %, 'edge2') const FOS = 2 // Factor of safety of 2
|> lineTo([pos[0] - (w / 2), pos[1] + l / 2], %, 'edge3') const shelfMountL = 8 // The length of the bracket holding up the shelf is 6 inches
|> close(%, "edge4") const wallMountL = 8 // the length of the bracket
return rr
}
// Define the hole radius and x, y location constants
const holeRadius = 1
const holeIndex = 6
// Create the mounting plate extrusion, holes, and fillets // Calculate the thickness off the allowable bending stress and factor of safety
const part = rectShape([0, 0], 20, 20) const thickness = sqrt(6 * M * FOS / (width * sigmaAllow))
|> hole(circle([-holeIndex, holeIndex], holeRadius, %), %)
|> hole(circle([holeIndex, holeIndex], holeRadius, %), %) // 0.25 inch fillet radius
|> hole(circle([-holeIndex, -holeIndex], holeRadius, %), %) const filletR = 0.25
|> hole(circle([holeIndex, -holeIndex], holeRadius, %), %)
|> extrude(2, %) // Sketch the bracket and extrude with fillets
const bracket = startSketchOn('XY')
|> startProfileAt([0, 0], %)
|> line([0, wallMountL], %, 'outerEdge')
|> line([-shelfMountL, 0], %)
|> line([0, -thickness], %)
|> line([shelfMountL - thickness, 0], %, 'innerEdge')
|> line([0, -wallMountL + thickness], %)
|> close(%)
|> extrude(width, %)
|> fillet({ |> fillet({
radius: 4, radius: filletR,
tags: [ tags: [getNextAdjacentEdge('innerEdge', %)]
getNextAdjacentEdge("edge1", %), }, %)
getNextAdjacentEdge("edge2", %), |> fillet({
getNextAdjacentEdge("edge3", %), radius: filletR + thickness,
getNextAdjacentEdge("edge4", %) tags: [getNextAdjacentEdge('outerEdge', %)]
]
}, %) }, %)
` `

View File

@ -61,7 +61,7 @@ export default function ParametricModeling() {
<p className="my-4"> <p className="my-4">
We are able to easily calculate the thickness of the material based We are able to easily calculate the thickness of the material based
on the width of the bracket to meet a set safety factor on{' '} on the width of the bracket to meet a set safety factor on{' '}
<em className="text-energy-60 dark:text-energy-20">line 6</em>. <em className="text-energy-60 dark:text-energy-20">line 14</em>.
</p> </p>
</section> </section>
<OnboardingButtons <OnboardingButtons