offsetPlane kwargs (#5367)

Previously: `offsetPlane('XY', 75)`
Now: `offsetPlane('XY', offset = 75)`

Pairs with this KCL-samples PR: https://github.com/KittyCAD/kcl-samples/pull/163
This commit is contained in:
Adam Chalmers
2025-02-13 13:37:02 -06:00
committed by GitHub
parent 5d02a27122
commit 78b42ea191
21 changed files with 320 additions and 297 deletions

View File

@ -33,6 +33,7 @@ import {
traverse,
ARG_INDEX_FIELD,
LABELED_ARG_FIELD,
UNLABELED_ARG,
} from './queryAst'
import {
addTagForSketchOnFace,
@ -656,10 +657,11 @@ export function addOffsetPlane({
const newPlane = createVariableDeclaration(
newPlaneName,
createCallExpressionStdLib('offsetPlane', [
createCallExpressionStdLibKw(
'offsetPlane',
createLiteral(defaultPlane.toUpperCase()),
offset,
])
[createLabeledArg('offset', offset)]
)
)
const insertAt =
@ -677,8 +679,7 @@ export function addOffsetPlane({
[insertAt, 'index'],
['declaration', 'VariableDeclaration'],
['init', 'VariableDeclarator'],
['arguments', 'CallExpression'],
[0, 'index'],
['unlabeled', UNLABELED_ARG],
]
return {
modifiedAst,