Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor Fillet Logic to Combine Multiple Tags Within the Same Fillet Expression #4058

Merged
merged 7 commits into from
Oct 3, 2024

Conversation

max-mrgrsk
Copy link
Collaborator

@max-mrgrsk max-mrgrsk commented Oct 1, 2024

this issue is part of Fillet project: #2606
continues AST mod: #3680
closes: #4039

PR Description:

Overview:

This PR refactors the modifyAstCloneWithFilletAndTag logic to consolidate multiple edge selections into a single fillet expression per extrusion, combining tags for all selected edges into one operation. The changes streamline the handling of multiple selections and remove redundant code that was previously designed for single selections.

Key Changes:

1. Two-Step Looping Logic:

  • First Loop: Iterates over all selected edges to:
    • Tag each segment.
    • Group the tags by their respective extrusion using an extrudeKey, ensuring that tags related to the same extrusion are grouped together.
  • Second Loop: Iterates over each extrusion and creates a single fillet expression that contains all the tags for the associated selected edges. This ensures that all relevant edges are filleted in one operation, reducing the need for multiple fillet expressions for the same extrusion.

2. Removal of addFillet Function:

The addFillet function, which was originally designed to handle single edge selections, became redundant after we refactored it's logic into modifyAstCloneWithFilletAndTag loops. With the refactor, addFillet is no longer needed and has been removed.

3. Test Suite Consolidation:

Previously, unit tests for single selections were separate from tests for multiple selections (which required mocking kclManager.executeAst({ ast }) due to the use of the artifact graph). This PR consolidates the test suite, combining single and multiple selection tests into the same framework.

Outstanding Issues (To Be Addressed in a Separate PR):

1. Support for Fillet in Sketch Pipes:

The current implementation does not handle cases where the extrude is part of the sketch pipe. This limitation will be addressed in a future update.

2. Handling Already-Filleted Edges:

If an edge that has already been filleted is selected again, the current logic does not remove or modify existing fillets. A future PR will address this by checking for existing fillets and removing the tags from previous fillets before applying new ones.

related comments:

Copy link

qa-wolf bot commented Oct 1, 2024

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!

@max-mrgrsk max-mrgrsk self-assigned this Oct 1, 2024
Copy link

vercel bot commented Oct 1, 2024

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

Name Status Preview Updated (UTC)
modeling-app ✅ Ready (Inspect) Visit Preview Oct 3, 2024 8:00am

@max-mrgrsk max-mrgrsk added refactor ast Issues / features relevant to ast and parser. desktop-app Issues from the desktop app. tests Pull requests that update or improve our test suite labels Oct 1, 2024
let pathToFilletNodes: Array<PathToNode> = []
// Step 1: modify ast with tags and group them by extrude nodes (bodies)
const extrudeToTagsMap: Map<PathToNode, string[]> = new Map()
const lookupMap: Map<string, PathToNode> = new Map() // work around for Map key comparison
Copy link
Collaborator

Choose a reason for hiding this comment

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

I found this a little confusing, but I get what's going on here.

Copy link
Collaborator

@Irev-Dev Irev-Dev left a comment

Choose a reason for hiding this comment

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

image

whoop!

@max-mrgrsk max-mrgrsk marked this pull request as ready for review October 2, 2024 10:16
@max-mrgrsk max-mrgrsk merged commit 46d335f into main Oct 3, 2024
24 checks passed
@max-mrgrsk max-mrgrsk deleted the 4039-group-all-fillet-tags branch October 3, 2024 09:14
@nadr0 nadr0 mentioned this pull request Oct 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ast Issues / features relevant to ast and parser. desktop-app Issues from the desktop app. refactor tests Pull requests that update or improve our test suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Group All Fillet Tags Under a Single Fillet Expression for Multiple Selections
2 participants