diff --git a/src/lang/modifyAst/addSweep.ts b/src/lang/modifyAst/addSweep.ts index 386d135a5..9468da62b 100644 --- a/src/lang/modifyAst/addSweep.ts +++ b/src/lang/modifyAst/addSweep.ts @@ -37,11 +37,13 @@ export function addExtrude({ ast, sketches, length, + symmetric, nodeToEdit, }: { ast: Node 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 diff --git a/src/lib/commandBarConfigs/modelingCommandConfig.ts b/src/lib/commandBarConfigs/modelingCommandConfig.ts index c0b778941..9fa51ff63 100644 --- a/src/lib/commandBarConfigs/modelingCommandConfig.ts +++ b/src/lib/commandBarConfigs/modelingCommandConfig.ts @@ -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: { diff --git a/src/machines/modelingMachine.ts b/src/machines/modelingMachine.ts index 077bc5d6a..f073500bb 100644 --- a/src/machines/modelingMachine.ts +++ b/src/machines/modelingMachine.ts @@ -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)) {