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] types: [opened, synchronize]
paths: paths:
- 'src/lib/exampleKcl.ts' - 'src/lib/exampleKcl.ts'
- 'public/kcl-samples/bracket/main.kcl'
permissions: permissions:
contents: read contents: read
@ -22,7 +23,7 @@ jobs:
uses: actions/github-script@v7 uses: actions/github-script@v7
with: with:
script: | 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 issue_number = context.payload.pull_request.number;
const owner = context.repo.owner; const owner = context.repo.owner;
const repo = context.repo.repo; 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 fsp from 'fs/promises'
import { join } from 'path' 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 { onboardingPaths } from '@src/routes/Onboarding/paths'
import fsp from 'fs/promises' import fsp from 'fs/promises'
import { join } from 'path' import { join } from 'path'
@ -15,6 +15,7 @@ import {
executorInputPath, executorInputPath,
getUtils, getUtils,
orRunWhenFullSuiteEnabled, orRunWhenFullSuiteEnabled,
runningOnWindows,
settingsToToml, settingsToToml,
} from '@e2e/playwright/test-utils' } from '@e2e/playwright/test-utils'
import { expect, test } from '@e2e/playwright/zoo-test' import { expect, test } from '@e2e/playwright/zoo-test'
@ -279,6 +280,9 @@ test.describe('Onboarding tests', () => {
if (!tronApp) { if (!tronApp) {
fail() fail()
} }
if (runningOnWindows()) {
test.fixme(orRunWhenFullSuiteEnabled())
}
await tronApp.cleanProjectDir({ await tronApp.cleanProjectDir({
app: { app: {
onboarding_status: '/parametric-modeling', onboarding_status: '/parametric-modeling',

View File

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

View File

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

View File

@ -1,47 +1,84 @@
// Shelf 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. // 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) sigmaAllow = 35000 // psi (6061-T6 aluminum)
width = 6 // inch width = 5.0
p = 300 // Force on shelf - lbs p = 300 // Force on shelf - lbs
factorOfSafety = 1.2 // FOS of 1.2 fos = 1.2 // Factor of safety of 1.2
shelfMountL = 5 // inches shelfMountLength = 5.0
wallMountL = 2 // inches wallMountLength = 2.25
shelfDepth = 12 // Shelf is 12 inches in depth from the wall shelfDepth = 12 // Shelf is 12 inches deep from the wall
moment = shelfDepth * p // assume the force is applied at the end of the shelf to be conservative (lb-in) 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 // Add checks to ensure bracket is possible. These make sure that there is adequate distance between holes and edges.
thickness = sqrt(moment * factorOfSafety * 6 / (sigmaAllow * width)) // this is the calculation of two brackets holding up the shelf (inches) 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")
// Create the body of the bracket
filletRadius = .25 bracketBody = startSketchOn(XZ)
extFilletRadius = filletRadius + thickness
mountingHoleDiameter = 0.5
sketch001 = startSketchOn(XZ)
|> startProfileAt([0, 0], %) |> startProfileAt([0, 0], %)
|> xLine(length = shelfMountL - thickness, tag = $seg01) |> xLine(length = shelfMountLength - thickness, tag = $seg01)
|> yLine(length = thickness, tag = $seg02) |> yLine(length = thickness, tag = $seg02)
|> xLine(length = -shelfMountL, tag = $seg03) |> xLine(length = -shelfMountLength, tag = $seg03)
|> yLine(length = -wallMountL, tag = $seg04) |> yLine(length = -wallMountLength, tag = $seg04)
|> xLine(length = thickness, tag = $seg05) |> xLine(length = thickness, tag = $seg05)
|> line(endAbsolute = [profileStartX(%), profileStartY(%)], tag = $seg06) |> line(endAbsolute = [profileStartX(%), profileStartY(%)], tag = $seg06)
|> close() |> close()
|> extrude(%, length = width) |> 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) // Add mounting holes to mount to the shelf
|> circle(center = [-1.25, 1], radius = mountingHoleDiameter / 2) shelfMountingHoles = startSketchOn(bracketBody, seg03)
|> patternLinear2d(instances = 2, distance = 2.5, axis = [-1, 0]) |> circle(
|> patternLinear2d(instances = 2, distance = 4, axis = [0, 1]) 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) |> extrude(%, length = -thickness - .01)
sketch003 = startSketchOn(sketch001, seg04) // Add mounting holes to mount to the wall
|> circle(center = [1, -1], radius = mountingHoleDiameter / 2) wallMountingHoles = startSketchOn(bracketBody, seg04)
|> patternLinear2d(instances = 2, distance = 4, axis = [1, 0]) |> circle(
center = [
wallMountLength - wallMountingHolePlacementOffset - bendRadius,
wallMountingHolePlacementOffset
],
radius = wallMountingHoleDiameter / 2,
)
|> patternLinear2d(instances = 2, distance = width - (wallMountingHolePlacementOffset * 2), axis = [0, 1])
|> extrude(%, length = -thickness - 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 "hidden": true
} }
}, },
{
"cmdId": "[uuid]",
"range": [],
"command": {
"type": "set_scene_units",
"unit": "in"
}
},
{ {
"cmdId": "[uuid]", "cmdId": "[uuid]",
"range": [], "range": [],
@ -106,7 +114,7 @@ description: Artifact commands bracket.kcl
"segment": { "segment": {
"type": "line", "type": "line",
"end": { "end": {
"x": 4.6487, "x": 4.6151,
"y": 0.0, "y": 0.0,
"z": 0.0 "z": 0.0
}, },
@ -124,7 +132,7 @@ description: Artifact commands bracket.kcl
"type": "line", "type": "line",
"end": { "end": {
"x": 0.0, "x": 0.0,
"y": 0.3513, "y": 0.3849,
"z": 0.0 "z": 0.0
}, },
"relative": true "relative": true
@ -158,7 +166,7 @@ description: Artifact commands bracket.kcl
"type": "line", "type": "line",
"end": { "end": {
"x": 0.0, "x": 0.0,
"y": -2.0, "y": -2.25,
"z": 0.0 "z": 0.0
}, },
"relative": true "relative": true
@ -174,7 +182,7 @@ description: Artifact commands bracket.kcl
"segment": { "segment": {
"type": "line", "type": "line",
"end": { "end": {
"x": 0.3513, "x": 0.3849,
"y": 0.0, "y": 0.0,
"z": 0.0 "z": 0.0
}, },
@ -229,7 +237,7 @@ description: Artifact commands bracket.kcl
"command": { "command": {
"type": "extrude", "type": "extrude",
"target": "[uuid]", "target": "[uuid]",
"distance": 6.0, "distance": 5.0,
"faces": null, "faces": null,
"opposite": "None" "opposite": "None"
} }
@ -378,118 +386,6 @@ description: Artifact commands bracket.kcl
"face_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.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]", "cmdId": "[uuid]",
"range": [], "range": [],
@ -516,30 +412,30 @@ description: Artifact commands bracket.kcl
"type": "move_path_pen", "type": "move_path_pen",
"path": "[uuid]", "path": "[uuid]",
"to": { "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, "x": -1.0,
"y": 1.0, "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.25,
"y": 1.0
}, },
"radius": 0.25, "radius": 0.25,
"start": { "start": {
@ -573,7 +469,7 @@ description: Artifact commands bracket.kcl
[ [
{ {
"translate": { "translate": {
"x": -2.5, "x": -2.8651438116461088,
"y": 0.0, "y": 0.0,
"z": 0.0 "z": 0.0
}, },
@ -614,7 +510,7 @@ description: Artifact commands bracket.kcl
{ {
"translate": { "translate": {
"x": 0.0, "x": 0.0,
"y": 4.0, "y": 3.5,
"z": 0.0 "z": 0.0
}, },
"scale": { "scale": {
@ -654,7 +550,7 @@ description: Artifact commands bracket.kcl
{ {
"translate": { "translate": {
"x": 0.0, "x": 0.0,
"y": 4.0, "y": 3.5,
"z": 0.0 "z": 0.0
}, },
"scale": { "scale": {
@ -700,7 +596,7 @@ description: Artifact commands bracket.kcl
"command": { "command": {
"type": "extrude", "type": "extrude",
"target": "[uuid]", "target": "[uuid]",
"distance": -0.361324026261472, "distance": -0.39485618835389114,
"faces": null, "faces": null,
"opposite": "None" "opposite": "None"
} }
@ -767,7 +663,7 @@ description: Artifact commands bracket.kcl
"command": { "command": {
"type": "extrude", "type": "extrude",
"target": "[uuid]", "target": "[uuid]",
"distance": -0.361324026261472, "distance": -0.39485618835389114,
"faces": null, "faces": null,
"opposite": "None" "opposite": "None"
} }
@ -834,7 +730,7 @@ description: Artifact commands bracket.kcl
"command": { "command": {
"type": "extrude", "type": "extrude",
"target": "[uuid]", "target": "[uuid]",
"distance": -0.361324026261472, "distance": -0.39485618835389114,
"faces": null, "faces": null,
"opposite": "None" "opposite": "None"
} }
@ -901,7 +797,7 @@ description: Artifact commands bracket.kcl
"command": { "command": {
"type": "extrude", "type": "extrude",
"target": "[uuid]", "target": "[uuid]",
"distance": -0.361324026261472, "distance": -0.39485618835389114,
"faces": null, "faces": null,
"opposite": "None" "opposite": "None"
} }
@ -976,8 +872,8 @@ description: Artifact commands bracket.kcl
"type": "move_path_pen", "type": "move_path_pen",
"path": "[uuid]", "path": "[uuid]",
"to": { "to": {
"x": 1.25, "x": 1.375,
"y": -1.0, "y": 0.9375,
"z": 0.0 "z": 0.0
} }
} }
@ -998,10 +894,10 @@ description: Artifact commands bracket.kcl
"segment": { "segment": {
"type": "arc", "type": "arc",
"center": { "center": {
"x": 1.0, "x": 1.0625,
"y": -1.0 "y": 0.9375
}, },
"radius": 0.25, "radius": 0.3125,
"start": { "start": {
"unit": "degrees", "unit": "degrees",
"value": 0.0 "value": 0.0
@ -1033,8 +929,8 @@ description: Artifact commands bracket.kcl
[ [
{ {
"translate": { "translate": {
"x": 4.0, "x": 0.0,
"y": 0.0, "y": 3.125,
"z": 0.0 "z": 0.0
}, },
"scale": { "scale": {
@ -1080,7 +976,7 @@ description: Artifact commands bracket.kcl
"command": { "command": {
"type": "extrude", "type": "extrude",
"target": "[uuid]", "target": "[uuid]",
"distance": -0.45132402626147194, "distance": -0.4848561883538911,
"faces": null, "faces": null,
"opposite": "None" "opposite": "None"
} }
@ -1147,7 +1043,7 @@ description: Artifact commands bracket.kcl
"command": { "command": {
"type": "extrude", "type": "extrude",
"target": "[uuid]", "target": "[uuid]",
"distance": -0.45132402626147194, "distance": -0.4848561883538911,
"faces": null, "faces": null,
"opposite": "None" "opposite": "None"
} }
@ -1195,5 +1091,117 @@ description: Artifact commands bracket.kcl
"edge_id": "[uuid]", "edge_id": "[uuid]",
"face_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 ```mermaid
flowchart LR flowchart LR
subgraph path2 [Path] subgraph path2 [Path]
2["Path<br>[1085, 1110, 0]"] 2["Path<br>[2001, 2026, 0]"]
3["Segment<br>[1116, 1169, 0]"] 3["Segment<br>[2032, 2090, 0]"]
4["Segment<br>[1175, 1214, 0]"] 4["Segment<br>[2096, 2135, 0]"]
5["Segment<br>[1220, 1262, 0]"] 5["Segment<br>[2141, 2188, 0]"]
6["Segment<br>[1268, 1309, 0]"] 6["Segment<br>[2194, 2240, 0]"]
7["Segment<br>[1315, 1354, 0]"] 7["Segment<br>[2246, 2285, 0]"]
8["Segment<br>[1360, 1430, 0]"] 8["Segment<br>[2291, 2361, 0]"]
9["Segment<br>[1436, 1443, 0]"] 9["Segment<br>[2367, 2374, 0]"]
10[Solid2d] 10[Solid2d]
end end
subgraph path38 [Path] subgraph path32 [Path]
38["Path<br>[1823, 1885, 0]"] 32["Path<br>[2512, 2702, 0]"]
39["Segment<br>[1823, 1885, 0]"] 33["Segment<br>[2512, 2702, 0]"]
40[Solid2d] 34[Solid2d]
end end
subgraph path48 [Path] subgraph path42 [Path]
48["Path<br>[2112, 2171, 0]"] 42["Path<br>[3129, 3331, 0]"]
49["Segment<br>[2112, 2171, 0]"] 43["Segment<br>[3129, 3331, 0]"]
50[Solid2d] 44[Solid2d]
end end
1["Plane<br>[1062, 1079, 0]"] 1["Plane<br>[1978, 1995, 0]"]
11["Sweep Extrusion<br>[1449, 1475, 0]"] 11["Sweep Extrusion<br>[2380, 2406, 0]"]
12[Wall] 12[Wall]
13[Wall] 13[Wall]
14[Wall] 14[Wall]
@ -43,26 +43,26 @@ flowchart LR
29["SweepEdge Adjacent"] 29["SweepEdge Adjacent"]
30["SweepEdge Opposite"] 30["SweepEdge Opposite"]
31["SweepEdge Adjacent"] 31["SweepEdge Adjacent"]
32["EdgeCut Fillet<br>[1481, 1550, 0]"] 35["Sweep Extrusion<br>[2988, 3025, 0]"]
33["EdgeCut Fillet<br>[1556, 1622, 0]"] 36[Wall]
34["EdgeCut Fillet<br>[1628, 1697, 0]"] 37["SweepEdge Opposite"]
35["EdgeCut Fillet<br>[1628, 1697, 0]"] 38["SweepEdge Adjacent"]
36["EdgeCut Fillet<br>[1703, 1772, 0]"] 39["Sweep Extrusion<br>[2988, 3025, 0]"]
37["EdgeCut Fillet<br>[1703, 1772, 0]"] 40["Sweep Extrusion<br>[2988, 3025, 0]"]
41["Sweep Extrusion<br>[2024, 2061, 0]"] 41["Sweep Extrusion<br>[2988, 3025, 0]"]
42[Wall] 45["Sweep Extrusion<br>[3446, 3483, 0]"]
43["SweepEdge Opposite"] 46[Wall]
44["SweepEdge Adjacent"] 47["SweepEdge Opposite"]
45["Sweep Extrusion<br>[2024, 2061, 0]"] 48["SweepEdge Adjacent"]
46["Sweep Extrusion<br>[2024, 2061, 0]"] 49["Sweep Extrusion<br>[3446, 3483, 0]"]
47["Sweep Extrusion<br>[2024, 2061, 0]"] 50["EdgeCut Fillet<br>[3500, 3580, 0]"]
51["Sweep Extrusion<br>[2242, 2279, 0]"] 51["EdgeCut Fillet<br>[3581, 3658, 0]"]
52[Wall] 52["EdgeCut Fillet<br>[3684, 3826, 0]"]
53["SweepEdge Opposite"] 53["EdgeCut Fillet<br>[3684, 3826, 0]"]
54["SweepEdge Adjacent"] 54["EdgeCut Fillet<br>[3684, 3826, 0]"]
55["Sweep Extrusion<br>[2242, 2279, 0]"] 55["EdgeCut Fillet<br>[3684, 3826, 0]"]
56["StartSketchOnFace<br>[1786, 1817, 0]"] 56["StartSketchOnFace<br>[2473, 2506, 0]"]
57["StartSketchOnFace<br>[2075, 2106, 0]"] 57["StartSketchOnFace<br>[3090, 3123, 0]"]
1 --- 2 1 --- 2
2 --- 3 2 --- 3
2 --- 4 2 --- 4
@ -79,7 +79,7 @@ flowchart LR
4 --- 13 4 --- 13
4 --- 22 4 --- 22
4 --- 23 4 --- 23
4 --- 34 4 --- 52
5 --- 14 5 --- 14
5 --- 24 5 --- 24
5 --- 25 5 --- 25
@ -89,7 +89,7 @@ flowchart LR
7 --- 16 7 --- 16
7 --- 28 7 --- 28
7 --- 29 7 --- 29
7 --- 36 7 --- 54
8 --- 17 8 --- 17
8 --- 30 8 --- 30
8 --- 31 8 --- 31
@ -113,30 +113,30 @@ flowchart LR
11 --- 29 11 --- 29
11 --- 30 11 --- 30
11 --- 31 11 --- 31
14 --- 38 14 --- 32
15 --- 48 15 --- 42
25 <--x 32 32 --- 33
31 <--x 33 32 ---- 35
22 <--x 35 32 --- 34
28 <--x 37 33 --- 36
38 --- 39 33 --- 37
38 ---- 41 33 --- 38
38 --- 40 35 --- 36
39 --- 42 35 --- 37
39 --- 43 35 --- 38
39 --- 44 42 --- 43
41 --- 42 42 ---- 45
41 --- 43 42 --- 44
41 --- 44 43 --- 46
48 --- 49 43 --- 47
48 ---- 51 43 --- 48
48 --- 50 45 --- 46
49 --- 52 45 --- 47
49 --- 53 45 --- 48
49 --- 54 25 <--x 50
51 --- 52 31 <--x 51
51 --- 53 22 <--x 53
51 --- 54 28 <--x 55
14 <--x 56 14 <--x 56
15 <--x 57 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": { "length": {
"value": { "value": {
"type": "Number", "type": "Number",
"value": 6.0, "value": 5.0,
"ty": { "ty": {
"type": "Default", "type": "Default",
"len": { "len": {
"type": "Mm" "type": "Inches"
}, },
"angle": { "angle": {
"type": "Degrees" "type": "Degrees"
@ -50,186 +50,6 @@ description: Operations executed bracket.kcl
"sourceRange": [] "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": { "labeledArgs": {
"data": { "data": {
@ -260,7 +80,7 @@ description: Operations executed bracket.kcl
"length": { "length": {
"value": { "value": {
"type": "Number", "type": "Number",
"value": -0.361324026261472, "value": -0.39485618835389114,
"ty": { "ty": {
"type": "Unknown" "type": "Unknown"
} }
@ -334,7 +154,7 @@ description: Operations executed bracket.kcl
"length": { "length": {
"value": { "value": {
"type": "Number", "type": "Number",
"value": -0.45132402626147194, "value": -0.4848561883538911,
"ty": { "ty": {
"type": "Unknown" "type": "Unknown"
} }
@ -365,5 +185,145 @@ description: Operations executed bracket.kcl
}, },
"sourceRange": [] "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 import bracket from '@public/kcl-samples/bracket/main.kcl?raw'
// 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.
export { bracket }
// 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)
`
/** /**
* @throws Error if the search text is not found in the example code. * @throws Error if the search text is not found in the example code.
@ -70,7 +23,6 @@ function findLineInExampleCode({
} }
return lineNumber return lineNumber
} }
export const bracketWidthConstantLine = findLineInExampleCode({ export const bracketWidthConstantLine = findLineInExampleCode({
searchText: 'width =', searchText: 'width =',
}) })

View File

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

View File

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