Make Helix available in numbered releases (#6024)

* Helix release outside of dev and nightly

* Make length non required on edge mode so we get the edge length by default
This commit is contained in:
Pierre Jacquier
2025-03-28 07:25:32 -04:00
committed by GitHub
parent cc2efd316c
commit 678ebbc310
4 changed files with 15 additions and 21 deletions

View File

@ -1097,7 +1097,6 @@ openSketch = startSketchOn(XY)
Mode: '', Mode: '',
AngleStart: '', AngleStart: '',
Revolutions: '', Revolutions: '',
Length: '',
Radius: '', Radius: '',
CounterClockWise: '', CounterClockWise: '',
}, },
@ -1194,14 +1193,14 @@ openSketch = startSketchOn(XY)
{ {
selectionType: 'segment', selectionType: 'segment',
testPoint: { x: 513, y: 221 }, testPoint: { x: 513, y: 221 },
expectedOutput: `helix001 = helix( axis = seg01, radius = 1, length = 100, revolutions = 20, angleStart = 0, ccw = false,)`, expectedOutput: `helix001 = helix( axis = seg01, radius = 1, revolutions = 20, angleStart = 0, ccw = false,)`,
expectedEditedOutput: `helix001 = helix( axis = seg01, radius = 1, length = 50, revolutions = 20, angleStart = 0, ccw = false,)`, expectedEditedOutput: `helix001 = helix( axis = seg01, radius = 5, revolutions = 20, angleStart = 0, ccw = false,)`,
}, },
{ {
selectionType: 'sweepEdge', selectionType: 'sweepEdge',
testPoint: { x: 564, y: 364 }, testPoint: { x: 564, y: 364 },
expectedOutput: `helix001 = helix( axis = getOppositeEdge(seg01), radius = 1, length = 100, revolutions = 20, angleStart = 0, ccw = false,)`, expectedOutput: `helix001 = helix( axis = getOppositeEdge(seg01), radius = 1, revolutions = 20, angleStart = 0, ccw = false,)`,
expectedEditedOutput: `helix001 = helix( axis = getOppositeEdge(seg01), radius = 1, length = 50, revolutions = 20, angleStart = 0, ccw = false,)`, expectedEditedOutput: `helix001 = helix( axis = getOppositeEdge(seg01), radius = 5, revolutions = 20, angleStart = 0, ccw = false,)`,
}, },
] ]
helixCases.map( helixCases.map(
@ -1244,7 +1243,6 @@ openSketch = startSketchOn(XY)
AngleStart: '', AngleStart: '',
Mode: '', Mode: '',
CounterClockWise: '', CounterClockWise: '',
Length: '',
Radius: '', Radius: '',
Revolutions: '', Revolutions: '',
}, },
@ -1261,8 +1259,6 @@ openSketch = startSketchOn(XY)
await cmdBar.progressCmdBar() await cmdBar.progressCmdBar()
await page.keyboard.insertText('1') await page.keyboard.insertText('1')
await cmdBar.progressCmdBar() await cmdBar.progressCmdBar()
await page.keyboard.insertText('100')
await cmdBar.progressCmdBar()
await cmdBar.expectState({ await cmdBar.expectState({
stage: 'review', stage: 'review',
headerArguments: { headerArguments: {
@ -1271,7 +1267,6 @@ openSketch = startSketchOn(XY)
AngleStart: '0', AngleStart: '0',
Revolutions: '20', Revolutions: '20',
Radius: '1', Radius: '1',
Length: '100',
CounterClockWise: '', CounterClockWise: '',
}, },
commandName: 'Helix', commandName: 'Helix',
@ -1292,8 +1287,8 @@ openSketch = startSketchOn(XY)
0 0
) )
await operationButton.dblclick() await operationButton.dblclick()
const initialInput = '100' const initialInput = '1'
const newInput = '50' const newInput = '5'
await cmdBar.expectState({ await cmdBar.expectState({
commandName: 'Helix', commandName: 'Helix',
stage: 'arguments', stage: 'arguments',
@ -1302,13 +1297,14 @@ openSketch = startSketchOn(XY)
headerArguments: { headerArguments: {
AngleStart: '0', AngleStart: '0',
Revolutions: '20', Revolutions: '20',
Radius: '1', Radius: initialInput,
Length: initialInput,
CounterClockWise: '', CounterClockWise: '',
}, },
highlightedHeaderArg: 'CounterClockWise', highlightedHeaderArg: 'CounterClockWise',
}) })
await page.keyboard.press('Shift+Backspace') await page
.getByRole('button', { name: 'radius', exact: false })
.click()
await expect(cmdBar.currentArgumentInput).toBeVisible() await expect(cmdBar.currentArgumentInput).toBeVisible()
await cmdBar.currentArgumentInput await cmdBar.currentArgumentInput
.locator('.cm-content') .locator('.cm-content')
@ -1319,8 +1315,7 @@ openSketch = startSketchOn(XY)
headerArguments: { headerArguments: {
AngleStart: '0', AngleStart: '0',
Revolutions: '20', Revolutions: '20',
Radius: '1', Radius: newInput,
Length: newInput,
CounterClockWise: '', CounterClockWise: '',
}, },
commandName: 'Helix', commandName: 'Helix',
@ -1391,7 +1386,6 @@ extrude001 = extrude(profile001, length = 100)
Mode: '', Mode: '',
AngleStart: '', AngleStart: '',
Revolutions: '', Revolutions: '',
Length: '',
Radius: '', Radius: '',
CounterClockWise: '', CounterClockWise: '',
}, },

View File

@ -681,9 +681,7 @@ export const modelingMachineCommandConfig: StateMachineCommandSetConfig<
inputType: 'kcl', inputType: 'kcl',
defaultValue: KCL_DEFAULT_LENGTH, defaultValue: KCL_DEFAULT_LENGTH,
required: (commandContext) => required: (commandContext) =>
!['Cylinder'].includes( ['Axis'].includes(commandContext.argumentsToSubmit.mode as string),
commandContext.argumentsToSubmit.mode as string
),
}, },
ccw: { ccw: {
inputType: 'options', inputType: 'options',

View File

@ -757,7 +757,9 @@ const prepareToEditHelix: PrepareToEditCallback = async ({ operation }) => {
} else { } else {
return { reason: "Couldn't find radius argument" } return { reason: "Couldn't find radius argument" }
} }
}
if (mode === 'Axis') {
if ('length' in operation.labeledArgs && operation.labeledArgs.length) { if ('length' in operation.labeledArgs && operation.labeledArgs.length) {
const r = await stringToKclExpression( const r = await stringToKclExpression(
codeManager.code.slice( codeManager.code.slice(

View File

@ -307,7 +307,7 @@ export const toolbarConfig: Record<ToolbarModeName, ToolbarMode> = {
}, },
hotkey: 'H', hotkey: 'H',
icon: 'helix', icon: 'helix',
status: DEV || IS_NIGHTLY_OR_DEBUG ? 'available' : 'kcl-only', status: 'available',
title: 'Helix', title: 'Helix',
description: 'Create a helix or spiral in 3D about an axis.', description: 'Create a helix or spiral in 3D about an axis.',
links: [{ label: 'KCL docs', url: 'https://zoo.dev/docs/kcl/helix' }], links: [{ label: 'KCL docs', url: 'https://zoo.dev/docs/kcl/helix' }],