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,
|
ast,
|
||||||
sketches,
|
sketches,
|
||||||
length,
|
length,
|
||||||
|
symmetric,
|
||||||
nodeToEdit,
|
nodeToEdit,
|
||||||
}: {
|
}: {
|
||||||
ast: Node<Program>
|
ast: Node<Program>
|
||||||
sketches: Selections
|
sketches: Selections
|
||||||
length: KclCommandValue
|
length: KclCommandValue
|
||||||
|
symmetric?: boolean
|
||||||
nodeToEdit?: PathToNode
|
nodeToEdit?: PathToNode
|
||||||
}):
|
}):
|
||||||
| {
|
| {
|
||||||
@ -63,9 +65,15 @@ export function addExtrude({
|
|||||||
return sketchesExprList
|
return sketchesExprList
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Extra labeled args expressions
|
||||||
|
const symmetricExpr = symmetric
|
||||||
|
? [createLabeledArg('symmetric', createLiteral(symmetric))]
|
||||||
|
: []
|
||||||
|
|
||||||
const sketchesExpr = createSketchExpression(sketchesExprList)
|
const sketchesExpr = createSketchExpression(sketchesExprList)
|
||||||
const call = createCallExpressionStdLibKw('extrude', sketchesExpr, [
|
const call = createCallExpressionStdLibKw('extrude', sketchesExpr, [
|
||||||
createLabeledArg('length', valueOrVariable(length)),
|
createLabeledArg('length', valueOrVariable(length)),
|
||||||
|
...symmetricExpr,
|
||||||
])
|
])
|
||||||
|
|
||||||
// Insert variables for labeled arguments if provided
|
// Insert variables for labeled arguments if provided
|
||||||
|
@ -60,6 +60,8 @@ export type ModelingCommandSchema = {
|
|||||||
// KCL stdlib arguments
|
// KCL stdlib arguments
|
||||||
sketches: Selections
|
sketches: Selections
|
||||||
length: KclCommandValue
|
length: KclCommandValue
|
||||||
|
symmetric?: boolean
|
||||||
|
// bidirectionalLength?: KclCommandValue
|
||||||
}
|
}
|
||||||
Sweep: {
|
Sweep: {
|
||||||
// Enables editing workflow
|
// Enables editing workflow
|
||||||
@ -394,6 +396,24 @@ export const modelingMachineCommandConfig: StateMachineCommandSetConfig<
|
|||||||
defaultValue: KCL_DEFAULT_LENGTH,
|
defaultValue: KCL_DEFAULT_LENGTH,
|
||||||
required: true,
|
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: {
|
Sweep: {
|
||||||
|
@ -2429,12 +2429,13 @@ export const modelingMachine = setup({
|
|||||||
return Promise.reject(new Error(NO_INPUT_PROVIDED_MESSAGE))
|
return Promise.reject(new Error(NO_INPUT_PROVIDED_MESSAGE))
|
||||||
}
|
}
|
||||||
|
|
||||||
const { nodeToEdit, sketches, length } = input
|
const { nodeToEdit, sketches, length, symmetric } = input
|
||||||
const { ast } = kclManager
|
const { ast } = kclManager
|
||||||
const astResult = addExtrude({
|
const astResult = addExtrude({
|
||||||
ast,
|
ast,
|
||||||
sketches,
|
sketches,
|
||||||
length,
|
length,
|
||||||
|
symmetric,
|
||||||
nodeToEdit,
|
nodeToEdit,
|
||||||
})
|
})
|
||||||
if (err(astResult)) {
|
if (err(astResult)) {
|
||||||
|
Reference in New Issue
Block a user