Skip to content

Part: Fix Part_Extrude taper angle regression for internal faces#26781

Merged
chennes merged 4 commits intoFreeCAD:mainfrom
tetektoza:fix/26772_part_extrude_taper_angle_regression
Jan 13, 2026
Merged

Part: Fix Part_Extrude taper angle regression for internal faces#26781
chennes merged 4 commits intoFreeCAD:mainfrom
tetektoza:fix/26772_part_extrude_taper_angle_regression

Conversation

@tetektoza
Copy link
Member

The taper angle for holes (inner wires) in Part_Extrude was not being negated after the toponaming refactor, causing internal faces to taper in the wrong direction compared to v0.21.2.

The original makeDraft function correctly handled inner wires by:

  • Negating taper for all inner wires in Part_Extrude
  • Negating taper only for multi-edge inner wires in PartDesign
    This logic was controlled via an isPartDesign function parameter.

When makeElementDraft was introduced for toponaming support, it was designed to use innerTaperAngleFwd/innerTaperAngleRev fields that were never ported from realthunder's branch. The cleanup (commits 4697de1 + c31ebee) removed references to these non-existent fields, leaving makeElementDraft with no inner wire taper handling at all.

So, this fix ports the makeDraft inner wire logic to makeElementDraft by adding the flag, and counting wires and then triggering proper angle flip depending on the flag/wire situation.

Note: I'm not even sure why we skip the angle flip for circles in PartDesign, although that seems to match 0.21.2 behavior which is apparently correct.

Before:

image

After:

image

Resolves: #26772

The taper angle for holes (inner wires) in `Part_Extrude` was not being
negated after the toponaming refactor, causing internal faces to taper
in the wrong direction compared to v0.21.2.

The original makeDraft function correctly handled inner wires by:
- Negating taper for all inner wires in Part_Extrude
- Negating taper only for multi-edge inner wires in PartDesign
This logic was controlled via an isPartDesign function parameter.

When makeElementDraft was introduced for toponaming support, it was
designed to use innerTaperAngleFwd/innerTaperAngleRev fields that were
never ported from realthunder's branch. The cleanup (commit c31ebee)
removed references to these non-existent fields, leaving makeElementDraft
with no inner wire taper handling at all.

So, this fix ports the makeDraft inner wire logic to makeElementDraft by
adding the flag, and counting wires and then triggering proper angle
flip depending on the flag/wire situation.
@github-actions github-actions bot added Mod: Part Design Related to the Part Design Workbench Mod: Part Related to the Part Workbench labels Jan 9, 2026
@maxwxyz maxwxyz requested a review from drwho495 January 9, 2026 07:35
@maxwxyz maxwxyz moved this from Queue to Merge Meeting in Merge Queue Jan 9, 2026
@maxwxyz maxwxyz added Type: Bug This issue or PR is related to a bug backport releases/FreeCAD-1-1 Applied to a PR that is on main to trigger the automatic creation of another PR onto 1.1 labels Jan 9, 2026
@maxwxyz maxwxyz added this to the 1.1 milestone Jan 9, 2026
@Roy-043
Copy link
Contributor

Roy-043 commented Jan 9, 2026

Thanks for working on this.

I am missing some version related code.
You have fixed the problem for v0.21.2->v1.1.
But there is then a problem for v1.0->v1.1.

double taperAngleFwd {0}; // in radians
double taperAngleRev {0};
std::string faceMakerClass;
bool isPartDesign {false}; // affects inner wire taper handling for single-edge circles
Copy link
Member

@kadet1090 kadet1090 Jan 8, 2026

Choose a reason for hiding this comment

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

We should not make booleans like "isPartDesign" - "PartDesign" does not exists as a conecept in the domain of "Extrusion Paremeters". Instead we need to find the concept that part design does, name it and use here.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done, changed to an enum, I can't find anything that I could tightly couple that with PartDesign, so I just went with that. I guess the enum can be reused with the new property (not the hidden one for compat) later on as well.

Comment on lines 618 to 636
// process each inner wire individually to check edge count
// Inner wires (holes) need negated taper angles
for (auto& innerWire : wires) {
ExtrusionParameters innerParams = params;

// count edges and if it's a circle and partDesign object, then don't flip the angle
int numEdges = 0;
TopExp_Explorer xp(innerWire.getShape(), TopAbs_EDGE);
while (xp.More()) {
numEdges++;
xp.Next();
}

if (numEdges > 1 || !params.isPartDesign) {
innerParams.taperAngleFwd = -params.taperAngleFwd;
innerParams.taperAngleRev = -params.taperAngleRev;
}
makeElementDraft(innerParams, innerWire, inner, hasher);
}
Copy link
Member

Choose a reason for hiding this comment

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

As @Roy-043 noted it will fix regression for 0.21 but will introduce one for 1.0. We need compatibility measures here - basically if choosing the method based on the property. For now we can create it as hidden, compatibility one but maybe it is worth to expose it to users?

I did something like that here: #26141. As for the default value - @Roy-043 which behavior makes more sense? The one in 1.0 or 0.21?

Copy link
Collaborator

@maxwxyz maxwxyz Jan 10, 2026

Choose a reason for hiding this comment

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

Just for consistency the 1.0 behavior seems OK - why should the angle be changed between using Part WB or PD WB to extrude a profile?

Copy link
Member

Choose a reason for hiding this comment

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

Looking at the picture the "fixed" version has a draft angle that allows you to safely pull the feature upwards (because faces are slanted correctly) while the 1.0 is not achieving that goal. From design perspective if you need draft you probably need it because of it's self-releasing ability from molds etc so that seems to make more sense.

