Fix sketchOnFace point&click for booleans#6713
Conversation
|
QA Wolf here! As you write new code it's important that your test coverage is keeping up. |
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
| type: 'Select default plane', | ||
| type: 'Select sketch plane', |
There was a problem hiding this comment.
This has been a bad name for a while, thought I should fix it up while I was in here.
| } | ||
|
|
||
| // Artifact is likely an extrusion face | ||
| // Artifact is likely an sweep face |
There was a problem hiding this comment.
Little bit of clean up, using the more generic term.
src/lang/modifyAst/boolean.ts
Outdated
| const pathToCompositeSolidMap: { [key: string]: string[] } = {} | ||
| for (const [id, artifact] of artifactGraph) { | ||
| if (artifact.type === 'compositeSolid') { | ||
| for (const pathId of artifact.solidIds) { | ||
| if (pathToCompositeSolidMap[pathId]) { | ||
| pathToCompositeSolidMap[pathId].push(id) | ||
| } else { | ||
| pathToCompositeSolidMap[pathId] = [id] | ||
| } | ||
| } | ||
| for (const pathId of artifact.toolIds) { | ||
| if (pathToCompositeSolidMap[pathId]) { | ||
| pathToCompositeSolidMap[pathId].push(id) | ||
| } else { | ||
| pathToCompositeSolidMap[pathId] = [id] | ||
| } | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
@jtran I wanted to ask you about this
I'm building up a little map to go from a pathId to compositeSolids if they exist, because the composite solids in the artifactGraph done have edges going both ways, so there's no way to go from a path to its compositeSolid
I did try adding the edge going the other way in https://github.com/KittyCAD/modeling-app/compare/kurt-composite-attempt?expand=1
But I danno it just didn't work and I couldn't figure out why, I thought maybe I screwed up the merge logic, but it looks okay to me?
But what do you think, solve this in rust, or just keep what I've got?
There was a problem hiding this comment.
When you say "it just didn't work", what symptoms are you actually seeing? The Mermaid chart generation wasn't updated, but when I did that, the charts show that the edges are bidirectional for the sim tests we have. But for some reason, edges in the graph are lost. Here's the diff of the intersect_cubes sim test. The path (3) correctly gains the edge to the composite (17), but it loses the edge to the solid2d (13). Same thing with the other path (4).
There was a problem hiding this comment.
Wait, I think I fixed it. The above diff made it obvious. I'll push to your branch.
There was a problem hiding this comment.
Pushed a few commits. This one is the fix: e23e6d2.
There was a problem hiding this comment.
Thank you!
Looking now.
There was a problem hiding this comment.
Oh, what a silly mistake :/
There was a problem hiding this comment.
Okay, I've removed my little mapping, just waiting for CI to be green.
pierremtb
left a comment
There was a problem hiding this comment.
Diff looks good and local testing went well!
There are still faces not available for sketching depending on the cut we make with CSG, and extrudes tend to get added weirdly up in the ast sometimes but that's out of scope here (and that could be addressed in #6437).
| async waitForFeatureTreeToBeBuilt() { | ||
| await this.openFeatureTreePane() | ||
| await expect(this.page.getByText('Building feature tree')).not.toBeVisible() | ||
| await this.closeFeatureTreePane() | ||
| } |
There was a problem hiding this comment.
Yeah seems like a good proxy for execution finished
| await expect | ||
| .poll(async () => { | ||
| const circleBtn = page.getByRole('button', { name: 'circle Circle' }) | ||
| return circleBtn.getAttribute('aria-pressed') | ||
| }) | ||
| .toBe('true') |
There was a problem hiding this comment.
Out of curiosity: is this meant to ensure we're ready to start sketching? As in, the highlight on the button is async after click, I guess as we "equip" the tool yes?
src/lang/modifyAst/boolean.ts
Outdated
| if (artifact.type === 'compositeSolid') { | ||
| for (const pathId of artifact.solidIds) { | ||
| if (pathToCompositeSolidMap[pathId]) { | ||
| pathToCompositeSolidMap[pathId].push(id) |
There was a problem hiding this comment.
Is it possible for a path to get used in multiple CSG ops? If so, composite_solid_id: Option<ArtifactId>, would need to get converted to composite_solid_ids: Vec<ArtifactId>,.
There was a problem hiding this comment.
yes, but not yet I don't think, it would be the keepTool situation.
* composite attempt * Add forward edge to CSG artifacts in artifact graph * Fix comment * Move the doc comments above the attributes * Fix to update the correct field of Path * Update output --------- Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
CodSpeed Instrumentation Performance ReportMerging #6713 will not alter performanceComparing Summary
|
The fix is changing this to adding the new expression instead of after the extrusion, instead at the end of the file, because the ME's wanted that anyway. And than some modifications to
findAllChildrenAndOrderByPlaceInCodeallows it to find the last declared variable so that it uses the solid001 etc for thestartSketchOn