2024-03-04 16:06:43 -05:00
|
|
|
import { Models } from '@kittycad/lib'
|
2024-12-09 16:43:58 -05:00
|
|
|
import { angleLengthInfo } from 'components/Toolbar/setAngleLength'
|
|
|
|
import { transformAstSketchLines } from 'lang/std/sketchcombos'
|
|
|
|
import { PathToNode } from 'lang/wasm'
|
2024-07-12 16:16:26 -04:00
|
|
|
import { StateMachineCommandSetConfig, KclCommandValue } from 'lib/commandTypes'
|
2024-09-17 08:29:52 -05:00
|
|
|
import { KCL_DEFAULT_LENGTH, KCL_DEFAULT_DEGREE } from 'lib/constants'
|
2024-08-04 00:51:30 -04:00
|
|
|
import { components } from 'lib/machine-api'
|
Command bar: add extrude command, nonlinear editing, etc (#1204)
* Tweak toaster look and feel
* Add icons, tweak plus icon names
* Rename commandBarMeta to commandBarConfig
* Refactor command bar, add support for icons
* Create a tailwind plugin for aria-pressed button state
* Remove overlay from behind command bar
* Clean up toolbar
* Button and other style tweaks
* Icon tweaks follow-up: make old icons work with new sizing
* Delete unused static icons
* More CSS tweaks
* Small CSS tweak to project sidebar
* Add command bar E2E test
* fumpt
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* fix typo in a comment
* Fix icon padding (built version only)
* Update onboarding and warning banner icons padding
* Misc minor style fixes
* Get Extrude opening and canceling from command bar
* Iconography tweaks
* Get extrude kind of working
* Refactor command bar config types and organization
* Move command bar configs to be co-located with each other
* Start building a state machine for the command bar
* Start converting command bar to state machine
* Add support for multiple args, confirmation step
* Submission behavior, hotkeys, code organization
* Add new test for extruding from command bar
* Polish step back and selection hotkeys, CSS tweaks
* Loading style tweaks
* Validate selection inputs, polish UX of args re-editing
* Prevent submission with multiple selection on singlular arg
* Remove stray console logs
* Tweak test, CSS nit, remove extrude "result" argument
* Fix linting warnings
* Show Ctrl+/ instead of ⌘K on all platforms but Mac
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* Add "Enter sketch" to command bar
* fix command bar test
* Fix flaky cmd bar extrude test by waiting for engine select response
* Cover both button labels '⌘K' and 'Ctrl+/' in test
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-12-13 12:49:01 -05:00
|
|
|
import { Selections } from 'lib/selections'
|
2024-12-09 16:43:58 -05:00
|
|
|
import { kclManager } from 'lib/singletons'
|
|
|
|
import { err } from 'lib/trap'
|
2024-07-12 16:16:26 -04:00
|
|
|
import { modelingMachine, SketchTool } from 'machines/modelingMachine'
|
2025-01-17 10:16:18 -05:00
|
|
|
import {
|
|
|
|
loftValidator,
|
|
|
|
revolveAxisValidator,
|
|
|
|
shellValidator,
|
2025-01-22 15:59:47 +01:00
|
|
|
sweepValidator,
|
2025-01-17 10:16:18 -05:00
|
|
|
} from './validators'
|
Command bar: add extrude command, nonlinear editing, etc (#1204)
* Tweak toaster look and feel
* Add icons, tweak plus icon names
* Rename commandBarMeta to commandBarConfig
* Refactor command bar, add support for icons
* Create a tailwind plugin for aria-pressed button state
* Remove overlay from behind command bar
* Clean up toolbar
* Button and other style tweaks
* Icon tweaks follow-up: make old icons work with new sizing
* Delete unused static icons
* More CSS tweaks
* Small CSS tweak to project sidebar
* Add command bar E2E test
* fumpt
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* fix typo in a comment
* Fix icon padding (built version only)
* Update onboarding and warning banner icons padding
* Misc minor style fixes
* Get Extrude opening and canceling from command bar
* Iconography tweaks
* Get extrude kind of working
* Refactor command bar config types and organization
* Move command bar configs to be co-located with each other
* Start building a state machine for the command bar
* Start converting command bar to state machine
* Add support for multiple args, confirmation step
* Submission behavior, hotkeys, code organization
* Add new test for extruding from command bar
* Polish step back and selection hotkeys, CSS tweaks
* Loading style tweaks
* Validate selection inputs, polish UX of args re-editing
* Prevent submission with multiple selection on singlular arg
* Remove stray console logs
* Tweak test, CSS nit, remove extrude "result" argument
* Fix linting warnings
* Show Ctrl+/ instead of ⌘K on all platforms but Mac
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* Add "Enter sketch" to command bar
* fix command bar test
* Fix flaky cmd bar extrude test by waiting for engine select response
* Cover both button labels '⌘K' and 'Ctrl+/' in test
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-12-13 12:49:01 -05:00
|
|
|
|
2024-03-04 16:06:43 -05:00
|
|
|
type OutputFormat = Models['OutputFormat_type']
|
|
|
|
type OutputTypeKey = OutputFormat['type']
|
|
|
|
type ExtractStorageTypes<T> = T extends { storage: infer U } ? U : never
|
|
|
|
type StorageUnion = ExtractStorageTypes<OutputFormat>
|
|
|
|
|
Command bar: add extrude command, nonlinear editing, etc (#1204)
* Tweak toaster look and feel
* Add icons, tweak plus icon names
* Rename commandBarMeta to commandBarConfig
* Refactor command bar, add support for icons
* Create a tailwind plugin for aria-pressed button state
* Remove overlay from behind command bar
* Clean up toolbar
* Button and other style tweaks
* Icon tweaks follow-up: make old icons work with new sizing
* Delete unused static icons
* More CSS tweaks
* Small CSS tweak to project sidebar
* Add command bar E2E test
* fumpt
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* fix typo in a comment
* Fix icon padding (built version only)
* Update onboarding and warning banner icons padding
* Misc minor style fixes
* Get Extrude opening and canceling from command bar
* Iconography tweaks
* Get extrude kind of working
* Refactor command bar config types and organization
* Move command bar configs to be co-located with each other
* Start building a state machine for the command bar
* Start converting command bar to state machine
* Add support for multiple args, confirmation step
* Submission behavior, hotkeys, code organization
* Add new test for extruding from command bar
* Polish step back and selection hotkeys, CSS tweaks
* Loading style tweaks
* Validate selection inputs, polish UX of args re-editing
* Prevent submission with multiple selection on singlular arg
* Remove stray console logs
* Tweak test, CSS nit, remove extrude "result" argument
* Fix linting warnings
* Show Ctrl+/ instead of ⌘K on all platforms but Mac
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* Add "Enter sketch" to command bar
* fix command bar test
* Fix flaky cmd bar extrude test by waiting for engine select response
* Cover both button labels '⌘K' and 'Ctrl+/' in test
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-12-13 12:49:01 -05:00
|
|
|
export const EXTRUSION_RESULTS = [
|
|
|
|
'new',
|
|
|
|
'add',
|
|
|
|
'subtract',
|
|
|
|
'intersect',
|
|
|
|
] as const
|
|
|
|
|
|
|
|
export type ModelingCommandSchema = {
|
|
|
|
'Enter sketch': {}
|
2024-03-04 16:06:43 -05:00
|
|
|
Export: {
|
|
|
|
type: OutputTypeKey
|
|
|
|
storage?: StorageUnion
|
|
|
|
}
|
2024-08-04 00:51:30 -04:00
|
|
|
Make: {
|
2024-08-28 15:15:37 -04:00
|
|
|
machine: components['schemas']['MachineInfoResponse']
|
2024-08-04 00:51:30 -04:00
|
|
|
}
|
Command bar: add extrude command, nonlinear editing, etc (#1204)
* Tweak toaster look and feel
* Add icons, tweak plus icon names
* Rename commandBarMeta to commandBarConfig
* Refactor command bar, add support for icons
* Create a tailwind plugin for aria-pressed button state
* Remove overlay from behind command bar
* Clean up toolbar
* Button and other style tweaks
* Icon tweaks follow-up: make old icons work with new sizing
* Delete unused static icons
* More CSS tweaks
* Small CSS tweak to project sidebar
* Add command bar E2E test
* fumpt
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* fix typo in a comment
* Fix icon padding (built version only)
* Update onboarding and warning banner icons padding
* Misc minor style fixes
* Get Extrude opening and canceling from command bar
* Iconography tweaks
* Get extrude kind of working
* Refactor command bar config types and organization
* Move command bar configs to be co-located with each other
* Start building a state machine for the command bar
* Start converting command bar to state machine
* Add support for multiple args, confirmation step
* Submission behavior, hotkeys, code organization
* Add new test for extruding from command bar
* Polish step back and selection hotkeys, CSS tweaks
* Loading style tweaks
* Validate selection inputs, polish UX of args re-editing
* Prevent submission with multiple selection on singlular arg
* Remove stray console logs
* Tweak test, CSS nit, remove extrude "result" argument
* Fix linting warnings
* Show Ctrl+/ instead of ⌘K on all platforms but Mac
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* Add "Enter sketch" to command bar
* fix command bar test
* Fix flaky cmd bar extrude test by waiting for engine select response
* Cover both button labels '⌘K' and 'Ctrl+/' in test
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-12-13 12:49:01 -05:00
|
|
|
Extrude: {
|
|
|
|
selection: Selections // & { type: 'face' } would be cool to lock that down
|
|
|
|
// result: (typeof EXTRUSION_RESULTS)[number]
|
2024-02-23 11:24:22 -05:00
|
|
|
distance: KclCommandValue
|
Command bar: add extrude command, nonlinear editing, etc (#1204)
* Tweak toaster look and feel
* Add icons, tweak plus icon names
* Rename commandBarMeta to commandBarConfig
* Refactor command bar, add support for icons
* Create a tailwind plugin for aria-pressed button state
* Remove overlay from behind command bar
* Clean up toolbar
* Button and other style tweaks
* Icon tweaks follow-up: make old icons work with new sizing
* Delete unused static icons
* More CSS tweaks
* Small CSS tweak to project sidebar
* Add command bar E2E test
* fumpt
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* fix typo in a comment
* Fix icon padding (built version only)
* Update onboarding and warning banner icons padding
* Misc minor style fixes
* Get Extrude opening and canceling from command bar
* Iconography tweaks
* Get extrude kind of working
* Refactor command bar config types and organization
* Move command bar configs to be co-located with each other
* Start building a state machine for the command bar
* Start converting command bar to state machine
* Add support for multiple args, confirmation step
* Submission behavior, hotkeys, code organization
* Add new test for extruding from command bar
* Polish step back and selection hotkeys, CSS tweaks
* Loading style tweaks
* Validate selection inputs, polish UX of args re-editing
* Prevent submission with multiple selection on singlular arg
* Remove stray console logs
* Tweak test, CSS nit, remove extrude "result" argument
* Fix linting warnings
* Show Ctrl+/ instead of ⌘K on all platforms but Mac
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* Add "Enter sketch" to command bar
* fix command bar test
* Fix flaky cmd bar extrude test by waiting for engine select response
* Cover both button labels '⌘K' and 'Ctrl+/' in test
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-12-13 12:49:01 -05:00
|
|
|
}
|
2025-01-11 08:20:49 -05:00
|
|
|
Sweep: {
|
2025-01-22 15:59:47 +01:00
|
|
|
target: Selections
|
|
|
|
trajectory: Selections
|
2025-01-11 08:20:49 -05:00
|
|
|
}
|
2024-12-04 17:24:16 -05:00
|
|
|
Loft: {
|
|
|
|
selection: Selections
|
|
|
|
}
|
2024-12-09 15:20:48 -05:00
|
|
|
Shell: {
|
|
|
|
selection: Selections
|
|
|
|
thickness: KclCommandValue
|
|
|
|
}
|
2024-09-17 08:29:52 -05:00
|
|
|
Revolve: {
|
|
|
|
selection: Selections
|
|
|
|
angle: KclCommandValue
|
2025-01-10 09:52:04 -05:00
|
|
|
axisOrEdge: string
|
|
|
|
axis: string
|
|
|
|
edge: Selections
|
2024-09-17 08:29:52 -05:00
|
|
|
}
|
2024-07-15 19:20:32 +10:00
|
|
|
Fillet: {
|
|
|
|
selection: Selections
|
|
|
|
radius: KclCommandValue
|
|
|
|
}
|
2025-01-14 18:08:32 +01:00
|
|
|
Chamfer: {
|
|
|
|
selection: Selections
|
|
|
|
length: KclCommandValue
|
|
|
|
}
|
2024-11-26 11:36:14 -05:00
|
|
|
'Offset plane': {
|
|
|
|
plane: Selections
|
|
|
|
distance: KclCommandValue
|
|
|
|
}
|
2024-07-12 16:16:26 -04:00
|
|
|
'change tool': {
|
|
|
|
tool: SketchTool
|
|
|
|
}
|
2024-12-09 16:43:58 -05:00
|
|
|
'Constrain length': {
|
|
|
|
selection: Selections
|
|
|
|
length: KclCommandValue
|
|
|
|
}
|
|
|
|
'Constrain with named value': {
|
|
|
|
currentValue: {
|
|
|
|
valueText: string
|
|
|
|
pathToNode: PathToNode
|
|
|
|
variableName: string
|
|
|
|
}
|
|
|
|
namedValue: KclCommandValue
|
|
|
|
}
|
2024-08-14 14:26:44 -04:00
|
|
|
'Text-to-CAD': {
|
|
|
|
prompt: string
|
|
|
|
}
|
2024-12-20 13:39:06 +11:00
|
|
|
'Prompt-to-edit': {
|
|
|
|
prompt: string
|
|
|
|
selection: Selections
|
|
|
|
}
|
Command bar: add extrude command, nonlinear editing, etc (#1204)
* Tweak toaster look and feel
* Add icons, tweak plus icon names
* Rename commandBarMeta to commandBarConfig
* Refactor command bar, add support for icons
* Create a tailwind plugin for aria-pressed button state
* Remove overlay from behind command bar
* Clean up toolbar
* Button and other style tweaks
* Icon tweaks follow-up: make old icons work with new sizing
* Delete unused static icons
* More CSS tweaks
* Small CSS tweak to project sidebar
* Add command bar E2E test
* fumpt
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* fix typo in a comment
* Fix icon padding (built version only)
* Update onboarding and warning banner icons padding
* Misc minor style fixes
* Get Extrude opening and canceling from command bar
* Iconography tweaks
* Get extrude kind of working
* Refactor command bar config types and organization
* Move command bar configs to be co-located with each other
* Start building a state machine for the command bar
* Start converting command bar to state machine
* Add support for multiple args, confirmation step
* Submission behavior, hotkeys, code organization
* Add new test for extruding from command bar
* Polish step back and selection hotkeys, CSS tweaks
* Loading style tweaks
* Validate selection inputs, polish UX of args re-editing
* Prevent submission with multiple selection on singlular arg
* Remove stray console logs
* Tweak test, CSS nit, remove extrude "result" argument
* Fix linting warnings
* Show Ctrl+/ instead of ⌘K on all platforms but Mac
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* Add "Enter sketch" to command bar
* fix command bar test
* Fix flaky cmd bar extrude test by waiting for engine select response
* Cover both button labels '⌘K' and 'Ctrl+/' in test
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-12-13 12:49:01 -05:00
|
|
|
}
|
|
|
|
|
2024-07-12 16:16:26 -04:00
|
|
|
export const modelingMachineCommandConfig: StateMachineCommandSetConfig<
|
Command bar: add extrude command, nonlinear editing, etc (#1204)
* Tweak toaster look and feel
* Add icons, tweak plus icon names
* Rename commandBarMeta to commandBarConfig
* Refactor command bar, add support for icons
* Create a tailwind plugin for aria-pressed button state
* Remove overlay from behind command bar
* Clean up toolbar
* Button and other style tweaks
* Icon tweaks follow-up: make old icons work with new sizing
* Delete unused static icons
* More CSS tweaks
* Small CSS tweak to project sidebar
* Add command bar E2E test
* fumpt
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* fix typo in a comment
* Fix icon padding (built version only)
* Update onboarding and warning banner icons padding
* Misc minor style fixes
* Get Extrude opening and canceling from command bar
* Iconography tweaks
* Get extrude kind of working
* Refactor command bar config types and organization
* Move command bar configs to be co-located with each other
* Start building a state machine for the command bar
* Start converting command bar to state machine
* Add support for multiple args, confirmation step
* Submission behavior, hotkeys, code organization
* Add new test for extruding from command bar
* Polish step back and selection hotkeys, CSS tweaks
* Loading style tweaks
* Validate selection inputs, polish UX of args re-editing
* Prevent submission with multiple selection on singlular arg
* Remove stray console logs
* Tweak test, CSS nit, remove extrude "result" argument
* Fix linting warnings
* Show Ctrl+/ instead of ⌘K on all platforms but Mac
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* Add "Enter sketch" to command bar
* fix command bar test
* Fix flaky cmd bar extrude test by waiting for engine select response
* Cover both button labels '⌘K' and 'Ctrl+/' in test
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-12-13 12:49:01 -05:00
|
|
|
typeof modelingMachine,
|
|
|
|
ModelingCommandSchema
|
|
|
|
> = {
|
|
|
|
'Enter sketch': {
|
|
|
|
description: 'Enter sketch mode.',
|
|
|
|
icon: 'sketch',
|
|
|
|
},
|
2024-07-12 16:16:26 -04:00
|
|
|
'change tool': [
|
|
|
|
{
|
|
|
|
description: 'Start drawing straight lines.',
|
|
|
|
icon: 'line',
|
|
|
|
displayName: 'Line',
|
|
|
|
args: {
|
|
|
|
tool: {
|
|
|
|
defaultValue: 'line',
|
|
|
|
required: true,
|
|
|
|
skip: true,
|
|
|
|
inputType: 'string',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
description: 'Start drawing an arc tangent to the current segment.',
|
|
|
|
icon: 'arc',
|
|
|
|
displayName: 'Tangential Arc',
|
|
|
|
args: {
|
|
|
|
tool: {
|
|
|
|
defaultValue: 'tangentialArc',
|
|
|
|
required: true,
|
|
|
|
skip: true,
|
|
|
|
inputType: 'string',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
{
|
|
|
|
description: 'Start drawing a rectangle.',
|
|
|
|
icon: 'rectangle',
|
|
|
|
displayName: 'Rectangle',
|
|
|
|
args: {
|
|
|
|
tool: {
|
|
|
|
defaultValue: 'rectangle',
|
|
|
|
required: true,
|
|
|
|
skip: true,
|
|
|
|
inputType: 'string',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
],
|
2024-03-04 16:06:43 -05:00
|
|
|
Export: {
|
|
|
|
description: 'Export the current model.',
|
2024-07-24 22:02:16 -04:00
|
|
|
icon: 'floppyDiskArrow',
|
2024-03-04 16:06:43 -05:00
|
|
|
needsReview: true,
|
|
|
|
args: {
|
|
|
|
type: {
|
|
|
|
inputType: 'options',
|
|
|
|
defaultValue: 'gltf',
|
|
|
|
required: true,
|
|
|
|
options: [
|
2024-07-28 07:59:38 +01:00
|
|
|
{ name: 'glTF', isCurrent: true, value: 'gltf' },
|
2024-03-04 16:06:43 -05:00
|
|
|
{ name: 'OBJ', isCurrent: false, value: 'obj' },
|
|
|
|
{ name: 'STL', isCurrent: false, value: 'stl' },
|
|
|
|
{ name: 'STEP', isCurrent: false, value: 'step' },
|
|
|
|
{ name: 'PLY', isCurrent: false, value: 'ply' },
|
|
|
|
],
|
|
|
|
},
|
|
|
|
storage: {
|
|
|
|
inputType: 'options',
|
|
|
|
defaultValue: (c) => {
|
|
|
|
switch (c.argumentsToSubmit.type) {
|
|
|
|
case 'gltf':
|
|
|
|
return 'embedded'
|
|
|
|
case 'stl':
|
|
|
|
return 'ascii'
|
|
|
|
case 'ply':
|
|
|
|
return 'ascii'
|
|
|
|
default:
|
|
|
|
return undefined
|
|
|
|
}
|
|
|
|
},
|
|
|
|
skip: true,
|
|
|
|
required: (commandContext) =>
|
|
|
|
['gltf', 'stl', 'ply'].includes(
|
|
|
|
commandContext.argumentsToSubmit.type as string
|
|
|
|
),
|
|
|
|
options: (commandContext) => {
|
|
|
|
const type = commandContext.argumentsToSubmit.type as
|
|
|
|
| OutputTypeKey
|
|
|
|
| undefined
|
|
|
|
|
|
|
|
switch (type) {
|
|
|
|
case 'gltf':
|
|
|
|
return [
|
|
|
|
{ name: 'embedded', isCurrent: true, value: 'embedded' },
|
|
|
|
{ name: 'binary', isCurrent: false, value: 'binary' },
|
|
|
|
{ name: 'standard', isCurrent: false, value: 'standard' },
|
|
|
|
]
|
|
|
|
case 'stl':
|
|
|
|
return [
|
|
|
|
{ name: 'binary', isCurrent: false, value: 'binary' },
|
|
|
|
{ name: 'ascii', isCurrent: true, value: 'ascii' },
|
|
|
|
]
|
|
|
|
case 'ply':
|
|
|
|
return [
|
|
|
|
{ name: 'ascii', isCurrent: true, value: 'ascii' },
|
|
|
|
{
|
|
|
|
name: 'binary_big_endian',
|
|
|
|
isCurrent: false,
|
|
|
|
value: 'binary_big_endian',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'binary_little_endian',
|
|
|
|
isCurrent: false,
|
|
|
|
value: 'binary_little_endian',
|
|
|
|
},
|
|
|
|
]
|
|
|
|
default:
|
|
|
|
return []
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2024-08-04 00:51:30 -04:00
|
|
|
Make: {
|
|
|
|
hide: 'web',
|
|
|
|
displayName: 'Make',
|
|
|
|
description:
|
|
|
|
'Export the current part and send to a 3D printer on the network.',
|
|
|
|
icon: 'printer3d',
|
|
|
|
needsReview: true,
|
|
|
|
args: {
|
|
|
|
machine: {
|
|
|
|
inputType: 'options',
|
|
|
|
required: true,
|
2024-08-28 15:15:37 -04:00
|
|
|
valueSummary: (machine: components['schemas']['MachineInfoResponse']) =>
|
|
|
|
machine.make_model.model ||
|
|
|
|
machine.make_model.manufacturer ||
|
|
|
|
'Unknown Machine',
|
2024-10-25 19:28:10 -04:00
|
|
|
options: (commandBarContext) => {
|
|
|
|
return Object.values(
|
|
|
|
commandBarContext.machineManager?.machines || []
|
|
|
|
).map((machine: components['schemas']['MachineInfoResponse']) => ({
|
|
|
|
name:
|
|
|
|
`${machine.id} (${
|
|
|
|
machine.make_model.model || machine.make_model.manufacturer
|
|
|
|
}) (${machine.state.state})` +
|
|
|
|
(machine.hardware_configuration &&
|
|
|
|
machine.hardware_configuration.type !== 'none' &&
|
|
|
|
machine.hardware_configuration.config.nozzle_diameter
|
|
|
|
? ` - Nozzle Diameter: ${machine.hardware_configuration.config.nozzle_diameter}`
|
|
|
|
: '') +
|
|
|
|
(machine.hardware_configuration &&
|
|
|
|
machine.hardware_configuration.type !== 'none' &&
|
|
|
|
machine.hardware_configuration.config.filaments &&
|
|
|
|
machine.hardware_configuration.config.filaments[0]
|
|
|
|
? ` - ${
|
|
|
|
machine.hardware_configuration.config.filaments[0].name
|
|
|
|
} #${
|
|
|
|
machine.hardware_configuration.config &&
|
|
|
|
machine.hardware_configuration.config.filaments[0].color?.slice(
|
|
|
|
0,
|
|
|
|
6
|
|
|
|
)
|
|
|
|
}`
|
|
|
|
: ''),
|
|
|
|
isCurrent: false,
|
|
|
|
disabled: machine.state.state !== 'idle',
|
|
|
|
value: machine,
|
|
|
|
}))
|
2024-08-04 00:51:30 -04:00
|
|
|
},
|
2024-10-25 19:28:10 -04:00
|
|
|
defaultValue: (commandBarContext) => {
|
2024-08-04 00:51:30 -04:00
|
|
|
return Object.values(
|
2024-10-25 19:28:10 -04:00
|
|
|
commandBarContext.machineManager.machines || []
|
2024-08-28 15:15:37 -04:00
|
|
|
)[0] as components['schemas']['MachineInfoResponse']
|
2024-08-04 00:51:30 -04:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
Command bar: add extrude command, nonlinear editing, etc (#1204)
* Tweak toaster look and feel
* Add icons, tweak plus icon names
* Rename commandBarMeta to commandBarConfig
* Refactor command bar, add support for icons
* Create a tailwind plugin for aria-pressed button state
* Remove overlay from behind command bar
* Clean up toolbar
* Button and other style tweaks
* Icon tweaks follow-up: make old icons work with new sizing
* Delete unused static icons
* More CSS tweaks
* Small CSS tweak to project sidebar
* Add command bar E2E test
* fumpt
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* fix typo in a comment
* Fix icon padding (built version only)
* Update onboarding and warning banner icons padding
* Misc minor style fixes
* Get Extrude opening and canceling from command bar
* Iconography tweaks
* Get extrude kind of working
* Refactor command bar config types and organization
* Move command bar configs to be co-located with each other
* Start building a state machine for the command bar
* Start converting command bar to state machine
* Add support for multiple args, confirmation step
* Submission behavior, hotkeys, code organization
* Add new test for extruding from command bar
* Polish step back and selection hotkeys, CSS tweaks
* Loading style tweaks
* Validate selection inputs, polish UX of args re-editing
* Prevent submission with multiple selection on singlular arg
* Remove stray console logs
* Tweak test, CSS nit, remove extrude "result" argument
* Fix linting warnings
* Show Ctrl+/ instead of ⌘K on all platforms but Mac
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* Add "Enter sketch" to command bar
* fix command bar test
* Fix flaky cmd bar extrude test by waiting for engine select response
* Cover both button labels '⌘K' and 'Ctrl+/' in test
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-12-13 12:49:01 -05:00
|
|
|
Extrude: {
|
|
|
|
description: 'Pull a sketch into 3D along its normal or perpendicular.',
|
|
|
|
icon: 'extrude',
|
|
|
|
needsReview: true,
|
|
|
|
args: {
|
|
|
|
selection: {
|
|
|
|
inputType: 'selection',
|
2025-01-17 14:34:36 -05:00
|
|
|
selectionTypes: ['solid2d', 'segment'],
|
Command bar: add extrude command, nonlinear editing, etc (#1204)
* Tweak toaster look and feel
* Add icons, tweak plus icon names
* Rename commandBarMeta to commandBarConfig
* Refactor command bar, add support for icons
* Create a tailwind plugin for aria-pressed button state
* Remove overlay from behind command bar
* Clean up toolbar
* Button and other style tweaks
* Icon tweaks follow-up: make old icons work with new sizing
* Delete unused static icons
* More CSS tweaks
* Small CSS tweak to project sidebar
* Add command bar E2E test
* fumpt
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* fix typo in a comment
* Fix icon padding (built version only)
* Update onboarding and warning banner icons padding
* Misc minor style fixes
* Get Extrude opening and canceling from command bar
* Iconography tweaks
* Get extrude kind of working
* Refactor command bar config types and organization
* Move command bar configs to be co-located with each other
* Start building a state machine for the command bar
* Start converting command bar to state machine
* Add support for multiple args, confirmation step
* Submission behavior, hotkeys, code organization
* Add new test for extruding from command bar
* Polish step back and selection hotkeys, CSS tweaks
* Loading style tweaks
* Validate selection inputs, polish UX of args re-editing
* Prevent submission with multiple selection on singlular arg
* Remove stray console logs
* Tweak test, CSS nit, remove extrude "result" argument
* Fix linting warnings
* Show Ctrl+/ instead of ⌘K on all platforms but Mac
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* Add "Enter sketch" to command bar
* fix command bar test
* Fix flaky cmd bar extrude test by waiting for engine select response
* Cover both button labels '⌘K' and 'Ctrl+/' in test
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-12-13 12:49:01 -05:00
|
|
|
multiple: false, // TODO: multiple selection
|
|
|
|
required: true,
|
2024-02-08 12:59:01 -05:00
|
|
|
skip: true,
|
Command bar: add extrude command, nonlinear editing, etc (#1204)
* Tweak toaster look and feel
* Add icons, tweak plus icon names
* Rename commandBarMeta to commandBarConfig
* Refactor command bar, add support for icons
* Create a tailwind plugin for aria-pressed button state
* Remove overlay from behind command bar
* Clean up toolbar
* Button and other style tweaks
* Icon tweaks follow-up: make old icons work with new sizing
* Delete unused static icons
* More CSS tweaks
* Small CSS tweak to project sidebar
* Add command bar E2E test
* fumpt
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* fix typo in a comment
* Fix icon padding (built version only)
* Update onboarding and warning banner icons padding
* Misc minor style fixes
* Get Extrude opening and canceling from command bar
* Iconography tweaks
* Get extrude kind of working
* Refactor command bar config types and organization
* Move command bar configs to be co-located with each other
* Start building a state machine for the command bar
* Start converting command bar to state machine
* Add support for multiple args, confirmation step
* Submission behavior, hotkeys, code organization
* Add new test for extruding from command bar
* Polish step back and selection hotkeys, CSS tweaks
* Loading style tweaks
* Validate selection inputs, polish UX of args re-editing
* Prevent submission with multiple selection on singlular arg
* Remove stray console logs
* Tweak test, CSS nit, remove extrude "result" argument
* Fix linting warnings
* Show Ctrl+/ instead of ⌘K on all platforms but Mac
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* Add "Enter sketch" to command bar
* fix command bar test
* Fix flaky cmd bar extrude test by waiting for engine select response
* Cover both button labels '⌘K' and 'Ctrl+/' in test
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-12-13 12:49:01 -05:00
|
|
|
},
|
|
|
|
// result: {
|
|
|
|
// inputType: 'options',
|
2024-02-08 12:59:01 -05:00
|
|
|
// defaultValue: 'add',
|
|
|
|
// skip: true,
|
Command bar: add extrude command, nonlinear editing, etc (#1204)
* Tweak toaster look and feel
* Add icons, tweak plus icon names
* Rename commandBarMeta to commandBarConfig
* Refactor command bar, add support for icons
* Create a tailwind plugin for aria-pressed button state
* Remove overlay from behind command bar
* Clean up toolbar
* Button and other style tweaks
* Icon tweaks follow-up: make old icons work with new sizing
* Delete unused static icons
* More CSS tweaks
* Small CSS tweak to project sidebar
* Add command bar E2E test
* fumpt
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* fix typo in a comment
* Fix icon padding (built version only)
* Update onboarding and warning banner icons padding
* Misc minor style fixes
* Get Extrude opening and canceling from command bar
* Iconography tweaks
* Get extrude kind of working
* Refactor command bar config types and organization
* Move command bar configs to be co-located with each other
* Start building a state machine for the command bar
* Start converting command bar to state machine
* Add support for multiple args, confirmation step
* Submission behavior, hotkeys, code organization
* Add new test for extruding from command bar
* Polish step back and selection hotkeys, CSS tweaks
* Loading style tweaks
* Validate selection inputs, polish UX of args re-editing
* Prevent submission with multiple selection on singlular arg
* Remove stray console logs
* Tweak test, CSS nit, remove extrude "result" argument
* Fix linting warnings
* Show Ctrl+/ instead of ⌘K on all platforms but Mac
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* Add "Enter sketch" to command bar
* fix command bar test
* Fix flaky cmd bar extrude test by waiting for engine select response
* Cover both button labels '⌘K' and 'Ctrl+/' in test
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-12-13 12:49:01 -05:00
|
|
|
// required: true,
|
|
|
|
// options: EXTRUSION_RESULTS.map((r) => ({
|
|
|
|
// name: r,
|
|
|
|
// isCurrent: r === 'add',
|
|
|
|
// value: r,
|
|
|
|
// })),
|
|
|
|
// },
|
|
|
|
distance: {
|
2024-02-23 11:24:22 -05:00
|
|
|
inputType: 'kcl',
|
2024-05-17 10:29:04 -04:00
|
|
|
defaultValue: KCL_DEFAULT_LENGTH,
|
Command bar: add extrude command, nonlinear editing, etc (#1204)
* Tweak toaster look and feel
* Add icons, tweak plus icon names
* Rename commandBarMeta to commandBarConfig
* Refactor command bar, add support for icons
* Create a tailwind plugin for aria-pressed button state
* Remove overlay from behind command bar
* Clean up toolbar
* Button and other style tweaks
* Icon tweaks follow-up: make old icons work with new sizing
* Delete unused static icons
* More CSS tweaks
* Small CSS tweak to project sidebar
* Add command bar E2E test
* fumpt
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* fix typo in a comment
* Fix icon padding (built version only)
* Update onboarding and warning banner icons padding
* Misc minor style fixes
* Get Extrude opening and canceling from command bar
* Iconography tweaks
* Get extrude kind of working
* Refactor command bar config types and organization
* Move command bar configs to be co-located with each other
* Start building a state machine for the command bar
* Start converting command bar to state machine
* Add support for multiple args, confirmation step
* Submission behavior, hotkeys, code organization
* Add new test for extruding from command bar
* Polish step back and selection hotkeys, CSS tweaks
* Loading style tweaks
* Validate selection inputs, polish UX of args re-editing
* Prevent submission with multiple selection on singlular arg
* Remove stray console logs
* Tweak test, CSS nit, remove extrude "result" argument
* Fix linting warnings
* Show Ctrl+/ instead of ⌘K on all platforms but Mac
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* Add "Enter sketch" to command bar
* fix command bar test
* Fix flaky cmd bar extrude test by waiting for engine select response
* Cover both button labels '⌘K' and 'Ctrl+/' in test
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-12-13 12:49:01 -05:00
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2025-01-11 08:20:49 -05:00
|
|
|
Sweep: {
|
|
|
|
description:
|
|
|
|
'Create a 3D body by moving a sketch region along an arbitrary path.',
|
|
|
|
icon: 'sweep',
|
|
|
|
status: 'development',
|
2025-01-22 15:59:47 +01:00
|
|
|
needsReview: false,
|
2025-01-11 08:20:49 -05:00
|
|
|
args: {
|
2025-01-22 15:59:47 +01:00
|
|
|
target: {
|
2025-01-11 08:20:49 -05:00
|
|
|
inputType: 'selection',
|
2025-01-17 14:34:36 -05:00
|
|
|
selectionTypes: ['solid2d'],
|
2025-01-11 08:20:49 -05:00
|
|
|
required: true,
|
|
|
|
skip: true,
|
|
|
|
multiple: false,
|
|
|
|
warningMessage:
|
|
|
|
'The sweep workflow is new and under tested. Please break it and report issues.',
|
|
|
|
},
|
2025-01-22 15:59:47 +01:00
|
|
|
trajectory: {
|
2025-01-11 08:20:49 -05:00
|
|
|
inputType: 'selection',
|
|
|
|
selectionTypes: ['segment', 'path'],
|
|
|
|
required: true,
|
2025-01-22 15:59:47 +01:00
|
|
|
skip: false,
|
2025-01-11 08:20:49 -05:00
|
|
|
multiple: false,
|
2025-01-22 15:59:47 +01:00
|
|
|
validation: sweepValidator,
|
2025-01-11 08:20:49 -05:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2024-12-04 17:24:16 -05:00
|
|
|
Loft: {
|
|
|
|
description: 'Create a 3D body by blending between two or more sketches',
|
|
|
|
icon: 'loft',
|
2025-01-16 18:03:01 -05:00
|
|
|
needsReview: false,
|
2024-12-04 17:24:16 -05:00
|
|
|
args: {
|
|
|
|
selection: {
|
|
|
|
inputType: 'selection',
|
2025-01-17 14:34:36 -05:00
|
|
|
selectionTypes: ['solid2d'],
|
2024-12-04 17:24:16 -05:00
|
|
|
multiple: true,
|
|
|
|
required: true,
|
|
|
|
skip: false,
|
2024-12-17 16:55:07 +00:00
|
|
|
validation: loftValidator,
|
2024-12-04 17:24:16 -05:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2024-12-09 15:20:48 -05:00
|
|
|
Shell: {
|
|
|
|
description: 'Hollow out a 3D solid.',
|
|
|
|
icon: 'shell',
|
|
|
|
needsReview: true,
|
|
|
|
args: {
|
|
|
|
selection: {
|
|
|
|
inputType: 'selection',
|
|
|
|
selectionTypes: ['cap', 'wall'],
|
|
|
|
multiple: true,
|
|
|
|
required: true,
|
2025-01-17 10:16:18 -05:00
|
|
|
validation: shellValidator,
|
2024-12-09 15:20:48 -05:00
|
|
|
},
|
|
|
|
thickness: {
|
|
|
|
inputType: 'kcl',
|
|
|
|
defaultValue: KCL_DEFAULT_LENGTH,
|
|
|
|
required: true,
|
2025-01-17 10:16:18 -05:00
|
|
|
// TODO: add dry-run validation on thickness param
|
2024-12-09 15:20:48 -05:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2024-09-17 08:29:52 -05:00
|
|
|
Revolve: {
|
|
|
|
description: 'Create a 3D body by rotating a sketch region about an axis.',
|
|
|
|
icon: 'revolve',
|
2025-01-10 11:24:07 -05:00
|
|
|
status: 'development',
|
2024-09-17 08:29:52 -05:00
|
|
|
needsReview: true,
|
|
|
|
args: {
|
|
|
|
selection: {
|
|
|
|
inputType: 'selection',
|
2025-01-17 14:34:36 -05:00
|
|
|
selectionTypes: ['solid2d', 'segment'],
|
2024-09-17 08:29:52 -05:00
|
|
|
multiple: false, // TODO: multiple selection
|
|
|
|
required: true,
|
|
|
|
skip: true,
|
2025-01-10 11:24:07 -05:00
|
|
|
warningMessage:
|
|
|
|
'The revolve workflow is new and under tested. Please break it and report issues.',
|
2024-09-17 08:29:52 -05:00
|
|
|
},
|
2025-01-10 09:52:04 -05:00
|
|
|
axisOrEdge: {
|
|
|
|
inputType: 'options',
|
2024-12-10 12:11:01 -05:00
|
|
|
required: true,
|
2025-01-10 09:52:04 -05:00
|
|
|
defaultValue: 'Axis',
|
|
|
|
options: [
|
|
|
|
{ name: 'Axis', isCurrent: true, value: 'Axis' },
|
|
|
|
{ name: 'Edge', isCurrent: false, value: 'Edge' },
|
|
|
|
],
|
|
|
|
},
|
|
|
|
axis: {
|
|
|
|
required: (commandContext) =>
|
|
|
|
['Axis'].includes(
|
|
|
|
commandContext.argumentsToSubmit.axisOrEdge as string
|
|
|
|
),
|
|
|
|
inputType: 'options',
|
|
|
|
options: [
|
|
|
|
{ name: 'X Axis', isCurrent: true, value: 'X' },
|
|
|
|
{ name: 'Y Axis', isCurrent: false, value: 'Y' },
|
|
|
|
],
|
|
|
|
},
|
|
|
|
edge: {
|
|
|
|
required: (commandContext) =>
|
|
|
|
['Edge'].includes(
|
|
|
|
commandContext.argumentsToSubmit.axisOrEdge as string
|
|
|
|
),
|
2024-12-10 12:11:01 -05:00
|
|
|
inputType: 'selection',
|
|
|
|
selectionTypes: ['segment', 'sweepEdge', 'edgeCutEdge'],
|
|
|
|
multiple: false,
|
|
|
|
validation: revolveAxisValidator,
|
|
|
|
},
|
2024-09-17 08:29:52 -05:00
|
|
|
angle: {
|
|
|
|
inputType: 'kcl',
|
|
|
|
defaultValue: KCL_DEFAULT_DEGREE,
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2024-11-26 11:36:14 -05:00
|
|
|
'Offset plane': {
|
|
|
|
description: 'Offset a plane.',
|
|
|
|
icon: 'plane',
|
|
|
|
args: {
|
|
|
|
plane: {
|
|
|
|
inputType: 'selection',
|
|
|
|
selectionTypes: ['plane'],
|
|
|
|
multiple: false,
|
|
|
|
required: true,
|
|
|
|
skip: true,
|
|
|
|
},
|
|
|
|
distance: {
|
|
|
|
inputType: 'kcl',
|
|
|
|
defaultValue: KCL_DEFAULT_LENGTH,
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2024-07-15 19:20:32 +10:00
|
|
|
Fillet: {
|
|
|
|
description: 'Fillet edge',
|
2025-01-14 18:08:32 +01:00
|
|
|
icon: 'fillet3d',
|
2024-11-22 16:32:28 -05:00
|
|
|
status: 'development',
|
2024-07-15 19:20:32 +10:00
|
|
|
needsReview: true,
|
|
|
|
args: {
|
|
|
|
selection: {
|
|
|
|
inputType: 'selection',
|
2024-11-21 15:04:30 +11:00
|
|
|
selectionTypes: ['segment', 'sweepEdge', 'edgeCutEdge'],
|
2024-10-03 11:14:02 +02:00
|
|
|
multiple: true,
|
2024-07-15 19:20:32 +10:00
|
|
|
required: true,
|
2024-10-03 11:14:02 +02:00
|
|
|
skip: false,
|
2024-10-08 16:27:58 +02:00
|
|
|
warningMessage:
|
|
|
|
'Fillets cannot touch other fillets yet. This is under development.',
|
2024-07-15 19:20:32 +10:00
|
|
|
},
|
|
|
|
radius: {
|
|
|
|
inputType: 'kcl',
|
|
|
|
defaultValue: KCL_DEFAULT_LENGTH,
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2025-01-14 18:08:32 +01:00
|
|
|
Chamfer: {
|
|
|
|
description: 'Chamfer edge',
|
|
|
|
icon: 'chamfer3d',
|
|
|
|
status: 'development',
|
|
|
|
needsReview: true,
|
|
|
|
args: {
|
|
|
|
selection: {
|
|
|
|
inputType: 'selection',
|
|
|
|
selectionTypes: ['segment', 'sweepEdge', 'edgeCutEdge'],
|
|
|
|
multiple: true,
|
|
|
|
required: true,
|
|
|
|
skip: false,
|
|
|
|
warningMessage:
|
|
|
|
'Chamfers cannot touch other chamfers yet. This is under development.',
|
|
|
|
},
|
|
|
|
length: {
|
|
|
|
inputType: 'kcl',
|
|
|
|
defaultValue: KCL_DEFAULT_LENGTH,
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2024-12-09 16:43:58 -05:00
|
|
|
'Constrain length': {
|
|
|
|
description: 'Constrain the length of one or more segments.',
|
|
|
|
icon: 'dimension',
|
|
|
|
args: {
|
|
|
|
selection: {
|
|
|
|
inputType: 'selection',
|
|
|
|
selectionTypes: ['segment'],
|
|
|
|
multiple: false,
|
|
|
|
required: true,
|
|
|
|
skip: true,
|
|
|
|
},
|
|
|
|
length: {
|
|
|
|
inputType: 'kcl',
|
|
|
|
required: true,
|
|
|
|
createVariableByDefault: true,
|
|
|
|
defaultValue(_, machineContext) {
|
|
|
|
const selectionRanges = machineContext?.selectionRanges
|
|
|
|
if (!selectionRanges) return KCL_DEFAULT_LENGTH
|
|
|
|
const angleLength = angleLengthInfo({
|
|
|
|
selectionRanges,
|
|
|
|
angleOrLength: 'setLength',
|
|
|
|
})
|
|
|
|
if (err(angleLength)) return KCL_DEFAULT_LENGTH
|
|
|
|
const { transforms } = angleLength
|
|
|
|
|
|
|
|
// QUESTION: is it okay to reference kclManager here? will its state be up to date?
|
|
|
|
const sketched = transformAstSketchLines({
|
|
|
|
ast: structuredClone(kclManager.ast),
|
|
|
|
selectionRanges,
|
|
|
|
transformInfos: transforms,
|
|
|
|
programMemory: kclManager.programMemory,
|
|
|
|
referenceSegName: '',
|
|
|
|
})
|
|
|
|
if (err(sketched)) return KCL_DEFAULT_LENGTH
|
|
|
|
const { valueUsedInTransform } = sketched
|
|
|
|
return valueUsedInTransform?.toString() || KCL_DEFAULT_LENGTH
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
'Constrain with named value': {
|
|
|
|
description: 'Constrain a value by making it a named constant.',
|
|
|
|
icon: 'make-variable',
|
|
|
|
args: {
|
|
|
|
currentValue: {
|
|
|
|
description:
|
|
|
|
'Path to the node in the AST to constrain. This is never shown to the user.',
|
|
|
|
inputType: 'text',
|
|
|
|
required: false,
|
|
|
|
skip: true,
|
|
|
|
},
|
|
|
|
namedValue: {
|
|
|
|
inputType: 'kcl',
|
|
|
|
required: true,
|
|
|
|
createVariableByDefault: true,
|
|
|
|
variableName(commandBarContext, machineContext) {
|
|
|
|
const { currentValue } = commandBarContext.argumentsToSubmit
|
|
|
|
if (
|
|
|
|
!currentValue ||
|
|
|
|
!(currentValue instanceof Object) ||
|
|
|
|
!('variableName' in currentValue) ||
|
|
|
|
typeof currentValue.variableName !== 'string'
|
|
|
|
) {
|
|
|
|
return 'value'
|
|
|
|
}
|
|
|
|
return currentValue.variableName
|
|
|
|
},
|
|
|
|
defaultValue: (commandBarContext) => {
|
|
|
|
const { currentValue } = commandBarContext.argumentsToSubmit
|
|
|
|
if (
|
|
|
|
!currentValue ||
|
|
|
|
!(currentValue instanceof Object) ||
|
|
|
|
!('valueText' in currentValue) ||
|
|
|
|
typeof currentValue.valueText !== 'string'
|
|
|
|
) {
|
|
|
|
return KCL_DEFAULT_LENGTH
|
|
|
|
}
|
|
|
|
return currentValue.valueText
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2024-08-14 14:26:44 -04:00
|
|
|
'Text-to-CAD': {
|
|
|
|
description: 'Use the Zoo Text-to-CAD API to generate part starters.',
|
|
|
|
icon: 'chat',
|
|
|
|
args: {
|
|
|
|
prompt: {
|
|
|
|
inputType: 'text',
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2024-12-20 13:39:06 +11:00
|
|
|
'Prompt-to-edit': {
|
|
|
|
description: 'Use Zoo AI to edit your kcl',
|
|
|
|
icon: 'chat',
|
|
|
|
args: {
|
|
|
|
selection: {
|
|
|
|
inputType: 'selection',
|
|
|
|
selectionTypes: [
|
2025-01-17 14:34:36 -05:00
|
|
|
'solid2d',
|
2024-12-20 13:39:06 +11:00
|
|
|
'segment',
|
|
|
|
'sweepEdge',
|
|
|
|
'cap',
|
|
|
|
'wall',
|
|
|
|
'edgeCut',
|
|
|
|
'edgeCutEdge',
|
|
|
|
],
|
|
|
|
multiple: true,
|
|
|
|
required: true,
|
|
|
|
skip: true,
|
|
|
|
},
|
|
|
|
prompt: {
|
|
|
|
inputType: 'text',
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
Command bar: add extrude command, nonlinear editing, etc (#1204)
* Tweak toaster look and feel
* Add icons, tweak plus icon names
* Rename commandBarMeta to commandBarConfig
* Refactor command bar, add support for icons
* Create a tailwind plugin for aria-pressed button state
* Remove overlay from behind command bar
* Clean up toolbar
* Button and other style tweaks
* Icon tweaks follow-up: make old icons work with new sizing
* Delete unused static icons
* More CSS tweaks
* Small CSS tweak to project sidebar
* Add command bar E2E test
* fumpt
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* fix typo in a comment
* Fix icon padding (built version only)
* Update onboarding and warning banner icons padding
* Misc minor style fixes
* Get Extrude opening and canceling from command bar
* Iconography tweaks
* Get extrude kind of working
* Refactor command bar config types and organization
* Move command bar configs to be co-located with each other
* Start building a state machine for the command bar
* Start converting command bar to state machine
* Add support for multiple args, confirmation step
* Submission behavior, hotkeys, code organization
* Add new test for extruding from command bar
* Polish step back and selection hotkeys, CSS tweaks
* Loading style tweaks
* Validate selection inputs, polish UX of args re-editing
* Prevent submission with multiple selection on singlular arg
* Remove stray console logs
* Tweak test, CSS nit, remove extrude "result" argument
* Fix linting warnings
* Show Ctrl+/ instead of ⌘K on all platforms but Mac
* A snapshot a day keeps the bugs away! 📷🐛 (OS: ubuntu)
* Add "Enter sketch" to command bar
* fix command bar test
* Fix flaky cmd bar extrude test by waiting for engine select response
* Cover both button labels '⌘K' and 'Ctrl+/' in test
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-12-13 12:49:01 -05:00
|
|
|
}
|