Disallow segment selection in all sweeps and change Sketches display name to Profiles (#7045)

* Disallow segment selection in sweep, plus displayName: Profiles for clarity
Fixes #7044

* Change selection hints for solid2d to be profile instead of face

* Update tests

* More fixes

* Fix tests following behavior change: we don't select segments in code anymore but profiles
This commit is contained in:
Pierre Jacquier
2025-05-19 11:21:29 -04:00
committed by GitHub
parent e76ba9921c
commit fb35fdcc38
7 changed files with 55 additions and 50 deletions

View File

@ -36,7 +36,7 @@ test.describe('Command bar tests', () => {
await u.closeDebugPanel() await u.closeDebugPanel()
// Click the line of code for xLine. // Click the line of code for xLine.
await page.getByText(`close()`).click() // TODO remove this and reinstate // await topHorzSegmentClick() await page.getByText(`startProfile(at = [-10, -10])`).click()
await toolbar.extrudeButton.click() await toolbar.extrudeButton.click()
await cmdBar.expectState({ await cmdBar.expectState({
@ -45,10 +45,10 @@ test.describe('Command bar tests', () => {
currentArgKey: 'sketches', currentArgKey: 'sketches',
currentArgValue: '', currentArgValue: '',
headerArguments: { headerArguments: {
Sketches: '', Profiles: '',
Length: '', Length: '',
}, },
highlightedHeaderArg: 'sketches', highlightedHeaderArg: 'Profiles',
}) })
await cmdBar.progressCmdBar() await cmdBar.progressCmdBar()
await cmdBar.progressCmdBar() await cmdBar.progressCmdBar()
@ -56,7 +56,7 @@ test.describe('Command bar tests', () => {
stage: 'review', stage: 'review',
commandName: 'Extrude', commandName: 'Extrude',
headerArguments: { headerArguments: {
Sketches: '1 segment', Profiles: '1 profile',
Length: '5', Length: '5',
}, },
}) })
@ -286,7 +286,7 @@ test.describe('Command bar tests', () => {
await cmdBar.cmdOptions.getByText('Extrude').click() await cmdBar.cmdOptions.getByText('Extrude').click()
// Assert that we're on the selection step // Assert that we're on the selection step
await expect(page.getByRole('button', { name: 'sketches' })).toBeDisabled() await expect(page.getByRole('button', { name: 'Profiles' })).toBeDisabled()
// Select a face // Select a face
await page.mouse.move(700, 200) await page.mouse.move(700, 200)
await page.mouse.click(700, 200) await page.mouse.click(700, 200)

View File

@ -1138,7 +1138,7 @@ sketch001 = startSketchOn(XZ)
currentArgKey: 'length', currentArgKey: 'length',
currentArgValue: '5', currentArgValue: '5',
headerArguments: { headerArguments: {
Sketches: '1 face', Profiles: '1 profile',
Length: '', Length: '',
}, },
highlightedHeaderArg: 'length', highlightedHeaderArg: 'length',
@ -1148,7 +1148,7 @@ sketch001 = startSketchOn(XZ)
await cmdBar.expectState({ await cmdBar.expectState({
stage: 'review', stage: 'review',
headerArguments: { headerArguments: {
Sketches: '1 face', Profiles: '1 profile',
Length: '5', Length: '5',
}, },
commandName: 'Extrude', commandName: 'Extrude',

View File

@ -78,8 +78,8 @@ test.describe('Point-and-click tests', () => {
stage: 'arguments', stage: 'arguments',
currentArgKey: 'sketches', currentArgKey: 'sketches',
currentArgValue: '', currentArgValue: '',
headerArguments: { Sketches: '', Length: '' }, headerArguments: { Profiles: '', Length: '' },
highlightedHeaderArg: 'sketches', highlightedHeaderArg: 'Profiles',
commandName: 'Extrude', commandName: 'Extrude',
}) })
await cmdBar.progressCmdBar() await cmdBar.progressCmdBar()
@ -87,7 +87,7 @@ test.describe('Point-and-click tests', () => {
stage: 'arguments', stage: 'arguments',
currentArgKey: 'length', currentArgKey: 'length',
currentArgValue: '5', currentArgValue: '5',
headerArguments: { Sketches: '1 face', Length: '' }, headerArguments: { Profiles: '1 profile', Length: '' },
highlightedHeaderArg: 'length', highlightedHeaderArg: 'length',
commandName: 'Extrude', commandName: 'Extrude',
}) })
@ -98,7 +98,7 @@ test.describe('Point-and-click tests', () => {
await cmdBar.expectState({ await cmdBar.expectState({
stage: 'review', stage: 'review',
headerArguments: { Sketches: '1 face', Length: '5' }, headerArguments: { Profiles: '1 profile', Length: '5' },
commandName: 'Extrude', commandName: 'Extrude',
}) })
await cmdBar.progressCmdBar() await cmdBar.progressCmdBar()
@ -1634,15 +1634,15 @@ sketch002 = startSketchOn(plane001)
stage: 'arguments', stage: 'arguments',
currentArgKey: 'sketches', currentArgKey: 'sketches',
currentArgValue: '', currentArgValue: '',
headerArguments: { Sketches: '' }, headerArguments: { Profiles: '' },
highlightedHeaderArg: 'sketches', highlightedHeaderArg: 'Profiles',
commandName: 'Loft', commandName: 'Loft',
}) })
await selectSketches() await selectSketches()
await cmdBar.progressCmdBar() await cmdBar.progressCmdBar()
await cmdBar.expectState({ await cmdBar.expectState({
stage: 'review', stage: 'review',
headerArguments: { Sketches: '2 faces' }, headerArguments: { Profiles: '2 profiles' },
commandName: 'Loft', commandName: 'Loft',
}) })
await cmdBar.submit() await cmdBar.submit()
@ -1658,14 +1658,14 @@ sketch002 = startSketchOn(plane001)
stage: 'arguments', stage: 'arguments',
currentArgKey: 'sketches', currentArgKey: 'sketches',
currentArgValue: '', currentArgValue: '',
headerArguments: { Sketches: '' }, headerArguments: { Profiles: '' },
highlightedHeaderArg: 'sketches', highlightedHeaderArg: 'Profiles',
commandName: 'Loft', commandName: 'Loft',
}) })
await cmdBar.progressCmdBar() await cmdBar.progressCmdBar()
await cmdBar.expectState({ await cmdBar.expectState({
stage: 'review', stage: 'review',
headerArguments: { Sketches: '2 faces' }, headerArguments: { Profiles: '2 profiles' },
commandName: 'Loft', commandName: 'Loft',
}) })
await cmdBar.submit() await cmdBar.submit()
@ -1830,10 +1830,10 @@ sketch002 = startSketchOn(XZ)
currentArgValue: '', currentArgValue: '',
headerArguments: { headerArguments: {
Sectional: '', Sectional: '',
Sketches: '', Profiles: '',
Path: '', Path: '',
}, },
highlightedHeaderArg: 'sketches', highlightedHeaderArg: 'Profiles',
stage: 'arguments', stage: 'arguments',
}) })
await clickOnSketch1() await clickOnSketch1()
@ -1844,7 +1844,7 @@ sketch002 = startSketchOn(XZ)
currentArgValue: '', currentArgValue: '',
headerArguments: { headerArguments: {
Sectional: '', Sectional: '',
Sketches: '1 face', Profiles: '1 profile',
Path: '', Path: '',
}, },
highlightedHeaderArg: 'path', highlightedHeaderArg: 'path',
@ -1857,7 +1857,7 @@ sketch002 = startSketchOn(XZ)
currentArgValue: '', currentArgValue: '',
headerArguments: { headerArguments: {
Sectional: '', Sectional: '',
Sketches: '1 face', Profiles: '1 profile',
Path: '', Path: '',
}, },
highlightedHeaderArg: 'path', highlightedHeaderArg: 'path',
@ -1867,7 +1867,7 @@ sketch002 = startSketchOn(XZ)
await cmdBar.expectState({ await cmdBar.expectState({
commandName: 'Sweep', commandName: 'Sweep',
headerArguments: { headerArguments: {
Sketches: '1 face', Profiles: '1 profile',
Path: '1 segment', Path: '1 segment',
Sectional: '', Sectional: '',
}, },
@ -1968,10 +1968,10 @@ profile001 = ${circleCode}`
currentArgValue: '', currentArgValue: '',
headerArguments: { headerArguments: {
Sectional: '', Sectional: '',
Sketches: '', Profiles: '',
Path: '', Path: '',
}, },
highlightedHeaderArg: 'sketches', highlightedHeaderArg: 'Profiles',
stage: 'arguments', stage: 'arguments',
}) })
await editor.scrollToText(circleCode) await editor.scrollToText(circleCode)
@ -1983,7 +1983,7 @@ profile001 = ${circleCode}`
currentArgValue: '', currentArgValue: '',
headerArguments: { headerArguments: {
Sectional: '', Sectional: '',
Sketches: '1 face', Profiles: '1 profile',
Path: '', Path: '',
}, },
highlightedHeaderArg: 'path', highlightedHeaderArg: 'path',
@ -1997,7 +1997,7 @@ profile001 = ${circleCode}`
currentArgValue: '', currentArgValue: '',
headerArguments: { headerArguments: {
Sectional: '', Sectional: '',
Sketches: '1 face', Profiles: '1 profile',
Path: '', Path: '',
}, },
highlightedHeaderArg: 'path', highlightedHeaderArg: 'path',
@ -2007,7 +2007,7 @@ profile001 = ${circleCode}`
await cmdBar.expectState({ await cmdBar.expectState({
commandName: 'Sweep', commandName: 'Sweep',
headerArguments: { headerArguments: {
Sketches: '1 face', Profiles: '1 profile',
Path: '1 helix', Path: '1 helix',
Sectional: '', Sectional: '',
}, },
@ -3691,7 +3691,7 @@ tag=$rectangleSegmentC002,
await scene.settled(cmdBar) await scene.settled(cmdBar)
// select line of code // select line of code
const codeToSelection = `segAng(rectangleSegmentA002) - 90,` const codeToSelection = `startProfile(at = [-66.77, 84.81])`
// revolve // revolve
await editor.scrollToText(codeToSelection) await editor.scrollToText(codeToSelection)
await page.getByText(codeToSelection).click() await page.getByText(codeToSelection).click()
@ -4634,10 +4634,10 @@ path001 = startProfile(sketch001, at = [0, 0])
currentArgKey: 'sketches', currentArgKey: 'sketches',
currentArgValue: '', currentArgValue: '',
headerArguments: { headerArguments: {
Sketches: '', Profiles: '',
Length: '', Length: '',
}, },
highlightedHeaderArg: 'sketches', highlightedHeaderArg: 'Profiles',
commandName: 'Extrude', commandName: 'Extrude',
}) })
await cmdBar.progressCmdBar() await cmdBar.progressCmdBar()
@ -4646,7 +4646,7 @@ path001 = startProfile(sketch001, at = [0, 0])
currentArgKey: 'length', currentArgKey: 'length',
currentArgValue: '5', currentArgValue: '5',
headerArguments: { headerArguments: {
Sketches: '2 faces', Profiles: '2 profiles',
Length: '', Length: '',
}, },
highlightedHeaderArg: 'length', highlightedHeaderArg: 'length',
@ -4657,7 +4657,7 @@ path001 = startProfile(sketch001, at = [0, 0])
await cmdBar.expectState({ await cmdBar.expectState({
stage: 'review', stage: 'review',
headerArguments: { headerArguments: {
Sketches: '2 faces', Profiles: '2 profiles',
Length: '1', Length: '1',
}, },
commandName: 'Extrude', commandName: 'Extrude',
@ -4728,11 +4728,11 @@ path001 = startProfile(sketch001, at = [0, 0])
currentArgKey: 'sketches', currentArgKey: 'sketches',
currentArgValue: '', currentArgValue: '',
headerArguments: { headerArguments: {
Sketches: '', Profiles: '',
Path: '', Path: '',
Sectional: '', Sectional: '',
}, },
highlightedHeaderArg: 'sketches', highlightedHeaderArg: 'Profiles',
commandName: 'Sweep', commandName: 'Sweep',
}) })
await cmdBar.progressCmdBar() await cmdBar.progressCmdBar()
@ -4741,7 +4741,7 @@ path001 = startProfile(sketch001, at = [0, 0])
currentArgKey: 'path', currentArgKey: 'path',
currentArgValue: '', currentArgValue: '',
headerArguments: { headerArguments: {
Sketches: '2 faces', Profiles: '2 profiles',
Path: '', Path: '',
Sectional: '', Sectional: '',
}, },
@ -4754,7 +4754,7 @@ path001 = startProfile(sketch001, at = [0, 0])
await cmdBar.expectState({ await cmdBar.expectState({
stage: 'review', stage: 'review',
headerArguments: { headerArguments: {
Sketches: '2 faces', Profiles: '2 profiles',
Path: '1 segment', Path: '1 segment',
Sectional: '', Sectional: '',
}, },
@ -4825,11 +4825,11 @@ path001 = startProfile(sketch001, at = [0, 0])
currentArgKey: 'sketches', currentArgKey: 'sketches',
currentArgValue: '', currentArgValue: '',
headerArguments: { headerArguments: {
Sketches: '', Profiles: '',
AxisOrEdge: '', AxisOrEdge: '',
Angle: '', Angle: '',
}, },
highlightedHeaderArg: 'sketches', highlightedHeaderArg: 'Profiles',
commandName: 'Revolve', commandName: 'Revolve',
}) })
await cmdBar.progressCmdBar() await cmdBar.progressCmdBar()
@ -4838,7 +4838,7 @@ path001 = startProfile(sketch001, at = [0, 0])
currentArgKey: 'axisOrEdge', currentArgKey: 'axisOrEdge',
currentArgValue: '', currentArgValue: '',
headerArguments: { headerArguments: {
Sketches: '2 faces', Profiles: '2 profiles',
AxisOrEdge: '', AxisOrEdge: '',
Angle: '', Angle: '',
}, },
@ -4854,7 +4854,7 @@ path001 = startProfile(sketch001, at = [0, 0])
currentArgKey: 'angle', currentArgKey: 'angle',
currentArgValue: '360', currentArgValue: '360',
headerArguments: { headerArguments: {
Sketches: '2 faces', Profiles: '2 profiles',
AxisOrEdge: 'Edge', AxisOrEdge: 'Edge',
Edge: '1 segment', Edge: '1 segment',
Angle: '', Angle: '',
@ -4867,7 +4867,7 @@ path001 = startProfile(sketch001, at = [0, 0])
await cmdBar.expectState({ await cmdBar.expectState({
stage: 'review', stage: 'review',
headerArguments: { headerArguments: {
Sketches: '2 faces', Profiles: '2 profiles',
AxisOrEdge: 'Edge', AxisOrEdge: 'Edge',
Edge: '1 segment', Edge: '1 segment',
Angle: '180', Angle: '180',

View File

@ -995,8 +995,8 @@ profile001 = startProfile(sketch001, at = [${roundOff(scale * 69.6)}, ${roundOff
await u.expectCmdLog('[data-message-type="execution-done"]') await u.expectCmdLog('[data-message-type="execution-done"]')
await u.closeDebugPanel() await u.closeDebugPanel()
// click "line(end = [1.32, 0.38])" // click profile in code
await page.getByText(`line(end = [1.32, 0.38])`).click() await page.getByText(`startProfile(at = [-0.45, 0.87])`).click()
await page.waitForTimeout(100) await page.waitForTimeout(100)
await expect(page.getByRole('button', { name: 'Edit Sketch' })).toBeEnabled( await expect(page.getByRole('button', { name: 'Edit Sketch' })).toBeEnabled(
{ timeout: 10_000 } { timeout: 10_000 }
@ -1014,14 +1014,14 @@ profile001 = startProfile(sketch001, at = [${roundOff(scale * 69.6)}, ${roundOff
// click extrude // click extrude
await toolbar.extrudeButton.click() await toolbar.extrudeButton.click()
// sketch selection should already have been made. "Sketches: 1 face" only show up when the selection has been made already // sketch selection should already have been made.
// otherwise the cmdbar would be waiting for a selection. // otherwise the cmdbar would be waiting for a selection.
await cmdBar.progressCmdBar() await cmdBar.progressCmdBar()
await cmdBar.expectState({ await cmdBar.expectState({
stage: 'arguments', stage: 'arguments',
currentArgKey: 'length', currentArgKey: 'length',
currentArgValue: '5', currentArgValue: '5',
headerArguments: { Sketches: '1 segment', Length: '' }, headerArguments: { Profiles: '1 profile', Length: '' },
highlightedHeaderArg: 'length', highlightedHeaderArg: 'length',
commandName: 'Extrude', commandName: 'Extrude',
}) })

View File

@ -19,7 +19,8 @@ import type { modelingMachine } from '@src/machines/modelingMachine'
const semanticEntityNames: { const semanticEntityNames: {
[key: string]: Array<Artifact['type'] | 'defaultPlane'> [key: string]: Array<Artifact['type'] | 'defaultPlane'>
} = { } = {
face: ['wall', 'cap', 'solid2d'], face: ['wall', 'cap'],
profile: ['solid2d'],
edge: ['segment', 'sweepEdge', 'edgeCutEdge'], edge: ['segment', 'sweepEdge', 'edgeCutEdge'],
point: [], point: [],
plane: ['defaultPlane'], plane: ['defaultPlane'],

View File

@ -383,7 +383,8 @@ export const modelingMachineCommandConfig: StateMachineCommandSetConfig<
}, },
sketches: { sketches: {
inputType: 'selection', inputType: 'selection',
selectionTypes: ['solid2d', 'segment'], displayName: 'Profiles',
selectionTypes: ['solid2d'],
multiple: true, multiple: true,
required: true, required: true,
hidden: (context) => Boolean(context.argumentsToSubmit.nodeToEdit), hidden: (context) => Boolean(context.argumentsToSubmit.nodeToEdit),
@ -411,7 +412,8 @@ export const modelingMachineCommandConfig: StateMachineCommandSetConfig<
}, },
sketches: { sketches: {
inputType: 'selection', inputType: 'selection',
selectionTypes: ['solid2d', 'segment'], displayName: 'Profiles',
selectionTypes: ['solid2d'],
multiple: true, multiple: true,
required: true, required: true,
hidden: (context) => Boolean(context.argumentsToSubmit.nodeToEdit), hidden: (context) => Boolean(context.argumentsToSubmit.nodeToEdit),
@ -444,6 +446,7 @@ export const modelingMachineCommandConfig: StateMachineCommandSetConfig<
args: { args: {
sketches: { sketches: {
inputType: 'selection', inputType: 'selection',
displayName: 'Profiles',
selectionTypes: ['solid2d'], selectionTypes: ['solid2d'],
multiple: true, multiple: true,
required: true, required: true,
@ -464,7 +467,8 @@ export const modelingMachineCommandConfig: StateMachineCommandSetConfig<
}, },
sketches: { sketches: {
inputType: 'selection', inputType: 'selection',
selectionTypes: ['solid2d', 'segment'], displayName: 'Profiles',
selectionTypes: ['solid2d'],
multiple: true, multiple: true,
required: true, required: true,
hidden: (context) => Boolean(context.argumentsToSubmit.nodeToEdit), hidden: (context) => Boolean(context.argumentsToSubmit.nodeToEdit),

View File

@ -486,7 +486,7 @@ export function getSelectionTypeDisplayText(
.map( .map(
// Hack for showing "face" instead of "extrude-wall" in command bar text // Hack for showing "face" instead of "extrude-wall" in command bar text
([type, count]) => ([type, count]) =>
`${count} ${type.replace('wall', 'face').replace('solid2d', 'face')}${ `${count} ${type.replace('wall', 'face').replace('solid2d', 'profile')}${
count > 1 ? 's' : '' count > 1 ? 's' : ''
}` }`
) )