Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pierremtb/issue5101 allow feature tree selection for point and click sweep #5103

Draft
wants to merge 11 commits into
base: main
Choose a base branch
from
4 changes: 2 additions & 2 deletions src/lib/commandBarConfigs/modelingCommandConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ export const modelingMachineCommandConfig: StateMachineCommandSetConfig<
args: {
target: {
inputType: 'selection',
selectionTypes: ['solid2d'],
selectionTypes: ['solid2d', 'plane'],
required: true,
skip: true,
multiple: false,
Expand All @@ -322,7 +322,7 @@ export const modelingMachineCommandConfig: StateMachineCommandSetConfig<
},
trajectory: {
inputType: 'selection',
selectionTypes: ['segment', 'path'],
selectionTypes: ['segment', 'plane'],
required: true,
skip: false,
multiple: false,
Expand Down
27 changes: 17 additions & 10 deletions src/lib/commandBarConfigs/validators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,24 +222,31 @@

// 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') {

Check failure on line 241 in src/lib/commandBarConfigs/validators.ts

View workflow job for this annotation

GitHub Actions / yarn-tsc

This comparison appears to be unintentional because the types '"sweep" | "plane" | "path" | "segment" | "solid2d" | "startSketchOnFace" | "startSketchOnPlane" | "wall" | "cap" | "sweepEdge" | "edgeCut" | "edgeCutEdge"' and '"solid2D"' have no overlap.
target = targetArtifact.pathId

Check failure on line 242 in src/lib/commandBarConfigs/validators.ts

View workflow job for this annotation

GitHub Actions / yarn-tsc

Property 'pathId' does not exist on type 'never'.
} 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
Expand Down
Loading