Assemblies: Set translate and rotate via point-and-click (#6167)
* WIP: Add point-and-click Import for geometry Will eventually fix #6120 Right now the whole loop is there but the codemod doesn't work yet * Better pathToNOde, log on non-working cm dispatch call * Add workaround to updateModelingState not working * Back to updateModelingState with a skip flag * Better todo * Change working from Import to Insert, cleanups * Sister command in kclCommands to populate file options * Improve path selector * Unsure: move importAstMod to kclCommands onSubmit 😶 * Add e2e test * Clean up for review * Add native file menu entry and test * No await yo lint said so * WIP: UX improvements around foreign file imports Fixes #6152 * WIP: Set translate and rotate via point-and-click on imports. Boilerplate code Will eventually close #6020 * Full working loop of rotate and translate pipe mutation, including edits, only on module imports. VERY VERBOSE * Add first e2e test for set transform. Bunch of caveats listed as TODOs * @lrev-Dev's suggestion to remove a comment Co-authored-by: Kurt Hutten <k.hutten@protonmail.ch> * Update to scene.settled(cmdBar) * Add partNNN default name for alias * Lint * Lint * Fix unit tests * Add sad path insert test Thanks @Irev-Dev for the suggestion * Add step insert test * Lint * Add test for second foreign import thru file tree click * WIP: Add point-and-click Load to copy files from outside the project into the project Towards #6210 * Move Insert button to modeling toolbar, update menus and toolbars * Add default value for local name alias * Aligning tests * Fix tests * Add padding for filenames starting with a digit * Lint * Lint * Update snapshots * Merge branch 'main' into pierremtb/issue6210-Add-point-and-click-Load-to-copy-files-from-outside-the-project-into-the-project * Add disabled transform subbutton * Allow start of Transform flow from toolbar with selection * Merge kcl-samples and local disk load into one 'Load external model' command * Fix em tests * Fix test * Add test for file pick import, better input * Fix non .kcl loading * Lint * Update snapshots * Fix issue leading to test failure * Fix clone test * Add note * Fix nested clone issue * Clean up for review * Add valueSummary for path * Fix test after path change * Clean up for review * Support much wider range for transform * Set display names * Bug fixed itself moment... * Add test for extrude tranform * Oops missed a thing * Clean up selection arg * More tests incl for variable stuff * Fix imports * Add supportsTransform: true on all solids returning operations * Fix edit flow on variables, add test * Split transform command into translate and rotate * Clean up and comment * Clean up operations.ts * Add comment * Improve assemblies test * Support more things * Typo * Fix test after unit change on import * Last clean up for review * Fix remaining test --------- Co-authored-by: Kurt Hutten <k.hutten@protonmail.ch>
This commit is contained in:
@ -22,7 +22,11 @@ import type {
|
||||
KclCommandValue,
|
||||
StateMachineCommandSetConfig,
|
||||
} from '@src/lib/commandTypes'
|
||||
import { KCL_DEFAULT_DEGREE, KCL_DEFAULT_LENGTH } from '@src/lib/constants'
|
||||
import {
|
||||
KCL_DEFAULT_DEGREE,
|
||||
KCL_DEFAULT_LENGTH,
|
||||
KCL_DEFAULT_TRANSFORM,
|
||||
} from '@src/lib/constants'
|
||||
import type { components } from '@src/lib/machine-api'
|
||||
import type { Selections } from '@src/lib/selections'
|
||||
import { codeManager, kclManager } from '@src/lib/singletons'
|
||||
@ -163,6 +167,20 @@ export type ModelingCommandSchema = {
|
||||
nodeToEdit?: PathToNode
|
||||
color: string
|
||||
}
|
||||
Translate: {
|
||||
nodeToEdit?: PathToNode
|
||||
selection: Selections
|
||||
x: KclCommandValue
|
||||
y: KclCommandValue
|
||||
z: KclCommandValue
|
||||
}
|
||||
Rotate: {
|
||||
nodeToEdit?: PathToNode
|
||||
selection: Selections
|
||||
roll: KclCommandValue
|
||||
pitch: KclCommandValue
|
||||
yaw: KclCommandValue
|
||||
}
|
||||
'Boolean Subtract': {
|
||||
target: Selections
|
||||
tool: Selections
|
||||
@ -1024,6 +1042,88 @@ export const modelingMachineCommandConfig: StateMachineCommandSetConfig<
|
||||
// Add more fields
|
||||
},
|
||||
},
|
||||
Translate: {
|
||||
description: 'Set translation on solid or sketch.',
|
||||
icon: 'dimension', // TODO: likely not the best icon
|
||||
needsReview: true,
|
||||
hide: DEV || IS_NIGHTLY_OR_DEBUG ? undefined : 'both',
|
||||
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.',
|
||||
icon: 'angle', // TODO: likely not the best icon
|
||||
needsReview: true,
|
||||
hide: DEV || IS_NIGHTLY_OR_DEBUG ? undefined : 'both',
|
||||
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,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
modelingMachineCommandConfig
|
||||
|
Reference in New Issue
Block a user