2025-04-01 23:54:26 -07:00
|
|
|
import type { Models } from '@kittycad/lib'
|
|
|
|
|
2025-04-02 10:52:36 -04:00
|
|
|
import { angleLengthInfo } from '@src/components/Toolbar/angleLengthInfo'
|
2025-04-26 18:26:39 -04:00
|
|
|
import { findUniqueName } from '@src/lang/create'
|
2025-04-01 23:54:26 -07:00
|
|
|
import { getNodeFromPath } from '@src/lang/queryAst'
|
|
|
|
import { getVariableDeclaration } from '@src/lang/queryAst/getVariableDeclaration'
|
|
|
|
import { getNodePathFromSourceRange } from '@src/lang/queryAstNodePathUtils'
|
|
|
|
import { transformAstSketchLines } from '@src/lang/std/sketchcombos'
|
|
|
|
import type {
|
2025-03-20 16:41:09 -04:00
|
|
|
PathToNode,
|
|
|
|
SourceRange,
|
|
|
|
VariableDeclarator,
|
2025-04-01 23:54:26 -07:00
|
|
|
} from '@src/lang/wasm'
|
|
|
|
import { isPathToNode } from '@src/lang/wasm'
|
|
|
|
import type {
|
|
|
|
KclCommandValue,
|
|
|
|
StateMachineCommandSetConfig,
|
|
|
|
} from '@src/lib/commandTypes'
|
2025-04-17 11:44:31 -04:00
|
|
|
import {
|
2025-05-05 11:36:22 -04:00
|
|
|
IS_ML_EXPERIMENTAL,
|
2025-04-26 18:26:39 -04:00
|
|
|
KCL_DEFAULT_CONSTANT_PREFIXES,
|
2025-04-17 11:44:31 -04:00
|
|
|
KCL_DEFAULT_DEGREE,
|
|
|
|
KCL_DEFAULT_LENGTH,
|
|
|
|
KCL_DEFAULT_TRANSFORM,
|
|
|
|
} from '@src/lib/constants'
|
2025-04-01 23:54:26 -07:00
|
|
|
import type { components } from '@src/lib/machine-api'
|
|
|
|
import type { Selections } from '@src/lib/selections'
|
|
|
|
import { codeManager, kclManager } from '@src/lib/singletons'
|
|
|
|
import { err } from '@src/lib/trap'
|
|
|
|
import type { SketchTool, modelingMachine } from '@src/machines/modelingMachine'
|
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-03-26 11:12:35 -05:00
|
|
|
type OutputFormat = Models['OutputFormat3d_type']
|
2024-03-04 16:06:43 -05:00
|
|
|
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
|
|
|
|
|
2025-02-22 08:09:54 -05:00
|
|
|
export const COMMAND_APPEARANCE_COLOR_DEFAULT = 'default'
|
|
|
|
|
2025-03-26 17:57:30 -04:00
|
|
|
export type HelixModes = 'Axis' | 'Edge' | 'Cylinder'
|
|
|
|
|
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 type ModelingCommandSchema = {
|
2025-03-27 18:08:57 -04:00
|
|
|
'Enter sketch': { forceNewSketch?: boolean }
|
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: {
|
Add edit flows for extrude and offset plane operations (#5045)
* Start implementing a "prepareToEdit" callback for extrude
* Start of generic edit flow for operations
* Actually invoking command bar send generically on double-click
* Refactor: break out non-React hook helper to calculate Kcl expression value
* Add unit tests, fmt
* Integrate helper to get calculated KclExpression
* Clean up unused imports, simplify use of `programMemoryFromVariables`
* Implement basic extrude editing
* Refactor: move DefaultPlanesStr to its own lib file
* Add support for editing offset planes
* Add Edit right-click menu option
* Turn off edit flow for sketch for now
* Add e2e tests for sketch and offset plane editing, fix bug found with offset plane editing
* Add failing e2e extrude edit test
* Remove action version of extrude AST mod
* Fix behavior when adding a constant while editing operation, fixing e2e test
* Patch in changes from 61b02b570394f11afbd04d0d126d87305165c73c
* Remove shell's prepareToEdit
* Add other Surface types to `artifactIsPlaneWithPaths`
* refactor: rename `item` to `operation`
* Allow `prepareToEdit` to fail with a toast, signal sketch-on-offset is unimplemented
* Rework sketch e2e test to test several working and failing cases
* Fix tsc errors related to making `codeRef` optional
* Make basic error messages more friendly
* fmt
* Reset modifyAst.ts to main
* Fix broken artifactGraph unit test
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* Remove unused import
* Look at this (photo)Graph *in the voice of Nickelback*
* Make the offset plane insert at the end, not one before
* Fix bug caught by e2e test failure with "Command needs review" logic
* Update src/machines/modelingMachine.ts
Co-authored-by: Pierre Jacquier <pierrejacquier39@gmail.com>
* Remove console logs per @pierremtb
* Update src/components/CommandBar/CommandBarHeader.tsx
Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
* Use better programMemory init thanks @jtran
* Fix tsc post merge of #5068
* Fix logic for `artifactIsPlaneWithPaths` post-merge
* Need to disable the sketch-on-face case now that artifactGraph is in Rust. Will active in a future PR (cc @jtran)
* Re-run CI after snapshots
* Update FeatureTreePane to not use `useCommandsContext`, missed during merge
* Fix merge issue, import location change on edited file
* fix click test step, which I believe is waiting for context scripts to load
* Convert toolbarFixture.exeIndicator to getter
We need to convert all these selectors on fixtures to getters, because
they can go stale if called on the fixture constructor.
* Missed a dumb little thing in toolbarFixture.ts
* Fix goof with merge
* fmt
* Another dumb missed thing during merge
I gotta get used to the LazyGit merge tool I'm not good at it yet
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* Conver sceneFixture's exeIndicator to a getter
Locators on fixtures will be frozen from the time of the fixture's
initialization, I'm increasingly convinced
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* Post-kwargs E2E test cleanup
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Pierre Jacquier <pierrejacquier39@gmail.com>
Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
2025-02-05 19:33:40 -05:00
|
|
|
// Enables editing workflow
|
|
|
|
nodeToEdit?: PathToNode
|
2025-05-06 17:57:27 -04:00
|
|
|
// KCL stdlib arguments
|
|
|
|
sketches: Selections
|
|
|
|
length: 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-03-20 20:42:41 -04:00
|
|
|
// Enables editing workflow
|
|
|
|
nodeToEdit?: PathToNode
|
2025-05-06 17:57:27 -04:00
|
|
|
// KCL stdlib arguments
|
|
|
|
sketches: Selections
|
|
|
|
path: Selections
|
|
|
|
sectional?: boolean
|
2025-01-11 08:20:49 -05:00
|
|
|
}
|
2024-12-04 17:24:16 -05:00
|
|
|
Loft: {
|
2025-05-06 17:57:27 -04:00
|
|
|
sketches: Selections
|
2024-12-09 15:20:48 -05:00
|
|
|
}
|
2024-09-17 08:29:52 -05:00
|
|
|
Revolve: {
|
2025-03-31 18:13:34 -04:00
|
|
|
// Enables editing workflow
|
|
|
|
nodeToEdit?: PathToNode
|
|
|
|
// Flow arg
|
|
|
|
axisOrEdge: 'Axis' | 'Edge'
|
|
|
|
// KCL stdlib arguments
|
2025-05-06 17:57:27 -04:00
|
|
|
sketches: Selections
|
2024-09-17 08:29:52 -05:00
|
|
|
angle: KclCommandValue
|
2025-03-31 18:13:34 -04:00
|
|
|
axis: string | undefined
|
|
|
|
edge: Selections | undefined
|
2024-09-17 08:29:52 -05:00
|
|
|
}
|
2025-05-06 17:57:27 -04:00
|
|
|
Shell: {
|
|
|
|
// Enables editing workflow
|
|
|
|
nodeToEdit?: PathToNode
|
|
|
|
// KCL stdlib arguments
|
|
|
|
selection: Selections
|
|
|
|
thickness: KclCommandValue
|
|
|
|
}
|
2024-07-15 19:20:32 +10:00
|
|
|
Fillet: {
|
2025-03-26 07:57:08 -04:00
|
|
|
// Enables editing workflow
|
|
|
|
nodeToEdit?: PathToNode
|
|
|
|
// KCL stdlib arguments
|
2024-07-15 19:20:32 +10:00
|
|
|
selection: Selections
|
|
|
|
radius: KclCommandValue
|
|
|
|
}
|
2025-01-14 18:08:32 +01:00
|
|
|
Chamfer: {
|
2025-03-26 07:57:08 -04:00
|
|
|
// Enables editing workflow
|
|
|
|
nodeToEdit?: PathToNode
|
|
|
|
// KCL stdlib arguments
|
2025-01-14 18:08:32 +01:00
|
|
|
selection: Selections
|
|
|
|
length: KclCommandValue
|
|
|
|
}
|
2024-11-26 11:36:14 -05:00
|
|
|
'Offset plane': {
|
Add edit flows for extrude and offset plane operations (#5045)
* Start implementing a "prepareToEdit" callback for extrude
* Start of generic edit flow for operations
* Actually invoking command bar send generically on double-click
* Refactor: break out non-React hook helper to calculate Kcl expression value
* Add unit tests, fmt
* Integrate helper to get calculated KclExpression
* Clean up unused imports, simplify use of `programMemoryFromVariables`
* Implement basic extrude editing
* Refactor: move DefaultPlanesStr to its own lib file
* Add support for editing offset planes
* Add Edit right-click menu option
* Turn off edit flow for sketch for now
* Add e2e tests for sketch and offset plane editing, fix bug found with offset plane editing
* Add failing e2e extrude edit test
* Remove action version of extrude AST mod
* Fix behavior when adding a constant while editing operation, fixing e2e test
* Patch in changes from 61b02b570394f11afbd04d0d126d87305165c73c
* Remove shell's prepareToEdit
* Add other Surface types to `artifactIsPlaneWithPaths`
* refactor: rename `item` to `operation`
* Allow `prepareToEdit` to fail with a toast, signal sketch-on-offset is unimplemented
* Rework sketch e2e test to test several working and failing cases
* Fix tsc errors related to making `codeRef` optional
* Make basic error messages more friendly
* fmt
* Reset modifyAst.ts to main
* Fix broken artifactGraph unit test
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* Remove unused import
* Look at this (photo)Graph *in the voice of Nickelback*
* Make the offset plane insert at the end, not one before
* Fix bug caught by e2e test failure with "Command needs review" logic
* Update src/machines/modelingMachine.ts
Co-authored-by: Pierre Jacquier <pierrejacquier39@gmail.com>
* Remove console logs per @pierremtb
* Update src/components/CommandBar/CommandBarHeader.tsx
Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
* Use better programMemory init thanks @jtran
* Fix tsc post merge of #5068
* Fix logic for `artifactIsPlaneWithPaths` post-merge
* Need to disable the sketch-on-face case now that artifactGraph is in Rust. Will active in a future PR (cc @jtran)
* Re-run CI after snapshots
* Update FeatureTreePane to not use `useCommandsContext`, missed during merge
* Fix merge issue, import location change on edited file
* fix click test step, which I believe is waiting for context scripts to load
* Convert toolbarFixture.exeIndicator to getter
We need to convert all these selectors on fixtures to getters, because
they can go stale if called on the fixture constructor.
* Missed a dumb little thing in toolbarFixture.ts
* Fix goof with merge
* fmt
* Another dumb missed thing during merge
I gotta get used to the LazyGit merge tool I'm not good at it yet
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* Conver sceneFixture's exeIndicator to a getter
Locators on fixtures will be frozen from the time of the fixture's
initialization, I'm increasingly convinced
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* Post-kwargs E2E test cleanup
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Pierre Jacquier <pierrejacquier39@gmail.com>
Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
2025-02-05 19:33:40 -05:00
|
|
|
// Enables editing workflow
|
|
|
|
nodeToEdit?: PathToNode
|
2024-11-26 11:36:14 -05:00
|
|
|
plane: Selections
|
|
|
|
distance: KclCommandValue
|
|
|
|
}
|
2025-02-07 10:16:36 -05:00
|
|
|
Helix: {
|
2025-02-24 18:44:13 -05:00
|
|
|
// Enables editing workflow
|
|
|
|
nodeToEdit?: PathToNode
|
2025-03-24 16:08:19 -04:00
|
|
|
// Flow arg
|
2025-03-26 17:57:30 -04:00
|
|
|
mode: HelixModes
|
|
|
|
// Three different arguments depending on mode
|
|
|
|
axis?: string
|
|
|
|
edge?: Selections
|
|
|
|
cylinder?: Selections
|
2025-02-24 18:44:13 -05:00
|
|
|
// KCL stdlib arguments
|
2025-02-07 10:16:36 -05:00
|
|
|
revolutions: KclCommandValue
|
|
|
|
angleStart: KclCommandValue
|
2025-03-26 17:57:30 -04:00
|
|
|
radius?: KclCommandValue // axis or edge modes only
|
|
|
|
length?: KclCommandValue // axis or edge modes only
|
|
|
|
ccw: boolean // optional boolean argument, default value to false
|
2025-02-07 10:16:36 -05:00
|
|
|
}
|
2025-03-19 11:58:53 -04:00
|
|
|
'event.parameter.create': {
|
|
|
|
value: KclCommandValue
|
|
|
|
}
|
2025-03-20 16:41:09 -04:00
|
|
|
'event.parameter.edit': {
|
|
|
|
nodeToEdit: PathToNode
|
|
|
|
value: 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-12-20 13:39:06 +11:00
|
|
|
'Prompt-to-edit': {
|
|
|
|
prompt: string
|
|
|
|
selection: Selections
|
|
|
|
}
|
2025-03-27 18:08:57 -04:00
|
|
|
// TODO: {} means any non-nullish value. This is probably not what we want.
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
2025-02-19 13:43:27 -05:00
|
|
|
'Delete selection': {}
|
2025-02-22 08:09:54 -05:00
|
|
|
Appearance: {
|
|
|
|
nodeToEdit?: PathToNode
|
|
|
|
color: string
|
|
|
|
}
|
2025-04-17 11:44:31 -04:00
|
|
|
Translate: {
|
|
|
|
nodeToEdit?: PathToNode
|
|
|
|
selection: Selections
|
|
|
|
x: KclCommandValue
|
|
|
|
y: KclCommandValue
|
|
|
|
z: KclCommandValue
|
|
|
|
}
|
|
|
|
Rotate: {
|
|
|
|
nodeToEdit?: PathToNode
|
|
|
|
selection: Selections
|
|
|
|
roll: KclCommandValue
|
|
|
|
pitch: KclCommandValue
|
|
|
|
yaw: KclCommandValue
|
|
|
|
}
|
2025-04-26 18:26:39 -04:00
|
|
|
Clone: {
|
|
|
|
nodeToEdit?: PathToNode
|
|
|
|
selection: Selections
|
|
|
|
variableName: string
|
|
|
|
}
|
2025-03-28 14:56:48 +11:00
|
|
|
'Boolean Subtract': {
|
|
|
|
target: Selections
|
|
|
|
tool: Selections
|
|
|
|
}
|
|
|
|
'Boolean Union': {
|
|
|
|
solids: Selections
|
|
|
|
}
|
|
|
|
'Boolean Intersect': {
|
|
|
|
solids: 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 || []
|
2025-03-28 00:24:24 -04:00
|
|
|
)[0]
|
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: {
|
Add edit flows for extrude and offset plane operations (#5045)
* Start implementing a "prepareToEdit" callback for extrude
* Start of generic edit flow for operations
* Actually invoking command bar send generically on double-click
* Refactor: break out non-React hook helper to calculate Kcl expression value
* Add unit tests, fmt
* Integrate helper to get calculated KclExpression
* Clean up unused imports, simplify use of `programMemoryFromVariables`
* Implement basic extrude editing
* Refactor: move DefaultPlanesStr to its own lib file
* Add support for editing offset planes
* Add Edit right-click menu option
* Turn off edit flow for sketch for now
* Add e2e tests for sketch and offset plane editing, fix bug found with offset plane editing
* Add failing e2e extrude edit test
* Remove action version of extrude AST mod
* Fix behavior when adding a constant while editing operation, fixing e2e test
* Patch in changes from 61b02b570394f11afbd04d0d126d87305165c73c
* Remove shell's prepareToEdit
* Add other Surface types to `artifactIsPlaneWithPaths`
* refactor: rename `item` to `operation`
* Allow `prepareToEdit` to fail with a toast, signal sketch-on-offset is unimplemented
* Rework sketch e2e test to test several working and failing cases
* Fix tsc errors related to making `codeRef` optional
* Make basic error messages more friendly
* fmt
* Reset modifyAst.ts to main
* Fix broken artifactGraph unit test
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* Remove unused import
* Look at this (photo)Graph *in the voice of Nickelback*
* Make the offset plane insert at the end, not one before
* Fix bug caught by e2e test failure with "Command needs review" logic
* Update src/machines/modelingMachine.ts
Co-authored-by: Pierre Jacquier <pierrejacquier39@gmail.com>
* Remove console logs per @pierremtb
* Update src/components/CommandBar/CommandBarHeader.tsx
Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
* Use better programMemory init thanks @jtran
* Fix tsc post merge of #5068
* Fix logic for `artifactIsPlaneWithPaths` post-merge
* Need to disable the sketch-on-face case now that artifactGraph is in Rust. Will active in a future PR (cc @jtran)
* Re-run CI after snapshots
* Update FeatureTreePane to not use `useCommandsContext`, missed during merge
* Fix merge issue, import location change on edited file
* fix click test step, which I believe is waiting for context scripts to load
* Convert toolbarFixture.exeIndicator to getter
We need to convert all these selectors on fixtures to getters, because
they can go stale if called on the fixture constructor.
* Missed a dumb little thing in toolbarFixture.ts
* Fix goof with merge
* fmt
* Another dumb missed thing during merge
I gotta get used to the LazyGit merge tool I'm not good at it yet
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* Conver sceneFixture's exeIndicator to a getter
Locators on fixtures will be frozen from the time of the fixture's
initialization, I'm increasingly convinced
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* Post-kwargs E2E test cleanup
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Pierre Jacquier <pierrejacquier39@gmail.com>
Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
2025-02-05 19:33:40 -05:00
|
|
|
nodeToEdit: {
|
|
|
|
description:
|
|
|
|
'Path to the node in the AST to edit. Never shown to the user.',
|
|
|
|
skip: true,
|
|
|
|
inputType: 'text',
|
|
|
|
required: false,
|
2025-02-28 18:00:29 -05:00
|
|
|
hidden: true,
|
Add edit flows for extrude and offset plane operations (#5045)
* Start implementing a "prepareToEdit" callback for extrude
* Start of generic edit flow for operations
* Actually invoking command bar send generically on double-click
* Refactor: break out non-React hook helper to calculate Kcl expression value
* Add unit tests, fmt
* Integrate helper to get calculated KclExpression
* Clean up unused imports, simplify use of `programMemoryFromVariables`
* Implement basic extrude editing
* Refactor: move DefaultPlanesStr to its own lib file
* Add support for editing offset planes
* Add Edit right-click menu option
* Turn off edit flow for sketch for now
* Add e2e tests for sketch and offset plane editing, fix bug found with offset plane editing
* Add failing e2e extrude edit test
* Remove action version of extrude AST mod
* Fix behavior when adding a constant while editing operation, fixing e2e test
* Patch in changes from 61b02b570394f11afbd04d0d126d87305165c73c
* Remove shell's prepareToEdit
* Add other Surface types to `artifactIsPlaneWithPaths`
* refactor: rename `item` to `operation`
* Allow `prepareToEdit` to fail with a toast, signal sketch-on-offset is unimplemented
* Rework sketch e2e test to test several working and failing cases
* Fix tsc errors related to making `codeRef` optional
* Make basic error messages more friendly
* fmt
* Reset modifyAst.ts to main
* Fix broken artifactGraph unit test
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* Remove unused import
* Look at this (photo)Graph *in the voice of Nickelback*
* Make the offset plane insert at the end, not one before
* Fix bug caught by e2e test failure with "Command needs review" logic
* Update src/machines/modelingMachine.ts
Co-authored-by: Pierre Jacquier <pierrejacquier39@gmail.com>
* Remove console logs per @pierremtb
* Update src/components/CommandBar/CommandBarHeader.tsx
Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
* Use better programMemory init thanks @jtran
* Fix tsc post merge of #5068
* Fix logic for `artifactIsPlaneWithPaths` post-merge
* Need to disable the sketch-on-face case now that artifactGraph is in Rust. Will active in a future PR (cc @jtran)
* Re-run CI after snapshots
* Update FeatureTreePane to not use `useCommandsContext`, missed during merge
* Fix merge issue, import location change on edited file
* fix click test step, which I believe is waiting for context scripts to load
* Convert toolbarFixture.exeIndicator to getter
We need to convert all these selectors on fixtures to getters, because
they can go stale if called on the fixture constructor.
* Missed a dumb little thing in toolbarFixture.ts
* Fix goof with merge
* fmt
* Another dumb missed thing during merge
I gotta get used to the LazyGit merge tool I'm not good at it yet
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* Conver sceneFixture's exeIndicator to a getter
Locators on fixtures will be frozen from the time of the fixture's
initialization, I'm increasingly convinced
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* Post-kwargs E2E test cleanup
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Pierre Jacquier <pierrejacquier39@gmail.com>
Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
2025-02-05 19:33:40 -05:00
|
|
|
},
|
2025-05-06 17:57:27 -04:00
|
|
|
sketches: {
|
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
|
|
|
inputType: 'selection',
|
2025-05-19 11:21:29 -04:00
|
|
|
displayName: 'Profiles',
|
|
|
|
selectionTypes: ['solid2d'],
|
2025-05-06 17:57:27 -04:00
|
|
|
multiple: 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,
|
2025-03-11 16:29:03 -04:00
|
|
|
hidden: (context) => Boolean(context.argumentsToSubmit.nodeToEdit),
|
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-05-06 17:57:27 -04:00
|
|
|
length: {
|
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',
|
2025-03-20 20:42:41 -04:00
|
|
|
needsReview: true,
|
2025-01-11 08:20:49 -05:00
|
|
|
args: {
|
2025-03-20 20:42:41 -04:00
|
|
|
nodeToEdit: {
|
|
|
|
description:
|
|
|
|
'Path to the node in the AST to edit. Never shown to the user.',
|
|
|
|
skip: true,
|
|
|
|
inputType: 'text',
|
|
|
|
required: false,
|
2025-05-06 17:57:27 -04:00
|
|
|
hidden: true,
|
2025-03-20 20:42:41 -04:00
|
|
|
},
|
2025-05-06 17:57:27 -04:00
|
|
|
sketches: {
|
2025-01-11 08:20:49 -05:00
|
|
|
inputType: 'selection',
|
2025-05-19 11:21:29 -04:00
|
|
|
displayName: 'Profiles',
|
|
|
|
selectionTypes: ['solid2d'],
|
2025-05-06 17:57:27 -04:00
|
|
|
multiple: true,
|
2025-01-11 08:20:49 -05:00
|
|
|
required: true,
|
2025-03-20 20:42:41 -04:00
|
|
|
hidden: (context) => Boolean(context.argumentsToSubmit.nodeToEdit),
|
2025-01-11 08:20:49 -05:00
|
|
|
},
|
2025-05-06 17:57:27 -04:00
|
|
|
path: {
|
2025-01-11 08:20:49 -05:00
|
|
|
inputType: 'selection',
|
2025-05-15 16:42:38 -04:00
|
|
|
selectionTypes: ['segment', 'helix'],
|
2025-01-11 08:20:49 -05:00
|
|
|
required: true,
|
|
|
|
multiple: false,
|
2025-03-20 20:42:41 -04:00
|
|
|
hidden: (context) => Boolean(context.argumentsToSubmit.nodeToEdit),
|
|
|
|
},
|
|
|
|
sectional: {
|
|
|
|
inputType: 'options',
|
2025-05-06 17:57:27 -04:00
|
|
|
skip: true,
|
|
|
|
defaultValue: false,
|
|
|
|
hidden: false,
|
2025-03-20 20:42:41 -04:00
|
|
|
required: true,
|
|
|
|
options: [
|
|
|
|
{ name: 'False', value: false },
|
|
|
|
{ name: 'True', value: true },
|
|
|
|
],
|
|
|
|
// No validation possible here until we have rollback
|
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-05-06 17:57:27 -04:00
|
|
|
needsReview: true,
|
2024-12-04 17:24:16 -05:00
|
|
|
args: {
|
2025-05-06 17:57:27 -04:00
|
|
|
sketches: {
|
2024-12-04 17:24:16 -05:00
|
|
|
inputType: 'selection',
|
2025-05-19 11:21:29 -04:00
|
|
|
displayName: 'Profiles',
|
2025-01-17 14:34:36 -05:00
|
|
|
selectionTypes: ['solid2d'],
|
2024-12-04 17:24:16 -05:00
|
|
|
multiple: true,
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2024-09-17 08:29:52 -05:00
|
|
|
Revolve: {
|
|
|
|
description: 'Create a 3D body by rotating a sketch region about an axis.',
|
|
|
|
icon: 'revolve',
|
|
|
|
needsReview: true,
|
|
|
|
args: {
|
2025-03-31 18:13:34 -04:00
|
|
|
nodeToEdit: {
|
|
|
|
description:
|
|
|
|
'Path to the node in the AST to edit. Never shown to the user.',
|
|
|
|
skip: true,
|
|
|
|
inputType: 'text',
|
|
|
|
required: false,
|
|
|
|
},
|
2025-05-06 17:57:27 -04:00
|
|
|
sketches: {
|
2024-09-17 08:29:52 -05:00
|
|
|
inputType: 'selection',
|
2025-05-19 11:21:29 -04:00
|
|
|
displayName: 'Profiles',
|
|
|
|
selectionTypes: ['solid2d'],
|
2025-05-06 17:57:27 -04:00
|
|
|
multiple: true,
|
2024-09-17 08:29:52 -05:00
|
|
|
required: true,
|
2025-03-11 16:29:03 -04:00
|
|
|
hidden: (context) => Boolean(context.argumentsToSubmit.nodeToEdit),
|
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: [
|
2025-05-20 16:57:55 -04:00
|
|
|
{ name: 'Sketch Axis', isCurrent: true, value: 'Axis' },
|
2025-01-10 09:52:04 -05:00
|
|
|
{ name: 'Edge', isCurrent: false, value: 'Edge' },
|
|
|
|
],
|
2025-03-11 16:29:03 -04:00
|
|
|
hidden: (context) => Boolean(context.argumentsToSubmit.nodeToEdit),
|
2025-01-10 09:52:04 -05:00
|
|
|
},
|
|
|
|
axis: {
|
|
|
|
required: (commandContext) =>
|
|
|
|
['Axis'].includes(
|
|
|
|
commandContext.argumentsToSubmit.axisOrEdge as string
|
|
|
|
),
|
|
|
|
inputType: 'options',
|
2025-05-20 16:57:55 -04:00
|
|
|
displayName: 'Sketch Axis',
|
2025-01-10 09:52:04 -05:00
|
|
|
options: [
|
|
|
|
{ name: 'X Axis', isCurrent: true, value: 'X' },
|
|
|
|
{ name: 'Y Axis', isCurrent: false, value: 'Y' },
|
|
|
|
],
|
2025-03-31 18:13:34 -04:00
|
|
|
hidden: (context) => Boolean(context.argumentsToSubmit.nodeToEdit),
|
2025-01-10 09:52:04 -05:00
|
|
|
},
|
|
|
|
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,
|
2025-03-11 16:29:03 -04:00
|
|
|
hidden: (context) => Boolean(context.argumentsToSubmit.nodeToEdit),
|
2024-12-10 12:11:01 -05:00
|
|
|
},
|
2024-09-17 08:29:52 -05:00
|
|
|
angle: {
|
|
|
|
inputType: 'kcl',
|
|
|
|
defaultValue: KCL_DEFAULT_DEGREE,
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2025-05-06 17:57:27 -04:00
|
|
|
Shell: {
|
|
|
|
description: 'Hollow out a 3D solid.',
|
|
|
|
icon: 'shell',
|
|
|
|
needsReview: true,
|
|
|
|
args: {
|
|
|
|
nodeToEdit: {
|
|
|
|
description:
|
|
|
|
'Path to the node in the AST to edit. Never shown to the user.',
|
|
|
|
skip: true,
|
|
|
|
inputType: 'text',
|
|
|
|
required: false,
|
|
|
|
},
|
|
|
|
selection: {
|
|
|
|
inputType: 'selection',
|
|
|
|
selectionTypes: ['cap', 'wall'],
|
|
|
|
multiple: true,
|
|
|
|
required: true,
|
|
|
|
hidden: (context) => Boolean(context.argumentsToSubmit.nodeToEdit),
|
|
|
|
},
|
|
|
|
thickness: {
|
|
|
|
inputType: 'kcl',
|
|
|
|
defaultValue: KCL_DEFAULT_LENGTH,
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2025-03-28 14:56:48 +11:00
|
|
|
'Boolean Subtract': {
|
|
|
|
description: 'Subtract one solid from another.',
|
|
|
|
icon: 'booleanSubtract',
|
|
|
|
needsReview: true,
|
|
|
|
args: {
|
|
|
|
target: {
|
|
|
|
inputType: 'selection',
|
|
|
|
selectionTypes: ['path'],
|
|
|
|
selectionFilter: ['object'],
|
|
|
|
multiple: false,
|
|
|
|
required: true,
|
|
|
|
skip: true,
|
|
|
|
hidden: (context) => Boolean(context.argumentsToSubmit.nodeToEdit),
|
|
|
|
},
|
|
|
|
tool: {
|
|
|
|
clearSelectionFirst: true,
|
|
|
|
inputType: 'selection',
|
|
|
|
selectionTypes: ['path'],
|
|
|
|
selectionFilter: ['object'],
|
|
|
|
multiple: false,
|
|
|
|
required: true,
|
|
|
|
skip: false,
|
|
|
|
hidden: (context) => Boolean(context.argumentsToSubmit.nodeToEdit),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
'Boolean Union': {
|
|
|
|
description: 'Union multiple solids into a single solid.',
|
|
|
|
icon: 'booleanUnion',
|
|
|
|
needsReview: true,
|
|
|
|
args: {
|
|
|
|
solids: {
|
|
|
|
inputType: 'selection',
|
|
|
|
selectionTypes: ['path'],
|
|
|
|
selectionFilter: ['object'],
|
|
|
|
multiple: true,
|
|
|
|
required: true,
|
|
|
|
skip: false,
|
|
|
|
hidden: (context) => Boolean(context.argumentsToSubmit.nodeToEdit),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
'Boolean Intersect': {
|
2025-04-25 12:49:11 -04:00
|
|
|
description: 'Create a solid from the intersection of two solids.',
|
2025-03-28 14:56:48 +11:00
|
|
|
icon: 'booleanIntersect',
|
|
|
|
needsReview: true,
|
|
|
|
args: {
|
|
|
|
solids: {
|
|
|
|
inputType: 'selectionMixed',
|
|
|
|
selectionTypes: ['path'],
|
|
|
|
selectionFilter: ['object'],
|
|
|
|
multiple: true,
|
|
|
|
required: true,
|
|
|
|
skip: false,
|
|
|
|
hidden: (context) => Boolean(context.argumentsToSubmit.nodeToEdit),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2024-11-26 11:36:14 -05:00
|
|
|
'Offset plane': {
|
|
|
|
description: 'Offset a plane.',
|
|
|
|
icon: 'plane',
|
|
|
|
args: {
|
Add edit flows for extrude and offset plane operations (#5045)
* Start implementing a "prepareToEdit" callback for extrude
* Start of generic edit flow for operations
* Actually invoking command bar send generically on double-click
* Refactor: break out non-React hook helper to calculate Kcl expression value
* Add unit tests, fmt
* Integrate helper to get calculated KclExpression
* Clean up unused imports, simplify use of `programMemoryFromVariables`
* Implement basic extrude editing
* Refactor: move DefaultPlanesStr to its own lib file
* Add support for editing offset planes
* Add Edit right-click menu option
* Turn off edit flow for sketch for now
* Add e2e tests for sketch and offset plane editing, fix bug found with offset plane editing
* Add failing e2e extrude edit test
* Remove action version of extrude AST mod
* Fix behavior when adding a constant while editing operation, fixing e2e test
* Patch in changes from 61b02b570394f11afbd04d0d126d87305165c73c
* Remove shell's prepareToEdit
* Add other Surface types to `artifactIsPlaneWithPaths`
* refactor: rename `item` to `operation`
* Allow `prepareToEdit` to fail with a toast, signal sketch-on-offset is unimplemented
* Rework sketch e2e test to test several working and failing cases
* Fix tsc errors related to making `codeRef` optional
* Make basic error messages more friendly
* fmt
* Reset modifyAst.ts to main
* Fix broken artifactGraph unit test
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* Remove unused import
* Look at this (photo)Graph *in the voice of Nickelback*
* Make the offset plane insert at the end, not one before
* Fix bug caught by e2e test failure with "Command needs review" logic
* Update src/machines/modelingMachine.ts
Co-authored-by: Pierre Jacquier <pierrejacquier39@gmail.com>
* Remove console logs per @pierremtb
* Update src/components/CommandBar/CommandBarHeader.tsx
Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
* Use better programMemory init thanks @jtran
* Fix tsc post merge of #5068
* Fix logic for `artifactIsPlaneWithPaths` post-merge
* Need to disable the sketch-on-face case now that artifactGraph is in Rust. Will active in a future PR (cc @jtran)
* Re-run CI after snapshots
* Update FeatureTreePane to not use `useCommandsContext`, missed during merge
* Fix merge issue, import location change on edited file
* fix click test step, which I believe is waiting for context scripts to load
* Convert toolbarFixture.exeIndicator to getter
We need to convert all these selectors on fixtures to getters, because
they can go stale if called on the fixture constructor.
* Missed a dumb little thing in toolbarFixture.ts
* Fix goof with merge
* fmt
* Another dumb missed thing during merge
I gotta get used to the LazyGit merge tool I'm not good at it yet
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* Conver sceneFixture's exeIndicator to a getter
Locators on fixtures will be frozen from the time of the fixture's
initialization, I'm increasingly convinced
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* Post-kwargs E2E test cleanup
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Pierre Jacquier <pierrejacquier39@gmail.com>
Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
2025-02-05 19:33:40 -05:00
|
|
|
nodeToEdit: {
|
|
|
|
description:
|
|
|
|
'Path to the node in the AST to edit. Never shown to the user.',
|
|
|
|
skip: true,
|
|
|
|
inputType: 'text',
|
|
|
|
required: false,
|
2025-02-28 18:00:29 -05:00
|
|
|
hidden: true,
|
Add edit flows for extrude and offset plane operations (#5045)
* Start implementing a "prepareToEdit" callback for extrude
* Start of generic edit flow for operations
* Actually invoking command bar send generically on double-click
* Refactor: break out non-React hook helper to calculate Kcl expression value
* Add unit tests, fmt
* Integrate helper to get calculated KclExpression
* Clean up unused imports, simplify use of `programMemoryFromVariables`
* Implement basic extrude editing
* Refactor: move DefaultPlanesStr to its own lib file
* Add support for editing offset planes
* Add Edit right-click menu option
* Turn off edit flow for sketch for now
* Add e2e tests for sketch and offset plane editing, fix bug found with offset plane editing
* Add failing e2e extrude edit test
* Remove action version of extrude AST mod
* Fix behavior when adding a constant while editing operation, fixing e2e test
* Patch in changes from 61b02b570394f11afbd04d0d126d87305165c73c
* Remove shell's prepareToEdit
* Add other Surface types to `artifactIsPlaneWithPaths`
* refactor: rename `item` to `operation`
* Allow `prepareToEdit` to fail with a toast, signal sketch-on-offset is unimplemented
* Rework sketch e2e test to test several working and failing cases
* Fix tsc errors related to making `codeRef` optional
* Make basic error messages more friendly
* fmt
* Reset modifyAst.ts to main
* Fix broken artifactGraph unit test
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* Remove unused import
* Look at this (photo)Graph *in the voice of Nickelback*
* Make the offset plane insert at the end, not one before
* Fix bug caught by e2e test failure with "Command needs review" logic
* Update src/machines/modelingMachine.ts
Co-authored-by: Pierre Jacquier <pierrejacquier39@gmail.com>
* Remove console logs per @pierremtb
* Update src/components/CommandBar/CommandBarHeader.tsx
Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
* Use better programMemory init thanks @jtran
* Fix tsc post merge of #5068
* Fix logic for `artifactIsPlaneWithPaths` post-merge
* Need to disable the sketch-on-face case now that artifactGraph is in Rust. Will active in a future PR (cc @jtran)
* Re-run CI after snapshots
* Update FeatureTreePane to not use `useCommandsContext`, missed during merge
* Fix merge issue, import location change on edited file
* fix click test step, which I believe is waiting for context scripts to load
* Convert toolbarFixture.exeIndicator to getter
We need to convert all these selectors on fixtures to getters, because
they can go stale if called on the fixture constructor.
* Missed a dumb little thing in toolbarFixture.ts
* Fix goof with merge
* fmt
* Another dumb missed thing during merge
I gotta get used to the LazyGit merge tool I'm not good at it yet
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* Conver sceneFixture's exeIndicator to a getter
Locators on fixtures will be frozen from the time of the fixture's
initialization, I'm increasingly convinced
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* Post-kwargs E2E test cleanup
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Pierre Jacquier <pierrejacquier39@gmail.com>
Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
2025-02-05 19:33:40 -05:00
|
|
|
},
|
2024-11-26 11:36:14 -05:00
|
|
|
plane: {
|
|
|
|
inputType: 'selection',
|
|
|
|
selectionTypes: ['plane'],
|
|
|
|
multiple: false,
|
|
|
|
required: true,
|
|
|
|
skip: true,
|
|
|
|
},
|
|
|
|
distance: {
|
|
|
|
inputType: 'kcl',
|
|
|
|
defaultValue: KCL_DEFAULT_LENGTH,
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2025-02-07 10:16:36 -05:00
|
|
|
Helix: {
|
|
|
|
description: 'Create a helix or spiral in 3D about an axis.',
|
|
|
|
icon: 'helix',
|
|
|
|
needsReview: true,
|
|
|
|
args: {
|
2025-02-24 18:44:13 -05:00
|
|
|
nodeToEdit: {
|
|
|
|
description:
|
|
|
|
'Path to the node in the AST to edit. Never shown to the user.',
|
|
|
|
skip: true,
|
|
|
|
inputType: 'text',
|
|
|
|
required: false,
|
2025-02-28 18:00:29 -05:00
|
|
|
hidden: true,
|
2025-02-24 18:44:13 -05:00
|
|
|
},
|
2025-03-26 17:57:30 -04:00
|
|
|
mode: {
|
2025-03-24 16:08:19 -04:00
|
|
|
inputType: 'options',
|
|
|
|
required: true,
|
|
|
|
defaultValue: 'Axis',
|
|
|
|
options: [
|
|
|
|
{ name: 'Axis', isCurrent: true, value: 'Axis' },
|
|
|
|
{ name: 'Edge', isCurrent: false, value: 'Edge' },
|
2025-03-26 17:57:30 -04:00
|
|
|
{ name: 'Cylinder', isCurrent: false, value: 'Cylinder' },
|
2025-03-24 16:08:19 -04:00
|
|
|
],
|
|
|
|
hidden: (context) => Boolean(context.argumentsToSubmit.nodeToEdit),
|
|
|
|
},
|
|
|
|
axis: {
|
|
|
|
inputType: 'options',
|
|
|
|
required: (commandContext) =>
|
2025-03-26 17:57:30 -04:00
|
|
|
['Axis'].includes(commandContext.argumentsToSubmit.mode as string),
|
2025-03-24 16:08:19 -04:00
|
|
|
options: [
|
|
|
|
{ name: 'X Axis', value: 'X' },
|
|
|
|
{ name: 'Y Axis', value: 'Y' },
|
|
|
|
{ name: 'Z Axis', value: 'Z' },
|
|
|
|
],
|
2025-03-26 17:57:30 -04:00
|
|
|
hidden: false, // for consistency here, we can actually edit here since it's not a selection
|
2025-03-24 16:08:19 -04:00
|
|
|
},
|
|
|
|
edge: {
|
|
|
|
required: (commandContext) =>
|
2025-03-26 17:57:30 -04:00
|
|
|
['Edge'].includes(commandContext.argumentsToSubmit.mode as string),
|
2025-03-24 16:08:19 -04:00
|
|
|
inputType: 'selection',
|
|
|
|
selectionTypes: ['segment', 'sweepEdge'],
|
|
|
|
multiple: false,
|
|
|
|
hidden: (context) => Boolean(context.argumentsToSubmit.nodeToEdit),
|
|
|
|
},
|
2025-03-26 17:57:30 -04:00
|
|
|
cylinder: {
|
|
|
|
required: (commandContext) =>
|
|
|
|
['Cylinder'].includes(
|
|
|
|
commandContext.argumentsToSubmit.mode as string
|
|
|
|
),
|
|
|
|
inputType: 'selection',
|
|
|
|
selectionTypes: ['wall'],
|
|
|
|
multiple: false,
|
|
|
|
hidden: (context) => Boolean(context.argumentsToSubmit.nodeToEdit),
|
|
|
|
},
|
2025-02-07 10:16:36 -05:00
|
|
|
revolutions: {
|
|
|
|
inputType: 'kcl',
|
|
|
|
defaultValue: '1',
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
angleStart: {
|
|
|
|
inputType: 'kcl',
|
|
|
|
defaultValue: KCL_DEFAULT_DEGREE,
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
radius: {
|
|
|
|
inputType: 'kcl',
|
|
|
|
defaultValue: KCL_DEFAULT_LENGTH,
|
2025-03-26 17:57:30 -04:00
|
|
|
required: (commandContext) =>
|
|
|
|
!['Cylinder'].includes(
|
|
|
|
commandContext.argumentsToSubmit.mode as string
|
|
|
|
),
|
2025-02-07 10:16:36 -05:00
|
|
|
},
|
|
|
|
length: {
|
|
|
|
inputType: 'kcl',
|
|
|
|
defaultValue: KCL_DEFAULT_LENGTH,
|
2025-03-26 17:57:30 -04:00
|
|
|
required: (commandContext) =>
|
2025-03-28 07:25:32 -04:00
|
|
|
['Axis'].includes(commandContext.argumentsToSubmit.mode as string),
|
2025-03-26 17:57:30 -04:00
|
|
|
},
|
|
|
|
ccw: {
|
|
|
|
inputType: 'options',
|
|
|
|
skip: true,
|
2025-02-07 10:16:36 -05:00
|
|
|
required: true,
|
2025-03-26 17:57:30 -04:00
|
|
|
defaultValue: false,
|
|
|
|
valueSummary: (value) => String(value),
|
|
|
|
displayName: 'CounterClockWise',
|
|
|
|
options: (commandContext) => [
|
|
|
|
{
|
|
|
|
name: 'False',
|
|
|
|
value: false,
|
|
|
|
isCurrent: !Boolean(commandContext.argumentsToSubmit.ccw),
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'True',
|
|
|
|
value: true,
|
|
|
|
isCurrent: Boolean(commandContext.argumentsToSubmit.ccw),
|
|
|
|
},
|
|
|
|
],
|
2025-02-07 10:16:36 -05:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2024-07-15 19:20:32 +10:00
|
|
|
Fillet: {
|
|
|
|
description: 'Fillet edge',
|
2025-01-14 18:08:32 +01:00
|
|
|
icon: 'fillet3d',
|
2024-07-15 19:20:32 +10:00
|
|
|
needsReview: true,
|
|
|
|
args: {
|
2025-03-26 07:57:08 -04:00
|
|
|
nodeToEdit: {
|
|
|
|
description:
|
|
|
|
'Path to the node in the AST to edit. Never shown to the user.',
|
|
|
|
inputType: 'text',
|
|
|
|
required: false,
|
|
|
|
hidden: true,
|
|
|
|
},
|
2024-07-15 19:20:32 +10:00
|
|
|
selection: {
|
|
|
|
inputType: 'selection',
|
2025-03-26 07:57:08 -04:00
|
|
|
selectionTypes: ['segment', 'sweepEdge'],
|
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,
|
2025-03-26 07:57:08 -04:00
|
|
|
hidden: (context) => Boolean(context.argumentsToSubmit.nodeToEdit),
|
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',
|
|
|
|
needsReview: true,
|
|
|
|
args: {
|
2025-03-26 07:57:08 -04:00
|
|
|
nodeToEdit: {
|
|
|
|
description:
|
|
|
|
'Path to the node in the AST to edit. Never shown to the user.',
|
|
|
|
inputType: 'text',
|
|
|
|
required: false,
|
|
|
|
hidden: true,
|
|
|
|
},
|
2025-01-14 18:08:32 +01:00
|
|
|
selection: {
|
|
|
|
inputType: 'selection',
|
2025-03-26 07:57:08 -04:00
|
|
|
selectionTypes: ['segment', 'sweepEdge'],
|
2025-01-14 18:08:32 +01:00
|
|
|
multiple: true,
|
|
|
|
required: true,
|
|
|
|
skip: false,
|
2025-03-26 07:57:08 -04:00
|
|
|
hidden: (context) => Boolean(context.argumentsToSubmit.nodeToEdit),
|
2025-01-14 18:08:32 +01:00
|
|
|
},
|
|
|
|
length: {
|
|
|
|
inputType: 'kcl',
|
|
|
|
defaultValue: KCL_DEFAULT_LENGTH,
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2025-03-19 11:58:53 -04:00
|
|
|
'event.parameter.create': {
|
|
|
|
displayName: 'Create parameter',
|
|
|
|
description: 'Add a named constant to use in geometry',
|
|
|
|
icon: 'make-variable',
|
|
|
|
needsReview: false,
|
|
|
|
args: {
|
|
|
|
value: {
|
|
|
|
inputType: 'kcl',
|
|
|
|
required: true,
|
|
|
|
createVariable: 'force',
|
|
|
|
variableName: 'myParameter',
|
|
|
|
defaultValue: '5',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2025-03-20 16:41:09 -04:00
|
|
|
'event.parameter.edit': {
|
|
|
|
displayName: 'Edit parameter',
|
|
|
|
description: 'Edit the value of a named constant',
|
|
|
|
icon: 'make-variable',
|
|
|
|
needsReview: false,
|
|
|
|
args: {
|
|
|
|
nodeToEdit: {
|
|
|
|
displayName: 'Name',
|
|
|
|
inputType: 'options',
|
|
|
|
valueSummary: (nodeToEdit: PathToNode) => {
|
|
|
|
const node = getNodeFromPath<VariableDeclarator>(
|
|
|
|
kclManager.ast,
|
|
|
|
nodeToEdit
|
|
|
|
)
|
|
|
|
if (err(node) || node.node.type !== 'VariableDeclarator')
|
|
|
|
return 'Error'
|
|
|
|
return node.node.id.name || ''
|
|
|
|
},
|
|
|
|
required: true,
|
|
|
|
options() {
|
|
|
|
return (
|
|
|
|
Object.entries(kclManager.execState.variables)
|
|
|
|
// TODO: @franknoirot && @jtran would love to make this go away soon 🥺
|
|
|
|
.filter(([_, variable]) => variable?.type === 'Number')
|
2025-05-08 12:58:30 +02:00
|
|
|
.map(([name, _variable]) => {
|
2025-03-20 16:41:09 -04:00
|
|
|
const node = getVariableDeclaration(kclManager.ast, name)
|
|
|
|
if (node === undefined) return
|
|
|
|
const range: SourceRange = [node.start, node.end, node.moduleId]
|
|
|
|
const pathToNode = getNodePathFromSourceRange(
|
|
|
|
kclManager.ast,
|
|
|
|
range
|
|
|
|
)
|
|
|
|
return {
|
|
|
|
name,
|
|
|
|
value: pathToNode,
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.filter((a) => !!a) || []
|
|
|
|
)
|
|
|
|
},
|
|
|
|
},
|
|
|
|
value: {
|
|
|
|
inputType: 'kcl',
|
|
|
|
required: true,
|
|
|
|
defaultValue(commandBarContext) {
|
|
|
|
const nodeToEdit = commandBarContext.argumentsToSubmit.nodeToEdit
|
|
|
|
if (!nodeToEdit || !isPathToNode(nodeToEdit)) return '5'
|
|
|
|
const node = getNodeFromPath<VariableDeclarator>(
|
|
|
|
kclManager.ast,
|
|
|
|
nodeToEdit
|
|
|
|
)
|
|
|
|
if (err(node) || node.node.type !== 'VariableDeclarator')
|
|
|
|
return 'Error'
|
|
|
|
const variableName = node.node.id.name || ''
|
|
|
|
if (typeof variableName !== 'string') return '5'
|
|
|
|
const variableNode = getVariableDeclaration(
|
|
|
|
kclManager.ast,
|
|
|
|
variableName
|
|
|
|
)
|
|
|
|
if (!variableNode) return '5'
|
|
|
|
const code = codeManager.code.slice(
|
|
|
|
variableNode.declaration.init.start,
|
|
|
|
variableNode.declaration.init.end
|
|
|
|
)
|
|
|
|
return code
|
|
|
|
},
|
|
|
|
createVariable: 'disallow',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
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,
|
2025-03-19 11:58:53 -04:00
|
|
|
createVariable: 'byDefault',
|
2024-12-09 16:43:58 -05:00
|
|
|
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,
|
2025-02-12 10:22:56 +13:00
|
|
|
memVars: kclManager.variables,
|
2024-12-09 16:43:58 -05:00
|
|
|
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,
|
2025-03-19 11:58:53 -04:00
|
|
|
createVariable: 'byDefault',
|
2025-05-08 12:58:30 +02:00
|
|
|
variableName(commandBarContext, _machineContext) {
|
2024-12-09 16:43:58 -05:00
|
|
|
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-12-20 13:39:06 +11:00
|
|
|
'Prompt-to-edit': {
|
2025-05-18 06:24:48 -04:00
|
|
|
displayName: 'Text-to-CAD Edit',
|
|
|
|
description:
|
|
|
|
'Use machine learning to edit your parts and code from a text prompt.',
|
|
|
|
icon: 'sparkles',
|
2025-05-05 11:36:22 -04:00
|
|
|
status: IS_ML_EXPERIMENTAL ? 'experimental' : 'active',
|
2024-12-20 13:39:06 +11:00
|
|
|
args: {
|
|
|
|
selection: {
|
2025-02-26 14:06:51 +11:00
|
|
|
inputType: 'selectionMixed',
|
2024-12-20 13:39:06 +11:00
|
|
|
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,
|
2025-05-16 05:15:52 -04:00
|
|
|
required: false,
|
2025-02-26 14:06:51 +11:00
|
|
|
selectionSource: {
|
|
|
|
allowSceneSelection: true,
|
|
|
|
allowCodeSelection: true,
|
|
|
|
},
|
2025-05-16 05:15:52 -04:00
|
|
|
skip: false,
|
2024-12-20 13:39:06 +11:00
|
|
|
},
|
|
|
|
prompt: {
|
|
|
|
inputType: 'text',
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2025-02-22 08:09:54 -05:00
|
|
|
Appearance: {
|
|
|
|
description:
|
|
|
|
'Set the appearance of a solid. This only works on solids, not sketches or individual paths.',
|
|
|
|
icon: 'extrude',
|
|
|
|
needsReview: true,
|
|
|
|
args: {
|
|
|
|
nodeToEdit: {
|
|
|
|
description:
|
|
|
|
'Path to the node in the AST to edit. Never shown to the user.',
|
|
|
|
skip: true,
|
|
|
|
inputType: 'text',
|
|
|
|
required: false,
|
2025-02-28 18:00:29 -05:00
|
|
|
hidden: true,
|
2025-02-22 08:09:54 -05:00
|
|
|
},
|
|
|
|
color: {
|
|
|
|
inputType: 'options',
|
|
|
|
required: true,
|
|
|
|
options: [
|
|
|
|
{ name: 'Red', value: '#FF0000' },
|
|
|
|
{ name: 'Green', value: '#00FF00' },
|
|
|
|
{ name: 'Blue', value: '#0000FF' },
|
|
|
|
{ name: 'Turquoise', value: '#00FFFF' },
|
|
|
|
{ name: 'Purple', value: '#FF00FF' },
|
|
|
|
{ name: 'Yellow', value: '#FFFF00' },
|
|
|
|
{ name: 'Black', value: '#000000' },
|
|
|
|
{ name: 'Dark Grey', value: '#080808' },
|
|
|
|
{ name: 'Light Grey', value: '#D3D3D3' },
|
|
|
|
{ name: 'White', value: '#FFFFFF' },
|
|
|
|
{
|
|
|
|
name: 'Default (clear appearance)',
|
|
|
|
value: COMMAND_APPEARANCE_COLOR_DEFAULT,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
// Add more fields
|
|
|
|
},
|
|
|
|
},
|
2025-04-17 11:44:31 -04:00
|
|
|
Translate: {
|
|
|
|
description: 'Set translation on solid or sketch.',
|
2025-04-25 12:49:11 -04:00
|
|
|
icon: 'move',
|
2025-04-17 11:44:31 -04:00
|
|
|
needsReview: true,
|
|
|
|
args: {
|
|
|
|
nodeToEdit: {
|
|
|
|
description:
|
|
|
|
'Path to the node in the AST to edit. Never shown to the user.',
|
|
|
|
skip: true,
|
|
|
|
inputType: 'text',
|
|
|
|
required: false,
|
|
|
|
hidden: true,
|
|
|
|
},
|
|
|
|
selection: {
|
|
|
|
// selectionMixed allows for feature tree selection of module imports
|
|
|
|
inputType: 'selectionMixed',
|
|
|
|
multiple: false,
|
|
|
|
required: true,
|
|
|
|
skip: true,
|
|
|
|
selectionTypes: ['path'],
|
|
|
|
selectionFilter: ['object'],
|
|
|
|
hidden: (context) => Boolean(context.argumentsToSubmit.nodeToEdit),
|
|
|
|
},
|
|
|
|
x: {
|
|
|
|
inputType: 'kcl',
|
|
|
|
defaultValue: KCL_DEFAULT_TRANSFORM,
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
y: {
|
|
|
|
inputType: 'kcl',
|
|
|
|
defaultValue: KCL_DEFAULT_TRANSFORM,
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
z: {
|
|
|
|
inputType: 'kcl',
|
|
|
|
defaultValue: KCL_DEFAULT_TRANSFORM,
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
Rotate: {
|
|
|
|
description: 'Set rotation on solid or sketch.',
|
2025-04-25 12:49:11 -04:00
|
|
|
icon: 'rotate',
|
2025-04-17 11:44:31 -04:00
|
|
|
needsReview: true,
|
|
|
|
args: {
|
|
|
|
nodeToEdit: {
|
|
|
|
description:
|
|
|
|
'Path to the node in the AST to edit. Never shown to the user.',
|
|
|
|
skip: true,
|
|
|
|
inputType: 'text',
|
|
|
|
required: false,
|
|
|
|
hidden: true,
|
|
|
|
},
|
|
|
|
selection: {
|
|
|
|
// selectionMixed allows for feature tree selection of module imports
|
|
|
|
inputType: 'selectionMixed',
|
|
|
|
multiple: false,
|
|
|
|
required: true,
|
|
|
|
skip: true,
|
|
|
|
selectionTypes: ['path'],
|
|
|
|
selectionFilter: ['object'],
|
|
|
|
hidden: (context) => Boolean(context.argumentsToSubmit.nodeToEdit),
|
|
|
|
},
|
|
|
|
roll: {
|
|
|
|
inputType: 'kcl',
|
|
|
|
defaultValue: KCL_DEFAULT_TRANSFORM,
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
pitch: {
|
|
|
|
inputType: 'kcl',
|
|
|
|
defaultValue: KCL_DEFAULT_TRANSFORM,
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
yaw: {
|
|
|
|
inputType: 'kcl',
|
|
|
|
defaultValue: KCL_DEFAULT_TRANSFORM,
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2025-04-26 18:26:39 -04:00
|
|
|
Clone: {
|
|
|
|
description: 'Clone a solid or sketch.',
|
|
|
|
icon: 'clone',
|
|
|
|
needsReview: true,
|
|
|
|
args: {
|
|
|
|
nodeToEdit: {
|
|
|
|
description:
|
|
|
|
'Path to the node in the AST to edit. Never shown to the user.',
|
|
|
|
skip: true,
|
|
|
|
inputType: 'text',
|
|
|
|
required: false,
|
|
|
|
hidden: true,
|
|
|
|
},
|
|
|
|
selection: {
|
|
|
|
// selectionMixed allows for feature tree selection of module imports
|
|
|
|
inputType: 'selectionMixed',
|
|
|
|
multiple: false,
|
|
|
|
required: true,
|
|
|
|
skip: true,
|
|
|
|
selectionTypes: ['path'],
|
|
|
|
selectionFilter: ['object'],
|
|
|
|
hidden: (context) => Boolean(context.argumentsToSubmit.nodeToEdit),
|
|
|
|
},
|
|
|
|
variableName: {
|
|
|
|
inputType: 'string',
|
|
|
|
required: true,
|
|
|
|
defaultValue: () => {
|
|
|
|
return findUniqueName(
|
|
|
|
kclManager.ast,
|
|
|
|
KCL_DEFAULT_CONSTANT_PREFIXES.CLONE
|
|
|
|
)
|
|
|
|
},
|
|
|
|
validation: async ({ data }: { data: string }) => {
|
|
|
|
const variableExists = kclManager.variables[data]
|
|
|
|
if (variableExists) {
|
|
|
|
return 'This variable name is already in use.'
|
|
|
|
}
|
|
|
|
|
|
|
|
return 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
|
|
|
}
|
2025-03-28 14:56:48 +11:00
|
|
|
|
|
|
|
modelingMachineCommandConfig
|