Skip to content

Comments

Fix sketchOnFace point&click for booleans#6713

Merged
Irev-Dev merged 10 commits intomainfrom
kurt-bool-sketchonface-6307
May 6, 2025
Merged

Fix sketchOnFace point&click for booleans#6713
Irev-Dev merged 10 commits intomainfrom
kurt-bool-sketchonface-6307

Conversation

@Irev-Dev
Copy link
Contributor

@Irev-Dev Irev-Dev commented May 6, 2025

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 findAllChildrenAndOrderByPlaceInCode allows it to find the last declared variable so that it uses the solid001 etc for the startSketchOn

  • Fix bug
  • Add test

@qa-wolf
Copy link

qa-wolf bot commented May 6, 2025

QA Wolf here! As you write new code it's important that your test coverage is keeping up.
Click here to request test coverage for this PR!

@vercel
Copy link

vercel bot commented May 6, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
modeling-app ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 6, 2025 9:58pm

@Irev-Dev Irev-Dev changed the title fix bool sketchOnFace Fix sketchOnFace point&click for booleans May 6, 2025
Comment on lines -149 to +150
type: 'Select default plane',
type: 'Select sketch plane',
Copy link
Contributor Author

Choose a reason for hiding this comment

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

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
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Little bit of clean up, using the more generic term.

@Irev-Dev Irev-Dev marked this pull request as ready for review May 6, 2025 10:10
@Irev-Dev Irev-Dev requested a review from a team May 6, 2025 10:10
Comment on lines 170 to 188
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]
}
}
}
}
Copy link
Contributor Author

@Irev-Dev Irev-Dev May 6, 2025

Choose a reason for hiding this comment

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

@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?

Copy link
Contributor

Choose a reason for hiding this comment

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

I'll wait for @jtran's input before merging

Copy link
Contributor

Choose a reason for hiding this comment

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

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).

Screenshot 2025-05-06 at 11 31 01 AM

Copy link
Contributor

Choose a reason for hiding this comment

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

Wait, I think I fixed it. The above diff made it obvious. I'll push to your branch.

Copy link
Contributor

Choose a reason for hiding this comment

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

Pushed a few commits. This one is the fix: e23e6d2.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you!

Looking now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, what a silly mistake :/

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay, I've removed my little mapping, just waiting for CI to be green.

Copy link
Contributor

@pierremtb pierremtb left a comment

Choose a reason for hiding this comment

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

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).

Comment on lines +245 to +249
async waitForFeatureTreeToBeBuilt() {
await this.openFeatureTreePane()
await expect(this.page.getByText('Building feature tree')).not.toBeVisible()
await this.closeFeatureTreePane()
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Oh this looks handy

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah seems like a good proxy for execution finished

Comment on lines +1331 to +1336
await expect
.poll(async () => {
const circleBtn = page.getByRole('button', { name: 'circle Circle' })
return circleBtn.getAttribute('aria-pressed')
})
.toBe('true')
Copy link
Contributor

Choose a reason for hiding this comment

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

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes.

if (artifact.type === 'compositeSolid') {
for (const pathId of artifact.solidIds) {
if (pathToCompositeSolidMap[pathId]) {
pathToCompositeSolidMap[pathId].push(id)
Copy link
Contributor

Choose a reason for hiding this comment

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

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>,.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, but not yet I don't think, it would be the keepTool situation.

Irev-Dev and others added 3 commits May 7, 2025 05:45
* 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-hq
Copy link

codspeed-hq bot commented May 6, 2025

CodSpeed Instrumentation Performance Report

Merging #6713 will not alter performance

Comparing kurt-bool-sketchonface-6307 (1ff012f) with main (1841e63)

Summary

✅ 54 untouched benchmarks

@Irev-Dev Irev-Dev merged commit d187a29 into main May 6, 2025
68 checks passed
@Irev-Dev Irev-Dev deleted the kurt-bool-sketchonface-6307 branch May 6, 2025 22:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants