WIP: Add bidirectional args to point-and-click Extrude
Will eventually close #7495
This commit is contained in:
@ -37,11 +37,13 @@ export function addExtrude({
|
||||
ast,
|
||||
sketches,
|
||||
length,
|
||||
symmetric,
|
||||
nodeToEdit,
|
||||
}: {
|
||||
ast: Node<Program>
|
||||
sketches: Selections
|
||||
length: KclCommandValue
|
||||
symmetric?: boolean
|
||||
nodeToEdit?: PathToNode
|
||||
}):
|
||||
| {
|
||||
@ -63,9 +65,15 @@ export function addExtrude({
|
||||
return sketchesExprList
|
||||
}
|
||||
|
||||
// Extra labeled args expressions
|
||||
const symmetricExpr = symmetric
|
||||
? [createLabeledArg('symmetric', createLiteral(symmetric))]
|
||||
: []
|
||||
|
||||
const sketchesExpr = createSketchExpression(sketchesExprList)
|
||||
const call = createCallExpressionStdLibKw('extrude', sketchesExpr, [
|
||||
createLabeledArg('length', valueOrVariable(length)),
|
||||
...symmetricExpr,
|
||||
])
|
||||
|
||||
// Insert variables for labeled arguments if provided
|
||||
|
@ -60,6 +60,8 @@ export type ModelingCommandSchema = {
|
||||
// KCL stdlib arguments
|
||||
sketches: Selections
|
||||
length: KclCommandValue
|
||||
symmetric?: boolean
|
||||
// bidirectionalLength?: KclCommandValue
|
||||
}
|
||||
Sweep: {
|
||||
// Enables editing workflow
|
||||
@ -394,6 +396,24 @@ export const modelingMachineCommandConfig: StateMachineCommandSetConfig<
|
||||
defaultValue: KCL_DEFAULT_LENGTH,
|
||||
required: true,
|
||||
},
|
||||
symmetric: {
|
||||
inputType: 'options',
|
||||
skip: true,
|
||||
defaultValue: false,
|
||||
hidden: false,
|
||||
required: true,
|
||||
options: [
|
||||
{ name: 'False', value: false },
|
||||
{ name: 'True', value: true },
|
||||
],
|
||||
},
|
||||
// bidirectionalLength: {
|
||||
// inputType: 'kcl',
|
||||
// defaultValue: KCL_DEFAULT_LENGTH,
|
||||
// skip: true,
|
||||
// hidden: false,
|
||||
// required: false,
|
||||
// },
|
||||
},
|
||||
},
|
||||
Sweep: {
|
||||
|
@ -2429,12 +2429,13 @@ export const modelingMachine = setup({
|
||||
return Promise.reject(new Error(NO_INPUT_PROVIDED_MESSAGE))
|
||||
}
|
||||
|
||||
const { nodeToEdit, sketches, length } = input
|
||||
const { nodeToEdit, sketches, length, symmetric } = input
|
||||
const { ast } = kclManager
|
||||
const astResult = addExtrude({
|
||||
ast,
|
||||
sketches,
|
||||
length,
|
||||
symmetric,
|
||||
nodeToEdit,
|
||||
})
|
||||
if (err(astResult)) {
|
||||
|
Reference in New Issue
Block a user