Update onboarding bracket to be robust (#6099)
* update onboarding bracket to be robust * update onboarding bracket with bends * checking if asserts causing parse failure * fun fact, it was not the asserts * fix bracket loading Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> --------- Signed-off-by: Jess Frazelle <github@jessfraz.com> Co-authored-by: Pierre Jacquier <pierrejacquier39@gmail.com> Co-authored-by: Jess Frazelle <github@jessfraz.com> Co-authored-by: Jess Frazelle <jessfraz@users.noreply.github.com>
This commit is contained in:
@ -1,53 +1,6 @@
|
||||
export const bracket = `// Shelf Bracket
|
||||
// This is a bracket that holds a shelf. It is made of aluminum and is designed to hold a force of 300 lbs. The bracket is 6 inches wide and the force is applied at the end of the shelf, 12 inches from the wall. The bracket has a factor of safety of 1.2. The legs of the bracket are 5 inches and 2 inches long. The thickness of the bracket is calculated from the constraints provided.
|
||||
import bracket from '@public/kcl-samples/bracket/main.kcl?raw'
|
||||
|
||||
|
||||
// Define constants
|
||||
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)
|
||||
|
||||
// Calculate required thickness of bracket
|
||||
thickness = sqrt(moment * factorOfSafety * 6 / (sigmaAllow * width)) // this is the calculation of two brackets holding up the shelf (inches)
|
||||
|
||||
filletRadius = .25
|
||||
extFilletRadius = filletRadius + thickness
|
||||
mountingHoleDiameter = 0.5
|
||||
|
||||
sketch001 = startSketchOn(XZ)
|
||||
|> startProfileAt([0, 0], %)
|
||||
|> xLine(length = shelfMountL - thickness, tag = $seg01)
|
||||
|> yLine(length = thickness, tag = $seg02)
|
||||
|> xLine(length = -shelfMountL, tag = $seg03)
|
||||
|> yLine(length = -wallMountL, tag = $seg04)
|
||||
|> xLine(length = thickness, tag = $seg05)
|
||||
|> line(endAbsolute = [profileStartX(%), profileStartY(%)], tag = $seg06)
|
||||
|> close()
|
||||
|
||||
extrude001 = extrude(sketch001, length = width)
|
||||
|> fillet(radius = extFilletRadius, tags = [getNextAdjacentEdge(seg03)])
|
||||
|> fillet(radius = filletRadius, tags = [getNextAdjacentEdge(seg06)])
|
||||
|> fillet(radius = filletRadius, tags = [seg02, getOppositeEdge(seg02)])
|
||||
|> fillet(radius = filletRadius, tags = [seg05, getOppositeEdge(seg05)])
|
||||
|
||||
sketch002 = startSketchOn(extrude001, seg03)
|
||||
|> circle(center = [-1.25, 1], radius = mountingHoleDiameter / 2)
|
||||
|> patternLinear2d(instances = 2, distance = 2.5, axis = [-1, 0])
|
||||
|> patternLinear2d(instances = 2, distance = 4, axis = [0, 1])
|
||||
|
||||
extrude002 = extrude(sketch002, length = -thickness - .01)
|
||||
|
||||
sketch003 = startSketchOn(extrude002, seg04)
|
||||
|> circle(center = [1, -1], radius = mountingHoleDiameter / 2)
|
||||
|> patternLinear2d(instances = 2, distance = 4, axis = [1, 0])
|
||||
|
||||
extrude003 = extrude(sketch003, length = -thickness - 0.1)
|
||||
`
|
||||
export { bracket }
|
||||
|
||||
/**
|
||||
* @throws Error if the search text is not found in the example code.
|
||||
@ -70,7 +23,6 @@ function findLineInExampleCode({
|
||||
}
|
||||
return lineNumber
|
||||
}
|
||||
|
||||
export const bracketWidthConstantLine = findLineInExampleCode({
|
||||
searchText: 'width =',
|
||||
})
|
||||
|
Reference in New Issue
Block a user