Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .github/workflows/check-exampleKcl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
types: [opened, synchronize]
paths:
- 'src/lib/exampleKcl.ts'
- 'public/kcl-samples/bracket/main.kcl'

permissions:
contents: read
Expand All @@ -22,11 +23,11 @@ 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;

const { data: comments } = await github.rest.issues.listComments({
owner,
repo,
Expand All @@ -43,4 +44,4 @@ jobs:
issue_number,
body: message,
});
}
}
2 changes: 1 addition & 1 deletion e2e/playwright/code-pane-and-errors.spec.ts
Original file line number Diff line number Diff line change
@@ -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'

Expand Down
16 changes: 16 additions & 0 deletions e2e/playwright/fixtures/bracket.ts
Original file line number Diff line number Diff line change
@@ -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'
)
6 changes: 5 additions & 1 deletion e2e/playwright/onboarding-tests.spec.ts
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -15,6 +15,7 @@ import {
executorInputPath,
getUtils,
orRunWhenFullSuiteEnabled,
runningOnWindows,
settingsToToml,
} from '@e2e/playwright/test-utils'
import { expect, test } from '@e2e/playwright/zoo-test'
Expand Down Expand Up @@ -279,6 +280,9 @@ test.describe('Onboarding tests', () => {
if (!tronApp) {
fail()
}
if (runningOnWindows()) {
test.fixme(orRunWhenFullSuiteEnabled())
}
await tronApp.cleanProjectDir({
app: {
onboarding_status: '/parametric-modeling',
Expand Down
2 changes: 1 addition & 1 deletion e2e/playwright/regression-tests.spec.ts
Original file line number Diff line number Diff line change
@@ -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'
Expand Down
11 changes: 9 additions & 2 deletions e2e/playwright/testing-samples-loading.spec.ts
Original file line number Diff line number Diff line change
@@ -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', () => {
Expand Down Expand Up @@ -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 })
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@
"importOrder": [
"<THIRD_PARTY_MODULES>",
"^@rust/(.*)$",
"^@public/(.*)$",
"^@e2e/(.*)$",
"^@src/(.*)$",
"^[./]"
Expand Down
97 changes: 67 additions & 30 deletions public/kcl-samples/bracket/main.kcl
Original file line number Diff line number Diff line change
@@ -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)


// Calculate required thickness of bracket
thickness = sqrt(moment * factorOfSafety * 6 / (sigmaAllow * width)) // this is the calculation of two brackets holding up the shelf (inches)
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

filletRadius = .25
extFilletRadius = filletRadius + thickness
mountingHoleDiameter = 0.5
// 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")

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)
],
)
Loading
Loading