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:
Josh Gomez
2025-04-11 12:27:29 -07:00
committed by GitHub
parent 67a8bf525d
commit 74c07fc0eb
17 changed files with 5091 additions and 4515 deletions

View File

@ -5,6 +5,7 @@ on:
types: [opened, synchronize]
paths:
- 'src/lib/exampleKcl.ts'
- 'public/kcl-samples/bracket/main.kcl'
permissions:
contents: read
@ -22,7 +23,7 @@ jobs:
uses: actions/github-script@v7
with:
script: |
const message = '`src/lib/exampleKcl.ts` has been updated in this PR, please review and update the `src/routes/onboarding`, if needed.';
const message = '`public/kcl-samples/bracket/main.kcl` or `src/lib/exampleKcl.ts` has been updated in this PR, please review and update the `src/routes/onboarding`, if needed.';
const issue_number = context.payload.pull_request.number;
const owner = context.repo.owner;
const repo = context.repo.repo;

View File

@ -1,4 +1,4 @@
import { bracket } from '@src/lib/exampleKcl'
import { bracket } from '@e2e/playwright/fixtures/bracket'
import fsp from 'fs/promises'
import { join } from 'path'

View File

@ -0,0 +1,16 @@
import fs from 'fs'
import path from 'path'
export const bracket = fs.readFileSync(
path.resolve(
__dirname,
'..',
'..',
'..',
'public',
'kcl-samples',
'bracket',
'main.kcl'
),
'utf8'
)

View File

