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

@ -126,8 +126,7 @@ const prepareToEditOffsetPlane: PrepareToEditCallback = async ({
if (
operation.type !== 'StdLibCall' ||
!operation.labeledArgs ||
!('std_plane' in operation.labeledArgs) ||
!operation.labeledArgs.std_plane ||
!operation.unlabeledArg ||
!('offset' in operation.labeledArgs) ||
!operation.labeledArgs.offset
) {
@ -135,11 +134,9 @@ const prepareToEditOffsetPlane: PrepareToEditCallback = async ({
}
// TODO: Implement conversion to arbitrary plane selection
// once the Offset Plane command supports it.
const stdPlane = operation.unlabeledArg
const planeName = codeManager.code
.slice(
operation.labeledArgs.std_plane.sourceRange[0],
operation.labeledArgs.std_plane.sourceRange[1]
)
.slice(stdPlane.sourceRange[0], stdPlane.sourceRange[1])
.replaceAll(`'`, ``)
if (!isDefaultPlaneStr(planeName)) {