Fix Shell point-and-click picking the wrong face with piped extrudes (#4981)
* [BUG] Shell point and click references the wrong feature Fixes #4961 * Add test for sketch on face based on extrudes in pipe * Add no extrude in pipe case * Lint * Add scene.waitForExecutionDone() * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) * Trigger CI * A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores) * Trigger CI * Update src/lang/modifyAst/addShell.ts Co-authored-by: Frank Noirot <frank@zoo.dev> --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: Frank Noirot <frank@zoo.dev>
This commit is contained in:
@ -49,17 +49,27 @@ export function addShell({
|
||||
return new Error("Couldn't find extrude")
|
||||
}
|
||||
|
||||
pathToExtrudeNode = extrudeLookupResult.pathToExtrudeNode
|
||||
// Get the sketch ref from the selection
|
||||
// TODO: this assumes the segment is piped directly from the sketch, with no intermediate `VariableDeclarator` between.
|
||||
// We must find a technique for these situations that is robust to intermediate declarations
|
||||
const sketchNode = getNodeFromPath<VariableDeclarator>(
|
||||
const extrudeNode = getNodeFromPath<VariableDeclarator>(
|
||||
modifiedAst,
|
||||
graphSelection.codeRef.pathToNode,
|
||||
extrudeLookupResult.pathToExtrudeNode,
|
||||
'VariableDeclarator'
|
||||
)
|
||||
if (err(sketchNode)) {
|
||||
return sketchNode
|
||||
const segmentNode = getNodeFromPath<VariableDeclarator>(
|
||||
modifiedAst,
|
||||
extrudeLookupResult.pathToSegmentNode,
|
||||
'VariableDeclarator'
|
||||
)
|
||||
if (err(extrudeNode) || err(segmentNode)) {
|
||||
return new Error("Couldn't find extrude")
|
||||
}
|
||||
if (extrudeNode.node.init.type === 'CallExpression') {
|
||||
pathToExtrudeNode = extrudeLookupResult.pathToExtrudeNode
|
||||
} else if (segmentNode.node.init.type === 'PipeExpression') {
|
||||
pathToExtrudeNode = extrudeLookupResult.pathToSegmentNode
|
||||
} else {
|
||||
return new Error("Couldn't find extrude")
|
||||
}
|
||||
|
||||
const selectedArtifact = graphSelection.artifact
|
||||
|
Reference in New Issue
Block a user