diff --git a/src/lib/commandBarConfigs/modelingCommandConfig.ts b/src/lib/commandBarConfigs/modelingCommandConfig.ts index 5faa1ecb5d..b9b791781a 100644 --- a/src/lib/commandBarConfigs/modelingCommandConfig.ts +++ b/src/lib/commandBarConfigs/modelingCommandConfig.ts @@ -313,7 +313,7 @@ export const modelingMachineCommandConfig: StateMachineCommandSetConfig< args: { target: { inputType: 'selection', - selectionTypes: ['solid2d'], + selectionTypes: ['solid2d', 'plane'], required: true, skip: true, multiple: false, @@ -322,7 +322,7 @@ export const modelingMachineCommandConfig: StateMachineCommandSetConfig< }, trajectory: { inputType: 'selection', - selectionTypes: ['segment', 'path'], + selectionTypes: ['segment', 'plane'], required: true, skip: false, multiple: false, diff --git a/src/lib/commandBarConfigs/validators.ts b/src/lib/commandBarConfigs/validators.ts index 2d87294aa2..2762ee6bdf 100644 --- a/src/lib/commandBarConfigs/validators.ts +++ b/src/lib/commandBarConfigs/validators.ts @@ -222,24 +222,31 @@ export const sweepValidator = async ({ // Retrieve the parent path from the segment selection directly const trajectoryArtifact = data.trajectory.graphSelections[0].artifact - if (!trajectoryArtifact) { - return "Unable to sweep, couldn't find the trajectory artifact" + let trajectory: string | undefined = undefined + if (trajectoryArtifact && trajectoryArtifact.type === 'segment') { + trajectory = trajectoryArtifact.pathId + } else if (trajectoryArtifact && trajectoryArtifact.type === 'plane') { + // TODO: check again after multi profile + trajectory = trajectoryArtifact.pathIds[0] } - if (trajectoryArtifact.type !== 'segment') { - return "Unable to sweep, couldn't find the target from a non-segment selection" + + if (!trajectory) { + return "Unable to sweep, couldn't find the trajectory artifact" } - const trajectory = trajectoryArtifact.pathId // Get the former arg in the command bar flow, and retrieve the path from the solid2d directly const targetArg = context.argumentsToSubmit['target'] as Selections const targetArtifact = targetArg.graphSelections[0].artifact - if (!targetArtifact) { - return "Unable to sweep, couldn't find the profile artifact" + let target: string | undefined = undefined + if (targetArtifact && targetArtifact.type === 'solid2D') { + target = targetArtifact.pathId + } else if (targetArtifact && targetArtifact.type === 'plane') { + target = targetArtifact.pathIds[0] } - if (targetArtifact.type !== 'solid2d') { - return "Unable to sweep, couldn't find the target from a non-solid2d selection" + + if (!target) { + return "Unable to sweep, couldn't find the profile artifact" } - const target = targetArtifact.pathId const sweepCommand = async () => { // TODO: second look on defaults here