I agree however that Part and Part Design should have consistent behavior. At this point it seems that we simply should have property for it (Inner Faces Draft Orientation? Maybe something like that) which will be supported both by Part and Part Design.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done, added hidden compat property for compatibility.

@github-project-automation github-project-automation bot moved this from Merge Meeting to Queue in Merge Queue Jan 9, 2026
@maxwxyz maxwxyz moved this from Queue to Merge Meeting in Merge Queue Jan 9, 2026
@chennes chennes requested a review from kadet1090 January 11, 2026 21:41
@kadet1090 kadet1090 added Requires: Testing The PR needs testing by users and developers Approved: Code Quality The PR was checked for code quality and approved labels Jan 11, 2026
for (auto& innerWire : wires) {
ExtrusionParameters innerParams = params;

// count edges and if it's a circle and partDesign object, then don't flip the angle
Copy link
Member

Choose a reason for hiding this comment

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

Is this comment still accurate?

@maxwxyz maxwxyz moved this from Merge Meeting to Approved in Merge Queue Jan 12, 2026
@chennes chennes self-assigned this Jan 12, 2026
@chennes chennes enabled auto-merge (squash) January 13, 2026 03:09
@chennes chennes merged commit bb48de8 into FreeCAD:main Jan 13, 2026
12 checks passed
@github-project-automation github-project-automation bot moved this from Approved to Done in Merge Queue Jan 13, 2026
freecad-ci-runner pushed a commit that referenced this pull request Jan 13, 2026
)

* Part: Fix Part_Extrude taper angle regression for internal faces

The taper angle for holes (inner wires) in `Part_Extrude` was not being
negated after the toponaming refactor, causing internal faces to taper
in the wrong direction compared to v0.21.2.

The original makeDraft function correctly handled inner wires by:
- Negating taper for all inner wires in Part_Extrude
- Negating taper only for multi-edge inner wires in PartDesign
This logic was controlled via an isPartDesign function parameter.

When makeElementDraft was introduced for toponaming support, it was
designed to use innerTaperAngleFwd/innerTaperAngleRev fields that were
never ported from realthunder's branch. The cleanup (commit c31ebee)
removed references to these non-existent fields, leaving makeElementDraft
with no inner wire taper handling at all.

So, this fix ports the makeDraft inner wire logic to makeElementDraft by
adding the flag, and counting wires and then triggering proper angle
flip depending on the flag/wire situation.

---------

Co-authored-by: Chris Hennes <[email protected]>
(cherry picked from commit bb48de8)
@freecad-ci-runner
Copy link
Collaborator

Successfully created backport PR for releases/FreeCAD-1-1:

maxwxyz pushed a commit that referenced this pull request Jan 13, 2026
)

* Part: Fix Part_Extrude taper angle regression for internal faces

The taper angle for holes (inner wires) in `Part_Extrude` was not being
negated after the toponaming refactor, causing internal faces to taper
in the wrong direction compared to v0.21.2.

The original makeDraft function correctly handled inner wires by:
- Negating taper for all inner wires in Part_Extrude
- Negating taper only for multi-edge inner wires in PartDesign
This logic was controlled via an isPartDesign function parameter.

When makeElementDraft was introduced for toponaming support, it was
designed to use innerTaperAngleFwd/innerTaperAngleRev fields that were
never ported from realthunder's branch. The cleanup (commit c31ebee)
removed references to these non-existent fields, leaving makeElementDraft
with no inner wire taper handling at all.

So, this fix ports the makeDraft inner wire logic to makeElementDraft by
adding the flag, and counting wires and then triggering proper angle
flip depending on the flag/wire situation.

---------

Co-authored-by: Chris Hennes <[email protected]>
(cherry picked from commit bb48de8)
@kadet1090 kadet1090 added Approved: Tested The PR was manually tested and approved and removed Requires: Testing The PR needs testing by users and developers labels Jan 14, 2026
tritao pushed a commit to tritao/FreeCAD that referenced this pull request Jan 17, 2026
…eCAD#26781)

* Part: Fix Part_Extrude taper angle regression for internal faces

The taper angle for holes (inner wires) in `Part_Extrude` was not being
negated after the toponaming refactor, causing internal faces to taper
in the wrong direction compared to v0.21.2.

The original makeDraft function correctly handled inner wires by:
- Negating taper for all inner wires in Part_Extrude
- Negating taper only for multi-edge inner wires in PartDesign
This logic was controlled via an isPartDesign function parameter.

When makeElementDraft was introduced for toponaming support, it was
designed to use innerTaperAngleFwd/innerTaperAngleRev fields that were
never ported from realthunder's branch. The cleanup (commit c31ebee)
removed references to these non-existent fields, leaving makeElementDraft
with no inner wire taper handling at all.

So, this fix ports the makeDraft inner wire logic to makeElementDraft by
adding the flag, and counting wires and then triggering proper angle
flip depending on the flag/wire situation.

---------

Co-authored-by: Chris Hennes <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Approved: Code Quality The PR was checked for code quality and approved Approved: Tested The PR was manually tested and approved backport releases/FreeCAD-1-1 Applied to a PR that is on main to trigger the automatic creation of another PR onto 1.1 Mod: Part Design Related to the Part Design Workbench Mod: Part Related to the Part Workbench Type: Bug This issue or PR is related to a bug

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Part: v0.21.2 -> v1.0 regression: Part_Extrude taper angle of internal faces reversed

6 participants