@ -1,4 +1,4 @@
import { bracket } from '@src/lib/exampleKcl'
import { bracket } from '@e2e/playwright/fixtures/bracket'
import { onboardingPaths } from '@src/routes/Onboarding/paths'
import fsp from 'fs/promises'
import { join } from 'path'
@ -15,6 +15,7 @@ import {
executorInputPath,
getUtils,
orRunWhenFullSuiteEnabled,
runningOnWindows,
settingsToToml,
} from '@e2e/playwright/test-utils'
import { expect, test } from '@e2e/playwright/zoo-test'
@ -279,6 +280,9 @@ test.describe('Onboarding tests', () => {
if (!tronApp) {
fail()
}
if (runningOnWindows()) {
test.fixme(orRunWhenFullSuiteEnabled())
}
await tronApp.cleanProjectDir({
app: {
onboarding_status: '/parametric-modeling',

View File

@ -1,5 +1,5 @@
import { bracket } from '@e2e/playwright/fixtures/bracket'
import type { Page } from '@playwright/test'
import { bracket } from '@src/lib/exampleKcl'
import { reportRejection } from '@src/lib/trap'
import * as fsp from 'fs/promises'
import path from 'path'

View File

@ -1,9 +1,13 @@
import { bracket } from '@e2e/playwright/fixtures/bracket'
import { FILE_EXT } from '@src/lib/constants'
import { bracket } from '@src/lib/exampleKcl'
import * as fsp from 'fs/promises'
import { join } from 'path'
import { getUtils } from '@e2e/playwright/test-utils'
import {
getUtils,
orRunWhenFullSuiteEnabled,
runningOnWindows,
} from '@e2e/playwright/test-utils'
import { expect, test } from '@e2e/playwright/zoo-test'
test.describe('Testing in-app sample loading', () => {
@ -80,6 +84,9 @@ test.describe('Testing in-app sample loading', () => {
'Desktop: should create new file by default, optionally overwrite',
{ tag: '@electron' },
async ({ editor, context, page, scene, cmdBar }, testInfo) => {
if (runningOnWindows()) {
test.fixme(orRunWhenFullSuiteEnabled())
}
const { dir } = await context.folderSetupFn(async (dir) => {
const bracketDir = join(dir, 'bracket')
await fsp.mkdir(bracketDir, { recursive: true })

View File

@ -147,6 +147,7 @@
"importOrder": [
"<THIRD_PARTY_MODULES>",
"^@rust/(.*)$",
"^@public/(.*)$",
"^@e2e/(.*)$",
"^@src/(.*)$",
"^[./]"

View File

@ -1,47 +1,84 @@
// 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.
// Define constants
// Set units
@settings(defaultLengthUnit = in)
// Define parameters
sigmaAllow = 35000 // psi (6061-T6 aluminum)
width = 6 // inch
width = 5.0
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)
fos = 1.2 // Factor of safety of 1.2
shelfMountLength = 5.0
wallMountLength = 2.25
shelfDepth = 12 // Shelf is 12 inches deep from the wall
shelfMountingHoleDiameter = .50
wallMountingHoleDiameter = .625
// Calculated parameters
moment = shelfDepth * p // assume the force is applied at the end of the shelf
thickness = sqrt(moment * fos * 6 / (sigmaAllow * width)) // required thickness for two brackets to hold up the shelf
bendRadius = 0.25
extBendRadius = bendRadius + thickness
filletRadius = .5
shelfMountingHolePlacementOffset = shelfMountingHoleDiameter * 1.5
wallMountingHolePlacementOffset = wallMountingHoleDiameter * 1.5
// Calculate required thickness of bracket
thickness = sqrt(moment * factorOfSafety * 6 / (sigmaAllow * width)) // this is the calculation of two brackets holding up the shelf (inches)
// Add checks to ensure bracket is possible. These make sure that there is adequate distance between holes and edges.
assertGreaterThanOrEq(wallMountLength, wallMountingHoleDiameter * 3, "Holes not possible. Either decrease hole diameter or increase wallMountLength")
assertGreaterThanOrEq(shelfMountLength, shelfMountingHoleDiameter * 5.5, "wallMountLength must be longer for hole sizes to work. Either decrease mounting hole diameters or increase shelfMountLength")
assertGreaterThanOrEq(width, shelfMountingHoleDiameter * 5.5, "Holes not possible. Either decrease hole diameter or increase width")
assertGreaterThanOrEq(width, wallMountingHoleDiameter * 5.5, "Holes not possible. Either decrease hole diameter or increase width")
filletRadius = .25
extFilletRadius = filletRadius + thickness
mountingHoleDiameter = 0.5
sketch001 = startSketchOn(XZ)
// Create the body of the bracket
bracketBody = startSketchOn(XZ)
|> startProfileAt([0, 0], %)
|> xLine(length = shelfMountL - thickness, tag = $seg01)
|> xLine(length = shelfMountLength - thickness, tag = $seg01)
|> yLine(length = thickness, tag = $seg02)
|> xLine(length = -shelfMountL, tag = $seg03)
|> yLine(length = -wallMountL, tag = $seg04)
|> xLine(length = -shelfMountLength, tag = $seg03)
|> yLine(length = -wallMountLength, tag = $seg04)
|> xLine(length = thickness, tag = $seg05)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)], tag = $seg06)
|> close()
|> extrude(%, 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(sketch001, 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])
// Add mounting holes to mount to the shelf
shelfMountingHoles = startSketchOn(bracketBody, seg03)
|> circle(
center = [
-(bendRadius + shelfMountingHolePlacementOffset),
shelfMountingHolePlacementOffset
],
radius = shelfMountingHoleDiameter / 2,
)
|> patternLinear2d(instances = 2, distance = -(extBendRadius + shelfMountingHolePlacementOffset) + shelfMountLength - shelfMountingHolePlacementOffset, axis = [-1, 0])
|> patternLinear2d(instances = 2, distance = width - (shelfMountingHolePlacementOffset * 2), axis = [0, 1])
|> extrude(%, length = -thickness - .01)
sketch003 = startSketchOn(sketch001, seg04)
|> circle(center = [1, -1], radius = mountingHoleDiameter / 2)
|> patternLinear2d(instances = 2, distance = 4, axis = [1, 0])
// Add mounting holes to mount to the wall
wallMountingHoles = startSketchOn(bracketBody, seg04)
|> circle(
center = [
wallMountLength - wallMountingHolePlacementOffset - bendRadius,
wallMountingHolePlacementOffset
],
radius = wallMountingHoleDiameter / 2,
)
|> patternLinear2d(instances = 2, distance = width - (wallMountingHolePlacementOffset * 2), axis = [0, 1])
|> extrude(%, length = -thickness - 0.1)
// Apply bends
fillet(bracketBody, radius = extBendRadius, tags = [getNextAdjacentEdge(seg03)])
fillet(bracketBody, radius = bendRadius, tags = [getNextAdjacentEdge(seg06)])
// Apply corner fillets
fillet(
bracketBody,
radius = filletRadius,
tags = [
seg02,
getOppositeEdge(seg02),
seg05,
getOppositeEdge(seg05)
],
)

View File

@ -29,6 +29,14 @@ description: Artifact commands bracket.kcl
"hidden": true
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "set_scene_units",
"unit": "in"
}
},
{
"cmdId": "[uuid]",
"range": [],
@ -106,7 +114,7 @@ description: Artifact commands bracket.kcl
"segment": {
"type": "line",
"end": {
"x": 4.6487,
"x": 4.6151,
"y": 0.0,
"z": 0.0
},
@ -124,7 +132,7 @@ description: Artifact commands bracket.kcl
"type": "line",
"end": {
"x": 0.0,
"y": 0.3513,
"y": 0.3849,
"z": 0.0
},
"relative": true
@ -158,7 +166,7 @@ description: Artifact commands bracket.kcl
"type": "line",
"end": {
"x": 0.0,
"y": -2.0,
"y": -2.25,
"z": 0.0
},
"relative": true
@ -174,7 +182,7 @@ description: Artifact commands bracket.kcl
"segment": {
"type": "line",
"end": {
"x": 0.3513,
"x": 0.3849,
"y": 0.0,
"z": 0.0
},
@ -229,7 +237,7 @@ description: Artifact commands bracket.kcl
"command": {
"type": "extrude",
"target": "[uuid]",
"distance": 6.0,
"distance": 5.0,
"faces": null,
"opposite": "None"
}
@ -378,118 +386,6 @@ description: Artifact commands bracket.kcl
"face_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "solid3d_get_next_adjacent_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "solid3d_get_next_adjacent_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "solid3d_get_opposite_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "solid3d_get_opposite_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "solid3d_fillet_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"radius": 0.601324026261472,
"tolerance": 0.0000001,
"cut_type": "fillet"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "solid3d_fillet_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"radius": 0.25,
"tolerance": 0.0000001,
"cut_type": "fillet"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "solid3d_fillet_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"radius": 0.25,
"tolerance": 0.0000001,
"cut_type": "fillet"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "solid3d_fillet_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"radius": 0.25,
"tolerance": 0.0000001,
"cut_type": "fillet"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "solid3d_fillet_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"radius": 0.25,
"tolerance": 0.0000001,
"cut_type": "fillet"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "solid3d_fillet_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"radius": 0.25,
"tolerance": 0.0000001,
"cut_type": "fillet"
}
},
{
"cmdId": "[uuid]",
"range": [],
@ -516,30 +412,30 @@ description: Artifact commands bracket.kcl
"type": "move_path_pen",
"path": "[uuid]",
"to": {
"x": -0.75,
"y": 0.75,
"z": 0.0
}
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "sketch_mode_disable"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "extend_path",
"path": "[uuid]",
"segment": {
"type": "arc",
"center": {
"x": -1.0,
"y": 1.0,
"z": 0.0
}
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "sketch_mode_disable"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "extend_path",
"path": "[uuid]",
"segment": {
"type": "arc",
"center": {
"x": -1.25,
"y": 1.0
"y": 0.75
},
"radius": 0.25,
"start": {
@ -573,7 +469,7 @@ description: Artifact commands bracket.kcl
[
{
"translate": {
"x": -2.5,
"x": -2.8651438116461088,
"y": 0.0,
"z": 0.0
},
@ -614,7 +510,7 @@ description: Artifact commands bracket.kcl
{
"translate": {
"x": 0.0,
"y": 4.0,
"y": 3.5,
"z": 0.0
},
"scale": {
@ -654,7 +550,7 @@ description: Artifact commands bracket.kcl
{
"translate": {
"x": 0.0,
"y": 4.0,
"y": 3.5,
"z": 0.0
},
"scale": {
@ -700,7 +596,7 @@ description: Artifact commands bracket.kcl
"command": {
"type": "extrude",
"target": "[uuid]",
"distance": -0.361324026261472,
"distance": -0.39485618835389114,
"faces": null,
"opposite": "None"
}
@ -767,7 +663,7 @@ description: Artifact commands bracket.kcl
"command": {
"type": "extrude",
"target": "[uuid]",
"distance": -0.361324026261472,
"distance": -0.39485618835389114,
"faces": null,
"opposite": "None"
}
@ -834,7 +730,7 @@ description: Artifact commands bracket.kcl
"command": {
"type": "extrude",
"target": "[uuid]",
"distance": -0.361324026261472,
"distance": -0.39485618835389114,
"faces": null,
"opposite": "None"
}
@ -901,7 +797,7 @@ description: Artifact commands bracket.kcl
"command": {
"type": "extrude",
"target": "[uuid]",
"distance": -0.361324026261472,
"distance": -0.39485618835389114,
"faces": null,
"opposite": "None"
}
@ -976,8 +872,8 @@ description: Artifact commands bracket.kcl
"type": "move_path_pen",
"path": "[uuid]",
"to": {
"x": 1.25,
"y": -1.0,
"x": 1.375,
"y": 0.9375,
"z": 0.0
}
}
@ -998,10 +894,10 @@ description: Artifact commands bracket.kcl
"segment": {
"type": "arc",
"center": {
"x": 1.0,
"y": -1.0
"x": 1.0625,
"y": 0.9375
},
"radius": 0.25,
"radius": 0.3125,
"start": {
"unit": "degrees",
"value": 0.0
@ -1033,8 +929,8 @@ description: Artifact commands bracket.kcl
[
{
"translate": {
"x": 4.0,
"y": 0.0,
"x": 0.0,
"y": 3.125,
"z": 0.0
},
"scale": {
@ -1080,7 +976,7 @@ description: Artifact commands bracket.kcl
"command": {
"type": "extrude",
"target": "[uuid]",
"distance": -0.45132402626147194,
"distance": -0.4848561883538911,
"faces": null,
"opposite": "None"
}
@ -1147,7 +1043,7 @@ description: Artifact commands bracket.kcl
"command": {
"type": "extrude",
"target": "[uuid]",
"distance": -0.45132402626147194,
"distance": -0.4848561883538911,
"faces": null,
"opposite": "None"
}
@ -1195,5 +1091,117 @@ description: Artifact commands bracket.kcl
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "solid3d_get_next_adjacent_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "solid3d_get_next_adjacent_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "solid3d_get_opposite_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "solid3d_get_opposite_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"face_id": "[uuid]"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "solid3d_fillet_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"radius": 0.6348561883538911,
"tolerance": 0.0000001,
"cut_type": "fillet"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "solid3d_fillet_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"radius": 0.25,
"tolerance": 0.0000001,
"cut_type": "fillet"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "solid3d_fillet_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"radius": 0.5,
"tolerance": 0.0000001,
"cut_type": "fillet"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "solid3d_fillet_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"radius": 0.5,
"tolerance": 0.0000001,
"cut_type": "fillet"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "solid3d_fillet_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"radius": 0.5,
"tolerance": 0.0000001,
"cut_type": "fillet"
}
},
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "solid3d_fillet_edge",
"object_id": "[uuid]",
"edge_id": "[uuid]",
"radius": 0.5,
"tolerance": 0.0000001,
"cut_type": "fillet"
}
}
]

View File

@ -1,28 +1,28 @@
```mermaid
flowchart LR
subgraph path2 [Path]
2["Path<br>[1085, 1110, 0]"]
3["Segment<br>[1116, 1169, 0]"]
4["Segment<br>[1175, 1214, 0]"]
5["Segment<br>[1220, 1262, 0]"]
6["Segment<br>[1268, 1309, 0]"]
7["Segment<br>[1315, 1354, 0]"]
8["Segment<br>[1360, 1430, 0]"]
9["Segment<br>[1436, 1443, 0]"]
2["Path<br>[2001, 2026, 0]"]
3["Segment<br>[2032, 2090, 0]"]
4["Segment<br>[2096, 2135, 0]"]
5["Segment<br>[2141, 2188, 0]"]
6["Segment<br>[2194, 2240, 0]"]
7["Segment<br>[2246, 2285, 0]"]
8["Segment<br>[2291, 2361, 0]"]
9["Segment<br>[2367, 2374, 0]"]
10[Solid2d]
end
subgraph path38 [Path]
38["Path<br>[1823, 1885, 0]"]
39["Segment<br>[1823, 1885, 0]"]
40[Solid2d]
subgraph path32 [Path]
32["Path<br>[2512, 2702, 0]"]
33["Segment<br>[2512, 2702, 0]"]
34[Solid2d]
end
subgraph path48 [Path]
48["Path<br>[2112, 2171, 0]"]
49["Segment<br>[2112, 2171, 0]"]
50[Solid2d]
subgraph path42 [Path]
42["Path<br>[3129, 3331, 0]"]
43["Segment<br>[3129, 3331, 0]"]
44[Solid2d]
end
1["Plane<br>[1062, 1079, 0]"]
11["Sweep Extrusion<br>[1449, 1475, 0]"]
1["Plane<br>[1978, 1995, 0]"]
11["Sweep Extrusion<br>[2380, 2406, 0]"]
12[Wall]
13[Wall]
14[Wall]
@ -43,26 +43,26 @@ flowchart LR
29["SweepEdge Adjacent"]
30["SweepEdge Opposite"]
31["SweepEdge Adjacent"]
32["EdgeCut Fillet<br>[1481, 1550, 0]"]
33["EdgeCut Fillet<br>[1556, 1622, 0]"]
34["EdgeCut Fillet<br>[1628, 1697, 0]"]
35["EdgeCut Fillet<br>[1628, 1697, 0]"]
36["EdgeCut Fillet<br>[1703, 1772, 0]"]
37["EdgeCut Fillet<br>[1703, 1772, 0]"]
41["Sweep Extrusion<br>[2024, 2061, 0]"]
42[Wall]
43["SweepEdge Opposite"]
44["SweepEdge Adjacent"]
45["Sweep Extrusion<br>[2024, 2061, 0]"]
46["Sweep Extrusion<br>[2024, 2061, 0]"]
47["Sweep Extrusion<br>[2024, 2061, 0]"]
51["Sweep Extrusion<br>[2242, 2279, 0]"]
52[Wall]
53["SweepEdge Opposite"]
54["SweepEdge Adjacent"]
55["Sweep Extrusion<br>[2242, 2279, 0]"]
56["StartSketchOnFace<br>[1786, 1817, 0]"]
57["StartSketchOnFace<br>[2075, 2106, 0]"]
35["Sweep Extrusion<br>[2988, 3025, 0]"]
36[Wall]
37["SweepEdge Opposite"]
38["SweepEdge Adjacent"]
39["Sweep Extrusion<br>[2988, 3025, 0]"]
40["Sweep Extrusion<br>[2988, 3025, 0]"]
41["Sweep Extrusion<br>[2988, 3025, 0]"]
45["Sweep Extrusion<br>[3446, 3483, 0]"]
46[Wall]
47["SweepEdge Opposite"]
48["SweepEdge Adjacent"]
49["Sweep Extrusion<br>[3446, 3483, 0]"]
50["EdgeCut Fillet<br>[3500, 3580, 0]"]
51["EdgeCut Fillet<br>[3581, 3658, 0]"]
52["EdgeCut Fillet<br>[3684, 3826, 0]"]
53["EdgeCut Fillet<br>[3684, 3826, 0]"]
54["EdgeCut Fillet<br>[3684, 3826, 0]"]
55["EdgeCut Fillet<br>[3684, 3826, 0]"]
56["StartSketchOnFace<br>[2473, 2506, 0]"]
57["StartSketchOnFace<br>[3090, 3123, 0]"]
1 --- 2
2 --- 3
2 --- 4
@ -79,7 +79,7 @@ flowchart LR
4 --- 13
4 --- 22
4 --- 23
4 --- 34
4 --- 52
5 --- 14
5 --- 24
5 --- 25
@ -89,7 +89,7 @@ flowchart LR
7 --- 16
7 --- 28
7 --- 29
7 --- 36
7 --- 54
8 --- 17
8 --- 30
8 --- 31
@ -113,30 +113,30 @@ flowchart LR
11 --- 29
11 --- 30
11 --- 31
14 --- 38
15 --- 48
25 <--x 32
31 <--x 33
22 <--x 35
28 <--x 37
38 --- 39
38 ---- 41
38 --- 40
39 --- 42
39 --- 43
39 --- 44
41 --- 42
41 --- 43
41 --- 44
48 --- 49
48 ---- 51
48 --- 50
49 --- 52
49 --- 53
49 --- 54
51 --- 52
51 --- 53
51 --- 54
14 --- 32
15 --- 42
32 --- 33
32 ---- 35
32 --- 34
33 --- 36
33 --- 37
33 --- 38
35 --- 36
35 --- 37
35 --- 38
42 --- 43
42 ---- 45
42 --- 44
43 --- 46
43 --- 47
43 --- 48
45 --- 46
45 --- 47
45 --- 48
25 <--x 50
31 <--x 51
22 <--x 53
28 <--x 55
14 <--x 56
15 <--x 57
```

File diff suppressed because it is too large Load Diff

View File

@ -23,11 +23,11 @@ description: Operations executed bracket.kcl
"length": {
"value": {
"type": "Number",
"value": 6.0,
"value": 5.0,
"ty": {
"type": "Default",
"len": {
"type": "Mm"
"type": "Inches"
},
"angle": {
"type": "Degrees"
@ -50,186 +50,6 @@ description: Operations executed bracket.kcl
"sourceRange": []
}
},
{
"labeledArgs": {
"radius": {
"value": {
"type": "Number",
"value": 0.601324026261472,
"ty": {
"type": "Unknown"
}
},
"sourceRange": []
},
"tags": {
"value": {
"type": "Array",
"value": [
{
"type": "Uuid",
"value": "[uuid]"
}
]
},
"sourceRange": []
}
},
"name": "fillet",
"sourceRange": [],
"type": "StdLibCall",
"unlabeledArg": {
"value": {
"type": "Solid",
"value": {
"artifactId": "[uuid]"
}
},
"sourceRange": []
}
},
{
"labeledArgs": {
"radius": {
"value": {
"type": "Number",
"value": 0.25,
"ty": {
"type": "Default",
"len": {
"type": "Mm"
},
"angle": {
"type": "Degrees"
}
}
},
"sourceRange": []
},
"tags": {
"value": {
"type": "Array",
"value": [
{
"type": "Uuid",
"value": "[uuid]"
}
]
},
"sourceRange": []
}
},
"name": "fillet",
"sourceRange": [],
"type": "StdLibCall",
"unlabeledArg": {
"value": {
"type": "Solid",
"value": {
"artifactId": "[uuid]"
}
},
"sourceRange": []
}
},
{
"labeledArgs": {
"radius": {
"value": {
"type": "Number",
"value": 0.25,
"ty": {
"type": "Default",
"len": {
"type": "Mm"
},
"angle": {
"type": "Degrees"
}
}
},
"sourceRange": []
},
"tags": {
"value": {
"type": "Array",
"value": [
{
"type": "TagIdentifier",
"value": "seg02",
"artifact_id": "[uuid]"
},
{
"type": "Uuid",
"value": "[uuid]"
}
]
},
"sourceRange": []
}
},
"name": "fillet",
"sourceRange": [],
"type": "StdLibCall",
"unlabeledArg": {
"value": {
"type": "Solid",
"value": {
"artifactId": "[uuid]"
}
},
"sourceRange": []
}
},
{
"labeledArgs": {
"radius": {
"value": {
"type": "Number",
"value": 0.25,
"ty": {
"type": "Default",
"len": {
"type": "Mm"
},
"angle": {
"type": "Degrees"
}
}
},
"sourceRange": []
},
"tags": {
"value": {
"type": "Array",
"value": [
{
"type": "TagIdentifier",
"value": "seg05",
"artifact_id": "[uuid]"
},
{
"type": "Uuid",
"value": "[uuid]"
}
]
},
"sourceRange": []
}
},
"name": "fillet",
"sourceRange": [],
"type": "StdLibCall",
"unlabeledArg": {
"value": {
"type": "Solid",
"value": {
"artifactId": "[uuid]"
}
},
"sourceRange": []
}
},
{
"labeledArgs": {
"data": {
@ -260,7 +80,7 @@ description: Operations executed bracket.kcl
"length": {
"value": {
"type": "Number",
"value": -0.361324026261472,
"value": -0.39485618835389114,
"ty": {
"type": "Unknown"
}
@ -334,7 +154,7 @@ description: Operations executed bracket.kcl
"length": {
"value": {
"type": "Number",
"value": -0.45132402626147194,
"value": -0.4848561883538911,
"ty": {
"type": "Unknown"
}
@ -365,5 +185,145 @@ description: Operations executed bracket.kcl
},
"sourceRange": []
}
},
{
"labeledArgs": {
"radius": {
"value": {
"type": "Number",
"value": 0.6348561883538911,
"ty": {
"type": "Unknown"
}
},
"sourceRange": []
},
"tags": {
"value": {
"type": "Array",
"value": [
{
"type": "Uuid",
"value": "[uuid]"
}
]
},
"sourceRange": []
}
},
"name": "fillet",
"sourceRange": [],
"type": "StdLibCall",
"unlabeledArg": {
"value": {
"type": "Solid",
"value": {
"artifactId": "[uuid]"
}
},
"sourceRange": []
}
},
{
"labeledArgs": {
"radius": {
"value": {
"type": "Number",
"value": 0.25,
"ty": {
"type": "Default",
"len": {
"type": "Inches"
},
"angle": {
"type": "Degrees"
}
}
},
"sourceRange": []
},
"tags": {
"value": {
"type": "Array",
"value": [
{
"type": "Uuid",
"value": "[uuid]"
}
]
},
"sourceRange": []
}
},
"name": "fillet",
"sourceRange": [],
"type": "StdLibCall",
"unlabeledArg": {
"value": {
"type": "Solid",
"value": {
"artifactId": "[uuid]"
}
},
"sourceRange": []
}
},
{
"labeledArgs": {
"radius": {
"value": {
"type": "Number",
"value": 0.5,
"ty": {
"type": "Default",
"len": {
"type": "Inches"
},
"angle": {
"type": "Degrees"
}
}
},
"sourceRange": []
},
"tags": {
"value": {
"type": "Array",
"value": [
{
"type": "TagIdentifier",
"value": "seg02",
"artifact_id": "[uuid]"
},
{
"type": "Uuid",
"value": "[uuid]"
},
{
"type": "TagIdentifier",
"value": "seg05",
"artifact_id": "[uuid]"
},
{
"type": "Uuid",
"value": "[uuid]"
}
]
},
"sourceRange": []
}
},
"name": "fillet",
"sourceRange": [],
"type": "StdLibCall",
"unlabeledArg": {
"value": {
"type": "Solid",
"value": {
"artifactId": "[uuid]"
}
},
"sourceRange": []
}
}
]

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 60 KiB

After

Width:  |  Height:  |  Size: 65 KiB

View File

@ -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 =',
})

View File

@ -11,6 +11,7 @@
"@rust/*": ["./rust/*"],
"@e2e/*": ["./e2e/*"],
"@src/*": ["./src/*"],
"@public/*": ["./public/*"],
"@root/*": ["./*"]
},
"types": [

View File

@ -65,6 +65,7 @@ const config = defineConfig({
'@rust': '/rust',
'@e2e': '/e2e',
'@src': '/src',
'@public': '/public',
'@root': '/',
},
},