Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions e2e/playwright/point-click.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1766,7 +1766,7 @@ loft001 = loft([sketch001, sketch002])
sketch001 = startSketchOn(YZ)
profile001 = circle(sketch001, center = [0, 0], radius = 500)
sketch002 = startSketchOn(XZ)
|> startProfile(at = [0, 0])
profile002 = startProfile(sketch002, at = [0, 0])
|> xLine(length = -500)
|> tangentialArc(endAbsolute = [-2000, 500])`,
},
Expand All @@ -1782,7 +1782,7 @@ profile001 = startProfile(sketch001, at = [-400, -400])
|> line(endAbsolute = [profileStartX(%), profileStartY(%)])
|> close()
sketch002 = startSketchOn(XZ)
|> startProfile(at = [0, 0])
profile002 = startProfile(sketch002, at = [0, 0])
|> xLine(length = -500)
|> tangentialArc(endAbsolute = [-2000, 500])`,
},
Expand Down Expand Up @@ -1810,9 +1810,9 @@ sketch002 = startSketchOn(XZ)
testPoint.x - 50,
testPoint.y
)
const sweepDeclaration = 'sweep001 = sweep(profile001, path = sketch002)'
const sweepDeclaration = 'sweep001 = sweep(profile001, path = profile002)'
const editedSweepDeclaration =
'sweep001 = sweep(profile001, path = sketch002, sectional = true)'
'sweep001 = sweep(profile001, path = profile002, sectional = true)'

await test.step(`Look for sketch001`, async () => {
await toolbar.closePane('code')
Expand Down
8 changes: 2 additions & 6 deletions src/lang/modifyAst/addSweep.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,14 +136,10 @@ export function addSweep({
return sketchesExprList
}

// Extra roundabout to find the trajectory (or path) declaration for the labeled argument
const pathNodePath = getNodePathFromSourceRange(
ast,
path.graphSelections[0].codeRef.range
)
// Find the path declaration for the labeled argument
const pathDeclaration = getNodeFromPath<VariableDeclaration>(
ast,
pathNodePath,
path.graphSelections[0].codeRef.pathToNode,
Comment on lines -140 to +142
Copy link
Contributor Author

@pierremtb pierremtb May 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Irev-Dev @jtran I was playing with this as I remember you telling me to start trusting codeRef.pathToNode more. This change away from getNodePathFromSourceRange works perfectly for me when I'm creating a sweep, but not if I'm editing one. Just a data point, I can help investigate whenever

Related https://github.com/KittyCAD/modeling-app/pull/6737/files#r2077656349

'VariableDeclaration'
)
if (err(pathDeclaration)) {
Expand Down
Loading