Skip to content

Fix sketch on face with a hole in it#8992

Merged
pierremtb merged 1 commit intomainfrom
pierremtb/issue8851-Can-not-sketch-on-face-with-a-hole-in-it
Nov 21, 2025
Merged

Fix sketch on face with a hole in it#8992
pierremtb merged 1 commit intomainfrom
pierremtb/issue8851-Can-not-sketch-on-face-with-a-hole-in-it

Conversation

@pierremtb
Copy link
Contributor

@pierremtb pierremtb commented Nov 20, 2025

Fixes #8851

Changes

While adding debugging statements and figuring out where the issue was, I noticed that this part of selectionBodyFace to recover ExtrudePlaneFace wasn't properly returning the last item, in our case here hole001.

const lastChild =
findAllChildrenAndOrderByPlaceInCode(
{ type: 'sweep', ...extrusion },
kclManager.artifactGraph
)[0] || null
const lastChildCodeRef: PathToNode | null =
lastChild?.type === 'compositeSolid' ? lastChild.codeRef.pathToNode : null
const extrudePathToNode = !err(extrusion)
? lastChildCodeRef || extrusion.codeRef.pathToNode
: []

Other places in the codebase use getLastVariable instead of direct indexing after calls to findAllChildrenAndOrderByPlaceInCode, so I did that and it seems to fix the issue for me!

Demo

Screen.Recording.2025-11-20.at.10.06.41.AM.mov

@vercel
Copy link

vercel bot commented Nov 20, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
modeling-app Ready Ready Preview Comment Nov 20, 2025 2:05pm

Copy link
Contributor

@max-mrgrsk max-mrgrsk left a comment

Choose a reason for hiding this comment

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

Wow, that was fast, thank you! Works locally like magic. I’ve left 2 comments just to know your opinion on these things, happy to approve otherwise.

Image

const extrudePathToNode =
lastChildVariable && !err(lastChildVariable)
? lastChildVariable.pathToNode
: []
Copy link
Contributor

Choose a reason for hiding this comment

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

can this fallback cause a silent fail?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe? I didn't touch that cause this is how it was :/

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good to wait for @Irev-Dev to chime in

const children = findAllChildrenAndOrderByPlaceInCode(
{ type: 'sweep', ...extrusion },
kclManager.artifactGraph
)
Copy link
Contributor

Choose a reason for hiding this comment

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

do we need a little comment here to explain why do we need to compute children twice?

// necessary for faces with holes ( multiple children exist )

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What do you mean twice? We were doing that already? getLastVariable is taking as input the result from findAllChildrenAndOrderByPlaceInCode, as introduced by @Irev-Dev in https://github.com/KittyCAD/modeling-app/pull/5906/files#diff-0498f1baa97e5510a829a42a13959af07e67dc56384e46cd7c2a89b553516b08R165

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, I was thinking I wouldn’t guess why we’re using getLastVariable without the issue’s context. Not a blocker - just chatting.

@pierremtb pierremtb enabled auto-merge (squash) November 21, 2025 16:32
@max-mrgrsk max-mrgrsk self-requested a review November 21, 2025 16:33
@pierremtb pierremtb merged commit 8af5bc4 into main Nov 21, 2025
57 checks passed
@pierremtb pierremtb deleted the pierremtb/issue8851-Can-not-sketch-on-face-with-a-hole-in-it branch November 21, 2025 16:33
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.

Can not sketch on face with a hole in it

2 participants