Compare commits
27 Commits
Author | SHA1 | Date | |
---|---|---|---|
ccb3edb0ec | |||
252050468d | |||
358b34de4c | |||
9973e5fde3 | |||
36875e05fd | |||
42123383bb | |||
ef4c606ed1 | |||
1ebb73b935 | |||
b57d31c0e7 | |||
678ebbc310 | |||
cc2efd316c | |||
d1f811f91d | |||
7ca3afff9f | |||
71b9e40bd9 | |||
4f35197a96 | |||
40b0cf5fd3 | |||
355e6acf0d | |||
4ff38e7f44 | |||
1dcd3b84b7 | |||
2957216bd3 | |||
11160f0b40 | |||
4b2c745db5 | |||
bb983021b1 | |||
d27b8871bc | |||
1753047d87 | |||
fa16fcedff | |||
0677474097 |
@ -1,5 +1,6 @@
|
||||
NODE_ENV=development
|
||||
DEV=true
|
||||
|
||||
VITE_KC_API_WS_MODELING_URL=wss://api.dev.zoo.dev/ws/modeling/commands
|
||||
VITE_KC_API_BASE_URL=https://api.dev.zoo.dev
|
||||
VITE_KC_SITE_BASE_URL=https://dev.zoo.dev
|
||||
@ -8,3 +9,5 @@ VITE_KC_SKIP_AUTH=false
|
||||
VITE_KC_CONNECTION_TIMEOUT_MS=5000
|
||||
# ONLY add your token in .env.development.local if you want to skip auth, otherwise this token takes precedence!
|
||||
#VITE_KC_DEV_TOKEN="your token from dev.zoo.dev should go in .env.development.local"
|
||||
|
||||
FAIL_ON_CONSOLE_ERRORS=true
|
||||
|
10
.envrc
@ -1,3 +1,13 @@
|
||||
# Load optional shared environment variables
|
||||
source_up_if_exists
|
||||
|
||||
# Load default development environment variables
|
||||
dotenv .env.development
|
||||
|
||||
# Load optional environment variables overrides
|
||||
dotenv_if_exists .env.development.local
|
||||
|
||||
# Load optional testing environment variables
|
||||
dotenv_if_exists e2e/playwright/playwright-secrets.env
|
||||
|
||||
use flake .
|
||||
|
13
.eslintrc
@ -20,8 +20,20 @@
|
||||
"plugin:react-hooks/recommended"
|
||||
],
|
||||
"rules": {
|
||||
"no-array-constructor": "off", // This is wrong; use the @typescript-eslint one instead.
|
||||
"@typescript-eslint/no-array-constructor": "error",
|
||||
"@typescript-eslint/no-array-delete": "error",
|
||||
"@typescript-eslint/no-duplicate-enum-values": "error",
|
||||
"@typescript-eslint/no-duplicate-type-constituents": "error",
|
||||
"@typescript-eslint/no-empty-object-type": "error",
|
||||
"@typescript-eslint/no-floating-promises": "error",
|
||||
"no-implied-eval": "off", // This is wrong; use the @typescript-eslint one instead.
|
||||
"@typescript-eslint/no-implied-eval": "error",
|
||||
"@typescript-eslint/no-misused-promises": "error",
|
||||
"@typescript-eslint/no-namespace": "error",
|
||||
"@typescript-eslint/no-unnecessary-type-assertion": "error",
|
||||
"@typescript-eslint/no-unnecessary-type-constraint": "error",
|
||||
"no-unused-vars": "off", // This is wrong; use the @typescript-eslint one instead.
|
||||
"@typescript-eslint/no-unused-vars": ["error", {
|
||||
"varsIgnorePattern": "^_",
|
||||
"argsIgnorePattern": "^_",
|
||||
@ -29,6 +41,7 @@
|
||||
"vars": "all",
|
||||
"args": "none"
|
||||
}],
|
||||
"@typescript-eslint/prefer-as-const": "warn",
|
||||
"jsx-a11y/click-events-have-key-events": "off",
|
||||
"jsx-a11y/no-autofocus": "off",
|
||||
"jsx-a11y/no-noninteractive-element-interactions": "off",
|
||||
|
144
.github/workflows/static-analysis.yml
vendored
@ -28,43 +28,57 @@ jobs:
|
||||
- run: yarn fmt-check
|
||||
|
||||
yarn-build-wasm:
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
# Build the wasm blob once on the fastest runner.
|
||||
runs-on: runs-on=${{ github.run_id }}/family=i7ie.2xlarge/image=ubuntu22-full-x64
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version-file: '.nvmrc'
|
||||
cache: 'yarn'
|
||||
- run: yarn install
|
||||
|
||||
- name: Install dependencies
|
||||
run: yarn install
|
||||
|
||||
- name: Use correct Rust toolchain
|
||||
shell: bash
|
||||
run: |
|
||||
[ -e rust-toolchain.toml ] || cp rust/rust-toolchain.toml ./
|
||||
|
||||
- name: Install rust
|
||||
uses: actions-rust-lang/setup-rust-toolchain@v1
|
||||
with:
|
||||
cache: false # Configured below.
|
||||
|
||||
- uses: taiki-e/install-action@37bdc826eaedac215f638a96472df572feab0f9b
|
||||
with:
|
||||
tool: wasm-pack
|
||||
- run: yarn build:wasm
|
||||
|
||||
yarn-tsc:
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version-file: '.nvmrc'
|
||||
cache: 'yarn'
|
||||
- run: yarn install
|
||||
- run: yarn --cwd ./rust/kcl-language-server --modules-folder node_modules install
|
||||
- uses: Swatinem/rust-cache@v2
|
||||
- name: Rust Cache
|
||||
uses: Swatinem/rust-cache@v2
|
||||
with:
|
||||
workspaces: './rust'
|
||||
|
||||
- uses: taiki-e/install-action@37bdc826eaedac215f638a96472df572feab0f9b
|
||||
with:
|
||||
tool: wasm-pack
|
||||
- run: yarn build:wasm
|
||||
- run: yarn tsc
|
||||
- name: Build Wasm
|
||||
shell: bash
|
||||
run: yarn build:wasm
|
||||
|
||||
yarn-lint:
|
||||
runs-on: ubuntu-22.04
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: prepared-wasm
|
||||
path: |
|
||||
rust/kcl-wasm-lib/pkg/kcl_wasm_lib*
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: prepared-ts-rs-bindings
|
||||
path: |
|
||||
rust/kcl-lib/bindings/*
|
||||
|
||||
yarn-tsc:
|
||||
runs-on: ubuntu-latest
|
||||
needs: yarn-build-wasm
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
@ -73,7 +87,53 @@ jobs:
|
||||
node-version-file: '.nvmrc'
|
||||
cache: 'yarn'
|
||||
- run: yarn install
|
||||
- run: yarn --cwd ./rust/kcl-language-server --modules-folder node_modules install
|
||||
|
||||
- name: Download all artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
|
||||
- name: Copy prepared wasm
|
||||
run: |
|
||||
ls -R prepared-wasm
|
||||
cp prepared-wasm/kcl_wasm_lib_bg.wasm public
|
||||
mkdir rust/kcl-wasm-lib/pkg
|
||||
cp prepared-wasm/kcl_wasm_lib* rust/kcl-wasm-lib/pkg
|
||||
|
||||
- name: Copy prepared ts-rs bindings
|
||||
run: |
|
||||
ls -R prepared-ts-rs-bindings
|
||||
mkdir rust/kcl-lib/bindings
|
||||
cp -r prepared-ts-rs-bindings/* rust/kcl-lib/bindings/
|
||||
|
||||
- run: yarn tsc
|
||||
|
||||
yarn-lint:
|
||||
runs-on: ubuntu-latest
|
||||
needs: yarn-build-wasm
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version-file: '.nvmrc'
|
||||
cache: 'yarn'
|
||||
- run: yarn install
|
||||
|
||||
- name: Download all artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
|
||||
- name: Copy prepared wasm
|
||||
run: |
|
||||
ls -R prepared-wasm
|
||||
cp prepared-wasm/kcl_wasm_lib_bg.wasm public
|
||||
mkdir rust/kcl-wasm-lib/pkg
|
||||
cp prepared-wasm/kcl_wasm_lib* rust/kcl-wasm-lib/pkg
|
||||
|
||||
- name: Copy prepared ts-rs bindings
|
||||
run: |
|
||||
ls -R prepared-ts-rs-bindings
|
||||
mkdir rust/kcl-lib/bindings
|
||||
cp -r prepared-ts-rs-bindings/* rust/kcl-lib/bindings/
|
||||
|
||||
- run: yarn lint
|
||||
|
||||
python-codespell:
|
||||
@ -91,6 +151,7 @@ jobs:
|
||||
|
||||
yarn-unit-test-kcl-samples:
|
||||
runs-on: ubuntu-latest
|
||||
needs: yarn-build-wasm
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
@ -103,7 +164,22 @@ jobs:
|
||||
- uses: taiki-e/install-action@37bdc826eaedac215f638a96472df572feab0f9b
|
||||
with:
|
||||
tool: wasm-pack
|
||||
- run: yarn build:wasm
|
||||
|
||||
- name: Download all artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
|
||||
- name: Copy prepared wasm
|
||||
run: |
|
||||
ls -R prepared-wasm
|
||||
cp prepared-wasm/kcl_wasm_lib_bg.wasm public
|
||||
mkdir rust/kcl-wasm-lib/pkg
|
||||
cp prepared-wasm/kcl_wasm_lib* rust/kcl-wasm-lib/pkg
|
||||
|
||||
- name: Copy prepared ts-rs bindings
|
||||
run: |
|
||||
ls -R prepared-ts-rs-bindings
|
||||
mkdir rust/kcl-lib/bindings
|
||||
cp -r prepared-ts-rs-bindings/* rust/kcl-lib/bindings/
|
||||
|
||||
- run: yarn simpleserver:bg
|
||||
if: ${{ github.event_name != 'release' && github.event_name != 'schedule' }}
|
||||
@ -120,6 +196,7 @@ jobs:
|
||||
|
||||
yarn-unit-test:
|
||||
runs-on: ubuntu-latest
|
||||
needs: yarn-build-wasm
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
@ -132,7 +209,22 @@ jobs:
|
||||
- uses: taiki-e/install-action@37bdc826eaedac215f638a96472df572feab0f9b
|
||||
with:
|
||||
tool: wasm-pack
|
||||
- run: yarn build:wasm
|
||||
|
||||
- name: Download all artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
|
||||
- name: Copy prepared wasm
|
||||
run: |
|
||||
ls -R prepared-wasm
|
||||
cp prepared-wasm/kcl_wasm_lib_bg.wasm public
|
||||
mkdir rust/kcl-wasm-lib/pkg
|
||||
cp prepared-wasm/kcl_wasm_lib* rust/kcl-wasm-lib/pkg
|
||||
|
||||
- name: Copy prepared ts-rs bindings
|
||||
run: |
|
||||
ls -R prepared-ts-rs-bindings
|
||||
mkdir rust/kcl-lib/bindings
|
||||
cp -r prepared-ts-rs-bindings/* rust/kcl-lib/bindings/
|
||||
|
||||
- run: yarn simpleserver:bg
|
||||
if: ${{ github.event_name != 'release' && github.event_name != 'schedule' }}
|
||||
|
16
.github/workflows/update-e2e-branch.yml
vendored
@ -28,14 +28,18 @@ jobs:
|
||||
|
||||
- name: Sync with main
|
||||
run: |
|
||||
# checkout our branch
|
||||
# Create the branch
|
||||
git checkout all-e2e || git checkout -b all-e2e
|
||||
# fetch origin
|
||||
|
||||
# Reset to main
|
||||
git fetch origin
|
||||
# reset to main
|
||||
git reset --hard origin/main
|
||||
# get a new SHA to prevent overwriting the commit status on main
|
||||
git commit --amend --message="[all-e2e] $(git log --max-count=1 --pretty=%B)"
|
||||
# force push it
|
||||
|
||||
# Get a new SHA to prevent overwriting the commit status on main
|
||||
git config --local user.email "github-actions[bot]@users.noreply.github.com"
|
||||
git config --local user.name "github-actions[bot]"
|
||||
git commit --allow-empty --message="[all-e2e] $(git log --max-count=1 --pretty=%B)"
|
||||
|
||||
# Overwrite the branch
|
||||
git remote set-url origin https://x-access-token:${{ steps.app-token.outputs.token }}@github.com/${{ github.repository }}.git
|
||||
git push --force origin all-e2e
|
||||
|
4
Makefile
@ -37,7 +37,7 @@ build-web: public/kcl_wasm_lib_bg.wasm build/index.html
|
||||
build-desktop: public/kcl_wasm_lib_bg.wasm .vite/build/main.js
|
||||
|
||||
public/kcl_wasm_lib_bg.wasm: $(CARGO_SOURCES)$(RUST_SOURCES)
|
||||
yarn build:wasm
|
||||
yarn build:wasm:dev
|
||||
|
||||
build/index.html: $(REACT_SOURCES) $(TYPESCRIPT_SOURCES) $(VITE_SOURCES)
|
||||
yarn build:local
|
||||
@ -99,7 +99,7 @@ test-e2e-web: install build-web ## Run the web e2e tests
|
||||
|
||||
.PHONY: test-e2e-desktop
|
||||
test-e2e-desktop: install build-desktop ## Run the desktop e2e tests
|
||||
yarn test:playwright:electron --workers=$(E2E_WORKERS) --max-failures=$(E2E_FAILURES) --grep=$(E2E_GREP)
|
||||
yarn test:playwright:electron --workers=$(E2E_WORKERS) --max-failures=$(E2E_FAILURES) --grep="$(E2E_GREP)"
|
||||
|
||||
###############################################################################
|
||||
# CLEAN
|
||||
|
@ -6,6 +6,10 @@ layout: manual
|
||||
|
||||
Rotate a solid or a sketch.
|
||||
|
||||
This is really useful for assembling parts together. You can create a part and then rotate it to the correct orientation.
|
||||
|
||||
For sketches, you can use this to rotate a sketch and then loft it with another sketch.
|
||||
|
||||
### Using Roll, Pitch, and Yaw
|
||||
|
||||
When rotating a part in 3D space, "roll," "pitch," and "yaw" refer to the three rotational axes used to describe its orientation: roll is rotation around the longitudinal axis (front-to-back), pitch is rotation around the lateral axis (wing-to-wing), and yaw is rotation around the vertical axis (up-down); essentially, it's like tilting the part on its side (roll), tipping the nose up or down (pitch), and turning it left or right (yaw).
|
||||
@ -166,7 +170,7 @@ fn square() {
|
||||
profile001 = square()
|
||||
|
||||
profile002 = square()
|
||||
|> translate(translate = [0, 0, 20])
|
||||
|> translate(x = 0, y = 0, z = 20)
|
||||
|> rotate(axis = [0, 0, 1.0], angle = 45)
|
||||
|
||||
loft([profile001, profile002])
|
||||
|
6446
docs/kcl/std.json
117
e2e/playwright/boolean.spec.ts
Normal file
@ -0,0 +1,117 @@
|
||||
import { test, expect } from './zoo-test'
|
||||
import fs from 'node:fs/promises'
|
||||
import path from 'node:path'
|
||||
|
||||
test.describe('Point and click for boolean workflows', () => {
|
||||
// Boolean operations to test
|
||||
const booleanOperations = [
|
||||
{
|
||||
name: 'union',
|
||||
code: 'union([extrude001, extrude006])',
|
||||
},
|
||||
{
|
||||
name: 'subtract',
|
||||
code: 'subtract([extrude001], tools = [extrude006])',
|
||||
},
|
||||
{
|
||||
name: 'intersect',
|
||||
code: 'intersect([extrude001, extrude006])',
|
||||
},
|
||||
] as const
|
||||
for (let i = 0; i < booleanOperations.length; i++) {
|
||||
const operation = booleanOperations[i]
|
||||
const operationName = operation.name
|
||||
const commandName = `Boolean ${
|
||||
operationName.charAt(0).toUpperCase() + operationName.slice(1)
|
||||
}`
|
||||
test(`Create boolean operation -- ${operationName}`, async ({
|
||||
context,
|
||||
homePage,
|
||||
cmdBar,
|
||||
editor,
|
||||
toolbar,
|
||||
scene,
|
||||
page,
|
||||
}) => {
|
||||
const file = await fs.readFile(
|
||||
path.resolve(
|
||||
__dirname,
|
||||
'../../',
|
||||
'./rust/kcl-lib/e2e/executor/inputs/boolean-setup-with'
|
||||
),
|
||||
'utf-8'
|
||||
)
|
||||
await context.addInitScript((file) => {
|
||||
localStorage.setItem('persistCode', file)
|
||||
}, file)
|
||||
await homePage.goToModelingScene()
|
||||
await scene.waitForExecutionDone()
|
||||
|
||||
await scene.settled(cmdBar)
|
||||
|
||||
// Test coordinates for selection - these might need adjustment based on actual scene layout
|
||||
const cylinderPoint = { x: 592, y: 174 }
|
||||
const secondObjectPoint = { x: 683, y: 273 }
|
||||
|
||||
// Create mouse helpers for selecting objects
|
||||
const [clickFirstObject] = scene.makeMouseHelpers(
|
||||
cylinderPoint.x,
|
||||
cylinderPoint.y,
|
||||
{ steps: 10 }
|
||||
)
|
||||
const [clickSecondObject] = scene.makeMouseHelpers(
|
||||
secondObjectPoint.x,
|
||||
secondObjectPoint.y,
|
||||
{ steps: 10 }
|
||||
)
|
||||
|
||||
await test.step(`Test ${operationName} operation`, async () => {
|
||||
// Click the boolean operation button in the toolbar
|
||||
await toolbar.selectBoolean(operationName)
|
||||
|
||||
// Verify command bar is showing the right command
|
||||
await expect(cmdBar.page.getByTestId('command-name')).toContainText(
|
||||
commandName
|
||||
)
|
||||
|
||||
// Select first object in the scene, expect there to be a pixel diff from the selection color change
|
||||
await clickFirstObject({ pixelDiff: 50 })
|
||||
|
||||
// For subtract, we need to proceed to the next step before selecting the second object
|
||||
if (operationName !== 'subtract') {
|
||||
// should down shift key to select multiple objects
|
||||
await page.keyboard.down('Shift')
|
||||
}
|
||||
|
||||
// Select second object
|
||||
await clickSecondObject({ pixelDiff: 50 })
|
||||
|
||||
// Confirm the operation in the command bar
|
||||
await cmdBar.progressCmdBar()
|
||||
|
||||
if (operationName === 'union' || operationName === 'intersect') {
|
||||
await cmdBar.expectState({
|
||||
stage: 'review',
|
||||
headerArguments: {
|
||||
Solids: '2 paths',
|
||||
},
|
||||
commandName,
|
||||
})
|
||||
} else if (operationName === 'subtract') {
|
||||
await cmdBar.expectState({
|
||||
stage: 'review',
|
||||
headerArguments: {
|
||||
Tool: '1 path',
|
||||
Target: '1 path',
|
||||
},
|
||||
commandName,
|
||||
})
|
||||
}
|
||||
|
||||
await cmdBar.submit()
|
||||
|
||||
await editor.expectEditor.toContain(operation.code)
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
@ -181,6 +181,14 @@ export class ToolbarFixture {
|
||||
).toBeVisible()
|
||||
await this.page.getByTestId('dropdown-center-rectangle').click()
|
||||
}
|
||||
selectBoolean = async (operation: 'union' | 'subtract' | 'intersect') => {
|
||||
await this.page
|
||||
.getByRole('button', { name: 'caret down Union: open menu' })
|
||||
.click()
|
||||
const operationTestId = `dropdown-boolean-${operation}`
|
||||
await expect(this.page.getByTestId(operationTestId)).toBeVisible()
|
||||
await this.page.getByTestId(operationTestId).click()
|
||||
}
|
||||
|
||||
selectCircleThreePoint = async () => {
|
||||
await this.page
|
||||
|
@ -257,6 +257,37 @@ export const isErrorWhitelisted = (exception: Error) => {
|
||||
project: 'Google Chrome',
|
||||
foundInSpec: 'e2e/playwright/testing-settings.spec.ts',
|
||||
},
|
||||
// TODO: fix this error in the code
|
||||
{
|
||||
name: 'ReferenceError',
|
||||
message: '_testUtils is not defined',
|
||||
stack: '',
|
||||
project: 'Google Chrome',
|
||||
foundInSpec: 'e2e/playwright/snapshot-tests.spec.ts',
|
||||
},
|
||||
{
|
||||
name: 'TypeError',
|
||||
message: 'Failed to fetch',
|
||||
stack: '',
|
||||
project: 'Google Chrome',
|
||||
foundInSpec: 'e2e/playwright/snapshot-tests.spec.ts',
|
||||
},
|
||||
// TODO: fix this error in the code
|
||||
{
|
||||
name: 'ReferenceError',
|
||||
message: 'createNewVariableCheckbox is not defined',
|
||||
stack: '',
|
||||
project: 'Google Chrome',
|
||||
foundInSpec: 'e2e/playwright/testing-constraints.spec.ts',
|
||||
},
|
||||
{
|
||||
name: 'Error',
|
||||
message: 'The "path" argument must be of type string. Received undefined',
|
||||
stack:
|
||||
'Error: The "path" argument must be of type string. Received undefined',
|
||||
project: 'Google Chrome',
|
||||
foundInSpec: '', // many tests are impacted by this error
|
||||
},
|
||||
]
|
||||
|
||||
const cleanString = (str: string) => str.replace(/[`"]/g, '')
|
||||
|
292
e2e/playwright/named-views.spec.ts
Normal file
@ -0,0 +1,292 @@
|
||||
import { test, expect } from './zoo-test'
|
||||
import { PROJECT_SETTINGS_FILE_NAME } from 'lib/constants'
|
||||
import * as fsp from 'fs/promises'
|
||||
import { join } from 'path'
|
||||
import {
|
||||
createProject,
|
||||
tomlToPerProjectSettings,
|
||||
perProjectsettingsToToml,
|
||||
} from './test-utils'
|
||||
import { NamedView } from '@rust/kcl-lib/bindings/NamedView'
|
||||
|
||||
// Helper function to determine if the file path on disk exists
|
||||
// Specifically this is used to check if project.toml exists on disk
|
||||
const fileExists = async (path: string) => {
|
||||
return !!(await fsp
|
||||
.stat(path)
|
||||
.then((_) => true)
|
||||
.catch((_) => false))
|
||||
}
|
||||
|
||||
// Here are a few uuids.
|
||||
// When created named views rust will auto generate uuids and they will
|
||||
// never match the snapshots. Overwrite them in memory to these
|
||||
// values to have them match the snapshots.
|
||||
const uuid1: string = '0656fb1a-9640-473e-b334-591dc70c0138'
|
||||
const uuid2: string = 'c810cf04-c6cc-4a4a-8b11-17bf445dcab7'
|
||||
const uuid3: string = 'cfecbfee-48a6-4561-b96d-ffbe5678bb7d'
|
||||
|
||||
// Look up the named view by name and then rewrite it with the same uuid each time
|
||||
const nameToUuid: Map<string, string> = new Map()
|
||||
nameToUuid.set('uuid1', uuid1)
|
||||
nameToUuid.set('uuid2', uuid2)
|
||||
nameToUuid.set('uuid3', uuid3)
|
||||
|
||||
/**
|
||||
* Given the project.toml string, overwrite the named views to be the constant uuid
|
||||
* values to match the snapshots. The uuids are randomly generated
|
||||
*/
|
||||
function tomlStringOverWriteNamedViewUuids(toml: string): string {
|
||||
const settings = tomlToPerProjectSettings(toml)
|
||||
const namedViews = settings.settings?.app?.named_views
|
||||
if (namedViews) {
|
||||
const entries = Object.entries(namedViews)
|
||||
const remappedNamedViews: { [key: string]: NamedView } = {}
|
||||
entries.forEach(([_, value]) => {
|
||||
if (value) {
|
||||
// {name:'uuid1'} -> uuid1 lookup
|
||||
const staticUuid = nameToUuid.get(value.name)
|
||||
if (staticUuid) {
|
||||
remappedNamedViews[staticUuid] = value
|
||||
}
|
||||
}
|
||||
})
|
||||
if (settings && settings.settings && settings.settings.app) {
|
||||
settings.settings.app.named_views = remappedNamedViews
|
||||
}
|
||||
}
|
||||
return perProjectsettingsToToml(settings)
|
||||
}
|
||||
|
||||
test.describe('Named view tests', () => {
|
||||
test('Verify project.toml is not created', async ({ page }, testInfo) => {
|
||||
// Create project and load it
|
||||
const projectName = 'named-views'
|
||||
await createProject({ name: projectName, page })
|
||||
|
||||
// Generate file paths for project.toml
|
||||
const projectDirName = testInfo.outputPath('electron-test-projects-dir')
|
||||
const tempProjectSettingsFilePath = join(
|
||||
projectDirName,
|
||||
projectName,
|
||||
PROJECT_SETTINGS_FILE_NAME
|
||||
)
|
||||
|
||||
// project.toml should not exist on initial project creation
|
||||
let exists = await fileExists(tempProjectSettingsFilePath)
|
||||
expect(exists).toBe(false)
|
||||
})
|
||||
test('Verify named view gets created', async ({
|
||||
cmdBar,
|
||||
scene,
|
||||
page,
|
||||
}, testInfo) => {
|
||||
const projectName = 'named-views'
|
||||
const myNamedView = 'uuid1'
|
||||
|
||||
// Create and load project
|
||||
await createProject({ name: projectName, page })
|
||||
await scene.waitForExecutionDone()
|
||||
|
||||
// Create named view
|
||||
const projectDirName = testInfo.outputPath('electron-test-projects-dir')
|
||||
await cmdBar.openCmdBar()
|
||||
await cmdBar.chooseCommand('create named view')
|
||||
await cmdBar.argumentInput.fill(myNamedView)
|
||||
await cmdBar.progressCmdBar(false)
|
||||
|
||||
// Generate paths for the project.toml
|
||||
const tempProjectSettingsFilePath = join(
|
||||
projectDirName,
|
||||
projectName,
|
||||
PROJECT_SETTINGS_FILE_NAME
|
||||
)
|
||||
|
||||
// Expect project.toml to be generated on disk since a named view was created
|
||||
await expect(async () => {
|
||||
let exists = await fileExists(tempProjectSettingsFilePath)
|
||||
expect(exists).toBe(true)
|
||||
}).toPass()
|
||||
|
||||
// Read project.toml into memory
|
||||
let tomlString = await fsp.readFile(tempProjectSettingsFilePath, 'utf-8')
|
||||
// Rewrite the uuids in the named views to match snapshot otherwise they will be randomly generated from rust and break
|
||||
tomlString = tomlStringOverWriteNamedViewUuids(tomlString)
|
||||
|
||||
// Write the entire tomlString to a snapshot.
|
||||
// There are many key/value pairs to check this is a safer match.
|
||||
expect(tomlString).toMatchSnapshot('verify-named-view-gets-created')
|
||||
})
|
||||
test('Verify named view gets deleted', async ({
|
||||
cmdBar,
|
||||
scene,
|
||||
page,
|
||||
}, testInfo) => {
|
||||
const projectName = 'named-views'
|
||||
const myNamedView1 = 'uuid1'
|
||||
const myNamedView2 = 'uuid2'
|
||||
|
||||
// Create project and go into the project
|
||||
await createProject({ name: projectName, page })
|
||||
await scene.waitForExecutionDone()
|
||||
|
||||
// Create a new named view
|
||||
await cmdBar.openCmdBar()
|
||||
await cmdBar.chooseCommand('create named view')
|
||||
await cmdBar.argumentInput.fill(myNamedView1)
|
||||
await cmdBar.progressCmdBar(false)
|
||||
|
||||
// Generate file paths for project.toml
|
||||
const projectDirName = testInfo.outputPath('electron-test-projects-dir')
|
||||
const tempProjectSettingsFilePath = join(
|
||||
projectDirName,
|
||||
projectName,
|
||||
PROJECT_SETTINGS_FILE_NAME
|
||||
)
|
||||
|
||||
// Except the project.toml to be written to disk since a named view was created
|
||||
await expect(async () => {
|
||||
let exists = await fileExists(tempProjectSettingsFilePath)
|
||||
expect(exists).toBe(true)
|
||||
}).toPass()
|
||||
|
||||
// Read project.toml into memory
|
||||
let tomlString = await fsp.readFile(tempProjectSettingsFilePath, 'utf-8')
|
||||
// Rewrite the uuids in the named views to match snapshot otherwise they will be randomly generated from rust and break
|
||||
tomlString = tomlStringOverWriteNamedViewUuids(tomlString)
|
||||
|
||||
// Write the entire tomlString to a snapshot.
|
||||
// There are many key/value pairs to check this is a safer match.
|
||||
expect(tomlString).toMatchSnapshot('verify-named-view-gets-created')
|
||||
|
||||
// Delete a named view
|
||||
await cmdBar.openCmdBar()
|
||||
await cmdBar.chooseCommand('delete named view')
|
||||
cmdBar.selectOption({ name: myNamedView2 })
|
||||
await cmdBar.progressCmdBar(false)
|
||||
|
||||
// Read project.toml into memory again since we deleted a named view
|
||||
tomlString = await fsp.readFile(tempProjectSettingsFilePath, 'utf-8')
|
||||
// Rewrite the uuids in the named views to match snapshot otherwise they will be randomly generated from rust and break
|
||||
tomlString = tomlStringOverWriteNamedViewUuids(tomlString)
|
||||
|
||||
// // Write the entire tomlString to a snapshot.
|
||||
// // There are many key/value pairs to check this is a safer match.
|
||||
expect(tomlString).toMatchSnapshot('verify-named-view-gets-deleted')
|
||||
})
|
||||
test('Verify named view gets loaded', async ({
|
||||
cmdBar,
|
||||
scene,
|
||||
page,
|
||||
}, testInfo) => {
|
||||
const projectName = 'named-views'
|
||||
const myNamedView = 'uuid1'
|
||||
|
||||
// Create project and go into the project
|
||||
await createProject({ name: projectName, page })
|
||||
await scene.waitForExecutionDone()
|
||||
|
||||
// Create a new named view
|
||||
await cmdBar.openCmdBar()
|
||||
await cmdBar.chooseCommand('create named view')
|
||||
await cmdBar.argumentInput.fill(myNamedView)
|
||||
await cmdBar.progressCmdBar(false)
|
||||
|
||||
// Generate file paths for project.toml
|
||||
const projectDirName = testInfo.outputPath('electron-test-projects-dir')
|
||||
const tempProjectSettingsFilePath = join(
|
||||
projectDirName,
|
||||
projectName,
|
||||
PROJECT_SETTINGS_FILE_NAME
|
||||
)
|
||||
|
||||
// Except the project.toml to be written to disk since a named view was created
|
||||
await expect(async () => {
|
||||
let exists = await fileExists(tempProjectSettingsFilePath)
|
||||
expect(exists).toBe(true)
|
||||
}).toPass()
|
||||
|
||||
// Read project.toml into memory
|
||||
let tomlString = await fsp.readFile(tempProjectSettingsFilePath, 'utf-8')
|
||||
// Rewrite the uuids in the named views to match snapshot otherwise they will be randomly generated from rust and break
|
||||
tomlString = tomlStringOverWriteNamedViewUuids(tomlString)
|
||||
|
||||
// Write the entire tomlString to a snapshot.
|
||||
// There are many key/value pairs to check this is a safer match.
|
||||
expect(tomlString).toMatchSnapshot('verify-named-view-gets-created')
|
||||
|
||||
// Create a load a named view
|
||||
await cmdBar.openCmdBar()
|
||||
await cmdBar.chooseCommand('load named view')
|
||||
await cmdBar.argumentInput.fill(myNamedView)
|
||||
await cmdBar.progressCmdBar(false)
|
||||
|
||||
// Check the toast appeared
|
||||
await expect(
|
||||
page.getByText(`Named view ${myNamedView} loaded.`)
|
||||
).toBeVisible()
|
||||
})
|
||||
test('Verify two named views get created', async ({
|
||||
cmdBar,
|
||||
scene,
|
||||
page,
|
||||
}, testInfo) => {
|
||||
const projectName = 'named-views'
|
||||
const myNamedView1 = 'uuid1'
|
||||
const myNamedView2 = 'uuid2'
|
||||
|
||||
// Create and load project
|
||||
await createProject({ name: projectName, page })
|
||||
await scene.waitForExecutionDone()
|
||||
|
||||
// Create named view
|
||||
const projectDirName = testInfo.outputPath('electron-test-projects-dir')
|
||||
await cmdBar.openCmdBar()
|
||||
await cmdBar.chooseCommand('create named view')
|
||||
await cmdBar.argumentInput.fill(myNamedView1)
|
||||
await cmdBar.progressCmdBar(false)
|
||||
|
||||
await page.waitForTimeout(1000)
|
||||
|
||||
const orbitMouseStart = { x: 800, y: 130 }
|
||||
const orbitMouseEnd = { x: 0, y: 130 }
|
||||
await page.mouse.move(orbitMouseStart.x, orbitMouseStart.y)
|
||||
await page.mouse.down({ button: 'middle' })
|
||||
await page.mouse.move(orbitMouseEnd.x, orbitMouseEnd.y, {
|
||||
steps: 3,
|
||||
})
|
||||
await page.mouse.up({ button: 'middle' })
|
||||
|
||||
await page.waitForTimeout(1000)
|
||||
|
||||
await cmdBar.openCmdBar()
|
||||
await cmdBar.chooseCommand('create named view')
|
||||
await cmdBar.argumentInput.fill(myNamedView2)
|
||||
await cmdBar.progressCmdBar(false)
|
||||
|
||||
// Wait a moment for the project.toml to get written to disk with the new view point
|
||||
await page.waitForTimeout(1000)
|
||||
|
||||
// Generate paths for the project.toml
|
||||
const tempProjectSettingsFilePath = join(
|
||||
projectDirName,
|
||||
projectName,
|
||||
PROJECT_SETTINGS_FILE_NAME
|
||||
)
|
||||
|
||||
// Expect project.toml to be generated on disk since a named view was created
|
||||
await expect(async () => {
|
||||
let exists = await fileExists(tempProjectSettingsFilePath)
|
||||
expect(exists).toBe(true)
|
||||
}).toPass()
|
||||
|
||||
// Read project.toml into memory
|
||||
let tomlString = await fsp.readFile(tempProjectSettingsFilePath, 'utf-8')
|
||||
// Rewrite the uuids in the named views to match snapshot otherwise they will be randomly generated from rust and break
|
||||
tomlString = tomlStringOverWriteNamedViewUuids(tomlString)
|
||||
|
||||
// Write the entire tomlString to a snapshot.
|
||||
// There are many key/value pairs to check this is a safer match.
|
||||
expect(tomlString).toMatchSnapshot('verify-two-named-view-gets-created')
|
||||
})
|
||||
})
|
@ -0,0 +1,16 @@
|
||||
[settings]
|
||||
modeling = { }
|
||||
text_editor = { }
|
||||
command_bar = { }
|
||||
|
||||
[settings.app.named_views.0656fb1a-9640-473e-b334-591dc70c0138]
|
||||
name = "uuid1"
|
||||
eye_offset = 1_378.0059
|
||||
fov_y = 45
|
||||
is_ortho = false
|
||||
ortho_scale_enabled = true
|
||||
ortho_scale_factor = 1.6
|
||||
pivot_position = [ 0, 0, 0 ]
|
||||
pivot_rotation = [ 0.5380994, 0.0, 0.0, 0.8428814 ]
|
||||
world_coord_system = "right_handed_up_z"
|
||||
version = 1
|
@ -0,0 +1,16 @@
|
||||
[settings]
|
||||
modeling = { }
|
||||
text_editor = { }
|
||||
command_bar = { }
|
||||
|
||||
[settings.app.named_views.0656fb1a-9640-473e-b334-591dc70c0138]
|
||||
name = "uuid1"
|
||||
eye_offset = 1_378.0059
|
||||
fov_y = 45
|
||||
is_ortho = false
|
||||
ortho_scale_enabled = true
|
||||
ortho_scale_factor = 1.6
|
||||
pivot_position = [ 0, 0, 0 ]
|
||||
pivot_rotation = [ 0.5380994, 0.0, 0.0, 0.8428814 ]
|
||||
world_coord_system = "right_handed_up_z"
|
||||
version = 1
|
@ -0,0 +1,28 @@
|
||||
[settings]
|
||||
modeling = { }
|
||||
text_editor = { }
|
||||
command_bar = { }
|
||||
|
||||
[settings.app.named_views.0656fb1a-9640-473e-b334-591dc70c0138]
|
||||
name = "uuid1"
|
||||
eye_offset = 1_378.0059
|
||||
fov_y = 45
|
||||
is_ortho = false
|
||||
ortho_scale_enabled = true
|
||||
ortho_scale_factor = 1.6
|
||||
pivot_position = [ 0, 0, 0 ]
|
||||
pivot_rotation = [ 0.5380994, 0.0, 0.0, 0.8428814 ]
|
||||
world_coord_system = "right_handed_up_z"
|
||||
version = 1
|
||||
|
||||
[settings.app.named_views.c810cf04-c6cc-4a4a-8b11-17bf445dcab7]
|
||||
name = "uuid2"
|
||||
eye_offset = 1_378.0059
|
||||
fov_y = 45
|
||||
is_ortho = false
|
||||
ortho_scale_enabled = true
|
||||
ortho_scale_factor = 1.6
|
||||
pivot_position = [ 1_826.5239, 0.0, 0.0 ]
|
||||
pivot_rotation = [ 0.5380994, 0.0, 0.0, 0.8428814 ]
|
||||
world_coord_system = "right_handed_up_z"
|
||||
version = 1
|
312
e2e/playwright/native-file-menu.spec.ts
Normal file
@ -0,0 +1,312 @@
|
||||
import { test, expect } from './zoo-test'
|
||||
|
||||
/**
|
||||
* Not all menu actions are tested. Some are default electron menu actions.
|
||||
* Test file menu actions that trigger something in the frontend
|
||||
*/
|
||||
test.describe('Native file menu', { tag: ['@electron'] }, () => {
|
||||
test.describe('Home page', () => {
|
||||
test.describe('File role', () => {
|
||||
test('File.Create project', async ({ tronApp, cmdBar, page }) => {
|
||||
if (!tronApp) fail()
|
||||
// Run electron snippet to find the Menu!
|
||||
await tronApp.electron.evaluate(async ({ app }) => {
|
||||
if (!app || !app.applicationMenu) fail()
|
||||
const newProject =
|
||||
app.applicationMenu.getMenuItemById('File.New project')
|
||||
if (!newProject) fail()
|
||||
newProject.click()
|
||||
})
|
||||
// Check that the command bar is opened
|
||||
await expect(cmdBar.cmdBarElement).toBeVisible()
|
||||
// Check the placeholder project name exists
|
||||
const actualArgument = await cmdBar.cmdBarElement
|
||||
.getByTestId('cmd-bar-arg-value')
|
||||
.inputValue()
|
||||
const expectedArgument = 'project-$nnn'
|
||||
expect(actualArgument).toBe(expectedArgument)
|
||||
})
|
||||
test('File.Open project', async ({ tronApp, cmdBar, page }) => {
|
||||
if (!tronApp) fail()
|
||||
// Run electron snippet to find the Menu!
|
||||
await tronApp.electron.evaluate(async ({ app }) => {
|
||||
if (!app || !app.applicationMenu) fail()
|
||||
const openProject =
|
||||
app.applicationMenu.getMenuItemById('File.Open project')
|
||||
if (!openProject) fail()
|
||||
openProject.click()
|
||||
})
|
||||
// Check that the command bar is opened
|
||||
await expect(cmdBar.cmdBarElement).toBeVisible()
|
||||
// Check the placeholder project name exists
|
||||
const actual = await cmdBar.cmdBarElement
|
||||
.getByTestId('command-name')
|
||||
.textContent()
|
||||
const expected = 'Open project'
|
||||
expect(actual).toBe(expected)
|
||||
})
|
||||
test('File.Preferences.User settings', async ({
|
||||
tronApp,
|
||||
cmdBar,
|
||||
page,
|
||||
}) => {
|
||||
if (!tronApp) fail()
|
||||
// Run electron snippet to find the Menu!
|
||||
await tronApp.electron.evaluate(async ({ app }) => {
|
||||
if (!app || !app.applicationMenu) fail()
|
||||
const userSettings = app.applicationMenu.getMenuItemById(
|
||||
'File.Preferences.User settings'
|
||||
)
|
||||
if (!userSettings) fail()
|
||||
userSettings.click()
|
||||
})
|
||||
const settings = page.getByTestId('settings-dialog-panel')
|
||||
await expect(settings).toBeVisible()
|
||||
// You are viewing the user tab
|
||||
const actualText = settings.getByText(
|
||||
'The overall appearance of the app'
|
||||
)
|
||||
await expect(actualText).toBeVisible()
|
||||
})
|
||||
test('File.Preferences.Keybindings', async ({
|
||||
tronApp,
|
||||
cmdBar,
|
||||
page,
|
||||
}) => {
|
||||
if (!tronApp) fail()
|
||||
// Run electron snippet to find the Menu!
|
||||
await tronApp.electron.evaluate(async ({ app }) => {
|
||||
if (!app || !app.applicationMenu) fail()
|
||||
const keybindings = app.applicationMenu.getMenuItemById(
|
||||
'File.Preferences.Keybindings'
|
||||
)
|
||||
if (!keybindings) fail()
|
||||
keybindings.click()
|
||||
})
|
||||
const settings = page.getByTestId('settings-dialog-panel')
|
||||
await expect(settings).toBeVisible()
|
||||
// You are viewing the keybindings tab
|
||||
const enterSketchMode = settings.locator('#enter-sketch-mode')
|
||||
await expect(enterSketchMode).toBeVisible()
|
||||
})
|
||||
test('File.Preferences.User default units', async ({
|
||||
tronApp,
|
||||
cmdBar,
|
||||
page,
|
||||
}) => {
|
||||
if (!tronApp) fail()
|
||||
// Run electron snippet to find the Menu!
|
||||
await tronApp.electron.evaluate(async ({ app }) => {
|
||||
if (!app || !app.applicationMenu) fail()
|
||||
const menu = app.applicationMenu.getMenuItemById(
|
||||
'File.Preferences.User default units'
|
||||
)
|
||||
if (!menu) fail()
|
||||
menu.click()
|
||||
})
|
||||
const settings = page.getByTestId('settings-dialog-panel')
|
||||
await expect(settings).toBeVisible()
|
||||
const defaultUnit = settings.locator('#defaultUnit')
|
||||
await expect(defaultUnit).toBeVisible()
|
||||
})
|
||||
test('File.Preferences.Theme', async ({ tronApp, cmdBar, page }) => {
|
||||
if (!tronApp) fail()
|
||||
// Run electron snippet to find the Menu!
|
||||
await tronApp.electron.evaluate(async ({ app }) => {
|
||||
if (!app || !app.applicationMenu) fail()
|
||||
const menu = app.applicationMenu.getMenuItemById(
|
||||
'File.Preferences.Theme'
|
||||
)
|
||||
if (!menu) fail()
|
||||
menu.click()
|
||||
})
|
||||
// Check that the command bar is opened
|
||||
await expect(cmdBar.cmdBarElement).toBeVisible()
|
||||
// Check the placeholder project name exists
|
||||
const actual = await cmdBar.cmdBarElement
|
||||
.getByTestId('command-name')
|
||||
.textContent()
|
||||
const expected = 'Settings · app · theme'
|
||||
expect(actual).toBe(expected)
|
||||
})
|
||||
test('File.Preferences.Theme color', async ({
|
||||
tronApp,
|
||||
cmdBar,
|
||||
page,
|
||||
}) => {
|
||||
if (!tronApp) fail()
|
||||
// Run electron snippet to find the Menu!
|
||||
await tronApp.electron.evaluate(async ({ app }) => {
|
||||
if (!app || !app.applicationMenu) fail()
|
||||
const menu = app.applicationMenu.getMenuItemById(
|
||||
'File.Preferences.Theme color'
|
||||
)
|
||||
if (!menu) fail()
|
||||
menu.click()
|
||||
})
|
||||
const settings = page.getByTestId('settings-dialog-panel')
|
||||
await expect(settings).toBeVisible()
|
||||
const defaultUnit = settings.locator('#themeColor')
|
||||
await expect(defaultUnit).toBeVisible()
|
||||
})
|
||||
test('File.Preferences.Sign out', async ({ tronApp, cmdBar, page }) => {
|
||||
if (!tronApp) fail()
|
||||
// Run electron snippet to find the Menu!
|
||||
await tronApp.electron.evaluate(async ({ app }) => {
|
||||
if (!app || !app.applicationMenu) fail()
|
||||
const menu = app.applicationMenu.getMenuItemById('File.Sign out')
|
||||
if (!menu) fail()
|
||||
// FIXME: Add back when you can actually sign out
|
||||
// menu.click()
|
||||
})
|
||||
// FIXME: When signing out during E2E the page is not bound correctly.
|
||||
// It cannot find the button
|
||||
// const signIn = page.getByTestId('sign-in-button')
|
||||
// await expect(signIn).toBeVisible()
|
||||
})
|
||||
})
|
||||
|
||||
test.describe('Edit role', () => {
|
||||
test('Edit.Rename project', async ({ tronApp, cmdBar, page }) => {
|
||||
if (!tronApp) fail()
|
||||
// Run electron snippet to find the Menu!
|
||||
await tronApp.electron.evaluate(async ({ app }) => {
|
||||
if (!app || !app.applicationMenu) fail()
|
||||
const menu = app.applicationMenu.getMenuItemById(
|
||||
'Edit.Rename project'
|
||||
)
|
||||
if (!menu) fail()
|
||||
menu.click()
|
||||
})
|
||||
// Check the placeholder project name exists
|
||||
const actual = await cmdBar.cmdBarElement
|
||||
.getByTestId('command-name')
|
||||
.textContent()
|
||||
const expected = 'Rename project'
|
||||
expect(actual).toBe(expected)
|
||||
})
|
||||
test('Edit.Delete project', async ({ tronApp, cmdBar, page }) => {
|
||||
if (!tronApp) fail()
|
||||
// Run electron snippet to find the Menu!
|
||||
await tronApp.electron.evaluate(async ({ app }) => {
|
||||
if (!app || !app.applicationMenu) fail()
|
||||
const menu = app.applicationMenu.getMenuItemById(
|
||||
'Edit.Delete project'
|
||||
)
|
||||
if (!menu) fail()
|
||||
menu.click()
|
||||
})
|
||||
// Check the placeholder project name exists
|
||||
const actual = await cmdBar.cmdBarElement
|
||||
.getByTestId('command-name')
|
||||
.textContent()
|
||||
const expected = 'Delete project'
|
||||
expect(actual).toBe(expected)
|
||||
})
|
||||
test('Edit.Change project directory', async ({
|
||||
tronApp,
|
||||
cmdBar,
|
||||
page,
|
||||
}) => {
|
||||
if (!tronApp) fail()
|
||||
// Run electron snippet to find the Menu!
|
||||
await tronApp.electron.evaluate(async ({ app }) => {
|
||||
if (!app || !app.applicationMenu) fail()
|
||||
const menu = app.applicationMenu.getMenuItemById(
|
||||
'Edit.Change project directory'
|
||||
)
|
||||
if (!menu) fail()
|
||||
menu.click()
|
||||
})
|
||||
const settings = page.getByTestId('settings-dialog-panel')
|
||||
await expect(settings).toBeVisible()
|
||||
const projectDirectory = settings.locator('#projectDirectory')
|
||||
await expect(projectDirectory).toBeVisible()
|
||||
})
|
||||
})
|
||||
test.describe('View role', () => {
|
||||
test('View.Command Palette...', async ({ tronApp, cmdBar, page }) => {
|
||||
if (!tronApp) fail()
|
||||
// Run electron snippet to find the Menu!
|
||||
await tronApp.electron.evaluate(async ({ app }) => {
|
||||
if (!app || !app.applicationMenu) fail()
|
||||
const menu = app.applicationMenu.getMenuItemById(
|
||||
'View.Command Palette...'
|
||||
)
|
||||
if (!menu) fail()
|
||||
menu.click()
|
||||
})
|
||||
// Check the placeholder project name exists
|
||||
const actual = cmdBar.cmdBarElement.getByTestId('cmd-bar-search')
|
||||
await expect(actual).toBeVisible()
|
||||
})
|
||||
})
|
||||
test.describe('Help role', () => {
|
||||
test('Help.Show all commands', async ({ tronApp, cmdBar, page }) => {
|
||||
if (!tronApp) fail()
|
||||
// Run electron snippet to find the Menu!
|
||||
await tronApp.electron.evaluate(async ({ app }) => {
|
||||
if (!app || !app.applicationMenu) fail()
|
||||
const menu = app.applicationMenu.getMenuItemById(
|
||||
'Help.Show all commands'
|
||||
)
|
||||
if (!menu) fail()
|
||||
menu.click()
|
||||
})
|
||||
// Check the placeholder project name exists
|
||||
const actual = cmdBar.cmdBarElement.getByTestId('cmd-bar-search')
|
||||
await expect(actual).toBeVisible()
|
||||
})
|
||||
test('Help.KCL code samples', async ({ tronApp, cmdBar, page }) => {
|
||||
if (!tronApp) fail()
|
||||
// Run electron snippet to find the Menu!
|
||||
await tronApp.electron.evaluate(async ({ app }) => {
|
||||
if (!app || !app.applicationMenu) fail()
|
||||
const menu = app.applicationMenu.getMenuItemById(
|
||||
'Help.KCL code samples'
|
||||
)
|
||||
if (!menu) fail()
|
||||
})
|
||||
})
|
||||
test('Help.Refresh and report a bug', async ({
|
||||
tronApp,
|
||||
cmdBar,
|
||||
page,
|
||||
}) => {
|
||||
if (!tronApp) fail()
|
||||
// Run electron snippet to find the Menu!
|
||||
await tronApp.electron.evaluate(async ({ app }) => {
|
||||
if (!app || !app.applicationMenu) fail()
|
||||
const menu = app.applicationMenu.getMenuItemById(
|
||||
'Help.Refresh and report a bug'
|
||||
)
|
||||
if (!menu) fail()
|
||||
menu.click()
|
||||
})
|
||||
// Core dump and refresh magic number timeout
|
||||
await page.waitForTimeout(7000)
|
||||
const actual = page.getByText(
|
||||
'No Projects found, ready to make your first one?'
|
||||
)
|
||||
await expect(actual).toBeVisible()
|
||||
})
|
||||
test('Help.Reset onboarding', async ({ tronApp, cmdBar, page }) => {
|
||||
if (!tronApp) fail()
|
||||
// Run electron snippet to find the Menu!
|
||||
await tronApp.electron.evaluate(async ({ app }) => {
|
||||
if (!app || !app.applicationMenu) fail()
|
||||
const menu = app.applicationMenu.getMenuItemById(
|
||||
'Help.Reset onboarding'
|
||||
)
|
||||
if (!menu) fail()
|
||||
menu.click()
|
||||
})
|
||||
|
||||
const actual = page.getByText(
|
||||
`This is a hardware design tool that lets you edit visually, with code, or both. It's powered by the KittyCAD Design API, the first API created for anyone to build hardware design tools.`
|
||||
)
|
||||
await expect(actual).toBeVisible()
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
@ -230,9 +230,9 @@ test.describe('Onboarding tests', () => {
|
||||
|
||||
// Override beforeEach test setup
|
||||
await context.addInitScript(
|
||||
async ({ settingsKey, settings }) => {
|
||||
async ({ settingsKey, settings, code }) => {
|
||||
// Give some initial code, so we can test that it's cleared
|
||||
localStorage.setItem('persistCode', originalCode)
|
||||
localStorage.setItem('persistCode', code)
|
||||
localStorage.setItem(settingsKey, settings)
|
||||
},
|
||||
{
|
||||
@ -240,6 +240,7 @@ test.describe('Onboarding tests', () => {
|
||||
settings: settingsToToml({
|
||||
settings: TEST_SETTINGS_ONBOARDING_EXPORT,
|
||||
}),
|
||||
code: originalCode,
|
||||
}
|
||||
)
|
||||
|
||||
|
@ -1082,8 +1082,8 @@ openSketch = startSketchOn(XY)
|
||||
}) => {
|
||||
// One dumb hardcoded screen pixel value
|
||||
const testPoint = { x: 620, y: 257 }
|
||||
const expectedOutput = `helix001 = helix( revolutions = 1, angleStart = 360, ccw = false, radius = 5, axis = 'X', length = 5,)`
|
||||
const expectedLine = `revolutions=1,`
|
||||
const expectedOutput = `helix001 = helix( axis = 'X', radius = 5, length = 5, revolutions = 1, angleStart = 360, ccw = false,)`
|
||||
const expectedLine = `axis='X',`
|
||||
|
||||
await homePage.goToModelingScene()
|
||||
|
||||
@ -1091,17 +1091,16 @@ openSketch = startSketchOn(XY)
|
||||
await toolbar.helixButton.click()
|
||||
await cmdBar.expectState({
|
||||
stage: 'arguments',
|
||||
currentArgKey: 'axisOrEdge',
|
||||
currentArgKey: 'mode',
|
||||
currentArgValue: '',
|
||||
headerArguments: {
|
||||
Mode: '',
|
||||
AngleStart: '',
|
||||
AxisOrEdge: '',
|
||||
CounterClockWise: '',
|
||||
Length: '',
|
||||
Radius: '',
|
||||
Revolutions: '',
|
||||
Radius: '',
|
||||
CounterClockWise: '',
|
||||
},
|
||||
highlightedHeaderArg: 'axisOrEdge',
|
||||
highlightedHeaderArg: 'mode',
|
||||
commandName: 'Helix',
|
||||
})
|
||||
await cmdBar.progressCmdBar()
|
||||
@ -1110,7 +1109,19 @@ openSketch = startSketchOn(XY)
|
||||
await cmdBar.progressCmdBar()
|
||||
await cmdBar.progressCmdBar()
|
||||
await cmdBar.progressCmdBar()
|
||||
await cmdBar.progressCmdBar()
|
||||
await cmdBar.expectState({
|
||||
stage: 'review',
|
||||
headerArguments: {
|
||||
Mode: 'Axis',
|
||||
Axis: 'X',
|
||||
AngleStart: '360',
|
||||
Revolutions: '1',
|
||||
Length: '5',
|
||||
Radius: '5',
|
||||
CounterClockWise: '',
|
||||
},
|
||||
commandName: 'Helix',
|
||||
})
|
||||
await cmdBar.progressCmdBar()
|
||||
})
|
||||
|
||||
@ -1134,30 +1145,31 @@ openSketch = startSketchOn(XY)
|
||||
await cmdBar.expectState({
|
||||
commandName: 'Helix',
|
||||
stage: 'arguments',
|
||||
currentArgKey: 'length',
|
||||
currentArgValue: initialInput,
|
||||
currentArgKey: 'CounterClockWise',
|
||||
currentArgValue: '',
|
||||
headerArguments: {
|
||||
AngleStart: '360',
|
||||
Axis: 'X',
|
||||
CounterClockWise: '',
|
||||
Length: initialInput,
|
||||
Radius: '5',
|
||||
AngleStart: '360',
|
||||
Revolutions: '1',
|
||||
Radius: '5',
|
||||
Length: initialInput,
|
||||
CounterClockWise: '',
|
||||
},
|
||||
highlightedHeaderArg: 'length',
|
||||
highlightedHeaderArg: 'CounterClockWise',
|
||||
})
|
||||
await page.keyboard.press('Shift+Backspace')
|
||||
await expect(cmdBar.currentArgumentInput).toBeVisible()
|
||||
await cmdBar.currentArgumentInput.locator('.cm-content').fill(newInput)
|
||||
await cmdBar.progressCmdBar()
|
||||
await cmdBar.expectState({
|
||||
stage: 'review',
|
||||
headerArguments: {
|
||||
AngleStart: '360',
|
||||
Axis: 'X',
|
||||
CounterClockWise: '',
|
||||
Length: newInput,
|
||||
Radius: '5',
|
||||
AngleStart: '360',
|
||||
Revolutions: '1',
|
||||
Radius: '5',
|
||||
Length: newInput,
|
||||
CounterClockWise: '',
|
||||
},
|
||||
commandName: 'Helix',
|
||||
})
|
||||
@ -1181,14 +1193,14 @@ openSketch = startSketchOn(XY)
|
||||
{
|
||||
selectionType: 'segment',
|
||||
testPoint: { x: 513, y: 221 },
|
||||
expectedOutput: `helix001 = helix( revolutions = 20, angleStart = 0, ccw = true, radius = 1, axis = seg01, length = 100,)`,
|
||||
expectedEditedOutput: `helix001 = helix( revolutions = 20, angleStart = 0, ccw = true, radius = 1, axis = seg01, length = 50,)`,
|
||||
expectedOutput: `helix001 = helix( axis = seg01, radius = 1, revolutions = 20, angleStart = 0, ccw = false,)`,
|
||||
expectedEditedOutput: `helix001 = helix( axis = seg01, radius = 5, revolutions = 20, angleStart = 0, ccw = false,)`,
|
||||
},
|
||||
{
|
||||
selectionType: 'sweepEdge',
|
||||
testPoint: { x: 564, y: 364 },
|
||||
expectedOutput: `helix001 = helix( revolutions = 20, angleStart = 0, ccw = true, radius = 1, axis = getOppositeEdge(seg01), length = 100,)`,
|
||||
expectedEditedOutput: `helix001 = helix( revolutions = 20, angleStart = 0, ccw = true, radius = 1, axis = getOppositeEdge(seg01), length = 50,)`,
|
||||
expectedOutput: `helix001 = helix( axis = getOppositeEdge(seg01), radius = 1, revolutions = 20, angleStart = 0, ccw = false,)`,
|
||||
expectedEditedOutput: `helix001 = helix( axis = getOppositeEdge(seg01), radius = 5, revolutions = 20, angleStart = 0, ccw = false,)`,
|
||||
},
|
||||
]
|
||||
helixCases.map(
|
||||
@ -1225,17 +1237,16 @@ openSketch = startSketchOn(XY)
|
||||
await toolbar.helixButton.click()
|
||||
await cmdBar.expectState({
|
||||
stage: 'arguments',
|
||||
currentArgKey: 'axisOrEdge',
|
||||
currentArgKey: 'mode',
|
||||
currentArgValue: '',
|
||||
headerArguments: {
|
||||
AngleStart: '',
|
||||
AxisOrEdge: '',
|
||||
Mode: '',
|
||||
CounterClockWise: '',
|
||||
Length: '',
|
||||
Radius: '',
|
||||
Revolutions: '',
|
||||
},
|
||||
highlightedHeaderArg: 'axisOrEdge',
|
||||
highlightedHeaderArg: 'mode',
|
||||
commandName: 'Helix',
|
||||
})
|
||||
await cmdBar.selectOption({ name: 'Edge' }).click()
|
||||
@ -1246,21 +1257,17 @@ openSketch = startSketchOn(XY)
|
||||
await cmdBar.progressCmdBar()
|
||||
await page.keyboard.insertText('0')
|
||||
await cmdBar.progressCmdBar()
|
||||
await cmdBar.selectOption({ name: 'True' }).click()
|
||||
await page.keyboard.insertText('1')
|
||||
await cmdBar.progressCmdBar()
|
||||
await page.keyboard.insertText('100')
|
||||
await cmdBar.progressCmdBar()
|
||||
await cmdBar.expectState({
|
||||
stage: 'review',
|
||||
headerArguments: {
|
||||
AngleStart: '0',
|
||||
AxisOrEdge: 'Edge',
|
||||
Mode: 'Edge',
|
||||
Edge: `1 ${selectionType}`,
|
||||
CounterClockWise: '',
|
||||
Length: '100',
|
||||
Radius: '1',
|
||||
AngleStart: '0',
|
||||
Revolutions: '20',
|
||||
Radius: '1',
|
||||
CounterClockWise: '',
|
||||
},
|
||||
commandName: 'Helix',
|
||||
})
|
||||
@ -1280,22 +1287,24 @@ openSketch = startSketchOn(XY)
|
||||
0
|
||||
)
|
||||
await operationButton.dblclick()
|
||||
const initialInput = '100'
|
||||
const newInput = '50'
|
||||
const initialInput = '1'
|
||||
const newInput = '5'
|
||||
await cmdBar.expectState({
|
||||
commandName: 'Helix',
|
||||
stage: 'arguments',
|
||||
currentArgKey: 'length',
|
||||
currentArgValue: initialInput,
|
||||
currentArgKey: 'CounterClockWise',
|
||||
currentArgValue: '',
|
||||
headerArguments: {
|
||||
AngleStart: '0',
|
||||
CounterClockWise: '',
|
||||
Length: initialInput,
|
||||
Radius: '1',
|
||||
Revolutions: '20',
|
||||
Radius: initialInput,
|
||||
CounterClockWise: '',
|
||||
},
|
||||
highlightedHeaderArg: 'length',
|
||||
highlightedHeaderArg: 'CounterClockWise',
|
||||
})
|
||||
await page
|
||||
.getByRole('button', { name: 'radius', exact: false })
|
||||
.click()
|
||||
await expect(cmdBar.currentArgumentInput).toBeVisible()
|
||||
await cmdBar.currentArgumentInput
|
||||
.locator('.cm-content')
|
||||
@ -1305,10 +1314,9 @@ openSketch = startSketchOn(XY)
|
||||
stage: 'review',
|
||||
headerArguments: {
|
||||
AngleStart: '0',
|
||||
CounterClockWise: '',
|
||||
Length: newInput,
|
||||
Radius: '1',
|
||||
Revolutions: '20',
|
||||
Radius: newInput,
|
||||
CounterClockWise: '',
|
||||
},
|
||||
commandName: 'Helix',
|
||||
})
|
||||
@ -1336,6 +1344,140 @@ openSketch = startSketchOn(XY)
|
||||
}
|
||||
)
|
||||
|
||||
test('Helix point-and-click on cylinder', async ({
|
||||
context,
|
||||
page,
|
||||
homePage,
|
||||
scene,
|
||||
editor,
|
||||
toolbar,
|
||||
cmdBar,
|
||||
}) => {
|
||||
const initialCode = `sketch001 = startSketchOn(XY)
|
||||
profile001 = circle(
|
||||
sketch001,
|
||||
center = [0, 0],
|
||||
radius = 100,
|
||||
tag = $seg01,
|
||||
)
|
||||
extrude001 = extrude(profile001, length = 100)
|
||||
`
|
||||
await context.addInitScript((initialCode) => {
|
||||
localStorage.setItem('persistCode', initialCode)
|
||||
}, initialCode)
|
||||
await page.setBodyDimensions({ width: 1000, height: 500 })
|
||||
await homePage.goToModelingScene()
|
||||
await scene.waitForExecutionDone()
|
||||
|
||||
// One dumb hardcoded screen pixel value
|
||||
const testPoint = { x: 620, y: 257 }
|
||||
const [clickOnWall] = scene.makeMouseHelpers(testPoint.x, testPoint.y)
|
||||
const expectedOutput = `helix001 = helix( cylinder = extrude001, revolutions = 1, angleStart = 360, ccw = false,)`
|
||||
const expectedLine = `cylinder = extrude001,`
|
||||
const expectedEditedOutput = `helix001 = helix( cylinder = extrude001, revolutions = 1, angleStart = 360, ccw = true,)`
|
||||
|
||||
await test.step(`Go through the command bar flow`, async () => {
|
||||
await toolbar.helixButton.click()
|
||||
await cmdBar.expectState({
|
||||
stage: 'arguments',
|
||||
currentArgKey: 'mode',
|
||||
currentArgValue: '',
|
||||
headerArguments: {
|
||||
Mode: '',
|
||||
AngleStart: '',
|
||||
Revolutions: '',
|
||||
Radius: '',
|
||||
CounterClockWise: '',
|
||||
},
|
||||
highlightedHeaderArg: 'mode',
|
||||
commandName: 'Helix',
|
||||
})
|
||||
await cmdBar.selectOption({ name: 'Cylinder' }).click()
|
||||
await cmdBar.expectState({
|
||||
stage: 'arguments',
|
||||
currentArgKey: 'cylinder',
|
||||
currentArgValue: '',
|
||||
headerArguments: {
|
||||
Mode: 'Cylinder',
|
||||
Cylinder: '',
|
||||
AngleStart: '',
|
||||
Revolutions: '',
|
||||
CounterClockWise: '',
|
||||
},
|
||||
highlightedHeaderArg: 'cylinder',
|
||||
commandName: 'Helix',
|
||||
})
|
||||
await clickOnWall()
|
||||
await cmdBar.progressCmdBar()
|
||||
await cmdBar.progressCmdBar()
|
||||
await cmdBar.progressCmdBar()
|
||||
await cmdBar.expectState({
|
||||
stage: 'review',
|
||||
headerArguments: {
|
||||
Mode: 'Cylinder',
|
||||
Cylinder: '1 face',
|
||||
AngleStart: '360',
|
||||
Revolutions: '1',
|
||||
CounterClockWise: '',
|
||||
},
|
||||
commandName: 'Helix',
|
||||
})
|
||||
await cmdBar.progressCmdBar()
|
||||
})
|
||||
|
||||
await test.step(`Confirm code is added to the editor, scene has changed`, async () => {
|
||||
await editor.expectEditor.toContain(expectedOutput)
|
||||
await editor.expectState({
|
||||
diagnostics: [],
|
||||
activeLines: [expectedLine],
|
||||
highlightedCode: '',
|
||||
})
|
||||
})
|
||||
|
||||
await test.step(`Edit helix through the feature tree`, async () => {
|
||||
await editor.closePane()
|
||||
const operationButton = await toolbar.getFeatureTreeOperation('Helix', 0)
|
||||
await operationButton.dblclick()
|
||||
await cmdBar.expectState({
|
||||
commandName: 'Helix',
|
||||
stage: 'arguments',
|
||||
currentArgKey: 'CounterClockWise',
|
||||
currentArgValue: '',
|
||||
headerArguments: {
|
||||
AngleStart: '360',
|
||||
Revolutions: '1',
|
||||
CounterClockWise: '',
|
||||
},
|
||||
highlightedHeaderArg: 'CounterClockWise',
|
||||
})
|
||||
await cmdBar.selectOption({ name: 'True' }).click()
|
||||
await cmdBar.expectState({
|
||||
stage: 'review',
|
||||
headerArguments: {
|
||||
AngleStart: '360',
|
||||
Revolutions: '1',
|
||||
CounterClockWise: 'true',
|
||||
},
|
||||
commandName: 'Helix',
|
||||
})
|
||||
await cmdBar.progressCmdBar()
|
||||
await toolbar.closePane('feature-tree')
|
||||
await toolbar.openPane('code')
|
||||
await editor.expectEditor.toContain(expectedEditedOutput)
|
||||
await editor.closePane()
|
||||
})
|
||||
|
||||
await test.step('Delete helix via feature tree selection', async () => {
|
||||
await toolbar.openPane('feature-tree')
|
||||
const operationButton = await toolbar.getFeatureTreeOperation('Helix', 0)
|
||||
await operationButton.click({ button: 'left' })
|
||||
await page.keyboard.press('Delete')
|
||||
await toolbar.closePane('feature-tree')
|
||||
await toolbar.openPane('code')
|
||||
await editor.expectEditor.not.toContain(expectedEditedOutput)
|
||||
})
|
||||
})
|
||||
|
||||
const loftPointAndClickCases = [
|
||||
{ shouldPreselect: true },
|
||||
{ shouldPreselect: false },
|
||||
|
@ -473,6 +473,9 @@ test.describe('Can export from electron app', () => {
|
||||
if (!tronApp) {
|
||||
fail()
|
||||
}
|
||||
if (runningOnWindows()) {
|
||||
test.fixme(orRunWhenFullSuiteEnabled())
|
||||
}
|
||||
|
||||
await context.folderSetupFn(async (dir) => {
|
||||
const bracketDir = path.join(dir, 'bracket')
|
||||
|
@ -778,6 +778,19 @@ plane002 = offsetPlane(XZ, offset = -2 * x)`
|
||||
await editor.expectEditor.not.toContain(`plane002`)
|
||||
})
|
||||
})
|
||||
|
||||
test.fail(
|
||||
'Console errors cause tests to fail',
|
||||
async ({ page, homePage }) => {
|
||||
const u = await getUtils(page)
|
||||
await homePage.goToModelingScene()
|
||||
await u.openAndClearDebugPanel()
|
||||
|
||||
await page.getByTestId('custom-cmd-input').fill('foobar')
|
||||
await page.getByTestId('custom-cmd-send-button').scrollIntoViewIfNeeded()
|
||||
await page.getByTestId('custom-cmd-send-button').click()
|
||||
}
|
||||
)
|
||||
})
|
||||
|
||||
async function clickExportButton(page: Page) {
|
||||
|
Before Width: | Height: | Size: 45 KiB After Width: | Height: | Size: 45 KiB |
Before Width: | Height: | Size: 49 KiB After Width: | Height: | Size: 49 KiB |
Before Width: | Height: | Size: 69 KiB After Width: | Height: | Size: 69 KiB |
Before Width: | Height: | Size: 72 KiB After Width: | Height: | Size: 72 KiB |
@ -26,6 +26,7 @@ import { isArray } from 'lib/utils'
|
||||
import { reportRejection } from 'lib/trap'
|
||||
import { DeepPartial } from 'lib/types'
|
||||
import { Configuration } from 'lang/wasm'
|
||||
import { ProjectConfiguration } from '@rust/kcl-lib/bindings/ProjectConfiguration'
|
||||
|
||||
const toNormalizedCode = (text: string) => {
|
||||
return text.replace(/\s+/g, '')
|
||||
@ -761,7 +762,7 @@ export interface Paths {
|
||||
}
|
||||
|
||||
export const doExport = async (
|
||||
output: Models['OutputFormat_type'],
|
||||
output: Models['OutputFormat3d_type'],
|
||||
rootDir: string,
|
||||
page: Page,
|
||||
exportFrom: 'dropdown' | 'sidebarButton' | 'commandBar' = 'dropdown'
|
||||
@ -934,47 +935,39 @@ export async function setup(
|
||||
}
|
||||
|
||||
function failOnConsoleErrors(page: Page, testInfo?: TestInfo) {
|
||||
// enabled for chrome for now
|
||||
if (page.context().browser()?.browserType().name() === 'chromium') {
|
||||
// No idea wtf exception is
|
||||
page.on('pageerror', (exception: any) => {
|
||||
if (isErrorWhitelisted(exception)) {
|
||||
return
|
||||
}
|
||||
page.on('pageerror', (exception: any) => {
|
||||
if (isErrorWhitelisted(exception)) {
|
||||
return
|
||||
}
|
||||
// Only disable this environment variable if you want to collect console errors
|
||||
if (process.env.FAIL_ON_CONSOLE_ERRORS !== 'false') {
|
||||
// Use expect to prevent page from closing and not cleaning up
|
||||
expect(`An error was detected in the console: \r\n message:${exception.message} \r\n name:${exception.name} \r\n stack:${exception.stack}
|
||||
|
||||
// only set this env var to false if you want to collect console errors
|
||||
// This can be configured in the GH workflow. This should be set to true by default (we want tests to fail when
|
||||
// unwhitelisted console errors are detected).
|
||||
if (process.env.FAIL_ON_CONSOLE_ERRORS === 'true') {
|
||||
// Fail when running on CI and FAIL_ON_CONSOLE_ERRORS is set
|
||||
// use expect to prevent page from closing and not cleaning up
|
||||
expect(`An error was detected in the console: \r\n message:${exception.message} \r\n name:${exception.name} \r\n stack:${exception.stack}
|
||||
|
||||
*Either fix the console error or add it to the whitelist defined in ./lib/console-error-whitelist.ts (if the error can be safely ignored)
|
||||
`).toEqual('Console error detected')
|
||||
} else {
|
||||
// the (test-results/exceptions.txt) file will be uploaded as part of an upload artifact in GH
|
||||
fsp
|
||||
.appendFile(
|
||||
'./test-results/exceptions.txt',
|
||||
[
|
||||
'~~~',
|
||||
`triggered_by_test:${
|
||||
testInfo?.file + ' ' + (testInfo?.title || ' ')
|
||||
}`,
|
||||
`name:${exception.name}`,
|
||||
`message:${exception.message}`,
|
||||
`stack:${exception.stack}`,
|
||||
`project:${testInfo?.project.name}`,
|
||||
'~~~',
|
||||
].join('\n')
|
||||
)
|
||||
.catch((err) => {
|
||||
console.error(err)
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
*Either fix the console error or add it to the whitelist defined in ./lib/console-error-whitelist.ts (if the error can be safely ignored)
|
||||
`).toEqual('Console error detected')
|
||||
} else {
|
||||
// Add errors to `test-results/exceptions.txt` as a test artifact
|
||||
fsp
|
||||
.appendFile(
|
||||
'./test-results/exceptions.txt',
|
||||
[
|
||||
'~~~',
|
||||
`triggered_by_test:${
|
||||
testInfo?.file + ' ' + (testInfo?.title || ' ')
|
||||
}`,
|
||||
`name:${exception.name}`,
|
||||
`message:${exception.message}`,
|
||||
`stack:${exception.stack}`,
|
||||
`project:${testInfo?.project.name}`,
|
||||
'~~~',
|
||||
].join('\n')
|
||||
)
|
||||
.catch((err) => {
|
||||
console.error(err)
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
export async function isOutOfViewInScrollContainer(
|
||||
element: Locator,
|
||||
@ -1125,3 +1118,15 @@ export function settingsToToml(settings: DeepPartial<Configuration>) {
|
||||
export function tomlToSettings(toml: string): DeepPartial<Configuration> {
|
||||
return TOML.parse(toml)
|
||||
}
|
||||
|
||||
export function tomlToPerProjectSettings(
|
||||
toml: string
|
||||
): DeepPartial<ProjectConfiguration> {
|
||||
return TOML.parse(toml)
|
||||
}
|
||||
|
||||
export function perProjectsettingsToToml(
|
||||
settings: DeepPartial<ProjectConfiguration>
|
||||
) {
|
||||
return TOML.stringify(settings as any)
|
||||
}
|
||||
|
20
interface.d.ts
vendored
@ -3,6 +3,18 @@ import fsSync from 'node:fs'
|
||||
import path from 'path'
|
||||
import { dialog, shell } from 'electron'
|
||||
import { MachinesListing } from 'components/MachineManagerProvider'
|
||||
import type { Channel } from 'src/menu/channels'
|
||||
import { Menu, WebContents } from 'electron'
|
||||
import { ZooLabel, ZooMenuEvents } from 'menu/roles'
|
||||
import type { MenuActionIPC } from 'menu/rules'
|
||||
import type { WebContentSendPayload } from 'menu/channels'
|
||||
|
||||
// Extend the interface with additional custom properties
|
||||
declare module 'electron' {
|
||||
interface Menu {
|
||||
label?: ZooLabel
|
||||
}
|
||||
}
|
||||
|
||||
type EnvFn = (value?: string) => string
|
||||
|
||||
@ -94,6 +106,14 @@ export interface IElectronAPI {
|
||||
appCheckForUpdates: () => Promise<unknown>
|
||||
getArgvParsed: () => any
|
||||
getAppTestProperty: (propertyName: string) => any
|
||||
|
||||
// Helper functions to create application Menus
|
||||
createHomePageMenu: () => Promise<any>
|
||||
createModelingPageMenu: () => Promise<any>
|
||||
createFallbackMenu: () => Promise<any>
|
||||
enableMenu(menuId: string): Promise<any>
|
||||
disableMenu(menuId: string): Promise<any>
|
||||
menuOn: (callback: (payload: WebContentSendPayload) => void) => any
|
||||
}
|
||||
|
||||
declare global {
|
||||
|
@ -26,7 +26,7 @@
|
||||
"@fortawesome/react-fontawesome": "^0.2.0",
|
||||
"@headlessui/react": "^1.7.19",
|
||||
"@headlessui/tailwindcss": "^0.2.0",
|
||||
"@kittycad/lib": "2.0.17",
|
||||
"@kittycad/lib": "2.0.21",
|
||||
"@lezer/highlight": "^1.2.1",
|
||||
"@lezer/lr": "^1.4.1",
|
||||
"@react-hook/resize-observer": "^2.0.1",
|
||||
@ -94,9 +94,11 @@
|
||||
"fetch:wasm": "./scripts/get-latest-wasm-bundle.sh",
|
||||
"fetch:wasm:windows": "./scripts/get-latest-wasm-bundle.ps1",
|
||||
"fetch:samples": "rm -rf public/kcl-samples* && curl -L -o public/kcl-samples.zip https://github.com/KittyCAD/kcl-samples/archive/refs/heads/achalmers/kw-args-xylineto.zip && unzip -o public/kcl-samples.zip -d public && mv public/kcl-samples-* public/kcl-samples",
|
||||
"build:wasm-dev": "yarn wasm-prep && (cd rust && wasm-pack build kcl-wasm-lib --dev --target web --out-dir pkg && cargo test -p kcl-lib export_bindings) && yarn isomorphic-copy-wasm && yarn fmt:generated",
|
||||
"build:wasm": "./scripts/build-wasm.sh",
|
||||
"build:wasm:windows": "./scripts/build-wasm.ps1",
|
||||
"build:wasm-dev": "yarn build:wasm:dev",
|
||||
"build:wasm:dev": "./scripts/build-wasm-dev.sh",
|
||||
"build:wasm:dev:windows": "./scripts/build-wasm-dev.ps1",
|
||||
"remove-importmeta": "sed -i 's/import.meta.url/window.location.origin/g' \"./rust/kcl-wasm-lib/pkg/kcl_wasm_lib.js\"; sed -i '' 's/import.meta.url/window.location.origin/g' \"./rust/kcl-wasm-lib/pkg/kcl_wasm_lib.js\" || echo \"sed for both mac and linux\"",
|
||||
"lint-fix": "eslint --fix --ext .ts --ext .tsx src e2e packages/codemirror-lsp-client/src rust/kcl-language-server/client/src",
|
||||
"lint": "eslint --max-warnings 0 --ext .ts --ext .tsx src e2e packages/codemirror-lsp-client/src rust/kcl-language-server/client/src",
|
||||
|
@ -90,7 +90,7 @@ export default class StreamDemuxer extends Queue<Uint8Array> {
|
||||
}
|
||||
|
||||
add(bytes: Uint8Array): void {
|
||||
const message = Codec.decode(bytes) as vsrpc.Message
|
||||
const message = Codec.decode<vsrpc.Message>(bytes)
|
||||
if (this.trace) {
|
||||
Tracer.server(message)
|
||||
}
|
||||
|
@ -7,7 +7,7 @@
|
||||
// Define function
|
||||
fn rail8020(originStart, railHeight, railLength) {
|
||||
// Sketch side 1 of profile
|
||||
sketch001 = startSketchOn('-XZ')
|
||||
sketch001 = startSketchOn(-XZ)
|
||||
|> startProfileAt([
|
||||
originStart[0],
|
||||
0.1 * railHeight + originStart[1]
|
||||
@ -194,7 +194,7 @@ fn rail8020(originStart, railHeight, railLength) {
|
||||
.5 * railHeight + originStart[0],
|
||||
.5 * railHeight + originStart[1]
|
||||
],
|
||||
radius = .205 * railHeight / 2
|
||||
radius = .205 * railHeight / 2,
|
||||
), %)
|
||||
|> extrude(length = railLength)
|
||||
|> fillet(
|
||||
@ -216,7 +216,7 @@ fn rail8020(originStart, railHeight, railLength) {
|
||||
getNextAdjacentEdge(edge28),
|
||||
getNextAdjacentEdge(edge29),
|
||||
getNextAdjacentEdge(edge30)
|
||||
]
|
||||
],
|
||||
)
|
||||
|> fillet(
|
||||
radius = 0.03,
|
||||
@ -237,7 +237,7 @@ fn rail8020(originStart, railHeight, railLength) {
|
||||
getNextAdjacentEdge(edge26),
|
||||
getNextAdjacentEdge(edge31),
|
||||
getNextAdjacentEdge(edge32)
|
||||
]
|
||||
],
|
||||
)
|
||||
return sketch001
|
||||
}
|
||||
|
@ -41,6 +41,8 @@ When you submit a PR to add or modify KCL samples, images and STEP files will be
|
||||
[](cycloidal-gear/main.kcl)
|
||||
#### [dodecahedron](dodecahedron/main.kcl) ([screenshot](screenshots/dodecahedron.png))
|
||||
[](dodecahedron/main.kcl)
|
||||
#### [dual-basin-utility-sink](dual-basin-utility-sink/main.kcl) ([screenshot](screenshots/dual-basin-utility-sink.png))
|
||||
[](dual-basin-utility-sink/main.kcl)
|
||||
#### [enclosure](enclosure/main.kcl) ([screenshot](screenshots/enclosure.png))
|
||||
[](enclosure/main.kcl)
|
||||
#### [exhaust-manifold](exhaust-manifold/main.kcl) ([screenshot](screenshots/exhaust-manifold.png))
|
||||
@ -75,6 +77,8 @@ When you submit a PR to add or modify KCL samples, images and STEP files will be
|
||||
[](kitt/main.kcl)
|
||||
#### [lego](lego/main.kcl) ([screenshot](screenshots/lego.png))
|
||||
[](lego/main.kcl)
|
||||
#### [makeup-mirror](makeup-mirror/main.kcl) ([screenshot](screenshots/makeup-mirror.png))
|
||||
[](makeup-mirror/main.kcl)
|
||||
#### [mounting-plate](mounting-plate/main.kcl) ([screenshot](screenshots/mounting-plate.png))
|
||||
[](mounting-plate/main.kcl)
|
||||
#### [multi-axis-robot](multi-axis-robot/main.kcl) ([screenshot](screenshots/multi-axis-robot.png))
|
||||
|
@ -15,57 +15,37 @@ padding = 1.5
|
||||
bearingDia = 3
|
||||
|
||||
// (Needs to be updated). Sketch the block and extrude up to where the counterbore diameter starts.
|
||||
extrude001 = startSketchOn('XY')
|
||||
extrude001 = startSketchOn(XY)
|
||||
|> startProfileAt([-width / 2, -length / 2], %)
|
||||
|> line(endAbsolute = [width / 2, -length / 2])
|
||||
|> line(endAbsolute = [width / 2, length / 2])
|
||||
|> line(endAbsolute = [-width / 2, length / 2])
|
||||
|> close()
|
||||
|> extrude(length = height)
|
||||
|
||||
extrude002 = startSketchOn(extrude001, 'end')
|
||||
|> circle(
|
||||
center = [
|
||||
center = [
|
||||
-(width / 2 - (padding / 2)),
|
||||
-(length / 2 - (padding / 2))
|
||||
],
|
||||
radius = cbDia / 2,
|
||||
],
|
||||
radius = cbDia / 2,
|
||||
)
|
||||
|> patternLinear2d(
|
||||
instances = 2,
|
||||
distance = length - padding,
|
||||
axis = [0, 1],
|
||||
)
|
||||
|> patternLinear2d(
|
||||
instances = 2,
|
||||
distance = width - padding,
|
||||
axis = [1, 0],
|
||||
)
|
||||
|> patternLinear2d(instances = 2, distance = length - padding, axis = [0, 1])
|
||||
|> patternLinear2d(instances = 2, distance = width - padding, axis = [1, 0])
|
||||
|> extrude(%, length = -cbDepth)
|
||||
|
||||
extrude003 = startSketchOn(extrude001, 'start')
|
||||
|> circle(
|
||||
center = [
|
||||
-(width / 2 - (padding / 2)),
|
||||
-(length / 2 - (padding / 2))
|
||||
],
|
||||
radius = holeDia / 2,
|
||||
center = [
|
||||
-(width / 2 - (padding / 2)),
|
||||
-(length / 2 - (padding / 2))
|
||||
],
|
||||
radius = holeDia / 2,
|
||||
)
|
||||
|> patternLinear2d(
|
||||
instances = 2,
|
||||
distance = length - padding,
|
||||
axis = [0, 1],
|
||||
)
|
||||
|> patternLinear2d(
|
||||
instances = 2,
|
||||
distance = width - padding,
|
||||
axis = [1, 0],
|
||||
)
|
||||
|> patternLinear2d(instances = 2, distance = length - padding, axis = [0, 1])
|
||||
|> patternLinear2d(instances = 2, distance = width - padding, axis = [1, 0])
|
||||
|> extrude(length = -height + cbDepth)
|
||||
|
||||
extrude004 = startSketchOn(extrude001, 'end')
|
||||
|> circle(
|
||||
center = [0, 0],
|
||||
radius = bearingDia/2,
|
||||
)
|
||||
|> extrude(length = -height)
|
||||
|> circle(center = [0, 0], radius = bearingDia / 2)
|
||||
|> extrude(length = -height)
|
||||
|
@ -17,21 +17,15 @@ chainThickness = sphereDia / 8
|
||||
linkDiameter = sphereDia / 4
|
||||
|
||||
// Sketch the inside bearing piece
|
||||
insideWallSketch = startSketchOn(offsetPlane("XY", offset = -overallThickness / 2))
|
||||
|> circle(
|
||||
center = [0, 0],
|
||||
radius = shaftDia / 2 + wallThickness
|
||||
)
|
||||
|> hole(circle(
|
||||
center = [0, 0],
|
||||
radius = shaftDia / 2
|
||||
), %)
|
||||
insideWallSketch = startSketchOn(offsetPlane(XY, offset = -overallThickness / 2))
|
||||
|> circle(center = [0, 0], radius = shaftDia / 2 + wallThickness)
|
||||
|> hole(circle(center = [0, 0], radius = shaftDia / 2), %)
|
||||
|
||||
// Extrude the inside bearing piece
|
||||
insideWall = extrude(insideWallSketch, length = overallThickness)
|
||||
|
||||
// Create the sketch of one of the balls
|
||||
ballsSketch = startSketchOn("XY")
|
||||
ballsSketch = startSketchOn(XY)
|
||||
|> startProfileAt([shaftDia / 2 + wallThickness, 0.001], %)
|
||||
|> arc({
|
||||
angleEnd = 0,
|
||||
@ -47,11 +41,11 @@ balls = revolve(ballsSketch, axis = "X")
|
||||
axis = [0, 0, 1],
|
||||
center = [0, 0, 0],
|
||||
instances = nBalls,
|
||||
rotateDuplicates = true
|
||||
rotateDuplicates = true,
|
||||
)
|
||||
|
||||
// Create the sketch for the chain around the balls
|
||||
chainSketch = startSketchOn("XY")
|
||||
chainSketch = startSketchOn(XY)
|
||||
|> startProfileAt([
|
||||
shaftDia / 2 + wallThickness + sphereDia / 2 - (chainWidth / 2),
|
||||
0.125 * sin(toRadians(60))
|
||||
@ -72,17 +66,17 @@ chainHead = revolve(chainSketch, axis = "X")
|
||||
axis = [0, 0, 1],
|
||||
center = [0, 0, 0],
|
||||
instances = nBalls,
|
||||
rotateDuplicates = true
|
||||
rotateDuplicates = true,
|
||||
)
|
||||
|
||||
// Create the sketch for the links in between the chains
|
||||
linkSketch = startSketchOn("XZ")
|
||||
linkSketch = startSketchOn(XZ)
|
||||
|> circle(
|
||||
center = [
|
||||
shaftDia / 2 + wallThickness + sphereDia / 2,
|
||||
0
|
||||
],
|
||||
radius = linkDiameter / 2
|
||||
radius = linkDiameter / 2,
|
||||
)
|
||||
|
||||
// Revolve the link sketch
|
||||
@ -92,19 +86,13 @@ linkRevolve = revolve(linkSketch, axis = 'Y', angle = 360 / nBalls)
|
||||
axis = [0, 0, 1],
|
||||
center = [0, 0, 0],
|
||||
instances = nBalls,
|
||||
rotateDuplicates = true
|
||||
rotateDuplicates = true,
|
||||
)
|
||||
|
||||
// Create the sketch for the outside walls
|
||||
outsideWallSketch = startSketchOn(offsetPlane("XY", offset = -overallThickness / 2))
|
||||
|> circle(
|
||||
center = [0, 0],
|
||||
radius = outsideDiameter / 2
|
||||
)
|
||||
|> hole(circle(
|
||||
center = [0, 0],
|
||||
radius = shaftDia / 2 + wallThickness + sphereDia
|
||||
), %)
|
||||
outsideWallSketch = startSketchOn(offsetPlane(XY, offset = -overallThickness / 2))
|
||||
|> circle(center = [0, 0], radius = outsideDiameter / 2)
|
||||
|> hole(circle(center = [0, 0], radius = shaftDia / 2 + wallThickness + sphereDia), %)
|
||||
|
||||
outsideWall = extrude(outsideWallSketch, length = overallThickness)
|
||||
|
||||
|
@ -130,7 +130,7 @@ fn armRestProfile(plane, offset) {
|
||||
|
||||
export fn armRest(plane, offset) {
|
||||
path = armRestPath( offsetPlane(plane, offset = offset))
|
||||
profile = armRestProfile( offsetPlane("-XZ", offset = 20), offset)
|
||||
profile = armRestProfile( offsetPlane(-XZ, offset = 20), offset)
|
||||
sweep(profile, path = path)
|
||||
return 0
|
||||
}
|
||||
|
@ -16,19 +16,19 @@ import backSlats from "bench-parts.kcl"
|
||||
import armRest from "bench-parts.kcl"
|
||||
|
||||
// Create the dividers, these hold the seat and back slats
|
||||
divider("YZ")
|
||||
divider(offsetPlane("-YZ", offset = benchLength / 2))
|
||||
divider(offsetPlane("YZ", offset = benchLength / 2))
|
||||
divider(YZ)
|
||||
divider(offsetPlane(-YZ, offset = benchLength / 2))
|
||||
divider(offsetPlane(YZ, offset = benchLength / 2))
|
||||
|
||||
// Create the connectors to join the dividers
|
||||
connector(offsetPlane("YZ", offset = -benchLength / 2), benchLength)
|
||||
connector(offsetPlane(YZ, offset = -benchLength / 2), benchLength)
|
||||
|
||||
// Create the seat slats
|
||||
seatSlats(offsetPlane("YZ", offset = -benchLength / 2 - dividerThickness / 2), benchLength + dividerThickness)
|
||||
seatSlats(offsetPlane(YZ, offset = -benchLength / 2 - (dividerThickness / 2)), benchLength + dividerThickness)
|
||||
|
||||
// Create the back slats
|
||||
backSlats(offsetPlane("YZ", offset = -benchLength / 2 - dividerThickness / 2), benchLength + dividerThickness)
|
||||
backSlats(offsetPlane(YZ, offset = -benchLength / 2 - (dividerThickness / 2)), benchLength + dividerThickness)
|
||||
|
||||
// Create the arm rests
|
||||
armRest("-YZ", benchLength / 2)
|
||||
armRest("-YZ", -benchLength / 2)
|
||||
armRest(-YZ, benchLength / 2)
|
||||
armRest(-YZ, -benchLength / 2)
|
||||
|
@ -1,7 +1,6 @@
|
||||
// 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
|
||||
sigmaAllow = 35000 // psi (6061-T6 aluminum)
|
||||
width = 6 // inch
|
||||
@ -12,14 +11,16 @@ 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')
|
||||
sketch001 = startSketchOn(XZ)
|
||||
|> startProfileAt([0, 0], %)
|
||||
|> xLine(length = shelfMountL - thickness, tag = $seg01)
|
||||
|> yLine(length = thickness, tag = $seg02)
|
||||
@ -29,48 +30,18 @@ sketch001 = startSketchOn('XZ')
|
||||
|> 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)],
|
||||
)
|
||||
|> 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],
|
||||
)
|
||||
|> extrude(%, length = -thickness-.01)
|
||||
|> 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])
|
||||
|> extrude(%, length = -thickness - .01)
|
||||
|
||||
sketch003 = startSketchOn(sketch001, seg04)
|
||||
|> circle(
|
||||
center = [1, -1],
|
||||
radius = mountingHoleDiameter / 2,
|
||||
)
|
||||
|> patternLinear2d(
|
||||
instances = 2,
|
||||
distance = 4,
|
||||
axis = [1, 0],
|
||||
)
|
||||
|> extrude(%, length = -thickness-0.1)
|
||||
|> circle(center = [1, -1], radius = mountingHoleDiameter / 2)
|
||||
|> patternLinear2d(instances = 2, distance = 4, axis = [1, 0])
|
||||
|> extrude(%, length = -thickness - 0.1)
|
||||
|
@ -1,16 +1,14 @@
|
||||
// Brake Caliper
|
||||
// Brake calipers are used to squeeze the brake pads against the rotor, causing larger and larger amounts of friction depending on how hard the brakes are pressed.
|
||||
|
||||
|
||||
// Set units
|
||||
@settings(defaultLengthUnit = in)
|
||||
|
||||
|
||||
// Import Constants
|
||||
import caliperTolerance, caliperPadLength, caliperThickness, caliperOuterEdgeRadius, caliperInnerEdgeRadius, rotorDiameter, rotorTotalThickness, yAxisOffset from "globals.kcl"
|
||||
|
||||
// Sketch the brake caliper profile
|
||||
brakeCaliperSketch = startSketchOn('XY')
|
||||
brakeCaliperSketch = startSketchOn(XY)
|
||||
|> startProfileAt([
|
||||
rotorDiameter / 2 + caliperTolerance,
|
||||
0
|
||||
|
@ -1,39 +1,28 @@
|
||||
// Wheel rotor
|
||||
// A component of a disc brake system. It provides a surface for brake pads to press against, generating the friction needed to slow or stop the vehicle.
|
||||
|
||||
|
||||
// Set units
|
||||
@settings(defaultLengthUnit = in)
|
||||
|
||||
|
||||
// Import Constants
|
||||
import rotorDiameter, rotorInnerDiameter, rotorSinglePlateThickness, rotorInnerDiameterThickness, lugHolePatternDia, lugSpacing, rotorTotalThickness, spacerPatternDiameter, spacerDiameter, spacerLength, spacerCount, wheelDiameter, lugCount, yAxisOffset, drillAndSlotCount from "globals.kcl"
|
||||
|
||||
rotorSketch = startSketchOn('XZ')
|
||||
|> circle(
|
||||
center = [0, 0],
|
||||
radius = rotorDiameter / 2
|
||||
)
|
||||
rotorSketch = startSketchOn(XZ)
|
||||
|> circle(center = [0, 0], radius = rotorDiameter / 2)
|
||||
rotor = extrude(rotorSketch, length = rotorSinglePlateThickness)
|
||||
|> appearance(color = "#dbcd70", roughness = 90, metalness = 90)
|
||||
|
||||
rotorBumpSketch = startSketchOn(rotor, 'end')
|
||||
|> circle(
|
||||
center = [0, 0],
|
||||
radius = rotorInnerDiameter / 2
|
||||
)
|
||||
|> circle(center = [0, 0], radius = rotorInnerDiameter / 2)
|
||||
rotorBump = extrude(rotorBumpSketch, length = rotorInnerDiameterThickness)
|
||||
|
||||
lugHoles = startSketchOn(rotorBump, 'end')
|
||||
|> circle(
|
||||
center = [-lugSpacing / 2, 0],
|
||||
radius = 0.315
|
||||
)
|
||||
|> circle(center = [-lugSpacing / 2, 0], radius = 0.315)
|
||||
|> patternCircular2d(
|
||||
arcDegrees = 360,
|
||||
center = [0, 0],
|
||||
instances = lugCount,
|
||||
rotateDuplicates = true
|
||||
rotateDuplicates = true,
|
||||
)
|
||||
|> extrude(%, length = -(rotorInnerDiameterThickness + rotorSinglePlateThickness))
|
||||
|> appearance(color = "#dbcd70", roughness = 90, metalness = 90)
|
||||
@ -44,35 +33,26 @@ centerSpacer = startSketchOn(rotor, 'start')
|
||||
|> extrude(%, length = spacerLength)
|
||||
|
||||
secondaryRotorSketch = startSketchOn(centerSpacer, 'end')
|
||||
|> circle(
|
||||
center = [0, 0],
|
||||
radius = rotorDiameter / 2
|
||||
)
|
||||
|> circle(center = [0, 0], radius = rotorDiameter / 2)
|
||||
secondRotor = extrude(secondaryRotorSketch, length = rotorSinglePlateThickness)
|
||||
|
||||
lugHoles2 = startSketchOn(secondRotor, 'end')
|
||||
|> circle(
|
||||
center = [-lugSpacing / 2, 0],
|
||||
radius = 0.315
|
||||
)
|
||||
|> circle(center = [-lugSpacing / 2, 0], radius = 0.315)
|
||||
|> patternCircular2d(
|
||||
arcDegrees = 360,
|
||||
center = [0, 0],
|
||||
instances = lugCount,
|
||||
rotateDuplicates = true
|
||||
rotateDuplicates = true,
|
||||
)
|
||||
|> extrude(length = -rotorSinglePlateThickness)
|
||||
|
||||
spacerSketch = startSketchOn(rotor, 'start')
|
||||
|> circle(
|
||||
center = [spacerPatternDiameter / 2, 0],
|
||||
radius = spacerDiameter
|
||||
)
|
||||
|> circle(center = [spacerPatternDiameter / 2, 0], radius = spacerDiameter)
|
||||
|> patternCircular2d(
|
||||
arcDegrees = 360,
|
||||
center = [0, 0],
|
||||
instances = spacerCount,
|
||||
rotateDuplicates = true
|
||||
rotateDuplicates = true,
|
||||
)
|
||||
spacers = extrude(spacerSketch, length = spacerLength)
|
||||
|
||||
@ -87,7 +67,7 @@ rotorSlottedSketch = startSketchOn(rotor, 'START')
|
||||
center = [0, 0],
|
||||
instances = drillAndSlotCount,
|
||||
arcDegrees = 360,
|
||||
rotateDuplicates = true
|
||||
rotateDuplicates = true,
|
||||
)
|
||||
rotorSlotted = extrude(rotorSlottedSketch, length = -rotorSinglePlateThickness / 2)
|
||||
|
||||
@ -102,7 +82,7 @@ secondRotorSlottedSketch = startSketchOn(secondRotor, 'END')
|
||||
center = [0, 0],
|
||||
instances = drillAndSlotCount,
|
||||
arcDegrees = 360,
|
||||
rotateDuplicates = true
|
||||
rotateDuplicates = true,
|
||||
)
|
||||
|
||||
extrude(secondRotorSlottedSketch, length = -rotorSinglePlateThickness / 2)
|
||||
|
@ -1,21 +1,22 @@
|
||||
// Tire
|
||||
// A tire is a critical component of a vehicle that provides the necessary traction and grip between the car and the road. It supports the vehicle's weight and absorbs shocks from road irregularities.
|
||||
|
||||
|
||||
// Set units
|
||||
@settings(defaultLengthUnit = in)
|
||||
|
||||
|
||||
// Import Constants
|
||||
import tireInnerDiameter, tireOuterDiameter, tireDepth, bendRadius, tireTreadWidth, tireTreadDepth, tireTreadOffset from "globals.kcl"
|
||||
|
||||
// Create the sketch of the tire
|
||||
tireSketch = startSketchOn("XY")
|
||||
tireSketch = startSketchOn(XY)
|
||||
|> startProfileAt([tireInnerDiameter / 2, tireDepth / 2], %)
|
||||
|> line(endAbsolute = [
|
||||
tireOuterDiameter / 2 - bendRadius,
|
||||
tireDepth / 2
|
||||
], tag = $edge1)
|
||||
|> line(
|
||||
endAbsolute = [
|
||||
tireOuterDiameter / 2 - bendRadius,
|
||||
tireDepth / 2
|
||||
],
|
||||
tag = $edge1,
|
||||
)
|
||||
|> tangentialArc({ offset = -90, radius = bendRadius }, %)
|
||||
|> line(endAbsolute = [
|
||||
tireOuterDiameter / 2,
|
||||
|
@ -1,69 +1,49 @@
|
||||
// Car Wheel
|
||||
// A sports car wheel with a circular lug pattern and spokes.
|
||||
|
||||
|
||||
// Set units
|
||||
@settings(defaultLengthUnit = in)
|
||||
|
||||
|
||||
// Import Constants
|
||||
import lugCount, lugSpacing, offset, backSpacing, wheelWidth, wheelDiameter, spokeCount, spokeGap, spokeAngle, spokeThickness from "globals.kcl"
|
||||
|
||||
// Create the wheel center
|
||||
lugBase = startSketchOn('XZ')
|
||||
|> circle(
|
||||
center = [0, 0],
|
||||
radius = (lugSpacing + 1.5) / 2
|
||||
)
|
||||
|> hole(circle(
|
||||
center = [0, 0],
|
||||
radius = (lugSpacing - 1.5) / 2
|
||||
), %)
|
||||
lugBase = startSketchOn(XZ)
|
||||
|> circle(center = [0, 0], radius = (lugSpacing + 1.5) / 2)
|
||||
|> hole(circle(center = [0, 0], radius = (lugSpacing - 1.5) / 2), %)
|
||||
|> extrude(length = wheelWidth / 20)
|
||||
|
||||
// Extend the wheel center and bore holes to accomidate the lug heads
|
||||
lugExtrusion = startSketchOn(lugBase, 'END')
|
||||
|> circle(
|
||||
center = [0, 0],
|
||||
radius = (lugSpacing + 1.5) / 2
|
||||
)
|
||||
|> hole(circle(
|
||||
center = [0, 0],
|
||||
radius = (lugSpacing - 1.5) / 2
|
||||
), %)
|
||||
|> circle(center = [0, 0], radius = (lugSpacing + 1.5) / 2)
|
||||
|> hole(circle(center = [0, 0], radius = (lugSpacing - 1.5) / 2), %)
|
||||
|> extrude(length = wheelWidth / 10)
|
||||
|
||||
// Create the circular pattern for the lugs
|
||||
lugClearance = startSketchOn(lugExtrusion, 'END')
|
||||
|> circle(
|
||||
center = [lugSpacing / 2, 0],
|
||||
radius = 1.2 / 2
|
||||
)
|
||||
|> circle(center = [lugSpacing / 2, 0], radius = 1.2 / 2)
|
||||
|> patternCircular2d(
|
||||
arcDegrees = 360,
|
||||
center = [0, 0],
|
||||
instances = lugCount,
|
||||
rotateDuplicates = true
|
||||
rotateDuplicates = true,
|
||||
)
|
||||
|> extrude(length = -wheelWidth / 10)
|
||||
|
||||
// Create the circular pattern for the lug holes
|
||||
lugHoles = startSketchOn(lugBase, 'END')
|
||||
|> circle(
|
||||
center = [lugSpacing / 2, 0],
|
||||
radius = 16 * mm() / 2
|
||||
)
|
||||
|> circle(center = [lugSpacing / 2, 0], radius = 16 * mm() / 2)
|
||||
|> patternCircular2d(
|
||||
arcDegrees = 360,
|
||||
center = [0, 0],
|
||||
instances = lugCount,
|
||||
rotateDuplicates = true
|
||||
rotateDuplicates = true,
|
||||
)
|
||||
|> extrude(length = -wheelWidth / 20)
|
||||
|> appearance(color = "#ffffff", metalness = 0, roughness = 0)
|
||||
|
||||
// Add detail to the wheel center by revolving curved edge profiles
|
||||
wheelCenterInner = startSketchOn('XY')
|
||||
wheelCenterInner = startSketchOn(XY)
|
||||
|> startProfileAt([(lugSpacing - 1.5) / 2, 0], %)
|
||||
|> yLine(length = -wheelWidth / 10 - (wheelWidth / 20))
|
||||
|> bezierCurve({
|
||||
@ -77,7 +57,7 @@ wheelCenterInner = startSketchOn('XY')
|
||||
|> revolve(axis = 'y')
|
||||
|> appearance(color = "#ffffff", metalness = 0, roughness = 0)
|
||||
|
||||
wheelCenterOuter = startSketchOn('XY')
|
||||
wheelCenterOuter = startSketchOn(XY)
|
||||
|> startProfileAt([(lugSpacing + 1.5) / 2, 0], %)
|
||||
|> yLine(length = -wheelWidth / 10 - (wheelWidth / 20))
|
||||
|> bezierCurve({
|
||||
@ -145,7 +125,7 @@ fn spoke(spokeGap, spokeAngle, spokeThickness) {
|
||||
center = [0, -2000, 0],
|
||||
instances = spokeCount,
|
||||
arcDegrees = 360,
|
||||
rotateDuplicates = true
|
||||
rotateDuplicates = true,
|
||||
)
|
||||
|> appearance(color = "#ffffff", metalness = 0, roughness = 0)
|
||||
return spokePattern
|
||||
@ -155,7 +135,7 @@ spoke(spokeGap, spokeAngle, spokeThickness)
|
||||
spoke(-spokeGap, -spokeAngle, -spokeThickness)
|
||||
|
||||
// Define and revolve wheel exterior
|
||||
startSketchOn('XY')
|
||||
startSketchOn(XY)
|
||||
|> startProfileAt([
|
||||
wheelDiameter / 2,
|
||||
-wheelWidth + backSpacing + offset
|
||||
|
@ -20,7 +20,7 @@ export lugDiameter = 24 * mm()
|
||||
export lugHeadLength = lugDiameter * .5
|
||||
export lugThreadDiameter = lugDiameter / 2 * .85
|
||||
export lugLength = 30 * mm()
|
||||
export lugThreadDepth = lugLength - 12.7 * mm()
|
||||
export lugThreadDepth = lugLength - (12.7 * mm())
|
||||
|
||||
// Car Rotor
|
||||
export rotorDiameter = 12
|
||||
@ -50,4 +50,4 @@ export caliperTolerance = 0.050
|
||||
export caliperPadLength = 1.6
|
||||
export caliperThickness = 0.39
|
||||
export caliperOuterEdgeRadius = 0.39
|
||||
export caliperInnerEdgeRadius = 0.12
|
||||
export caliperInnerEdgeRadius = 0.12
|
||||
|
@ -1,11 +1,9 @@
|
||||
// Lug Nut
|
||||
// lug Nuts are essential components used to create secure connections, whether for electrical purposes, like terminating wires or grounding, or for mechanical purposes, such as providing mounting points or reinforcing structural joints.
|
||||
|
||||
|
||||
// Set units
|
||||
@settings(defaultLengthUnit = in)
|
||||
|
||||
|
||||
// Import Constants
|
||||
import lugDiameter, lugHeadLength, lugThreadDiameter, lugLength, lugThreadDepth, lugSpacing from "globals.kcl"
|
||||
|
||||
|
@ -4,24 +4,24 @@
|
||||
// Set units
|
||||
@settings(defaultLengthUnit = in)
|
||||
|
||||
import 'car-wheel.kcl' as carWheel
|
||||
import 'car-rotor.kcl' as carRotor
|
||||
import "car-wheel.kcl" as carWheel
|
||||
import "car-rotor.kcl" as carRotor
|
||||
import "brake-caliper.kcl" as brakeCaliper
|
||||
import 'lug-nut.kcl' as lugNut
|
||||
import 'car-tire.kcl' as carTire
|
||||
import lugCount from 'globals.kcl'
|
||||
import "lug-nut.kcl" as lugNut
|
||||
import "car-tire.kcl" as carTire
|
||||
import lugCount from "globals.kcl"
|
||||
|
||||
carRotor
|
||||
|> translate(translate = [0, 0.5, 0])
|
||||
|> translate(x = 0, y = 0.5, z = 0)
|
||||
carWheel
|
||||
lugNut
|
||||
|> patternCircular3d(
|
||||
arcDegrees = 360,
|
||||
axis = [0, 1, 0],
|
||||
center = [0, 0, 0],
|
||||
instances = lugCount,
|
||||
rotateDuplicates = false
|
||||
)
|
||||
arcDegrees = 360,
|
||||
axis = [0, 1, 0],
|
||||
center = [0, 0, 0],
|
||||
instances = lugCount,
|
||||
rotateDuplicates = false,
|
||||
)
|
||||
brakeCaliper
|
||||
|> translate(translate = [0, 0.5, 0])
|
||||
|> translate(x = 0, y = 0.5, z = 0)
|
||||
carTire
|
||||
|
@ -6,42 +6,42 @@
|
||||
|
||||
// Globals referenced in drawRectangle
|
||||
size = 100
|
||||
halfSize = size/2
|
||||
halfSize = size / 2
|
||||
extrudeLength = 1.0
|
||||
metalConstant = 50
|
||||
roughnessConstant = 50
|
||||
|
||||
// Create planes for 6 sides of a cube
|
||||
bluePlane = offsetPlane('XY', offset = halfSize)
|
||||
yellowPlane = offsetPlane('XY', offset = -halfSize)
|
||||
greenPlane = offsetPlane('XZ', offset = -halfSize)
|
||||
purplePlane = offsetPlane('-XZ', offset = -halfSize)
|
||||
redPlane = offsetPlane('YZ', offset = halfSize - extrudeLength)
|
||||
tealPlane = offsetPlane('YZ', offset = -halfSize)
|
||||
bluePlane = offsetPlane(XY, offset = halfSize)
|
||||
yellowPlane = offsetPlane(XY, offset = -halfSize)
|
||||
greenPlane = offsetPlane(XZ, offset = -halfSize)
|
||||
purplePlane = offsetPlane(-XZ, offset = -halfSize)
|
||||
redPlane = offsetPlane(YZ, offset = halfSize - extrudeLength)
|
||||
tealPlane = offsetPlane(YZ, offset = -halfSize)
|
||||
|
||||
// Sketch a rectangle centered at the origin of the profile
|
||||
fn sketchRectangle (profile, color) {
|
||||
fn sketchRectangle(profile, color) {
|
||||
return profile
|
||||
|> startProfileAt([-halfSize, halfSize], %)
|
||||
|> angledLine([0, size], %, $rectangleSegmentA001)
|
||||
|> angledLine([
|
||||
segAng(rectangleSegmentA001) - 90,
|
||||
size
|
||||
], %, $rectangleSegmentB001)
|
||||
|> angledLine([
|
||||
segAng(rectangleSegmentA001),
|
||||
-segLen(rectangleSegmentA001)
|
||||
], %, $rectangleSegmentC001)
|
||||
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||
|> close()
|
||||
|> extrude(%, length = extrudeLength)
|
||||
|> appearance(color = color, metalness = metalConstant, roughness = roughnessConstant)
|
||||
|> startProfileAt([-halfSize, halfSize], %)
|
||||
|> angledLine([0, size], %, $rectangleSegmentA001)
|
||||
|> angledLine([
|
||||
segAng(rectangleSegmentA001) - 90,
|
||||
size
|
||||
], %, $rectangleSegmentB001)
|
||||
|> angledLine([
|
||||
segAng(rectangleSegmentA001),
|
||||
-segLen(rectangleSegmentA001)
|
||||
], %, $rectangleSegmentC001)
|
||||
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||
|> close()
|
||||
|> extrude(%, length = extrudeLength)
|
||||
|> appearance(color = color, metalness = metalConstant, roughness = roughnessConstant)
|
||||
}
|
||||
|
||||
// Sketch each side of the cube
|
||||
sketchRectangle(bluePlane,'#0000FF')
|
||||
sketchRectangle(yellowPlane,'#FFFF00')
|
||||
sketchRectangle(greenPlane,'#00FF00')
|
||||
sketchRectangle(redPlane,'#FF0000')
|
||||
sketchRectangle(tealPlane,'#00FFFF')
|
||||
sketchRectangle(purplePlane,'#FF00FF')
|
||||
sketchRectangle(bluePlane, '#0000FF')
|
||||
sketchRectangle(yellowPlane, '#FFFF00')
|
||||
sketchRectangle(greenPlane, '#00FF00')
|
||||
sketchRectangle(redPlane, '#FF0000')
|
||||
sketchRectangle(tealPlane, '#00FFFF')
|
||||
sketchRectangle(purplePlane, '#FF00FF')
|
||||
|
@ -4,12 +4,11 @@
|
||||
// Set Units
|
||||
@settings(defaultLengthUnit = in)
|
||||
|
||||
|
||||
fn cycloidalGear(gearPitch, gearHeight, holeDiameter, helixAngle) {
|
||||
// Create a function to draw the gear profile as a sketch. Rotate each profile about the gear's axis by an helix angle proportional to the total gear height
|
||||
fn gearSketch(gHeight) {
|
||||
helixAngleP = helixAngle * gHeight / gearHeight
|
||||
gearProfile = startSketchOn(offsetPlane("XY", offset = gHeight))
|
||||
gearProfile = startSketchOn(offsetPlane(XY, offset = gHeight))
|
||||
|> startProfileAt([
|
||||
gearPitch * 1.55 * cos(toRadians(helixAngleP)) + gearPitch * sin(toRadians(-helixAngleP)),
|
||||
gearPitch * 1.55 * sin(toRadians(helixAngleP)) + gearPitch * cos(toRadians(-helixAngleP))
|
||||
@ -31,10 +30,7 @@ fn cycloidalGear(gearPitch, gearHeight, holeDiameter, helixAngle) {
|
||||
|> tangentialArc({ radius = gearPitch, offset = -180 }, %)
|
||||
|> tangentialArcTo([profileStartX(%), profileStartY(%)], %)
|
||||
|> close(%)
|
||||
|> hole(circle(
|
||||
center = [0, 0],
|
||||
radius = holeDiameter / 2
|
||||
), %)
|
||||
|> hole(circle(center = [0, 0], radius = holeDiameter / 2), %)
|
||||
return gearProfile
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,7 @@ plane = {
|
||||
}
|
||||
|
||||
// Create a regular pentagon inscribed in a circle of radius pentR
|
||||
bottomFace = startSketchOn('XY')
|
||||
bottomFace = startSketchOn(XY)
|
||||
|> polygon({
|
||||
radius = pentR,
|
||||
numSides = 5,
|
||||
@ -66,7 +66,7 @@ bottomBowl = patternCircular3d(
|
||||
axis = [0, 0, 1],
|
||||
center = [0, 0, 0],
|
||||
arcDegrees = 360,
|
||||
rotateDuplicates = true
|
||||
rotateDuplicates = true,
|
||||
)
|
||||
|
||||
// pattern the bottom to create the top face
|
||||
@ -76,7 +76,7 @@ patternCircular3d(
|
||||
axis = [0, 1, 0],
|
||||
center = [0, 0, inscR],
|
||||
arcDegrees = 360,
|
||||
rotateDuplicates = true
|
||||
rotateDuplicates = true,
|
||||
)
|
||||
|
||||
// pattern the bottom angled faces to create the top
|
||||
@ -86,5 +86,5 @@ patternCircular3d(
|
||||
axis = [0, 1, 0],
|
||||
center = [0, 0, inscR],
|
||||
arcDegrees = 360,
|
||||
rotateDuplicates = true
|
||||
rotateDuplicates = true,
|
||||
)
|
||||
|
200
public/kcl-samples/dual-basin-utility-sink/main.kcl
Normal file
@ -0,0 +1,200 @@
|
||||
// Dual-Basin Utility Sink
|
||||
// A stainless steel sink unit with dual rectangular basins and six under-counter storage compartments.
|
||||
|
||||
@settings(defaultLengthUnit = mm)
|
||||
|
||||
// globals
|
||||
tableHeight = 850
|
||||
tableWidth = 3400
|
||||
tableDepth = 400
|
||||
|
||||
profileThickness = 13
|
||||
metalThickness = 2
|
||||
|
||||
blockCount = 3
|
||||
blockWidth = (tableWidth-profileThickness) / 3
|
||||
blockHeight = tableHeight - metalThickness - 0.5
|
||||
blockDepth = tableDepth - profileThickness
|
||||
|
||||
blockSubdivisionCount = 2
|
||||
blockSubdivisionWidth = blockWidth / blockSubdivisionCount
|
||||
|
||||
// Geometry
|
||||
floorPlane = startSketchOn(XY)
|
||||
|
||||
// legs
|
||||
legHeight = blockHeight - profileThickness
|
||||
legCount = blockCount + 1
|
||||
|
||||
legBody = startProfileAt([0, 0], floorPlane)
|
||||
|> yLine(length=profileThickness)
|
||||
|> xLine(length=profileThickness)
|
||||
|> yLine(length=-profileThickness)
|
||||
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||
|> close()
|
||||
|> patternLinear2d(axis = [1, 0], instances = legCount, distance = blockWidth)
|
||||
|> patternLinear2d(axis = [0, 1], instances = 2, distance = blockDepth)
|
||||
|> extrude(length = legHeight)
|
||||
|
||||
// lower belt
|
||||
lowerBeltHeightAboveTheFloor = 150
|
||||
lowerBeltLengthX = blockWidth - profileThickness
|
||||
|
||||
lowerBeltPlane = startSketchOn(offsetPlane(XY, offset = lowerBeltHeightAboveTheFloor))
|
||||
lowerBeltBodyX = startProfileAt([profileThickness, 0], lowerBeltPlane)
|
||||
|> yLine(length=profileThickness)
|
||||
|> xLine(length=lowerBeltLengthX)
|
||||
|> yLine(length=-profileThickness)
|
||||
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||
|> close()
|
||||
|> patternLinear2d(axis = [1, 0], instances = blockCount, distance = blockWidth)
|
||||
|> patternLinear2d(axis = [0, 1], instances = 2, distance = blockDepth)
|
||||
|> extrude(length = profileThickness)
|
||||
|
||||
lowerBeltLengthY = blockDepth - profileThickness
|
||||
lowerBeltBodyY = startProfileAt([0, profileThickness], lowerBeltPlane)
|
||||
|> yLine(length=lowerBeltLengthY)
|
||||
|> xLine(length=profileThickness)
|
||||
|> yLine(length=-lowerBeltLengthY)
|
||||
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||
|> close()
|
||||
|> patternLinear2d(axis = [1, 0], instances = 2, distance = tableWidth-profileThickness)
|
||||
|> extrude(length = profileThickness)
|
||||
|
||||
// pillars
|
||||
pillarHeightAboveTheFloor = lowerBeltHeightAboveTheFloor + profileThickness
|
||||
pillarPlane = startSketchOn(offsetPlane(XY, offset = pillarHeightAboveTheFloor))
|
||||
pillarTotalHeight = blockHeight - profileThickness - pillarHeightAboveTheFloor
|
||||
|
||||
pillarBody = startProfileAt([blockSubdivisionWidth, 0], pillarPlane)
|
||||
|> yLine(length=profileThickness)
|
||||
|> xLine(length=profileThickness)
|
||||
|> yLine(length=-profileThickness)
|
||||
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||
|> close()
|
||||
|> patternLinear2d(axis = [1, 0], instances = blockCount, distance = blockWidth)
|
||||
|> patternLinear2d(axis = [0, 1], instances = 2, distance = blockDepth)
|
||||
|> extrude(length = pillarTotalHeight)
|
||||
|
||||
// upper belt
|
||||
upperBeltPlane = startSketchOn(offsetPlane(XY, offset = blockHeight))
|
||||
|
||||
upperBeltBodyX = startProfileAt([0, 0], upperBeltPlane)
|
||||
|> yLine(length=profileThickness)
|
||||
|> xLine(length=tableWidth)
|
||||
|> yLine(length=-profileThickness)
|
||||
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||
|> close()
|
||||
|> patternLinear2d(axis = [0, 1], instances = 2, distance = blockDepth)
|
||||
|> extrude(length = -profileThickness)
|
||||
|
||||
upperBeltLengthY = blockDepth - profileThickness
|
||||
upperBeltBodyY = startProfileAt([0, profileThickness], upperBeltPlane)
|
||||
|> yLine(length=upperBeltLengthY)
|
||||
|> xLine(length=profileThickness)
|
||||
|> yLine(length=-upperBeltLengthY)
|
||||
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||
|> close()
|
||||
|> patternLinear2d(axis = [1, 0], instances = 2, distance = tableWidth-profileThickness)
|
||||
|> extrude(length = -profileThickness)
|
||||
|
||||
// sink
|
||||
tableTopPlane = startSketchOn(offsetPlane(XY, offset = tableHeight))
|
||||
tableTopBody = startProfileAt([0, 0], tableTopPlane)
|
||||
|> yLine(length=tableDepth)
|
||||
|> xLine(length=tableWidth)
|
||||
|> yLine(length=-tableDepth)
|
||||
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||
|> close()
|
||||
|> extrude(length = -metalThickness)
|
||||
|
||||
sinkCount = 2
|
||||
sinkWidth = 1000
|
||||
sinkLength = 250
|
||||
sinkDepth = 200
|
||||
sinkOffsetFront = 40
|
||||
sinkOffsetLeft = 350
|
||||
sinkSpacing = tableWidth - sinkWidth - sinkOffsetLeft*2
|
||||
|
||||
sinkPlaneOutside = startSketchOn(tableTopBody, 'START')
|
||||
sinkBodyOutside = startProfileAt([-sinkOffsetLeft, sinkOffsetFront], sinkPlaneOutside)
|
||||
|> yLine(length=sinkLength)
|
||||
|> xLine(length=-sinkWidth)
|
||||
|> yLine(length=-sinkLength)
|
||||
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||
|> close()
|
||||
|> patternLinear2d(axis = [-1, 0], instances = sinkCount, distance = sinkSpacing)
|
||||
|> extrude(length = sinkDepth)
|
||||
|
||||
sinkPlaneInside = startSketchOn(tableTopBody, 'END')
|
||||
sinkBodyInside = startProfileAt([sinkOffsetLeft+metalThickness, sinkOffsetFront+metalThickness], sinkPlaneInside)
|
||||
|> yLine(length=sinkLength-metalThickness*2)
|
||||
|> xLine(length=sinkWidth-metalThickness*2)
|
||||
|> yLine(length=-sinkLength+metalThickness*2)
|
||||
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||
|> close()
|
||||
|> patternLinear2d(axis = [1, 0], instances = sinkCount, distance = sinkSpacing)
|
||||
|> extrude(length = -sinkDepth)
|
||||
|
||||
// door panels
|
||||
doorGap = 2
|
||||
doorWidth = blockSubdivisionWidth - profileThickness - doorGap*2
|
||||
doorStart = profileThickness+doorGap
|
||||
doorHeightAboveTheFloor = pillarHeightAboveTheFloor + doorGap
|
||||
doorHeight = blockHeight - doorHeightAboveTheFloor - profileThickness - doorGap
|
||||
doorCount = blockCount * blockSubdivisionCount
|
||||
|
||||
doorPlane = startSketchOn(offsetPlane(XY, offset = doorHeightAboveTheFloor))
|
||||
doorBody = startProfileAt([doorStart, 0], doorPlane)
|
||||
|> yLine(length=profileThickness)
|
||||
|> xLine(length=doorWidth)
|
||||
|> yLine(length=-profileThickness)
|
||||
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||
|> close()
|
||||
|> patternLinear2d(axis = [1, 0], instances = doorCount, distance = blockSubdivisionWidth)
|
||||
|> extrude(length = doorHeight)
|
||||
|
||||
// side panels
|
||||
panelWidth = blockDepth - profileThickness - doorGap*2
|
||||
panelCount = doorCount + 1
|
||||
panelSpacing = tableWidth - profileThickness
|
||||
panelBody = startProfileAt([0, doorStart], doorPlane)
|
||||
|> yLine(length=panelWidth)
|
||||
|> xLine(length=profileThickness)
|
||||
|> yLine(length=-panelWidth)
|
||||
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||
|> close()
|
||||
|> patternLinear2d(axis = [1, 0], instances = 2, distance = panelSpacing)
|
||||
|> extrude(length = doorHeight)
|
||||
|
||||
// handle
|
||||
handleDepth = 40
|
||||
handleWidth = 120
|
||||
handleFillet = 20
|
||||
handleHeightAboveTheFloor = 780
|
||||
handleOffset = doorStart + doorWidth / 2 - (handleWidth / 2)
|
||||
handleLengthSegmentA = handleDepth - handleFillet
|
||||
handleLengthSegmentB = handleWidth - (handleFillet * 2)
|
||||
|
||||
handlePlane = startSketchOn(offsetPlane(XY, offset = handleHeightAboveTheFloor))
|
||||
|
||||
handleProfilePath = startProfileAt([0 + handleOffset, 0], handlePlane)
|
||||
|> yLine(length=-handleLengthSegmentA)
|
||||
|> tangentialArcTo([
|
||||
handleFillet + handleOffset,
|
||||
-handleDepth
|
||||
], %)
|
||||
|> xLine(length=handleLengthSegmentB)
|
||||
|> tangentialArcTo([
|
||||
handleOffset + handleWidth,
|
||||
-handleLengthSegmentA
|
||||
], %)
|
||||
|> yLine(length=handleLengthSegmentA)
|
||||
handleSectionPlane = startSketchOn(XZ)
|
||||
handleProfileSection = circle(
|
||||
handleSectionPlane,
|
||||
center = [handleOffset, handleHeightAboveTheFloor],
|
||||
radius = 2)
|
||||
|
||||
handleBody = sweep(handleProfileSection, path = handleProfilePath)
|
||||
|> patternLinear3d(axis = [1, 0, 0], instances = doorCount, distance = blockSubdivisionWidth)
|
@ -11,7 +11,7 @@ wallThickness = 3
|
||||
holeDia = 4
|
||||
|
||||
// Model a box with base enclosure dimensions
|
||||
sketch001 = startSketchOn('XY')
|
||||
sketch001 = startSketchOn(XY)
|
||||
|> startProfileAt([0, 0], %)
|
||||
|> angledLine([0, width], %, $rectangleSegmentA001)
|
||||
|> angledLine([
|
||||
@ -32,14 +32,11 @@ extrude001 = extrude(sketch001, length = height)
|
||||
getNextAdjacentEdge(rectangleSegmentB001),
|
||||
getNextAdjacentEdge(rectangleSegmentC001),
|
||||
getNextAdjacentEdge(rectangleSegmentD001)
|
||||
]
|
||||
],
|
||||
)
|
||||
|
||||
// Apply a shell to the enclosure base to create the internal storage
|
||||
|> shell(
|
||||
faces = ["end"],
|
||||
thickness = wallThickness
|
||||
)
|
||||
|> shell(faces = ["end"], thickness = wallThickness)
|
||||
|
||||
// Define a function to create the internal structure to secure a fastener at each corner
|
||||
fn function001(originStart) {
|
||||
@ -55,14 +52,8 @@ fn function001(originStart) {
|
||||
|
||||
// Create a pillar with a fasterner hole at the center
|
||||
sketch002 = startSketchOn(plane001)
|
||||
|> circle(
|
||||
center = [originStart[0], originStart[1]],
|
||||
radius = holeDia + wallThickness
|
||||
)
|
||||
|> hole(circle(
|
||||
center = [originStart[0], originStart[1]],
|
||||
radius = holeDia
|
||||
), %)
|
||||
|> circle(center = [originStart[0], originStart[1]], radius = holeDia + wallThickness)
|
||||
|> hole(circle(center = [originStart[0], originStart[1]], radius = holeDia), %)
|
||||
extrude002 = extrude(sketch002, length = height - wallThickness)
|
||||
|
||||
return extrude002
|
||||
@ -87,7 +78,7 @@ function001([
|
||||
])
|
||||
|
||||
// Define lid position and outer surface
|
||||
sketch003 = startSketchOn('XY')
|
||||
sketch003 = startSketchOn(XY)
|
||||
|> startProfileAt([width * 1.2, 0], %)
|
||||
|> angledLine([0, width], %, $rectangleSegmentA002)
|
||||
|> angledLine([
|
||||
@ -105,28 +96,28 @@ sketch003 = startSketchOn('XY')
|
||||
width * 1.2 + wallThickness * 3 + holeDia,
|
||||
wallThickness * 3 + holeDia
|
||||
],
|
||||
radius = holeDia
|
||||
radius = holeDia,
|
||||
), %)
|
||||
|> hole(circle(
|
||||
center = [
|
||||
width * 1.2 + wallThickness * 3 + holeDia,
|
||||
length - (wallThickness * 3 + holeDia)
|
||||
],
|
||||
radius = holeDia
|
||||
radius = holeDia,
|
||||
), %)
|
||||
|> hole(circle(
|
||||
center = [
|
||||
width * 2.2 - (wallThickness * 3 + holeDia),
|
||||
wallThickness * 3 + holeDia
|
||||
],
|
||||
radius = holeDia
|
||||
radius = holeDia,
|
||||
), %)
|
||||
|> hole(circle(
|
||||
center = [
|
||||
width * 2.2 - (wallThickness * 3 + holeDia),
|
||||
length - (wallThickness * 3 + holeDia)
|
||||
],
|
||||
radius = holeDia
|
||||
radius = holeDia,
|
||||
), %)
|
||||
extrude003 = extrude(sketch003, length = wallThickness)
|
||||
|> fillet(
|
||||
@ -136,7 +127,7 @@ extrude003 = extrude(sketch003, length = wallThickness)
|
||||
getNextAdjacentEdge(rectangleSegmentB002),
|
||||
getNextAdjacentEdge(rectangleSegmentC002),
|
||||
getNextAdjacentEdge(rectangleSegmentD002)
|
||||
]
|
||||
],
|
||||
)
|
||||
|
||||
// Define lid inner and sealing surfaces
|
||||
@ -161,28 +152,28 @@ sketch004 = startSketchOn(extrude003, 'END')
|
||||
width * 1.2 + wallThickness * 3 + holeDia,
|
||||
wallThickness * 3 + holeDia
|
||||
],
|
||||
radius = holeDia + wallThickness
|
||||
radius = holeDia + wallThickness,
|
||||
), %)
|
||||
|> hole(circle(
|
||||
center = [
|
||||
width * 1.2 + wallThickness * 3 + holeDia,
|
||||
length - (wallThickness * 3 + holeDia)
|
||||
],
|
||||
radius = holeDia + wallThickness
|
||||
radius = holeDia + wallThickness,
|
||||
), %)
|
||||
|> hole(circle(
|
||||
center = [
|
||||
width * 2.2 - (wallThickness * 3 + holeDia),
|
||||
wallThickness * 3 + holeDia
|
||||
],
|
||||
radius = holeDia + wallThickness
|
||||
radius = holeDia + wallThickness,
|
||||
), %)
|
||||
|> hole(circle(
|
||||
center = [
|
||||
width * 2.2 - (wallThickness * 3 + holeDia),
|
||||
length - (wallThickness * 3 + holeDia)
|
||||
],
|
||||
radius = holeDia + wallThickness
|
||||
radius = holeDia + wallThickness,
|
||||
), %)
|
||||
extrude004 = extrude(sketch004, length = wallThickness)
|
||||
|> fillet(
|
||||
@ -192,5 +183,5 @@ extrude004 = extrude(sketch004, length = wallThickness)
|
||||
getNextAdjacentEdge(rectangleSegmentB003),
|
||||
getNextAdjacentEdge(rectangleSegmentC003),
|
||||
getNextAdjacentEdge(rectangleSegmentD003)
|
||||
]
|
||||
],
|
||||
)
|
||||
|
@ -45,15 +45,9 @@ fn primaryTube(n, angle001, length001, length002, length003) {
|
||||
}, %)
|
||||
|
||||
// Create the cross section of each tube and sweep them
|
||||
sweepProfile = startSketchOn('XY')
|
||||
|> circle(
|
||||
center = [pos001, 0],
|
||||
radius = primaryTubeDiameter / 2
|
||||
)
|
||||
|> hole(circle(
|
||||
center = [pos001, 0],
|
||||
radius = primaryTubeDiameter / 2 - wallThickness
|
||||
), %)
|
||||
sweepProfile = startSketchOn(XY)
|
||||
|> circle(center = [pos001, 0], radius = primaryTubeDiameter / 2)
|
||||
|> hole(circle(center = [pos001, 0], radius = primaryTubeDiameter / 2 - wallThickness), %)
|
||||
|> sweep(path = sweepPath)
|
||||
|
||||
return { }
|
||||
@ -66,7 +60,7 @@ primaryTube(2, 24.3, 5, 5, 3)
|
||||
primaryTube(3, 25.2, 5, 5, 3)
|
||||
|
||||
// Create the mounting flange for the header
|
||||
flangeSketch = startSketchOn('XY')
|
||||
flangeSketch = startSketchOn(XY)
|
||||
|> startProfileAt([3 + 1.3, -1.25], %)
|
||||
|> xLine(length = -2.6, tag = $seg01)
|
||||
|> tangentialArc({ radius = .3, offset = -40 }, %)
|
||||
@ -87,22 +81,10 @@ flangeSketch = startSketchOn('XY')
|
||||
|> close()
|
||||
|
||||
// Create openings in the flange to accommodate each tube
|
||||
|> hole(circle(
|
||||
center = [0, 0],
|
||||
radius = primaryTubeDiameter / 2 - wallThickness
|
||||
), %)
|
||||
|> hole(circle(
|
||||
center = [2, 0],
|
||||
radius = primaryTubeDiameter / 2 - wallThickness
|
||||
), %)
|
||||
|> hole(circle(
|
||||
center = [4, 0],
|
||||
radius = primaryTubeDiameter / 2 - wallThickness
|
||||
), %)
|
||||
|> hole(circle(
|
||||
center = [6, 0],
|
||||
radius = primaryTubeDiameter / 2 - wallThickness
|
||||
), %)
|
||||
|> hole(circle(center = [0, 0], radius = primaryTubeDiameter / 2 - wallThickness), %)
|
||||
|> hole(circle(center = [2, 0], radius = primaryTubeDiameter / 2 - wallThickness), %)
|
||||
|> hole(circle(center = [4, 0], radius = primaryTubeDiameter / 2 - wallThickness), %)
|
||||
|> hole(circle(center = [6, 0], radius = primaryTubeDiameter / 2 - wallThickness), %)
|
||||
|
||||
// Add mounting holes to the flange
|
||||
|> hole(circle(
|
||||
@ -110,28 +92,28 @@ flangeSketch = startSketchOn('XY')
|
||||
-primaryTubeDiameter * .6,
|
||||
-primaryTubeDiameter * .6
|
||||
],
|
||||
radius = 0.25 / 2
|
||||
radius = 0.25 / 2,
|
||||
), %)
|
||||
|> hole(circle(
|
||||
center = [
|
||||
primaryTubeDiameter * .6,
|
||||
primaryTubeDiameter * .6
|
||||
],
|
||||
radius = 0.25 / 2
|
||||
radius = 0.25 / 2,
|
||||
), %)
|
||||
|> hole(circle(
|
||||
center = [
|
||||
3 * 2 - (primaryTubeDiameter * .6),
|
||||
primaryTubeDiameter * .6
|
||||
],
|
||||
radius = 0.25 / 2
|
||||
radius = 0.25 / 2,
|
||||
), %)
|
||||
|> hole(circle(
|
||||
center = [
|
||||
3 * 2 + primaryTubeDiameter * .6,
|
||||
-primaryTubeDiameter * .6
|
||||
],
|
||||
radius = 0.25 / 2
|
||||
radius = 0.25 / 2,
|
||||
), %)
|
||||
|
||||
// Extrude the flange and fillet the edges
|
||||
@ -141,12 +123,12 @@ flangeSketch = startSketchOn('XY')
|
||||
tags = [
|
||||
getNextAdjacentEdge(seg04),
|
||||
getNextAdjacentEdge(seg07)
|
||||
]
|
||||
],
|
||||
)
|
||||
|> fillet(
|
||||
radius = .25,
|
||||
tags = [
|
||||
getNextAdjacentEdge(seg03),
|
||||
getNextAdjacentEdge(seg08)
|
||||
]
|
||||
],
|
||||
)
|
||||
|
@ -21,44 +21,32 @@ nHoles = 4
|
||||
assertGreaterThan(nHoles, 1, "nHoles must be greater than 1")
|
||||
|
||||
// Create the circular pattern for the mounting holes
|
||||
circles = startSketchOn('XY')
|
||||
|> circle(
|
||||
center = [mountingHolePlacementDiameter / 2, 0],
|
||||
radius = mountingHoleDia / 2
|
||||
)
|
||||
circles = startSketchOn(XY)
|
||||
|> circle(center = [mountingHolePlacementDiameter / 2, 0], radius = mountingHoleDia / 2)
|
||||
|> patternCircular2d(
|
||||
arcDegrees = 360,
|
||||
center = [0, 0],
|
||||
instances = nHoles,
|
||||
rotateDuplicates = true
|
||||
rotateDuplicates = true,
|
||||
)
|
||||
|
||||
// Create the base of the flange and add the mounting holes
|
||||
flangeBase = startSketchOn('XY')
|
||||
|> circle(
|
||||
center = [0, 0],
|
||||
radius = baseDia / 2
|
||||
)
|
||||
flangeBase = startSketchOn(XY)
|
||||
|> circle(center = [0, 0], radius = baseDia / 2)
|
||||
|> hole(circles, %)
|
||||
|> extrude(length = baseThickness)
|
||||
|
||||
// Create the extrusion on the top of the flange base
|
||||
topExtrusion = startSketchOn(flangeBase, 'end')
|
||||
|> circle(
|
||||
center = [0, 0],
|
||||
radius = topTotalDiameter / 2
|
||||
)
|
||||
|> circle(center = [0, 0], radius = topTotalDiameter / 2)
|
||||
|> extrude(length = topTotalThickness)
|
||||
|
||||
// Create the extrusion on the bottom of the flange base
|
||||
bottomExtrusion = startSketchOn(flangeBase, 'start')
|
||||
|> circle(
|
||||
center = [0, 0],
|
||||
radius = bottomTotalDiameter / 2
|
||||
)
|
||||
|> circle(center = [0, 0], radius = bottomTotalDiameter / 2)
|
||||
|> extrude(length = bottomThickness)
|
||||
|
||||
// Cut a hole through the entire body
|
||||
pipeHole = startSketchOn(topExtrusion, 'end')
|
||||
|> circle(center = [0, 0], radius = pipeDia/2)
|
||||
|> circle(center = [0, 0], radius = pipeDia / 2)
|
||||
|> extrude(%, length = -(topTotalThickness + baseThickness + bottomThickness))
|
||||
|
@ -62,7 +62,7 @@ bracketBody = bs
|
||||
getPreviousAdjacentEdge(bs.tags.edge2),
|
||||
getPreviousAdjacentEdge(bs.tags.edge3),
|
||||
getPreviousAdjacentEdge(bs.tags.edge6)
|
||||
]
|
||||
],
|
||||
)
|
||||
|
||||
// define the tab plane
|
||||
@ -87,7 +87,7 @@ tabsR = startSketchOn(tabPlane)
|
||||
width / 2 + thk + tabWidth / 2,
|
||||
length / 2 + thk - (tabLength / (3 / 2))
|
||||
],
|
||||
radius = holeDiam / 2
|
||||
radius = holeDiam / 2,
|
||||
), %)
|
||||
|> extrude(length = -tabThk)
|
||||
|> fillet(
|
||||
@ -95,13 +95,9 @@ tabsR = startSketchOn(tabPlane)
|
||||
tags = [
|
||||
getNextAdjacentEdge(edge11),
|
||||
getNextAdjacentEdge(edge12)
|
||||
]
|
||||
)
|
||||
|> patternLinear3d(
|
||||
axis = [0, -1, 0],
|
||||
instances = 2,
|
||||
distance = length + 2 * thk - (tabLength * 4 / 3)
|
||||
],
|
||||
)
|
||||
|> patternLinear3d(axis = [0, -1, 0], instances = 2, distance = length + 2 * thk - (tabLength * 4 / 3))
|
||||
|
||||
// build the tabs of the mounting bracket (left side)
|
||||
tabsL = startSketchOn(tabPlane)
|
||||
@ -115,7 +111,7 @@ tabsL = startSketchOn(tabPlane)
|
||||
-width / 2 - thk - (tabWidth / 2),
|
||||
length / 2 + thk - (tabLength / (3 / 2))
|
||||
],
|
||||
radius = holeDiam / 2
|
||||
radius = holeDiam / 2,
|
||||
), %)
|
||||
|> extrude(length = -tabThk)
|
||||
|> fillet(
|
||||
@ -123,13 +119,9 @@ tabsL = startSketchOn(tabPlane)
|
||||
tags = [
|
||||
getNextAdjacentEdge(edge21),
|
||||
getNextAdjacentEdge(edge22)
|
||||
]
|
||||
)
|
||||
|> patternLinear3d(
|
||||
axis = [0, -1, 0],
|
||||
instances = 2,
|
||||
distance = length + 2 * thk - (tabLength * 4 / 3)
|
||||
],
|
||||
)
|
||||
|> patternLinear3d(axis = [0, -1, 0], instances = 2, distance = length + 2 * thk - (tabLength * 4 / 3))
|
||||
|
||||
// define a plane for retention bumps
|
||||
retPlane = {
|
||||
|
@ -44,7 +44,7 @@ fn slot(sketch1, start, end, width) {
|
||||
}
|
||||
|
||||
// create a sketch on the "XY" plane
|
||||
sketch000 = startSketchOn('XY')
|
||||
sketch000 = startSketchOn(XY)
|
||||
|
||||
// create a profile of the flipper
|
||||
flipperProfile = startProfileAt([-flipperLength, -32.0], sketch000)
|
||||
@ -83,11 +83,11 @@ fillet(
|
||||
tags = [
|
||||
getNextAdjacentEdge(backEdge),
|
||||
getPreviousAdjacentEdge(backEdge)
|
||||
]
|
||||
],
|
||||
)
|
||||
|
||||
// create a sketch on the "XZ" plane offset by half the thickness
|
||||
sketch001 = startSketchOn(offsetPlane("XZ", offset = -handleWidth / 2))
|
||||
sketch001 = startSketchOn(offsetPlane(XZ, offset = -handleWidth / 2))
|
||||
|
||||
// create a profile of the spatula handle
|
||||
handleProfile = startProfileAt([0.0, flipperThickness], sketch001)
|
||||
@ -109,7 +109,7 @@ fillet(
|
||||
tags = [
|
||||
getNextAdjacentEdge(handleBottomEdge),
|
||||
getNextAdjacentEdge(handleTopEdge)
|
||||
]
|
||||
],
|
||||
)
|
||||
|
||||
// define a plane which is at the end of the handle
|
||||
@ -163,4 +163,4 @@ sketch003 = startSketchOn(grip, gripEdgeTop)
|
||||
gripHoleProfile = slot(sketch003, [0, 200], [0, 210], gripSlotWidth)
|
||||
|
||||
// cut a hole in the grip
|
||||
extrude(gripHoleProfile, length = -gripWidth-20)
|
||||
extrude(gripHoleProfile, length = -gripWidth - 20)
|
||||
|
@ -10,7 +10,7 @@ carafeHeight = 7.32
|
||||
handleThickness = 0.65
|
||||
|
||||
// Upper ring of the metal structure
|
||||
sketch001 = startSketchOn('XZ')
|
||||
sketch001 = startSketchOn(XZ)
|
||||
|> startProfileAt([carafeDiameter / 2, 5.7], %)
|
||||
|> angledLine([0, 0.1], %, $rectangleSegmentA001)
|
||||
|> angledLine([
|
||||
@ -91,15 +91,12 @@ sketch002 = startSketchOn(plane001)
|
||||
center = [0, 0, 0],
|
||||
instances = 4,
|
||||
arcDegrees = 360,
|
||||
rotateDuplicates = true
|
||||
rotateDuplicates = true,
|
||||
)
|
||||
|
||||
// Cross plate
|
||||
sketch003 = startSketchOn(offsetPlane('XY', offset = 1))
|
||||
|> circle(
|
||||
center = [0, 0],
|
||||
radius = carafeDiameter / 2 - 0.15
|
||||
)
|
||||
sketch003 = startSketchOn(offsetPlane(XY, offset = 1))
|
||||
|> circle(center = [0, 0], radius = carafeDiameter / 2 - 0.15)
|
||||
|
||||
extrude001 = extrude(sketch003, length = 0.050)
|
||||
|
||||
@ -117,13 +114,13 @@ sketch004 = startSketchOn(extrude001, 'END')
|
||||
center = [0, 0],
|
||||
instances = 3,
|
||||
arcDegrees = 360,
|
||||
rotateDuplicates = true
|
||||
rotateDuplicates = true,
|
||||
)
|
||||
|
||||
extrude002 = extrude(sketch004, length = -0.050)
|
||||
|
||||
// Filter screen
|
||||
sketch005 = startSketchOn('XZ')
|
||||
sketch005 = startSketchOn(XZ)
|
||||
|> startProfileAt([0.15, 1.11], %)
|
||||
|> xLine(endAbsolute = carafeDiameter / 2 - 0.2)
|
||||
|> angledLineToX({
|
||||
@ -138,7 +135,7 @@ sketch005 = startSketchOn('XZ')
|
||||
|> revolve(axis = 'y')
|
||||
|
||||
// Plunger and stem
|
||||
sketch006 = startSketchOn('XZ')
|
||||
sketch006 = startSketchOn(XZ)
|
||||
|> startProfileAt([0.1, 1], %)
|
||||
|> line(end = [0.1, 0])
|
||||
|> angledLineToX({ angle = 10, to = 0.05 }, %)
|
||||
@ -151,11 +148,8 @@ sketch006 = startSketchOn('XZ')
|
||||
|> revolve(axis = 'y')
|
||||
|
||||
// Spiral plate
|
||||
sketch007 = startSketchOn(offsetPlane('XY', offset = 1.12))
|
||||
|> circle(
|
||||
center = [0, 0],
|
||||
radius = carafeDiameter / 2 - 0.24
|
||||
)
|
||||
sketch007 = startSketchOn(offsetPlane(XY, offset = 1.12))
|
||||
|> circle(center = [0, 0], radius = carafeDiameter / 2 - 0.24)
|
||||
|> hole(circle(center = [0, 0], radius = .15), %)
|
||||
|
||||
extrude003 = extrude(sketch007, length = 0.050)
|
||||
@ -167,7 +161,7 @@ sketch008 = startSketchOn(extrude003, 'END')
|
||||
center = [0, 0],
|
||||
instances = 8,
|
||||
arcDegrees = 360,
|
||||
rotateDuplicates = true
|
||||
rotateDuplicates = true,
|
||||
)
|
||||
|
||||
extrude004 = extrude(sketch008, length = -0.050)
|
||||
@ -179,24 +173,21 @@ sketch009 = startSketchOn(extrude003, 'END')
|
||||
center = [0, 0],
|
||||
instances = 4,
|
||||
arcDegrees = 360,
|
||||
rotateDuplicates = true
|
||||
rotateDuplicates = true,
|
||||
)
|
||||
|
||||
extrude005 = extrude(sketch009, length = -0.050)
|
||||
|
||||
// Extrude a glass carafe body
|
||||
sketch010 = startSketchOn("XY")
|
||||
|> circle(
|
||||
center = [0, 0],
|
||||
radius = carafeDiameter / 2
|
||||
)
|
||||
sketch010 = startSketchOn(XY)
|
||||
|> circle(center = [0, 0], radius = carafeDiameter / 2)
|
||||
|
||||
// Perform a shell operation to hollow the carafe body with the top face removed
|
||||
extrude006 = extrude(sketch010, length = carafeHeight)
|
||||
|> shell(faces = ["end"], thickness = .07)
|
||||
|
||||
// Draw and revolve the lid
|
||||
sketch011 = startSketchOn('XZ')
|
||||
sketch011 = startSketchOn(XZ)
|
||||
|> startProfileAt([0.2, carafeHeight - 0.7], %)
|
||||
|> xLine(length = carafeDiameter / 2 - 0.3)
|
||||
|> yLine(length = 0.7)
|
||||
@ -213,7 +204,7 @@ sketch011 = startSketchOn('XZ')
|
||||
|> revolve(axis = 'y')
|
||||
|
||||
// Draw and extrude handle
|
||||
sketch012 = startSketchOn(offsetPlane('XZ', offset = handleThickness / 2))
|
||||
sketch012 = startSketchOn(offsetPlane(XZ, offset = handleThickness / 2))
|
||||
|> startProfileAt([2.3, 6.4], %)
|
||||
|> line(end = [0.56, 0])
|
||||
|> tangentialArcTo([4.1, 5.26], %)
|
||||
|
@ -12,7 +12,7 @@ height = 12
|
||||
minHeight = 10.875
|
||||
|
||||
// Create the body of the rack
|
||||
rackBody = startSketchOn('XY')
|
||||
rackBody = startSketchOn(XY)
|
||||
|> startProfileAt([-length / 2, 0], %)
|
||||
|> line(end = [length, 0])
|
||||
|> line(end = [0, minHeight])
|
||||
@ -22,7 +22,7 @@ rackBody = startSketchOn('XY')
|
||||
|
||||
// Create a function for sketch of a single tooth
|
||||
fn tooth() {
|
||||
toothSketch = startSketchOn('XY')
|
||||
toothSketch = startSketchOn(XY)
|
||||
|> startProfileAt([-length / 2 + 0.567672, minHeight], %)
|
||||
|> tangentialArcToRelative([0.157636, 0.110378], %)
|
||||
|> line(end = [0.329118, 0.904244])
|
||||
@ -38,14 +38,10 @@ fn tooth() {
|
||||
|
||||
// Pattern the single tooth over the length of the rack body
|
||||
teeth = tooth()
|
||||
|> patternLinear3d(
|
||||
axis = [10, 0, 0],
|
||||
distance = 1.570796,
|
||||
instances = 63
|
||||
)
|
||||
|> patternLinear3d(axis = [10, 0, 0], distance = 1.570796, instances = 63)
|
||||
|
||||
// Sketch and extrude the first end cap. This is a partial tooth
|
||||
endCapTooth = startSketchOn('XY')
|
||||
endCapTooth = startSketchOn(XY)
|
||||
|> startProfileAt([-length / 2, 11.849525], %)
|
||||
|> line(end = [0.314524, -0.864147])
|
||||
|> tangentialArcToRelative([0.157636, -0.110378], %)
|
||||
@ -54,7 +50,7 @@ endCapTooth = startSketchOn('XY')
|
||||
|> extrude(length = width)
|
||||
|
||||
// Sketch and extrude the second end cap. This is a partial tooth
|
||||
endCapTooth2 = startSketchOn('XY')
|
||||
endCapTooth2 = startSketchOn(XY)
|
||||
|> startProfileAt([length / 2, 11.849525], %)
|
||||
|> line(end = [-0.314524, -0.864147])
|
||||
|> tangentialArcToRelative([-0.157636, -0.110378], %)
|
||||
|
@ -17,35 +17,32 @@ gearHeight = 3
|
||||
|
||||
// Interpolate points along the involute curve
|
||||
cmo = 101
|
||||
rs = map([0..cmo], fn (i) {
|
||||
rs = map([0..cmo], fn(i) {
|
||||
return baseDiameter / 2 + i / cmo * (tipDiameter - baseDiameter) / 2
|
||||
})
|
||||
|
||||
// Calculate operating pressure angle
|
||||
angles = map(rs, fn (r) {
|
||||
angles = map(rs, fn(r) {
|
||||
return toDegrees( acos(baseDiameter / 2 / r))
|
||||
})
|
||||
|
||||
// Calculate the involute function
|
||||
invas = map(angles, fn (a) {
|
||||
invas = map(angles, fn(a) {
|
||||
return tan(toRadians(a)) - toRadians(a)
|
||||
})
|
||||
|
||||
// Map the involute curve
|
||||
xs = map([0..cmo], fn (i) {
|
||||
xs = map([0..cmo], fn(i) {
|
||||
return rs[i] * cos(invas[i])
|
||||
})
|
||||
|
||||
ys = map([0..cmo], fn (i) {
|
||||
ys = map([0..cmo], fn(i) {
|
||||
return rs[i] * sin(invas[i])
|
||||
})
|
||||
|
||||
// Extrude the gear body
|
||||
body = startSketchOn('XY')
|
||||
|> circle(
|
||||
center = [0, 0],
|
||||
radius = baseDiameter / 2
|
||||
)
|
||||
body = startSketchOn(XY)
|
||||
|> circle(center = [0, 0], radius = baseDiameter / 2)
|
||||
|> extrude(length = gearHeight)
|
||||
|
||||
toothAngle = 360 / nTeeth / 1.5
|
||||
@ -63,7 +60,7 @@ fn rightInvolute(i, sg) {
|
||||
}
|
||||
|
||||
// Draw gear teeth
|
||||
start = startSketchOn('XY')
|
||||
start = startSketchOn(XY)
|
||||
|> startProfileAt([xs[101], ys[101]], %)
|
||||
teeth = reduce([0..100], start, leftInvolute)
|
||||
|> arc({
|
||||
@ -79,7 +76,7 @@ teeth = reduce([0..100], start, leftInvolute)
|
||||
center = [0, 0, 0],
|
||||
instances = nTeeth,
|
||||
arcDegrees = 360,
|
||||
rotateDuplicates = true
|
||||
rotateDuplicates = true,
|
||||
)
|
||||
|
||||
// Define the constants of the keyway and the bore hole
|
||||
|
@ -34,7 +34,7 @@ fn face(plane) {
|
||||
}
|
||||
|
||||
// extrude a single side of the bin
|
||||
singleSide = extrude(face(offsetPlane("YZ", offset = cornerRadius)), length = binLength - (cornerRadius * 2), )
|
||||
singleSide = extrude(face(offsetPlane(YZ, offset = cornerRadius)), length = binLength - (cornerRadius * 2))
|
||||
|
||||
// create the other sides of the bin by using a circular pattern
|
||||
sides = patternCircular3d(
|
||||
@ -43,7 +43,7 @@ sides = patternCircular3d(
|
||||
axis = [0, 0, 1],
|
||||
center = [binLength / 2, binLength / 2, 0],
|
||||
instances = 4,
|
||||
rotateDuplicates = true
|
||||
rotateDuplicates = true,
|
||||
)
|
||||
|
||||
// define an axis axis000
|
||||
@ -55,7 +55,7 @@ axis000 = {
|
||||
}
|
||||
|
||||
// create a single corner of the bin
|
||||
singleCorner = revolve(face(offsetPlane("YZ", offset = cornerRadius)), angle = -90, axis = axis000)
|
||||
singleCorner = revolve(face(offsetPlane(YZ, offset = cornerRadius)), angle = -90, axis = axis000)
|
||||
|
||||
// create the corners of the bin
|
||||
corners = patternCircular3d(
|
||||
@ -64,7 +64,7 @@ corners = patternCircular3d(
|
||||
axis = [0, 0, 1],
|
||||
center = [binLength / 2, binLength / 2, 0],
|
||||
instances = 4,
|
||||
rotateDuplicates = true
|
||||
rotateDuplicates = true,
|
||||
)
|
||||
|
||||
// create the baseplate by patterning sides
|
||||
@ -72,26 +72,18 @@ basePlateSides = patternLinear3d(
|
||||
sides,
|
||||
axis = [1.0, 0.0, 0.0],
|
||||
instances = countBinWidth,
|
||||
distance = binLength
|
||||
)
|
||||
|> patternLinear3d(
|
||||
axis = [0.0, 1.0, 0.0],
|
||||
instances = countBinLength,
|
||||
distance = binLength
|
||||
distance = binLength,
|
||||
)
|
||||
|> patternLinear3d(axis = [0.0, 1.0, 0.0], instances = countBinLength, distance = binLength)
|
||||
|
||||
// create the corners of the baseplate by patterning the corners
|
||||
basePlateCorners = patternLinear3d(
|
||||
corners,
|
||||
axis = [1.0, 0.0, 0.0],
|
||||
instances = countBinWidth,
|
||||
distance = binLength
|
||||
)
|
||||
|> patternLinear3d(
|
||||
axis = [0.0, 1.0, 0.0],
|
||||
instances = countBinLength,
|
||||
distance = binLength
|
||||
distance = binLength,
|
||||
)
|
||||
|> patternLinear3d(axis = [0.0, 1.0, 0.0], instances = countBinLength, distance = binLength)
|
||||
|
||||
// create the center cutout for the magnet profile
|
||||
fn magnetCenterCutout(plane) {
|
||||
@ -149,20 +141,17 @@ fn magnetBase(plane) {
|
||||
}
|
||||
|
||||
// create sketch profile sketch000Profile002
|
||||
magnetsSketch = startSketchOn('XY')
|
||||
|> circle(
|
||||
center = [cornerRadius * 2, cornerRadius * 2],
|
||||
radius = magOuterDiam / 2
|
||||
)
|
||||
magnetsSketch = startSketchOn(XY)
|
||||
|> circle(center = [cornerRadius * 2, cornerRadius * 2], radius = magOuterDiam / 2)
|
||||
|> patternCircular2d(
|
||||
center = [binLength / 2, binLength / 2],
|
||||
instances = 4,
|
||||
arcDegrees = 360,
|
||||
rotateDuplicates = true
|
||||
rotateDuplicates = true,
|
||||
)
|
||||
|
||||
// create a profile with holes for the magnets
|
||||
magnetProfile = magnetBase("XY")
|
||||
magnetProfile = magnetBase(XY)
|
||||
|> hole(magnetsSketch, %)
|
||||
|
||||
// create an extrusion of the magnet cutout with holes
|
||||
@ -177,11 +166,11 @@ magnetHolesExtrudeFillets = fillet(
|
||||
getPreviousAdjacentEdge(magnetHolesExtrude.sketch.tags.line001),
|
||||
getNextAdjacentEdge(magnetHolesExtrude.sketch.tags.line003),
|
||||
getPreviousAdjacentEdge(magnetHolesExtrude.sketch.tags.line003)
|
||||
]
|
||||
],
|
||||
)
|
||||
|
||||
// create a profile without the holes for the magnets
|
||||
magnetProfileNoMagnets = magnetBase(offsetPlane("XY", offset = -magDepth))
|
||||
magnetProfileNoMagnets = magnetBase(offsetPlane(XY, offset = -magDepth))
|
||||
|
||||
// create an extrusion of the magnet cutout without holes
|
||||
magnetCutoutExtrude = extrude(magnetProfileNoMagnets, length = -magDepth)
|
||||
@ -195,7 +184,7 @@ magnetCutoutExtrudeFillets = fillet(
|
||||
getPreviousAdjacentEdge(magnetCutoutExtrude.sketch.tags.line001),
|
||||
getNextAdjacentEdge(magnetCutoutExtrude.sketch.tags.line003),
|
||||
getPreviousAdjacentEdge(magnetCutoutExtrude.sketch.tags.line003)
|
||||
]
|
||||
],
|
||||
)
|
||||
|
||||
// pattern the magnet cutouts with holes
|
||||
@ -203,23 +192,15 @@ patternLinear3d(
|
||||
magnetHolesExtrudeFillets,
|
||||
axis = [1.0, 0.0, 0.0],
|
||||
instances = countBinWidth,
|
||||
distance = binLength
|
||||
)
|
||||
|> patternLinear3d(
|
||||
axis = [0.0, 1.0, 0.0],
|
||||
instances = countBinLength,
|
||||
distance = binLength
|
||||
distance = binLength,
|
||||
)
|
||||
|> patternLinear3d(axis = [0.0, 1.0, 0.0], instances = countBinLength, distance = binLength)
|
||||
|
||||
// pattern the magnet cutouts without holes
|
||||
patternLinear3d(
|
||||
magnetCutoutExtrudeFillets,
|
||||
axis = [1.0, 0.0, 0.0],
|
||||
instances = countBinWidth,
|
||||
distance = binLength
|
||||
)
|
||||
|> patternLinear3d(
|
||||
axis = [0.0, 1.0, 0.0],
|
||||
instances = countBinLength,
|
||||
distance = binLength
|
||||
distance = binLength,
|
||||
)
|
||||
|> patternLinear3d(axis = [0.0, 1.0, 0.0], instances = countBinLength, distance = binLength)
|
||||
|
@ -31,7 +31,7 @@ fn face(plane) {
|
||||
}
|
||||
|
||||
// extrude a single side of the bin
|
||||
singleSide = extrude(face(offsetPlane("YZ", offset = cornerRadius)), length = binLength - (cornerRadius * 2))
|
||||
singleSide = extrude(face(offsetPlane(YZ, offset = cornerRadius)), length = binLength - (cornerRadius * 2))
|
||||
|
||||
// create the other sides of the bin by using a circular pattern
|
||||
sides = patternCircular3d(
|
||||
@ -40,7 +40,7 @@ sides = patternCircular3d(
|
||||
axis = [0, 0, 1],
|
||||
center = [binLength / 2, binLength / 2, 0],
|
||||
instances = 4,
|
||||
rotateDuplicates = true
|
||||
rotateDuplicates = true,
|
||||
)
|
||||
|
||||
// define an axis axis000
|
||||
@ -52,7 +52,7 @@ axis000 = {
|
||||
}
|
||||
|
||||
// create a single corner of the bin
|
||||
singleCorner = revolve(face(offsetPlane("YZ", offset = cornerRadius)), angle = -90, axis = axis000)
|
||||
singleCorner = revolve(face(offsetPlane(YZ, offset = cornerRadius)), angle = -90, axis = axis000)
|
||||
|
||||
// create the corners of the bin
|
||||
corners = patternCircular3d(
|
||||
@ -61,7 +61,7 @@ corners = patternCircular3d(
|
||||
axis = [0, 0, 1],
|
||||
center = [binLength / 2, binLength / 2, 0],
|
||||
instances = 4,
|
||||
rotateDuplicates = true
|
||||
rotateDuplicates = true,
|
||||
)
|
||||
|
||||
// create the baseplate by patterning sides
|
||||
@ -69,23 +69,15 @@ basePlateSides = patternLinear3d(
|
||||
sides,
|
||||
axis = [1.0, 0.0, 0.0],
|
||||
instances = countBinWidth,
|
||||
distance = binLength
|
||||
)
|
||||
|> patternLinear3d(
|
||||
axis = [0.0, 1.0, 0.0],
|
||||
instances = countBinLength,
|
||||
distance = binLength
|
||||
distance = binLength,
|
||||
)
|
||||
|> patternLinear3d(axis = [0.0, 1.0, 0.0], instances = countBinLength, distance = binLength)
|
||||
|
||||
// create the corners of the baseplate by patterning the corners
|
||||
basePlateCorners = patternLinear3d(
|
||||
corners,
|
||||
axis = [1.0, 0.0, 0.0],
|
||||
instances = countBinWidth,
|
||||
distance = binLength
|
||||
)
|
||||
|> patternLinear3d(
|
||||
axis = [0.0, 1.0, 0.0],
|
||||
instances = countBinLength,
|
||||
distance = binLength
|
||||
distance = binLength,
|
||||
)
|
||||
|> patternLinear3d(axis = [0.0, 1.0, 0.0], instances = countBinLength, distance = binLength)
|
||||
|
@ -47,7 +47,7 @@ fn face(plane) {
|
||||
}
|
||||
|
||||
// extrude a single side of the bin
|
||||
singleSide = extrude(face(offsetPlane("YZ", offset = cornerRadius + binTol)), length = binLength - (cornerRadius * 2))
|
||||
singleSide = extrude(face(offsetPlane(YZ, offset = cornerRadius + binTol)), length = binLength - (cornerRadius * 2))
|
||||
|
||||
// create the other sides of the bin by using a circular pattern
|
||||
sides = patternCircular3d(
|
||||
@ -60,7 +60,7 @@ sides = patternCircular3d(
|
||||
0
|
||||
],
|
||||
instances = 4,
|
||||
rotateDuplicates = true
|
||||
rotateDuplicates = true,
|
||||
)
|
||||
|
||||
// define an axis axis000
|
||||
@ -75,7 +75,7 @@ axis000 = {
|
||||
}
|
||||
|
||||
// create a single corner of the bin
|
||||
singleCorner = revolve(face(offsetPlane("YZ", offset = cornerRadius + binTol)), angle = -90, axis = axis000)
|
||||
singleCorner = revolve(face(offsetPlane(YZ, offset = cornerRadius + binTol)), angle = -90, axis = axis000)
|
||||
|
||||
// create the corners of the bin
|
||||
corners = patternCircular3d(
|
||||
@ -88,10 +88,10 @@ corners = patternCircular3d(
|
||||
0
|
||||
],
|
||||
instances = 4,
|
||||
rotateDuplicates = true
|
||||
rotateDuplicates = true,
|
||||
)
|
||||
|
||||
singleBinFill = startSketchOn("XY")
|
||||
singleBinFill = startSketchOn(XY)
|
||||
|> startProfileAt([
|
||||
binBaseLength + binTol,
|
||||
binBaseLength + binTol
|
||||
@ -108,7 +108,7 @@ singleBinFill = startSketchOn("XY")
|
||||
getPreviousAdjacentEdge(line000),
|
||||
getNextAdjacentEdge(line002),
|
||||
getPreviousAdjacentEdge(line002)
|
||||
]
|
||||
],
|
||||
)
|
||||
|
||||
magCutout000 = startSketchOn(singleBinFill, "start")
|
||||
@ -117,7 +117,7 @@ magCutout000 = startSketchOn(singleBinFill, "start")
|
||||
-magOffset - binBaseLength - binTol,
|
||||
magOffset + binBaseLength + binTol
|
||||
],
|
||||
radius = magOuterDiam / 2
|
||||
radius = magOuterDiam / 2,
|
||||
)
|
||||
|> patternCircular2d(
|
||||
arcDegrees = 360,
|
||||
@ -126,7 +126,7 @@ magCutout000 = startSketchOn(singleBinFill, "start")
|
||||
(binLength + 2 * binTol) / 2
|
||||
],
|
||||
instances = 4,
|
||||
rotateDuplicates = true
|
||||
rotateDuplicates = true,
|
||||
)
|
||||
|> extrude(length = -magDepth)
|
||||
|
||||
@ -135,42 +135,30 @@ binSides = patternLinear3d(
|
||||
sides,
|
||||
axis = [1.0, 0.0, 0.0],
|
||||
instances = countBinWidth,
|
||||
distance = binLength + binTol * 2
|
||||
)
|
||||
|> patternLinear3d(
|
||||
axis = [0.0, 1.0, 0.0],
|
||||
instances = countBinLength,
|
||||
distance = binLength + binTol * 2
|
||||
distance = binLength + binTol * 2,
|
||||
)
|
||||
|> patternLinear3d(axis = [0.0, 1.0, 0.0], instances = countBinLength, distance = binLength + binTol * 2)
|
||||
|
||||
// create the corners of the baseplate by patterning the corners
|
||||
binCorners = patternLinear3d(
|
||||
corners,
|
||||
axis = [1.0, 0.0, 0.0],
|
||||
instances = countBinWidth,
|
||||
distance = binLength + binTol * 2
|
||||
)
|
||||
|> patternLinear3d(
|
||||
axis = [0.0, 1.0, 0.0],
|
||||
instances = countBinLength,
|
||||
distance = binLength + binTol * 2
|
||||
distance = binLength + binTol * 2,
|
||||
)
|
||||
|> patternLinear3d(axis = [0.0, 1.0, 0.0], instances = countBinLength, distance = binLength + binTol * 2)
|
||||
|
||||
// create the fill of the bin by patterning the corners
|
||||
binFill = patternLinear3d(
|
||||
singleBinFill,
|
||||
axis = [1.0, 0.0, 0.0],
|
||||
instances = countBinWidth,
|
||||
distance = binLength + binTol * 2
|
||||
)
|
||||
|> patternLinear3d(
|
||||
axis = [0.0, 1.0, 0.0],
|
||||
instances = countBinLength,
|
||||
distance = binLength + binTol * 2
|
||||
distance = binLength + binTol * 2,
|
||||
)
|
||||
|> patternLinear3d(axis = [0.0, 1.0, 0.0], instances = countBinLength, distance = binLength + binTol * 2)
|
||||
|
||||
//
|
||||
binTop = startSketchOn(offsetPlane("XY", offset = height))
|
||||
binTop = startSketchOn(offsetPlane(XY, offset = height))
|
||||
|> startProfileAt([0, 0], %)
|
||||
|> xLine(length = (binLength + 2 * binTol) * countBinWidth, tag = $line010)
|
||||
|> yLine(length = (binLength + 2 * binTol) * countBinLength, tag = $line011)
|
||||
@ -184,7 +172,7 @@ binTop = startSketchOn(offsetPlane("XY", offset = height))
|
||||
getPreviousAdjacentEdge(line010),
|
||||
getNextAdjacentEdge(line012),
|
||||
getPreviousAdjacentEdge(line012)
|
||||
]
|
||||
],
|
||||
)
|
||||
|> shell(faces = ["end"], thickness = binThk)
|
||||
|
||||
@ -265,7 +253,7 @@ lipLengths = patternCircular3d(
|
||||
0
|
||||
],
|
||||
instances = 2,
|
||||
rotateDuplicates = true
|
||||
rotateDuplicates = true,
|
||||
)
|
||||
|
||||
// create the other sides of the lips by using a circular pattern
|
||||
@ -279,7 +267,7 @@ lipWidths = patternCircular3d(
|
||||
0
|
||||
],
|
||||
instances = 2,
|
||||
rotateDuplicates = true
|
||||
rotateDuplicates = true,
|
||||
)
|
||||
|
||||
// define an axis axis000
|
||||
@ -307,7 +295,7 @@ lipCorners000 = patternCircular3d(
|
||||
0
|
||||
],
|
||||
instances = 2,
|
||||
rotateDuplicates = true
|
||||
rotateDuplicates = true,
|
||||
)
|
||||
|
||||
// create the corners of the bin
|
||||
@ -321,5 +309,5 @@ lipCorners001 = patternCircular3d(
|
||||
0
|
||||
],
|
||||
instances = 2,
|
||||
rotateDuplicates = true
|
||||
rotateDuplicates = true,
|
||||
)
|
||||
|
@ -40,7 +40,7 @@ fn face(plane) {
|
||||
}
|
||||
|
||||
// extrude a single side of the bin
|
||||
singleSide = extrude(face(offsetPlane("YZ", offset = cornerRadius + binTol)), length = binLength - (cornerRadius * 2), )
|
||||
singleSide = extrude(face(offsetPlane(YZ, offset = cornerRadius + binTol)), length = binLength - (cornerRadius * 2))
|
||||
|
||||
// create the other sides of the bin by using a circular pattern
|
||||
sides = patternCircular3d(
|
||||
@ -53,7 +53,7 @@ sides = patternCircular3d(
|
||||
0
|
||||
],
|
||||
instances = 4,
|
||||
rotateDuplicates = true
|
||||
rotateDuplicates = true,
|
||||
)
|
||||
|
||||
// define an axis axis000
|
||||
@ -68,7 +68,7 @@ axis000 = {
|
||||
}
|
||||
|
||||
// create a single corner of the bin
|
||||
singleCorner = revolve(face(offsetPlane("YZ", offset = cornerRadius + binTol)), angle = -90, axis = axis000)
|
||||
singleCorner = revolve(face(offsetPlane(YZ, offset = cornerRadius + binTol)), angle = -90, axis = axis000)
|
||||
|
||||
// create the corners of the bin
|
||||
corners = patternCircular3d(
|
||||
@ -81,10 +81,10 @@ corners = patternCircular3d(
|
||||
0
|
||||
],
|
||||
instances = 4,
|
||||
rotateDuplicates = true
|
||||
rotateDuplicates = true,
|
||||
)
|
||||
|
||||
singleBinFill = startSketchOn("XY")
|
||||
singleBinFill = startSketchOn(XY)
|
||||
|> startProfileAt([
|
||||
binBaseLength + binTol,
|
||||
binBaseLength + binTol
|
||||
@ -101,7 +101,7 @@ singleBinFill = startSketchOn("XY")
|
||||
getPreviousAdjacentEdge(line000),
|
||||
getNextAdjacentEdge(line002),
|
||||
getPreviousAdjacentEdge(line002)
|
||||
]
|
||||
],
|
||||
)
|
||||
|
||||
magCutout000 = startSketchOn(singleBinFill, "start")
|
||||
@ -110,7 +110,7 @@ magCutout000 = startSketchOn(singleBinFill, "start")
|
||||
-magOffset - binBaseLength - binTol,
|
||||
magOffset + binBaseLength + binTol
|
||||
],
|
||||
radius = magOuterDiam / 2
|
||||
radius = magOuterDiam / 2,
|
||||
)
|
||||
|> patternCircular2d(
|
||||
arcDegrees = 360,
|
||||
@ -119,7 +119,7 @@ magCutout000 = startSketchOn(singleBinFill, "start")
|
||||
(binLength + 2 * binTol) / 2
|
||||
],
|
||||
instances = 4,
|
||||
rotateDuplicates = true
|
||||
rotateDuplicates = true,
|
||||
)
|
||||
|> extrude(length = -magDepth)
|
||||
|
||||
@ -128,42 +128,30 @@ binSides = patternLinear3d(
|
||||
sides,
|
||||
axis = [1.0, 0.0, 0.0],
|
||||
instances = countBinWidth,
|
||||
distance = binLength + binTol * 2
|
||||
)
|
||||
|> patternLinear3d(
|
||||
axis = [0.0, 1.0, 0.0],
|
||||
instances = countBinLength,
|
||||
distance = binLength + binTol * 2
|
||||
distance = binLength + binTol * 2,
|
||||
)
|
||||
|> patternLinear3d(axis = [0.0, 1.0, 0.0], instances = countBinLength, distance = binLength + binTol * 2)
|
||||
|
||||
// create the corners of the baseplate by patterning the corners
|
||||
binCorners = patternLinear3d(
|
||||
corners,
|
||||
axis = [1.0, 0.0, 0.0],
|
||||
instances = countBinWidth,
|
||||
distance = binLength + binTol * 2
|
||||
)
|
||||
|> patternLinear3d(
|
||||
axis = [0.0, 1.0, 0.0],
|
||||
instances = countBinLength,
|
||||
distance = binLength + binTol * 2
|
||||
distance = binLength + binTol * 2,
|
||||
)
|
||||
|> patternLinear3d(axis = [0.0, 1.0, 0.0], instances = countBinLength, distance = binLength + binTol * 2)
|
||||
|
||||
// create the fill of the bin by patterning the corners
|
||||
binFill = patternLinear3d(
|
||||
singleBinFill,
|
||||
axis = [1.0, 0.0, 0.0],
|
||||
instances = countBinWidth,
|
||||
distance = binLength + binTol * 2
|
||||
)
|
||||
|> patternLinear3d(
|
||||
axis = [0.0, 1.0, 0.0],
|
||||
instances = countBinLength,
|
||||
distance = binLength + binTol * 2
|
||||
distance = binLength + binTol * 2,
|
||||
)
|
||||
|> patternLinear3d(axis = [0.0, 1.0, 0.0], instances = countBinLength, distance = binLength + binTol * 2)
|
||||
|
||||
// create the top of the bin
|
||||
binTop = startSketchOn(offsetPlane("XY", offset = height))
|
||||
binTop = startSketchOn(offsetPlane(XY, offset = height))
|
||||
|> startProfileAt([0, 0], %)
|
||||
|> xLine(length = (binLength + 2 * binTol) * countBinWidth, tag = $line010)
|
||||
|> yLine(length = (binLength + 2 * binTol) * countBinLength, tag = $line011)
|
||||
@ -177,6 +165,6 @@ binTop = startSketchOn(offsetPlane("XY", offset = height))
|
||||
getPreviousAdjacentEdge(line010),
|
||||
getNextAdjacentEdge(line012),
|
||||
getPreviousAdjacentEdge(line012)
|
||||
]
|
||||
],
|
||||
)
|
||||
|> shell(faces = ["end"], thickness = binThk)
|
||||
|
@ -11,7 +11,7 @@ diameter = 0.3125
|
||||
|
||||
// Define a function for the hex nut
|
||||
fn hexNut(start, thk, innerDia) {
|
||||
hexNutSketch = startSketchOn('-XZ')
|
||||
hexNutSketch = startSketchOn(-XZ)
|
||||
|> startProfileAt([start[0] + innerDia, start[1]], %)
|
||||
|> angledLine({ angle = 240, length = innerDia }, %)
|
||||
|> angledLine({ angle = 180, length = innerDia }, %)
|
||||
@ -19,10 +19,7 @@ fn hexNut(start, thk, innerDia) {
|
||||
|> angledLine({ angle = 60, length = innerDia }, %)
|
||||
|> angledLine({ angle = 0, length = innerDia * .90 }, %)
|
||||
|> close()
|
||||
|> hole(circle(
|
||||
center = [start[0], start[1]],
|
||||
radius = innerDia / 2
|
||||
), %)
|
||||
|> hole(circle(center = [start[0], start[1]], radius = innerDia / 2), %)
|
||||
|> extrude(length = thk)
|
||||
return hexNutSketch
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ row5 = row4 + keyHeight + spacing
|
||||
row6 = row5 + keyHeight + spacing
|
||||
|
||||
// Sketch the side profile of the keyboard base and extrude to total width
|
||||
sketch001 = startSketchOn('YZ')
|
||||
sketch001 = startSketchOn(YZ)
|
||||
|> startProfileAt([0, 0], %)
|
||||
|> line(end = [-0.14, 0.68], tag = $seg01)
|
||||
|> angledLine([7, row6 + 3 * spacing + keyHeight], %, $seg02)
|
||||
@ -89,7 +89,7 @@ fn keyFn(originStart, keyWidth, keyHeight, repeats, color) {
|
||||
|> close()
|
||||
|> extrude(length = keyDepth)
|
||||
|> appearance(color = color)
|
||||
// Repeat key when desired. This will default to zero
|
||||
// Repeat key when desired. This will default to zero
|
||||
|> patternLinear3d(
|
||||
%,
|
||||
instances = repeats + 1,
|
||||
|
@ -20,7 +20,7 @@ kitBodyWidth = 26
|
||||
kitBodyHeight = 25
|
||||
kitBodyDepth = 18
|
||||
|
||||
kitBody = startSketchOn('XZ')
|
||||
kitBody = startSketchOn(XZ)
|
||||
|> startProfileAt([-kitBodyWidth / 2, kitBodyElevation], %)
|
||||
|> line(end = [0, kitBodyHeight])
|
||||
|> line(end = [kitBodyWidth, 0], tag = $seg01)
|
||||
@ -159,7 +159,7 @@ kitShoeHeight = 3
|
||||
fn kitLeg(offsetFront, offsetSide) {
|
||||
kitShoeOffsetFront = kitShoeLength / 2 - (kitBodyDepth / 2) - offsetFront
|
||||
|
||||
kitFootPrint = startSketchOn('XY')
|
||||
kitFootPrint = startSketchOn(XY)
|
||||
|> startProfileAt([offsetSide, kitShoeOffsetFront], %)
|
||||
|> line(end = [kitShoeWidth, 0])
|
||||
|> line(end = [0, -kitShoeLength])
|
||||
|
@ -26,7 +26,7 @@ assertGreaterThan(lbumps, 1, "lbumps must be greater than 1")
|
||||
assertGreaterThan(wbumps, 1, "wbumps must be greater than 1")
|
||||
|
||||
// Make the base
|
||||
base = startSketchOn('XY')
|
||||
base = startSketchOn(XY)
|
||||
|> startProfileAt([-totalWidth / 2, -totalLength / 2], %)
|
||||
|> line(end = [totalWidth, 0])
|
||||
|> line(end = [0, totalLength])
|
||||
@ -53,18 +53,10 @@ peg = startSketchOn(base, 'end')
|
||||
-(pitch * (wbumps - 1) / 2),
|
||||
-(pitch * (lbumps - 1) / 2)
|
||||
],
|
||||
radius = bumpDiam / 2
|
||||
)
|
||||
|> patternLinear2d(
|
||||
axis = [1, 0],
|
||||
instances = wbumps,
|
||||
distance = pitch
|
||||
)
|
||||
|> patternLinear2d(
|
||||
axis = [0, 1],
|
||||
instances = lbumps,
|
||||
distance = pitch
|
||||
radius = bumpDiam / 2,
|
||||
)
|
||||
|> patternLinear2d(axis = [1, 0], instances = wbumps, distance = pitch)
|
||||
|> patternLinear2d(axis = [0, 1], instances = lbumps, distance = pitch)
|
||||
|> extrude(length = bumpHeight)
|
||||
|
||||
// Create the pegs on the bottom of the base
|
||||
@ -74,16 +66,8 @@ tubePattern = startSketchOn(shellExtrude, 'start')
|
||||
-(pitch * (wbumps - 1) / 2 - (pitch / 2)),
|
||||
-(pitch * (lbumps - 1) / 2 - (pitch / 2))
|
||||
],
|
||||
radius = bumpDiam / 2
|
||||
)
|
||||
|> patternLinear2d(
|
||||
axis = [1, 0],
|
||||
instances = wbumps - 1,
|
||||
distance = pitch
|
||||
)
|
||||
|> patternLinear2d(
|
||||
axis = [0, 1],
|
||||
instances = lbumps - 1,
|
||||
distance = pitch
|
||||
radius = bumpDiam / 2,
|
||||
)
|
||||
|> patternLinear2d(axis = [1, 0], instances = wbumps - 1, distance = pitch)
|
||||
|> patternLinear2d(axis = [0, 1], instances = lbumps - 1, distance = pitch)
|
||||
|> extrude(length = bumpHeight)
|
||||
|
75
public/kcl-samples/makeup-mirror/main.kcl
Normal file
@ -0,0 +1,75 @@
|
||||
// Makeup Mirror
|
||||
// A circular vanity mirror mounted on a swiveling arm with pivot joints, used for personal grooming.
|
||||
|
||||
// Settings
|
||||
@settings(defaultLengthUnit = mm)
|
||||
|
||||
// hinge
|
||||
hingeRadius = 8
|
||||
hingeHeight = hingeRadius * 3
|
||||
hingeGap = 0.5
|
||||
|
||||
// arm
|
||||
armLength = 170
|
||||
armRadius = 5
|
||||
|
||||
// mirror
|
||||
mirrorRadius = 170 / 2
|
||||
mirrorThickness = 10
|
||||
archToMirrorGap = 5
|
||||
archThickness = 1
|
||||
archRadius = mirrorRadius + archToMirrorGap
|
||||
|
||||
// Geometry
|
||||
// hinge
|
||||
fn hingeFn(x, y, z) {
|
||||
hingeBody = startSketchOn(offsetPlane(XY, offset = z))
|
||||
|> circle(center = [x, y], radius = hingeRadius)
|
||||
|> extrude(length = hingeHeight)
|
||||
return hingeBody
|
||||
}
|
||||
|
||||
hingePartA1 = hingeFn(0, 0, 0)
|
||||
hingePartA2 = hingeFn(0, 0, hingeHeight + hingeGap)
|
||||
hingePartA3 = hingeFn(0, 0, hingeHeight * 2 + hingeGap * 2)
|
||||
|
||||
hingePartB2 = hingeFn(armLength, 0, hingeHeight + hingeGap)
|
||||
hingePartB3 = hingeFn(armLength, 0, hingeHeight * 2 + hingeGap * 2)
|
||||
|
||||
hingePartC2 = hingeFn(armLength, -armLength, hingeHeight * 2 + hingeGap * 2)
|
||||
hingePartC3 = hingeFn(armLength, -armLength, hingeHeight * 3 + hingeGap * 3)
|
||||
|
||||
// arm
|
||||
fn armFn(plane, offset, altitude) {
|
||||
armBody = startSketchOn(plane)
|
||||
|> circle(center = [offset, altitude], radius = armRadius)
|
||||
|> extrude(length = armLength)
|
||||
return armBody
|
||||
}
|
||||
|
||||
armPartA = armFn(YZ, 0, hingeHeight * 1.5 + hingeGap)
|
||||
armPartB = armFn(XZ, armLength, hingeHeight * 2.5 + hingeGap * 2)
|
||||
|
||||
// mirror
|
||||
fn mirrorFn(plane, offsetX, offsetY, altitude, radius, tiefe, gestellR, gestellD) {
|
||||
armPlane = startSketchOn(offsetPlane(plane, offset = offsetY - (tiefe / 2)))
|
||||
armBody = circle(armPlane, center = [offsetX, altitude], radius = radius)
|
||||
|> extrude(length = tiefe)
|
||||
|
||||
archBody = startProfileAt([offsetX-gestellR, altitude], armPlane)
|
||||
|> xLine(length = gestellD)
|
||||
|> arcTo({
|
||||
interior = [offsetX, altitude-gestellR],
|
||||
end = [offsetX+gestellR, altitude]
|
||||
}, %)
|
||||
|> xLine(length = gestellD)
|
||||
|> arcTo({
|
||||
interior = [offsetX, altitude-gestellR-gestellD],
|
||||
end = [profileStartX(%), profileStartY(%)]
|
||||
}, %)
|
||||
|> close()
|
||||
|> extrude(length = tiefe)
|
||||
return armBody
|
||||
}
|
||||
|
||||
mirror = mirrorFn(XZ, armLength, armLength, hingeHeight * 4 + hingeGap * 3 + mirrorRadius+archToMirrorGap+archThickness, mirrorRadius, mirrorThickness, archRadius, archThickness)
|
@ -62,6 +62,13 @@
|
||||
"title": "Hollow Dodecahedron",
|
||||
"description": "A regular dodecahedron or pentagonal dodecahedron is a dodecahedron composed of regular pentagonal faces, three meeting at each vertex. This example shows constructing the individual faces of the dodecahedron and extruding inwards."
|
||||
},
|
||||
{
|
||||
"file": "main.kcl",
|
||||
"pathFromProjectDirectoryToFirstFile": "dual-basin-utility-sink/main.kcl",
|
||||
"multipleFiles": false,
|
||||
"title": "Dual-Basin Utility Sink",
|
||||
"description": "A stainless steel sink unit with dual rectangular basins and six under-counter storage compartments."
|
||||
},
|
||||
{
|
||||
"file": "main.kcl",
|
||||
"pathFromProjectDirectoryToFirstFile": "enclosure/main.kcl",
|
||||
@ -181,6 +188,13 @@
|
||||
"title": "Lego Brick",
|
||||
"description": "A standard Lego brick. This is a small, plastic construction block toy that can be interlocked with other blocks to build various structures, models, and figures. There are a lot of hacks used in this code."
|
||||
},
|
||||
{
|
||||
"file": "main.kcl",
|
||||
"pathFromProjectDirectoryToFirstFile": "makeup-mirror/main.kcl",
|
||||
"multipleFiles": false,
|
||||
"title": "Makeup Mirror",
|
||||
"description": "A circular vanity mirror mounted on a swiveling arm with pivot joints, used for personal grooming."
|
||||
},
|
||||
{
|
||||
"file": "main.kcl",
|
||||
"pathFromProjectDirectoryToFirstFile": "mounting-plate/main.kcl",
|
||||
|
@ -13,7 +13,7 @@ centerHoleDiameter = 2
|
||||
|
||||
// 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.
|
||||
fn rectShape(pos, w, l) {
|
||||
rr = startSketchOn('XY')
|
||||
rr = startSketchOn(XY)
|
||||
|> startProfileAt([pos[0] - (w / 2), pos[1] - (l / 2)], %)
|
||||
|> line(endAbsolute = [pos[0] + w / 2, pos[1] - (l / 2)], tag = $edge1)
|
||||
|> line(endAbsolute = [pos[0] + w / 2, pos[1] + l / 2], tag = $edge2)
|
||||
@ -34,33 +34,30 @@ part = rs
|
||||
-plateWidth / 2 + holeIndex,
|
||||
plateLength / 2 - holeIndex
|
||||
],
|
||||
radius = holeRadius
|
||||
radius = holeRadius,
|
||||
), %)
|
||||
|> hole(circle(
|
||||
center = [
|
||||
plateWidth / 2 - holeIndex,
|
||||
plateLength / 2 - holeIndex
|
||||
],
|
||||
radius = holeRadius
|
||||
radius = holeRadius,
|
||||
), %)
|
||||
|> hole(circle(
|
||||
center = [
|
||||
-plateWidth / 2 + holeIndex,
|
||||
-plateLength / 2 + holeIndex
|
||||
],
|
||||
radius = holeRadius
|
||||
radius = holeRadius,
|
||||
), %)
|
||||
|> hole(circle(
|
||||
center = [
|
||||
plateWidth / 2 - holeIndex,
|
||||
-plateLength / 2 + holeIndex
|
||||
],
|
||||
radius = holeRadius
|
||||
), %)
|
||||
|> hole(circle(
|
||||
center = [0, 0],
|
||||
radius = centerHoleDiameter
|
||||
radius = holeRadius,
|
||||
), %)
|
||||
|> hole(circle(center = [0, 0], radius = centerHoleDiameter), %)
|
||||
|> extrude(length = plateThickness)
|
||||
|> fillet(
|
||||
radius = filletRadius,
|
||||
@ -69,5 +66,5 @@ part = rs
|
||||
getPreviousAdjacentEdge(rs.tags.edge2),
|
||||
getPreviousAdjacentEdge(rs.tags.edge3),
|
||||
getPreviousAdjacentEdge(rs.tags.edge4)
|
||||
]
|
||||
],
|
||||
)
|
||||
|
@ -28,37 +28,37 @@ export axisJ3CArmThickness = 2.5
|
||||
|
||||
// Planes
|
||||
export plane001 = {
|
||||
plane = {
|
||||
origin = [0.0, 0.0, baseHeight - 1.5 + 0.1],
|
||||
xAxis = [1.0, 0.0, 0.0],
|
||||
yAxis = [0.0, 1.0, 0.0],
|
||||
zAxis = [0.0, 0.0, 1.0]
|
||||
}
|
||||
plane = {
|
||||
origin = [0.0, 0.0, baseHeight - 1.5 + 0.1],
|
||||
xAxis = [1.0, 0.0, 0.0],
|
||||
yAxis = [0.0, 1.0, 0.0],
|
||||
zAxis = [0.0, 0.0, 1.0]
|
||||
}
|
||||
}
|
||||
|
||||
export plane002 = {
|
||||
plane = {
|
||||
origin = [0.0, 0.0, 0.0],
|
||||
xAxis = [
|
||||
sin(toRadians(axisJ1)),
|
||||
cos(toRadians(axisJ1)),
|
||||
0.0
|
||||
],
|
||||
yAxis = [0.0, 0.0, 1.0],
|
||||
zAxis = [1.0, 0.0, 0.0]
|
||||
}
|
||||
plane = {
|
||||
origin = [0.0, 0.0, 0.0],
|
||||
xAxis = [
|
||||
sin(toRadians(axisJ1)),
|
||||
cos(toRadians(axisJ1)),
|
||||
0.0
|
||||
],
|
||||
yAxis = [0.0, 0.0, 1.0],
|
||||
zAxis = [1.0, 0.0, 0.0]
|
||||
}
|
||||
}
|
||||
|
||||
// Define Plane to Move J2 Axis Robot Arm
|
||||
export plane003 = {
|
||||
plane = {
|
||||
origin = [-0.1, 0.0, 0.0],
|
||||
xAxis = [
|
||||
sin(toRadians(axisJ1)),
|
||||
cos(toRadians(axisJ1)),
|
||||
0.0
|
||||
],
|
||||
yAxis = [0.0, 0.0, 1.0],
|
||||
zAxis = [1.0, 0.0, 0.0]
|
||||
}
|
||||
}
|
||||
plane = {
|
||||
origin = [-0.1, 0.0, 0.0],
|
||||
xAxis = [
|
||||
sin(toRadians(axisJ1)),
|
||||
cos(toRadians(axisJ1)),
|
||||
0.0
|
||||
],
|
||||
yAxis = [0.0, 0.0, 1.0],
|
||||
zAxis = [1.0, 0.0, 0.0]
|
||||
}
|
||||
}
|
||||
|
@ -4,10 +4,10 @@
|
||||
// Set Units
|
||||
@settings(defaultLengthUnit = in)
|
||||
|
||||
import 'robot-arm-base.kcl' as robotArmBase
|
||||
import 'robot-rotating-base.kcl' as rotatingBase
|
||||
import 'robot-arm-j2.kcl' as j2RobotArm
|
||||
import 'robot-arm-j3.kcl' as j3RobotArm
|
||||
import "robot-arm-base.kcl" as robotArmBase
|
||||
import "robot-rotating-base.kcl" as rotatingBase
|
||||
import "robot-arm-j2.kcl" as j2RobotArm
|
||||
import "robot-arm-j3.kcl" as j3RobotArm
|
||||
|
||||
robotArmBase
|
||||
rotatingBase
|
||||
|
@ -1,15 +1,13 @@
|
||||
// Robot Arm Base
|
||||
|
||||
|
||||
// Set Units
|
||||
@settings(defaultLengthUnit = in)
|
||||
|
||||
|
||||
// Import Constants
|
||||
import basePlateRadius, basePlateThickness, baseChamfer, baseHeight from "globals.kcl"
|
||||
|
||||
// Base Plate
|
||||
sketch001 = startSketchOn('XY')
|
||||
sketch001 = startSketchOn(XY)
|
||||
|> startProfileAt([-basePlateRadius, -basePlateRadius], %)
|
||||
|> angledLine([0, 2 * basePlateRadius], %, $rectangleSegmentA001)
|
||||
|> angledLine([
|
||||
@ -30,17 +28,14 @@ extrude001 = extrude(sketch001, length = basePlateThickness)
|
||||
getNextAdjacentEdge(rectangleSegmentB001),
|
||||
getNextAdjacentEdge(rectangleSegmentC001),
|
||||
getNextAdjacentEdge(rectangleSegmentD001)
|
||||
]
|
||||
],
|
||||
)
|
||||
|
||||
// Base Motor for actuating first joint
|
||||
sketch002 = startSketchOn(extrude001, 'END')
|
||||
|> circle(center = [0, 0], radius = 4, tag = $referenceEdge)
|
||||
extrude002 = extrude(sketch002, length = baseHeight - basePlateThickness - 1.5)
|
||||
|> fillet(
|
||||
radius = 0.1,
|
||||
tags = [getOppositeEdge(referenceEdge)]
|
||||
)
|
||||
|> fillet(radius = 0.1, tags = [getOppositeEdge(referenceEdge)])
|
||||
sketch003 = startSketchOn(extrude002, 'END')
|
||||
|> circle(center = [0, 0], radius = 0.5)
|
||||
extrude003 = extrude(sketch003, length = 1)
|
||||
@ -52,13 +47,13 @@ sketch4A = startSketchOn(extrude001, 'END')
|
||||
-basePlateRadius + 1,
|
||||
-basePlateRadius + baseChamfer + 0.5
|
||||
],
|
||||
radius = 0.4
|
||||
radius = 0.4,
|
||||
)
|
||||
|> patternCircular2d(
|
||||
arcDegrees = 360,
|
||||
center = [0, 0],
|
||||
instances = 4,
|
||||
rotateDuplicates = true
|
||||
rotateDuplicates = true,
|
||||
)
|
||||
|
||||
extrude4A = extrude(sketch4A, length = -basePlateThickness)
|
||||
@ -69,13 +64,13 @@ sketch4B = startSketchOn(extrude001, 'END')
|
||||
-basePlateRadius + 0.5 + baseChamfer,
|
||||
-basePlateRadius + 1
|
||||
],
|
||||
radius = 0.4
|
||||
radius = 0.4,
|
||||
)
|
||||
|> patternCircular2d(
|
||||
arcDegrees = 360,
|
||||
center = [0, 0],
|
||||
instances = 4,
|
||||
rotateDuplicates = true
|
||||
rotateDuplicates = true,
|
||||
)
|
||||
|
||||
extrude(sketch4B, length = -basePlateThickness)
|
||||
|
@ -1,10 +1,8 @@
|
||||
// J2 Axis for Robot Arm
|
||||
|
||||
|
||||
// Set Units
|
||||
@settings(defaultLengthUnit = in)
|
||||
|
||||
|
||||
import axisJ1, axisJ2, axisJ2ArmWidth, axisJ2ArmLength, axisJ2ArmThickness, plane003 from "globals.kcl"
|
||||
|
||||
// Create Body of J2 Robot Arm
|
||||
@ -35,24 +33,19 @@ sketch012 = startSketchOn(extrude011, 'START')
|
||||
|> circle(center = [-1.75, 8], radius = 1.9, tag = $referenceEdge4)
|
||||
|
||||
extrude012 = extrude(sketch012, length = 0.15)
|
||||
|> fillet(
|
||||
radius = 0.1,
|
||||
tags = [getOppositeEdge(referenceEdge4)]
|
||||
)
|
||||
|> fillet(radius = 0.1, tags = [getOppositeEdge(referenceEdge4)])
|
||||
sketch013 = startSketchOn(extrude011, 'START')
|
||||
|> circle(
|
||||
center = [
|
||||
center = [
|
||||
-1.75 - (axisJ2ArmLength * cos(toRadians(axisJ2))),
|
||||
8 + axisJ2ArmLength * sin(toRadians(axisJ2))
|
||||
],
|
||||
radius = 1.9,
|
||||
tag = $referenceEdge5)
|
||||
radius = 1.9,
|
||||
tag = $referenceEdge5,
|
||||
)
|
||||
|
||||
extrude013 = extrude(sketch013, length = 1)
|
||||
|> fillet(
|
||||
radius = 0.1,
|
||||
tags = [getOppositeEdge(referenceEdge5)]
|
||||
)
|
||||
|> fillet(radius = 0.1, tags = [getOppositeEdge(referenceEdge5)])
|
||||
|
||||
// Draw Bolt Patterns on J2 Robot Arm
|
||||
sketch014 = startSketchOn(extrude012, 'END')
|
||||
@ -61,7 +54,7 @@ sketch014 = startSketchOn(extrude012, 'END')
|
||||
center = [-1.75, 8],
|
||||
instances = 8,
|
||||
arcDegrees = 360,
|
||||
rotateDuplicates = true
|
||||
rotateDuplicates = true,
|
||||
)
|
||||
|
||||
extrude014 = extrude(sketch014, length = 0.15)
|
||||
@ -72,7 +65,7 @@ sketch015 = startSketchOn(extrude013, 'END')
|
||||
-1.75 - ((axisJ2ArmLength - 1) * cos(toRadians(axisJ2))),
|
||||
8 + (axisJ2ArmLength - 1.5) * sin(toRadians(axisJ2))
|
||||
],
|
||||
radius = 0.2
|
||||
radius = 0.2,
|
||||
)
|
||||
|> patternCircular2d(
|
||||
center = [
|
||||
@ -81,7 +74,7 @@ sketch015 = startSketchOn(extrude013, 'END')
|
||||
],
|
||||
instances = 4,
|
||||
arcDegrees = 360,
|
||||
rotateDuplicates = true
|
||||
rotateDuplicates = true,
|
||||
)
|
||||
|
||||
extrude015 = extrude(sketch015, length = 0.15)
|
||||
@ -92,7 +85,7 @@ sketch016 = startSketchOn(extrude011, 'END')
|
||||
1.75 + axisJ2ArmLength * cos(toRadians(axisJ2)),
|
||||
8 + axisJ2ArmLength * sin(toRadians(axisJ2))
|
||||
],
|
||||
radius = 0.3
|
||||
radius = 0.3,
|
||||
)
|
||||
|
||||
extrude(sketch016, length = 1)
|
||||
|
@ -1,10 +1,8 @@
|
||||
// J3 Robot Arm
|
||||
|
||||
|
||||
// Set Units
|
||||
@settings(defaultLengthUnit = in)
|
||||
|
||||
|
||||
import plane002, axisJ2, axisJ3C, axisJ4, axisJ2ArmLength, axisJ3CArmLength, axisJ3CArmWidth, axisJ3CArmThickness from "globals.kcl"
|
||||
|
||||
// Create Body of J3 Robot Arm
|
||||
@ -38,13 +36,11 @@ sketch018 = startSketchOn(extrude017, 'END')
|
||||
8 + axisJ2ArmLength * sin(toRadians(axisJ2))
|
||||
],
|
||||
radius = 3.7 / 2,
|
||||
tag = $referenceEdge6)
|
||||
tag = $referenceEdge6,
|
||||
)
|
||||
|
||||
extrude018 = extrude(sketch018, length = 0.15)
|
||||
|> fillet(
|
||||
radius = 0.1,
|
||||
tags = [getOppositeEdge(referenceEdge6)]
|
||||
)
|
||||
|> fillet(radius = 0.1, tags = [getOppositeEdge(referenceEdge6)])
|
||||
|
||||
// Draw Bolt Pattern on J3 Robot Arm
|
||||
sketch019 = startSketchOn(extrude018, 'END')
|
||||
@ -53,7 +49,7 @@ sketch019 = startSketchOn(extrude018, 'END')
|
||||
1.75 + (axisJ2ArmLength - 1) * cos(toRadians(axisJ2)),
|
||||
8 + (axisJ2ArmLength - 1.5) * sin(toRadians(axisJ2))
|
||||
],
|
||||
radius = 0.2
|
||||
radius = 0.2,
|
||||
)
|
||||
|> patternCircular2d(
|
||||
center = [
|
||||
@ -62,7 +58,7 @@ sketch019 = startSketchOn(extrude018, 'END')
|
||||
],
|
||||
instances = 8,
|
||||
arcDegrees = 360,
|
||||
rotateDuplicates = true
|
||||
rotateDuplicates = true,
|
||||
)
|
||||
|
||||
extrude019 = extrude(sketch019, length = 0.15)
|
||||
@ -74,7 +70,7 @@ sketch020 = startSketchOn(extrude017, 'START')
|
||||
-1.75 - (axisJ2ArmLength * cos(toRadians(axisJ2))) - (axisJ3CArmLength * cos(toRadians(axisJ3C))),
|
||||
8 + axisJ2ArmLength * sin(toRadians(axisJ2)) + axisJ3CArmLength * sin(toRadians(axisJ3C))
|
||||
],
|
||||
radius = axisJ3CArmWidth / 2
|
||||
radius = axisJ3CArmWidth / 2,
|
||||
)
|
||||
extrude020 = extrude(sketch020, length = -0.5)
|
||||
|
||||
@ -84,7 +80,7 @@ sketch021 = startSketchOn(extrude017, 'END')
|
||||
1.75 + axisJ2ArmLength * cos(toRadians(axisJ2)) + axisJ3CArmLength * cos(toRadians(axisJ3C)),
|
||||
8 + axisJ2ArmLength * sin(toRadians(axisJ2)) + axisJ3CArmLength * sin(toRadians(axisJ3C))
|
||||
],
|
||||
radius = axisJ3CArmWidth / 2.01
|
||||
radius = axisJ3CArmWidth / 2.01,
|
||||
)
|
||||
|
||||
extrude021 = extrude(sketch021, length = -0.5)
|
||||
|
@ -1,20 +1,15 @@
|
||||
// Robot Rotating Base
|
||||
|
||||
|
||||
// Set Units
|
||||
@settings(defaultLengthUnit = in)
|
||||
|
||||
|
||||
import axisJ1, baseHeight, plane001, plane002 from "globals.kcl"
|
||||
|
||||
// Create Rotating Base
|
||||
sketch005 = startSketchOn(plane001)
|
||||
|> circle(center = [0, 0], radius = 3.9, tag = $referenceEdge1)
|
||||
extrude005 = extrude(sketch005, length = 1.5 - 0.1)
|
||||
|> fillet(
|
||||
radius = 0.1,
|
||||
tags = [getOppositeEdge(referenceEdge1)]
|
||||
)
|
||||
|> fillet(radius = 0.1, tags = [getOppositeEdge(referenceEdge1)])
|
||||
|> appearance(color = "#4f7d54", metalness = 90, roughness = 90)
|
||||
|
||||
sketch006 = startSketchOn(plane002)
|
||||
@ -38,12 +33,10 @@ sketch007 = startSketchOn(extrude006, 'END')
|
||||
8
|
||||
],
|
||||
radius = 2.75,
|
||||
tag = $referenceEdge2)
|
||||
extrude007 = extrude(sketch007, length = 1.5)
|
||||
|> fillet(
|
||||
radius = 0.1,
|
||||
tags = [getOppositeEdge(referenceEdge2)]
|
||||
tag = $referenceEdge2,
|
||||
)
|
||||
extrude007 = extrude(sketch007, length = 1.5)
|
||||
|> fillet(radius = 0.1, tags = [getOppositeEdge(referenceEdge2)])
|
||||
|
||||
// Draw Bolt Pattern on Rotating Base
|
||||
sketch008 = startSketchOn(extrude007, 'END')
|
||||
@ -52,7 +45,7 @@ sketch008 = startSketchOn(extrude007, 'END')
|
||||
1.75 * cos(toRadians(axisJ1)) / abs(cos(toRadians(axisJ1))),
|
||||
6.75
|
||||
],
|
||||
radius = 0.2
|
||||
radius = 0.2,
|
||||
)
|
||||
|> patternCircular2d(
|
||||
center = [
|
||||
@ -61,7 +54,7 @@ sketch008 = startSketchOn(extrude007, 'END')
|
||||
],
|
||||
instances = 4,
|
||||
arcDegrees = 360,
|
||||
rotateDuplicates = true
|
||||
rotateDuplicates = true,
|
||||
)
|
||||
extrude008 = extrude(sketch008, length = 0.2)
|
||||
|
||||
@ -72,12 +65,10 @@ sketch009 = startSketchOn(extrude007, 'END')
|
||||
8
|
||||
],
|
||||
radius = 0.5,
|
||||
tag = $referenceEdge3)
|
||||
extrude009 = extrude(sketch009, length = 0.15)
|
||||
|> fillet(
|
||||
radius = 0.1,
|
||||
tags = [getOppositeEdge(referenceEdge3)]
|
||||
tag = $referenceEdge3,
|
||||
)
|
||||
extrude009 = extrude(sketch009, length = 0.15)
|
||||
|> fillet(radius = 0.1, tags = [getOppositeEdge(referenceEdge3)])
|
||||
|> appearance(color = "#4f7d54", metalness = 90, roughness = 90)
|
||||
|
||||
sketch010 = startSketchOn(plane002)
|
||||
|
@ -1,16 +1,16 @@
|
||||
// 1120t74 Pipe
|
||||
|
||||
// import constants
|
||||
import pipeInnerDiameter, pipeOuterDiameter, pipeLength from "globals.kcl"
|
||||
// Pipe
|
||||
// piping for the pipe flange assembly
|
||||
|
||||
// set units
|
||||
@settings(defaultLengthUnit = in)
|
||||
|
||||
// import constants
|
||||
import pipeInnerDiameter, pipeOuterDiameter, pipeLength from "globals.kcl"
|
||||
|
||||
// create a function to make the pipe
|
||||
export fn pipe() {
|
||||
|
||||
// create the pipe base
|
||||
pipeBase = startSketchOn('XZ')
|
||||
pipeBase = startSketchOn(XZ)
|
||||
|> circle(%, center = [0, 0], radius = pipeOuterDiameter / 2)
|
||||
|> extrude(%, length = pipeLength)
|
||||
|
||||
|
@ -1,16 +1,16 @@
|
||||
// 68095k348 flange
|
||||
|
||||
// import constants
|
||||
import pipeDiameter, mountingHoleDiameter, mountingHolePlacementDiameter, flangeDiameter, flangeTotalThickness, flangeBackHeight, flangeFrontHeight, flangeBaseThickness, flangeBackDiameter, flangeFrontDiameter from "globals.kcl"
|
||||
// flange used for mating two pipes together in the pipe flange assembly.
|
||||
|
||||
// set units
|
||||
@settings(defaultLengthUnit = in)
|
||||
|
||||
// import constants
|
||||
import pipeDiameter, mountingHoleDiameter, mountingHolePlacementDiameter, flangeDiameter, flangeTotalThickness, flangeBackHeight, flangeFrontHeight, flangeBaseThickness, flangeBackDiameter, flangeFrontDiameter from "globals.kcl"
|
||||
|
||||
// create a function to create the flange
|
||||
export fn flange() {
|
||||
|
||||
// sketch the mounting hole pattern
|
||||
mountingHoles = startSketchOn("XY")
|
||||
mountingHoles = startSketchOn(XY)
|
||||
|> circle(%, center = [0, mountingHolePlacementDiameter / 2], radius = mountingHoleDiameter / 2)
|
||||
|> patternCircular2d(
|
||||
%,
|
||||
@ -21,7 +21,7 @@ export fn flange() {
|
||||
)
|
||||
|
||||
// create the flange base
|
||||
flangeBase = startSketchOn("XY")
|
||||
flangeBase = startSketchOn(XY)
|
||||
|> circle(%, center = [0, 0], radius = flangeDiameter / 2)
|
||||
|> hole(mountingHoles, %)
|
||||
|> extrude(%, length = flangeBaseThickness)
|
||||
|
@ -1,16 +1,17 @@
|
||||
// 91251A404 Socket Head Cap Screw
|
||||
|
||||
// import constants
|
||||
import boltDiameter, boltLength, boltHeadLength, boltHeadDiameter, boltHexDrive, boltHexFlatLength, boltThreadLength from "globals.kcl"
|
||||
// screw for mating the flanges together in the pipe flange assembly
|
||||
|
||||
// set units
|
||||
@settings(defaultLengthUnit = in)
|
||||
|
||||
|
||||
// import constants
|
||||
import boltDiameter, boltLength, boltHeadLength, boltHeadDiameter, boltHexDrive, boltHexFlatLength, boltThreadLength from "globals.kcl"
|
||||
|
||||
// create a function to make a the bolt
|
||||
export fn bolt() {
|
||||
|
||||
// Create the head of the cap screw
|
||||
boltHead = startSketchOn('XZ')
|
||||
boltHead = startSketchOn(XZ)
|
||||
|> circle(center = [0, 0], radius = boltHeadDiameter / 2, tag = $topEdge)
|
||||
|> extrude(length = -boltHeadLength)
|
||||
|> fillet(radius = 0.020, tags = [topEdge, getOppositeEdge(topEdge)])
|
||||
|
@ -1,16 +1,16 @@
|
||||
// 9472K188 Gasket
|
||||
|
||||
// import constants
|
||||
import gasketOutsideDiameter, gasketInnerDiameter, gasketThickness from "globals.kcl"
|
||||
// gasket for the pipe flange assembly. A gasket is a mechanical seal that fills the space between two or more mating surfaces, preventing leaks of liquids or gases under compression
|
||||
|
||||
// set units
|
||||
@settings(defaultLengthUnit = in)
|
||||
|
||||
// import constants
|
||||
import gasketOutsideDiameter, gasketInnerDiameter, gasketThickness from "globals.kcl"
|
||||
|
||||
// create a function to make the gasket
|
||||
export fn gasket() {
|
||||
|
||||
// create the base of the gasket
|
||||
gasketBase = startSketchOn("XY")
|
||||
gasketBase = startSketchOn(XY)
|
||||
|> circle(%, center = [0, 0], radius = gasketOutsideDiameter / 2)
|
||||
|> extrude(%, length = gasketThickness)
|
||||
|
||||
|
@ -1,16 +1,16 @@
|
||||
// 95479A127 Hex Nut
|
||||
|
||||
// import constants
|
||||
import hexNutDiameter, hexNutFlatToFlat, hexNutThickness, hexNutFlatLength from "globals.kcl"
|
||||
// hex nut for the screws in the pipe flange assembly.
|
||||
|
||||
// set units
|
||||
@settings(defaultLengthUnit = in)
|
||||
|
||||
// import constants
|
||||
import hexNutDiameter, hexNutFlatToFlat, hexNutThickness, hexNutFlatLength from "globals.kcl"
|
||||
|
||||
// create a function to make the hex nut
|
||||
export fn hexNut() {
|
||||
|
||||
// create the base of the hex nut
|
||||
hexNutBase = startSketchOn('XY')
|
||||
hexNutBase = startSketchOn(XY)
|
||||
|> startProfileAt([
|
||||
hexNutFlatToFlat / 2,
|
||||
hexNutFlatLength / 2
|
||||
|
@ -1,16 +1,16 @@
|
||||
// 98017A257 Washer
|
||||
|
||||
// import constants
|
||||
import washerInnerDia, washerOuterDia, washerThickness from "globals.kcl"
|
||||
// washer for the screws in the pipe flange assembly.
|
||||
|
||||
// set units
|
||||
@settings(defaultLengthUnit = in)
|
||||
|
||||
// import constants
|
||||
import washerInnerDia, washerOuterDia, washerThickness from "globals.kcl"
|
||||
|
||||
// create a function to make the washer
|
||||
export fn washer() {
|
||||
|
||||
// create the base of the washer
|
||||
washerBase = startSketchOn('XY')
|
||||
washerBase = startSketchOn(XY)
|
||||
|> circle(center = [0, 0], radius = washerOuterDia / 2)
|
||||
|> extrude(length = washerThickness)
|
||||
|
||||
|
@ -5,54 +5,116 @@
|
||||
@settings(defaultLengthUnit = in)
|
||||
|
||||
// import constants
|
||||
import * from 'globals.kcl'
|
||||
import * from "globals.kcl"
|
||||
|
||||
// import parts
|
||||
import flange from '68095k348-flange.kcl'
|
||||
import gasket from '9472k188-gasket.kcl'
|
||||
import washer from '98017a257-washer.kcl'
|
||||
import bolt from '91251a404-bolt.kcl'
|
||||
import hexNut from '95479a127-hex-nut.kcl'
|
||||
import pipe from '1120t74-pipe.kcl'
|
||||
import flange from "68095k348-flange.kcl"
|
||||
import gasket from "9472k188-gasket.kcl"
|
||||
import washer from "98017a257-washer.kcl"
|
||||
import bolt from "91251a404-bolt.kcl"
|
||||
import hexNut from "95479a127-hex-nut.kcl"
|
||||
import pipe from "1120t74-pipe.kcl"
|
||||
|
||||
// place flanges
|
||||
flange()
|
||||
flange()
|
||||
|> rotate(axis = [0, 1, 0], angle = 180)
|
||||
|> translate(translate = [0, 0, flangeBackHeight*2 + gasketThickness])
|
||||
|> translate(
|
||||
x = 0,
|
||||
y = 0,
|
||||
z = flangeBackHeight * 2 + gasketThickness,
|
||||
)
|
||||
|
||||
// place gasket between the flanges
|
||||
gasket()
|
||||
|> translate(translate = [0, 0, -flangeBackHeight - gasketThickness])
|
||||
|> translate(
|
||||
x = 0,
|
||||
y = 0,
|
||||
z = -flangeBackHeight - gasketThickness
|
||||
)
|
||||
|
||||
// place eight washers (four front, four back)
|
||||
washer()
|
||||
|> translate(translate = [
|
||||
mountingHolePlacementDiameter/2,
|
||||
0,
|
||||
flangeBaseThickness
|
||||
])
|
||||
|> patternCircular3d(%, instances = 4, axis = [0, 0, 1], center = [0, 0, 0], arcDegrees = 360, rotateDuplicates = false)
|
||||
|> patternLinear3d(%, instances = 2, distance = -(flangeBaseThickness*2 + flangeBackHeight * 2 + gasketThickness + washerThickness), axis = [0, 0, 1])
|
||||
|> translate(
|
||||
x = mountingHolePlacementDiameter / 2,
|
||||
y = 0,
|
||||
z = flangeBaseThickness
|
||||
)
|
||||
|> patternCircular3d(
|
||||
%,
|
||||
instances = 4,
|
||||
axis = [0, 0, 1],
|
||||
center = [0, 0, 0],
|
||||
arcDegrees = 360,
|
||||
rotateDuplicates = false,
|
||||
)
|
||||
|> patternLinear3d(
|
||||
%,
|
||||
instances = 2,
|
||||
distance = -(flangeBaseThickness * 2 + flangeBackHeight * 2 + gasketThickness + washerThickness),
|
||||
axis = [0, 0, 1],
|
||||
)
|
||||
|
||||
// place four bolts
|
||||
bolt()
|
||||
|> translate(translate = [
|
||||
mountingHolePlacementDiameter/2, 0, flangeBaseThickness + washerThickness
|
||||
])
|
||||
|> translate(
|
||||
x = mountingHolePlacementDiameter / 2,
|
||||
y = 0,
|
||||
z = flangeBaseThickness + washerThickness,
|
||||
)
|
||||
|> rotate(roll = 90, pitch = 0, yaw = 0)
|
||||
|> patternCircular3d(%, instances = 4, axis = [0, 0, 1], center = [0, 0, 0], arcDegrees = 360, rotateDuplicates = false)
|
||||
|> patternCircular3d(
|
||||
%,
|
||||
instances = 4,
|
||||
axis = [0, 0, 1],
|
||||
center = [0, 0, 0],
|
||||
arcDegrees = 360,
|
||||
rotateDuplicates = false,
|
||||
)
|
||||
|
||||
// place four hex nuts
|
||||
hexNut()
|
||||
|> translate(translate = [mountingHolePlacementDiameter/2, 0, -(flangeBackHeight * 2 + gasketThickness + flangeBaseThickness + washerThickness + hexNutThickness)])
|
||||
|> patternCircular3d(%, instances = 4, axis = [0, 0, 1], center = [0, 0, 0], arcDegrees = 360, rotateDuplicates = false)
|
||||
|> translate(
|
||||
x = mountingHolePlacementDiameter / 2,
|
||||
y = 0,
|
||||
z = -(flangeBackHeight * 2 + gasketThickness + flangeBaseThickness + washerThickness + hexNutThickness),
|
||||
)
|
||||
|> patternCircular3d(
|
||||
%,
|
||||
instances = 4,
|
||||
axis = [0, 0, 1],
|
||||
center = [0, 0, 0],
|
||||
arcDegrees = 360,
|
||||
rotateDuplicates = false,
|
||||
)
|
||||
|
||||
// place both pieces of pipe
|
||||
pipe()
|
||||
|> rotate(%, roll = -90, pitch = 0, yaw = 0)
|
||||
|> translate(%, translate = [0, 0, flangeBaseThickness + flangeFrontHeight - 0.5], global = true)
|
||||
|> rotate(
|
||||
%,
|
||||
roll = -90,
|
||||
pitch = 0,
|
||||
yaw = 0,
|
||||
)
|
||||
|> translate(
|
||||
%,
|
||||
x = 0,
|
||||
y = 0,
|
||||
z = flangeBaseThickness + flangeFrontHeight - 0.5,
|
||||
global = true,
|
||||
)
|
||||
|
||||
pipe()
|
||||
|> rotate(%, roll = 90, pitch = 0, yaw = 0)
|
||||
|> translate(%, translate = [0, 0, -(flangeBackHeight * 2 + gasketThickness + flangeBaseThickness + flangeFrontHeight - 0.5)], global = true)
|
||||
|> rotate(
|
||||
%,
|
||||
roll = 90,
|
||||
pitch = 0,
|
||||
yaw = 0,
|
||||
)
|
||||
|> translate(
|
||||
%,
|
||||
x = 0,
|
||||
y = 0,
|
||||
z = -(flangeBackHeight * 2 + gasketThickness + flangeBaseThickness + flangeFrontHeight - 0.5),
|
||||
global = true,
|
||||
)
|
||||
|
@ -1,7 +1,6 @@
|
||||
// Pipe with bend
|
||||
// A tubular section or hollow cylinder, usually but not necessarily of circular cross-section, used mainly to convey substances that can flow.
|
||||
|
||||
|
||||
// Set units
|
||||
@settings(defaultLengthUnit = in)
|
||||
|
||||
@ -12,7 +11,7 @@ bendRadius = 30
|
||||
bendAngle = 90
|
||||
|
||||
// create a sketch in the 'XZ' plane
|
||||
sketch000 = startSketchOn("XZ")
|
||||
sketch000 = startSketchOn(XZ)
|
||||
|
||||
// create a profile for the outer diameter
|
||||
outerProfile = circle(sketch000, center = [bendRadius, 0], radius = outerDiameter / 2)
|
||||
|
@ -15,7 +15,7 @@ pipeTransitionLength = 0.5
|
||||
pipeSmallDiaLength = pipeTotalLength - pipeTransitionLength - pipeLargeDiaLength
|
||||
|
||||
// Create the sketch to be revolved around the y-axis. Use the small diameter, large diameter, length, and thickness to define the sketch.
|
||||
pipeSketch = startSketchOn('XY')
|
||||
pipeSketch = startSketchOn(XY)
|
||||
|> startProfileAt([pipeSmallDia - (thickness / 2), 38], %)
|
||||
|> line(end = [thickness, 0])
|
||||
|> line(end = [0, -pipeSmallDiaLength])
|
||||
|
@ -1,11 +1,9 @@
|
||||
// Poopy Shoe
|
||||
// poop shute for bambu labs printer - optimized for printing.
|
||||
|
||||
|
||||
// Set units
|
||||
@settings(defaultLengthUnit = in)
|
||||
|
||||
|
||||
wallThickness = 0.125
|
||||
wallsWidth = 3
|
||||
height = 5.125
|
||||
@ -14,7 +12,7 @@ backLength = 6
|
||||
exitHeight = 1
|
||||
frontLength = 7
|
||||
|
||||
sketch001 = startSketchOn("-YZ")
|
||||
sketch001 = startSketchOn(-YZ)
|
||||
|> startProfileAt([wallsWidth / 2, 0], %)
|
||||
|> xLine(length = wallThickness / 2)
|
||||
|> angledLineToX({ angle = 60, to = wallsWidth }, %, $seg01)
|
||||
@ -32,17 +30,18 @@ sketch001 = startSketchOn("-YZ")
|
||||
|> yLine(endAbsolute = segEndY(seg01))
|
||||
|> angledLineToY({ angle = 180 - 60, to = 0 }, %)
|
||||
|> close()
|
||||
part001 = revolve(sketch001,
|
||||
part001 = revolve(
|
||||
sketch001,
|
||||
angle = 90,
|
||||
axis = {
|
||||
custom = {
|
||||
axis = [1.0, 0.0],
|
||||
origin = [0.0, height + .0001]
|
||||
}
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
sketch002 = startSketchOn('-YZ')
|
||||
sketch002 = startSketchOn(-YZ)
|
||||
|> startProfileAt([wallsWidth / 2, 0], %)
|
||||
|> xLine(length = wallThickness / 2)
|
||||
|> angledLineToX({ angle = 60, to = wallsWidth }, %, $seg02)
|
||||
|
@ -13,7 +13,7 @@ templateThickness = 10
|
||||
radius = 10
|
||||
depth = 30
|
||||
distanceToInsideEdge = slateWidthHalf + templateThickness + templateGap
|
||||
sketch001 = startSketchOn('XZ')
|
||||
sketch001 = startSketchOn(XZ)
|
||||
|> startProfileAt([ZERO, depth + templateGap], %)
|
||||
|> xLine(length = slateWidthHalf - radius, tag = $seg01)
|
||||
|> arc({
|
||||
|
@ -17,7 +17,7 @@ length001 = slateWidthHalf - radius
|
||||
length002 = depth + minClampingDistance
|
||||
|
||||
// Create the first sketch
|
||||
sketch001 = startSketchOn('XZ')
|
||||
sketch001 = startSketchOn(XZ)
|
||||
|> startProfileAt([0, depth - templateGap], %)
|
||||
|> xLine(length = length001, tag = $seg01)
|
||||
|> arc({
|
||||
|
Before Width: | Height: | Size: 90 KiB After Width: | Height: | Size: 90 KiB |
BIN
public/kcl-samples/screenshots/dual-basin-utility-sink.png
Normal file
After Width: | Height: | Size: 55 KiB |
BIN
public/kcl-samples/screenshots/makeup-mirror.png
Normal file
After Width: | Height: | Size: 62 KiB |
@ -15,7 +15,7 @@ boltSize = 0.25
|
||||
flangeWidth = 1.5
|
||||
|
||||
// Sketch and extrude the base shape and fillet the inside and outside edges.
|
||||
baseExtrusion = startSketchOn('-XZ')
|
||||
baseExtrusion = startSketchOn(-XZ)
|
||||
|> startProfileAt([0, 0], %)
|
||||
|> line(end = [0, thickness], tag = $e1)
|
||||
|> line(end = [flangeLength, 0], tag = $e2)
|
||||
@ -30,82 +30,46 @@ baseExtrusion = startSketchOn('-XZ')
|
||||
|> line(end = [0, -hatHeight], tag = $e11)
|
||||
|> close(tag = $e12)
|
||||
|> extrude(length = hatWidth)
|
||||
|> fillet(
|
||||
radius = bendRad,
|
||||
tags = [getNextAdjacentEdge(e2)]
|
||||
)
|
||||
|> fillet(
|
||||
radius = outsideBendRad,
|
||||
tags = [getNextAdjacentEdge(e3)]
|
||||
)
|
||||
|> fillet(
|
||||
radius = outsideBendRad,
|
||||
tags = [getNextAdjacentEdge(e4)]
|
||||
)
|
||||
|> fillet(
|
||||
radius = bendRad,
|
||||
tags = [getNextAdjacentEdge(e5)]
|
||||
)
|
||||
|> fillet(
|
||||
radius = outsideBendRad,
|
||||
tags = [getNextAdjacentEdge(e8)]
|
||||
)
|
||||
|> fillet(
|
||||
radius = bendRad,
|
||||
tags = [getNextAdjacentEdge(e9)]
|
||||
)
|
||||
|> fillet(
|
||||
radius = bendRad,
|
||||
tags = [getNextAdjacentEdge(e10)]
|
||||
)
|
||||
|> fillet(
|
||||
radius = outsideBendRad,
|
||||
tags = [getNextAdjacentEdge(e11)]
|
||||
)
|
||||
|> fillet(radius = bendRad, tags = [getNextAdjacentEdge(e2)])
|
||||
|> fillet(radius = outsideBendRad, tags = [getNextAdjacentEdge(e3)])
|
||||
|> fillet(radius = outsideBendRad, tags = [getNextAdjacentEdge(e4)])
|
||||
|> fillet(radius = bendRad, tags = [getNextAdjacentEdge(e5)])
|
||||
|> fillet(radius = outsideBendRad, tags = [getNextAdjacentEdge(e8)])
|
||||
|> fillet(radius = bendRad, tags = [getNextAdjacentEdge(e9)])
|
||||
|> fillet(radius = bendRad, tags = [getNextAdjacentEdge(e10)])
|
||||
|> fillet(radius = outsideBendRad, tags = [getNextAdjacentEdge(e11)])
|
||||
|
||||
// Define the flanges and place the bolt holes
|
||||
flange1 = startSketchOn('XY')
|
||||
flange1 = startSketchOn(XY)
|
||||
|> startProfileAt([0, 0], %)
|
||||
|> line(end = [0, hatWidth])
|
||||
|> line(end = [flangeWidth, 0], tag = $e13)
|
||||
|> line(end = [0, -hatWidth], tag = $e14)
|
||||
|> close()
|
||||
|> hole(circle(
|
||||
center = [0.75, 1],
|
||||
radius = boltSize
|
||||
), %)
|
||||
|> hole(circle(
|
||||
center = [0.75, 4],
|
||||
radius = boltSize
|
||||
), %)
|
||||
|> hole(circle(center = [0.75, 1], radius = boltSize), %)
|
||||
|> hole(circle(center = [0.75, 4], radius = boltSize), %)
|
||||
|> extrude(length = thickness)
|
||||
|> fillet(
|
||||
radius = 0.5,
|
||||
tags = [
|
||||
getNextAdjacentEdge(e13),
|
||||
getNextAdjacentEdge(e14)
|
||||
]
|
||||
],
|
||||
)
|
||||
|
||||
flange2 = startSketchOn('XY')
|
||||
flange2 = startSketchOn(XY)
|
||||
|> startProfileAt([-6, 0], %)
|
||||
|> line(end = [0, hatWidth])
|
||||
|> line(end = [-flangeWidth, 0], tag = $e15)
|
||||
|> line(end = [0, -hatWidth], tag = $e16)
|
||||
|> close()
|
||||
|> hole(circle(
|
||||
center = [-6.75, 1],
|
||||
radius = boltSize
|
||||
), %)
|
||||
|> hole(circle(
|
||||
center = [-6.75, 4],
|
||||
radius = boltSize
|
||||
), %)
|
||||
|> hole(circle(center = [-6.75, 1], radius = boltSize), %)
|
||||
|> hole(circle(center = [-6.75, 4], radius = boltSize), %)
|
||||
|> extrude(length = thickness)
|
||||
|> fillet(
|
||||
radius = 0.25,
|
||||
tags = [
|
||||
getNextAdjacentEdge(e15),
|
||||
getNextAdjacentEdge(e16)
|
||||
]
|
||||
],
|
||||
)
|
||||
|
@ -5,24 +5,19 @@
|
||||
@settings(defaultLengthUnit = in, defaultAngleUnit = deg)
|
||||
|
||||
export boltDiameter = 0.190
|
||||
export boltLength = 1.00
|
||||
export boltLength = 1.0
|
||||
export boltHeadLength = boltDiameter
|
||||
export boltHeadDiameter = 0.313
|
||||
export boltHexDrive = 5/32
|
||||
export boltHexDrive = 5 / 32
|
||||
export boltHexFlatLength = boltHexDrive / (2 * cos(toRadians(30)))
|
||||
|
||||
export fn bolt () {
|
||||
|
||||
export fn bolt() {
|
||||
// Create the head of the cap screw
|
||||
boltHead = startSketchOn('XZ')
|
||||
|> circle(
|
||||
center = [0, 0],
|
||||
radius = boltHeadDiameter / 2,
|
||||
tag = $topEdge
|
||||
)
|
||||
boltHead = startSketchOn(XZ)
|
||||
|> circle(center = [0, 0], radius = boltHeadDiameter / 2, tag = $topEdge)
|
||||
|> extrude(length = -boltHeadLength)
|
||||
|> fillet(radius = 0.020, tags = [topEdge, getOppositeEdge(topEdge)])
|
||||
|
||||
|
||||
// Define the sketch of the hex pattern on the screw head
|
||||
hexPatternSketch = startSketchOn(boltHead, 'start')
|
||||
|> startProfileAt([
|
||||
@ -51,7 +46,6 @@ export fn bolt () {
|
||||
}, %)
|
||||
|> close()
|
||||
|> extrude(length = -boltHeadLength * 0.75)
|
||||
|
||||
boltBody = startSketchOn(boltHead, 'end')
|
||||
|> circle(center = [0, 0], radius = boltDiameter / 2, tag = $filletEdge)
|
||||
|> extrude(length = boltLength)
|
||||
|
@ -1,24 +1,23 @@
|
||||
// Antenna
|
||||
|
||||
|
||||
// import constants
|
||||
import antennaLength, antennaBaseWidth, antennaBaseHeight, antennaTopWidth, antennaTopHeight from "globals.kcl"
|
||||
// Walkie talkie antenna
|
||||
// antenna for the walkie talkie assembly
|
||||
|
||||
// Set units
|
||||
@settings(defaultLengthUnit = in)
|
||||
|
||||
export fn antenna () {
|
||||
// import constants
|
||||
import antennaLength, antennaBaseWidth, antennaBaseHeight, antennaTopWidth, antennaTopHeight from "globals.kcl"
|
||||
|
||||
export fn antenna() {
|
||||
// Create the antenna base sketch
|
||||
sketch001 = startSketchOn('XY')
|
||||
sketch001 = startSketchOn(XY)
|
||||
|> startProfileAt([0, 0], %)
|
||||
|> line(end = [antennaBaseWidth, 0])
|
||||
|> line(end = [0, -antennaBaseHeight])
|
||||
|> line(end = [-antennaBaseWidth, 0])
|
||||
|> close()
|
||||
|
||||
|
||||
// Create the antenna top sketch
|
||||
loftPlane = offsetPlane('XY', offset = antennaLength)
|
||||
|
||||
loftPlane = offsetPlane(XY, offset = antennaLength)
|
||||
sketch002 = startSketchOn(loftPlane)
|
||||
|> startProfileAt([
|
||||
(antennaBaseWidth - antennaTopWidth) / 2,
|
||||
@ -28,10 +27,9 @@ export fn antenna () {
|
||||
|> yLine(length = -antennaTopHeight)
|
||||
|> xLine(length = -antennaTopWidth)
|
||||
|> close()
|
||||
|
||||
|
||||
// Create the antenna using a loft
|
||||
antenna = loft([sketch001, sketch002])
|
||||
|> appearance(color = "#000000")
|
||||
return antenna
|
||||
|
||||
}
|
||||
|
@ -1,16 +1,16 @@
|
||||
// Walkie talkie body
|
||||
|
||||
// import constants
|
||||
import height, width, thickness, chamferLength, offset, screenWidth, screenHeight, screenYPosition, screenDepth, speakerBoxWidth, speakerBoxHeight from "globals.kcl"
|
||||
// the main body of the walkie talkie assembly
|
||||
|
||||
// set units
|
||||
@settings(defaultLengthUnit = in)
|
||||
|
||||
// create a function to define the body
|
||||
export fn body () {
|
||||
// import constants
|
||||
import height, width, thickness, chamferLength, offset, screenWidth, screenHeight, screenYPosition, screenDepth, speakerBoxWidth, speakerBoxHeight from "globals.kcl"
|
||||
|
||||
// create a function to define the body
|
||||
export fn body() {
|
||||
// sketch and extrude the body of the walkie talkie
|
||||
bodySketch = startSketchOn('XZ')
|
||||
bodySketch = startSketchOn(XZ)
|
||||
|> startProfileAt([-width / 2, height / 2], %)
|
||||
|> xLine(length = width, tag = $chamfer1)
|
||||
|> yLine(length = -height, tag = $chamfer2)
|
||||
@ -24,7 +24,7 @@ export fn body () {
|
||||
getNextAdjacentEdge(chamfer2),
|
||||
getNextAdjacentEdge(chamfer3),
|
||||
getNextAdjacentEdge(chamfer4)
|
||||
]
|
||||
],
|
||||
)
|
||||
|
||||
// cut out the indentation for the case
|
||||
@ -57,7 +57,7 @@ export fn body () {
|
||||
}, %)
|
||||
|> close()
|
||||
extrude002 = extrude(sketch002, length = -0.0625)
|
||||
|
||||
|
||||
// Create the pocket for the screen
|
||||
sketch003 = startSketchOn(extrude002, 'start')
|
||||
|> startProfileAt([-screenWidth / 2, screenYPosition], %)
|
||||
@ -67,7 +67,7 @@ export fn body () {
|
||||
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||
|> close()
|
||||
extrude003 = extrude(sketch003, length = screenDepth)
|
||||
|
||||
|
||||
// Create the speaker box
|
||||
sketch004 = startSketchOn(extrude002, 'start')
|
||||
|> startProfileAt([-1.25 / 2, -.125], %)
|
||||
@ -77,9 +77,7 @@ export fn body () {
|
||||
|> close()
|
||||
|
||||
body = extrude(sketch004, length = -.5)
|
||||
|> appearance(
|
||||
color = "#277bb0",
|
||||
)
|
||||
|> appearance(color = "#277bb0")
|
||||
return body
|
||||
}
|
||||
|
||||
|
@ -4,26 +4,16 @@
|
||||
@settings(defaultLengthUnit = in)
|
||||
|
||||
// import constants
|
||||
import buttonWidth, buttonHeight, buttonThickness from 'globals.kcl'
|
||||
import buttonWidth, buttonHeight, buttonThickness from "globals.kcl"
|
||||
|
||||
// create a function to define the button
|
||||
export fn button() {
|
||||
|
||||
// sketch the button profile and extrude
|
||||
buttonSketch = startSketchOn('XZ')
|
||||
buttonSketch = startSketchOn(XZ)
|
||||
|> startProfileAt([0, 0], %)
|
||||
|> angledLine({
|
||||
angle = 180,
|
||||
length = buttonWidth
|
||||
}, %, $tag1)
|
||||
|> angledLine({
|
||||
angle = 270,
|
||||
length = buttonHeight
|
||||
}, %, $tag2)
|
||||
|> angledLine({
|
||||
angle = 0,
|
||||
length = buttonWidth
|
||||
}, %)
|
||||
|> angledLine({ angle = 180, length = buttonWidth }, %, $tag1)
|
||||
|> angledLine({ angle = 270, length = buttonHeight }, %, $tag2)
|
||||
|> angledLine({ angle = 0, length = buttonWidth }, %)
|
||||
|> close()
|
||||
buttonExtrude = extrude(buttonSketch, length = buttonThickness)
|
||||
|> chamfer(
|
||||
@ -31,9 +21,9 @@ export fn button() {
|
||||
tags = [
|
||||
getNextAdjacentEdge(tag1),
|
||||
getNextAdjacentEdge(tag2)
|
||||
]
|
||||
],
|
||||
)
|
||||
|> appearance(color = "#ff0000")
|
||||
|> appearance(color = "#ff0000")
|
||||
|
||||
return buttonExtrude
|
||||
}
|
||||
}
|
||||
|
@ -1,25 +1,24 @@
|
||||
// Walkie talkie case
|
||||
// the plastic case for the front of the walkie talkie
|
||||
|
||||
// set units
|
||||
@settings(defaultLengthUnit = in)
|
||||
|
||||
// import constants and Zoo logo
|
||||
import width, height, chamferLength, offset, screenWidth, screenHeight, screenYPosition, screenDepth, speakerBoxWidth, speakerBoxHeight, squareHoleSideLength, caseTolerance from "globals.kcl"
|
||||
import zLogo, oLogo, oLogo2 from "zoo-logo.kcl"
|
||||
|
||||
// set units
|
||||
@settings(defaultLengthUnit = in)
|
||||
|
||||
// create a function to define the case
|
||||
export fn case () {
|
||||
|
||||
export fn case() {
|
||||
// sketch the profile of the screen
|
||||
sketch006 = startSketchOn(startSketchOn('XZ'))
|
||||
sketch006 = startSketchOn(startSketchOn(XZ))
|
||||
|> startProfileAt([-screenWidth / 2, screenYPosition], %)
|
||||
|> xLine(length = screenWidth)
|
||||
|> yLine(length = -screenHeight)
|
||||
|> xLine(length = -screenWidth)
|
||||
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|
||||
|> close()
|
||||
|
||||
|
||||
// create transform functions for the speaker grid pattern
|
||||
fn transformX(i) {
|
||||
return { translate = [.125 * i, 0] }
|
||||
@ -29,7 +28,7 @@ export fn case () {
|
||||
}
|
||||
|
||||
// sketch the square hole grid pattern
|
||||
squareHolePatternSketch = startSketchOn(startSketchOn('XZ'))
|
||||
squareHolePatternSketch = startSketchOn(startSketchOn(XZ))
|
||||
|> startProfileAt([-screenWidth / 2 + .100, 0], %)
|
||||
|> line(end = [squareHoleSideLength / 2, 0])
|
||||
|> line(end = [0, -squareHoleSideLength / 2])
|
||||
@ -38,8 +37,8 @@ export fn case () {
|
||||
|> patternTransform2d(instances = 13, transform = transformX)
|
||||
|> patternTransform2d(instances = 11, transform = transformY)
|
||||
|
||||
// sketch the outer profile of the case and extrude with holes using the previously made profiles
|
||||
sketch005 = startSketchOn(startSketchOn('XZ'))
|
||||
// sketch the outer profile of the case and extrude with holes using the previously made profiles
|
||||
sketch005 = startSketchOn(startSketchOn(XZ))
|
||||
|> startProfileAt([
|
||||
-width / 2 + offset + caseTolerance,
|
||||
height / 2 - (chamferLength + (offset + caseTolerance) / 2 * cos(toRadians(45)))
|
||||
@ -77,14 +76,13 @@ export fn case () {
|
||||
|> hole(squareHolePatternSketch, %)
|
||||
|
||||
// create the Zoo logo
|
||||
|> hole(zLogo(startSketchOn('XZ'), [-.30, -1.825], .20), %)
|
||||
|> hole(oLogo(startSketchOn('XZ'), [-.075, -1.825], .20), %)
|
||||
|> hole(oLogo2(startSketchOn('XZ'), [-.075, -1.825], .20), %)
|
||||
|> hole(oLogo(startSketchOn('XZ'), [.175, -1.825], .20), %)
|
||||
|> hole(oLogo2(startSketchOn('XZ'), [.175, -1.825], .20), %)
|
||||
|
||||
|> hole(zLogo(startSketchOn(XZ), [-.30, -1.825], .20), %)
|
||||
|> hole(oLogo(startSketchOn(XZ), [-.075, -1.825], .20), %)
|
||||
|> hole(oLogo2(startSketchOn(XZ), [-.075, -1.825], .20), %)
|
||||
|> hole(oLogo(startSketchOn(XZ), [.175, -1.825], .20), %)
|
||||
|> hole(oLogo2(startSketchOn(XZ), [.175, -1.825], .20), %)
|
||||
case = extrude(sketch005, length = -0.0625)
|
||||
|> appearance(color = '#D0FF01', metalness = 0, roughness = 50)
|
||||
|
||||
return case
|
||||
}
|
||||
}
|
||||
|
@ -40,4 +40,4 @@ export knobRadius = 0.050
|
||||
|
||||
// talk-button
|
||||
export talkButtonSideLength = 0.5
|
||||
export talkButtonHeight = 0.050
|
||||
export talkButtonHeight = 0.050
|
||||
|
@ -1,31 +1,28 @@
|
||||
// Walkie Talkie Frequency Knob
|
||||
|
||||
// import constants
|
||||
import width, thickness, height, knobDiameter, knobHeight, knobRadius from "globals.kcl"
|
||||
// Walkie talkie frequency knob
|
||||
// the frequency knob for the walkie talkie assembly
|
||||
|
||||
// set units
|
||||
@settings(defaultLengthUnit = in)
|
||||
|
||||
// create a function to define the knob
|
||||
export fn knob () {
|
||||
// import constants
|
||||
import width, thickness, height, knobDiameter, knobHeight, knobRadius from "globals.kcl"
|
||||
|
||||
// Create the knob sketch and revolve
|
||||
knob = startSketchOn('XZ')
|
||||
|> startProfileAt([0.0001, 0], %)
|
||||
|> xLine(length = knobDiameter / 2)
|
||||
|> yLine(length = knobHeight - 0.05)
|
||||
|> arc({
|
||||
angleStart = 0,
|
||||
angleEnd = 90,
|
||||
radius = .05
|
||||
}, %)
|
||||
|> xLine(endAbsolute = 0.0001)
|
||||
|> close()
|
||||
|> revolve(
|
||||
axis = "Y",
|
||||
)
|
||||
|> appearance(color = '#D0FF01', metalness = 90, roughness = 50)
|
||||
// create a function to define the knob
|
||||
export fn knob() {
|
||||
// Create the knob sketch and revolve
|
||||
knob = startSketchOn(XZ)
|
||||
|> startProfileAt([0.0001, 0], %)
|
||||
|> xLine(length = knobDiameter / 2)
|
||||
|> yLine(length = knobHeight - 0.05)
|
||||
|> arc({
|
||||
angleStart = 0,
|
||||
angleEnd = 90,
|
||||
radius = .05
|
||||
}, %)
|
||||
|> xLine(endAbsolute = 0.0001)
|
||||
|> close()
|
||||
|> revolve(axis = "Y")
|
||||
|> appearance(color = '#D0FF01', metalness = 90, roughness = 50)
|
||||
|
||||
return knob
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -5,14 +5,14 @@
|
||||
@settings(defaultLengthUnit = in)
|
||||
|
||||
// import constants
|
||||
import * from 'globals.kcl'
|
||||
import * from "globals.kcl"
|
||||
|
||||
// import parts and constants
|
||||
import body from 'body.kcl'
|
||||
import case from 'case.kcl'
|
||||
import antenna from 'antenna.kcl'
|
||||
import talkButton from 'talk-button.kcl'
|
||||
import knob from 'knob.kcl'
|
||||
import body from "body.kcl"
|
||||
import case from "case.kcl"
|
||||
import antenna from "antenna.kcl"
|
||||
import talkButton from "talk-button.kcl"
|
||||
import knob from "knob.kcl"
|
||||
import button from "button.kcl"
|
||||
|
||||
// import the body
|
||||
@ -20,28 +20,60 @@ body()
|
||||
|
||||
// import the antenna
|
||||
antenna()
|
||||
|> translate(translate = [-width / 2 + .45, -0.10, height/2])
|
||||
|> translate(x = -width / 2 + .45, y = -0.10, z = height / 2)
|
||||
|
||||
// import the case
|
||||
case()
|
||||
|> translate(translate = [0, -1, 0])
|
||||
|> translate(x = 0, y = -1, z = 0)
|
||||
|
||||
// import the talk button
|
||||
talkButton()
|
||||
|> translate(translate = [width / 2, -thickness / 2, .5])
|
||||
|> translate(x = width / 2, y = -thickness / 2, z = .5)
|
||||
|
||||
// import the frequency knob
|
||||
knob()
|
||||
|> translate(translate = [width / 2 - 0.70, -thickness / 2, height / 2])
|
||||
|> translate(
|
||||
x = width / 2 - 0.70,
|
||||
y = -thickness / 2,
|
||||
z = height / 2
|
||||
)
|
||||
|
||||
// import the buttons
|
||||
button()
|
||||
|> translate(translate = [-(screenWidth / 2 + tolerance), -1, screenYPosition])
|
||||
|> translate(
|
||||
x = -(screenWidth / 2 + tolerance),
|
||||
y = -1,
|
||||
z = screenYPosition
|
||||
)
|
||||
button()
|
||||
|> translate(translate = [-(screenWidth / 2 + tolerance), -1, screenYPosition - buttonHeight - tolerance*2])
|
||||
|> translate(
|
||||
x = -(screenWidth / 2 + tolerance),
|
||||
y = -1,
|
||||
z = screenYPosition - buttonHeight - (tolerance * 2)
|
||||
)
|
||||
button()
|
||||
|> rotate(%, roll = 0, pitch = 180, yaw = 0)
|
||||
|> translate(translate = [screenWidth / 2 + tolerance, -1, screenYPosition - buttonHeight], global = true)
|
||||
|> rotate(
|
||||
%,
|
||||
roll = 0,
|
||||
pitch = 180,
|
||||
yaw = 0,
|
||||
)
|
||||
|> translate(
|
||||
x = screenWidth / 2 + tolerance,
|
||||
y = -1,
|
||||
z = screenYPosition - buttonHeight,
|
||||
global = true,
|
||||
)
|
||||
button()
|
||||
|> rotate(%, roll = 0, pitch = 180, yaw = 0)
|
||||
|> translate(translate = [screenWidth / 2 + tolerance, -1, screenYPosition - buttonHeight*2 - tolerance * 2], global = true)
|
||||
|> rotate(
|
||||
%,
|
||||
roll = 0,
|
||||
pitch = 180,
|
||||
yaw = 0,
|
||||
)
|
||||
|> translate(
|
||||
x = screenWidth / 2 + tolerance,
|
||||
y = -1,
|
||||
z = screenYPosition - (buttonHeight * 2) - (tolerance * 2),
|
||||
global = true,
|
||||
)
|
||||
|
@ -1,6 +1,5 @@
|
||||
// Walkie talkie talk button
|
||||
|
||||
|
||||
// set units
|
||||
@settings(defaultLengthUnit = in)
|
||||
|
||||
@ -8,9 +7,8 @@
|
||||
import width, thickness, talkButtonSideLength, talkButtonHeight from "globals.kcl"
|
||||
|
||||
export fn talkButton() {
|
||||
|
||||
// create the talk button sketch
|
||||
talkButtonSketch = startSketchOn('YZ')
|
||||
talkButtonSketch = startSketchOn(YZ)
|
||||
|> startProfileAt([
|
||||
-talkButtonSideLength / 2,
|
||||
talkButtonSideLength / 2
|
||||
@ -23,14 +21,14 @@ export fn talkButton() {
|
||||
// create the talk button and apply fillets
|
||||
talkButton = extrude(talkButtonSketch, length = talkButtonHeight)
|
||||
|> fillet(
|
||||
radius = 0.050,
|
||||
tags = [
|
||||
getNextAdjacentEdge(tag1),
|
||||
getNextAdjacentEdge(tag2),
|
||||
getNextAdjacentEdge(tag3),
|
||||
getNextAdjacentEdge(tag4)
|
||||
]
|
||||
)
|
||||
radius = 0.050,
|
||||
tags = [
|
||||
getNextAdjacentEdge(tag1),
|
||||
getNextAdjacentEdge(tag2),
|
||||
getNextAdjacentEdge(tag3),
|
||||
getNextAdjacentEdge(tag4)
|
||||
],
|
||||
)
|
||||
|> appearance(color = '#D0FF01', metalness = 90, roughness = 90)
|
||||
|
||||
return talkButton
|
||||
|
@ -80,4 +80,4 @@ export fn oLogo2(surface, origin, scale) {
|
||||
}, %)
|
||||
|> close()
|
||||
return oSketch002
|
||||
}
|
||||
}
|
||||
|
@ -14,17 +14,11 @@ thicknessMin = 0.024
|
||||
fn washer(plane, innerDia, outerDia, thk) {
|
||||
// Define the sketch of the washer
|
||||
washerSketch = startSketchOn(plane)
|
||||
|> circle(
|
||||
center = [0, 0],
|
||||
radius = outerDia / 2
|
||||
)
|
||||
|> hole(circle(
|
||||
center = [0, 0],
|
||||
radius = innerDia / 2
|
||||
), %)
|
||||
|> circle(center = [0, 0], radius = outerDia / 2)
|
||||
|> hole(circle(center = [0, 0], radius = innerDia / 2), %)
|
||||
|
||||
washer = extrude(washerSketch, length = thk)
|
||||
return washer
|
||||
}
|
||||
|
||||
washer('XY', innerDiameter, outerDiameter, thicknessMax)
|
||||
washer(XY, innerDiameter, outerDiameter, thicknessMax)
|
||||
|