Skip to content

PartDesign: Fix refine not working with Boolean operations#26745

Merged
kadet1090 merged 1 commit intoFreeCAD:mainfrom
tetektoza:fix/26740_fix_refine_not_working_with_subshapebinder_and_boolean
Jan 8, 2026
Merged

PartDesign: Fix refine not working with Boolean operations#26745
kadet1090 merged 1 commit intoFreeCAD:mainfrom
tetektoza:fix/26740_fix_refine_not_working_with_subshapebinder_and_boolean

Conversation

@tetektoza
Copy link
Member

@tetektoza tetektoza commented Jan 7, 2026

This reverts commit 527b2de.

The bakeInTransform() call uses transformGeometry() which converts planar faces to BSplineSurfaces. This prevents the refine algorithm (BRepBuilderAPI_RefineModel) from detecting and merging coplanar faces, breaking the Refine option for Boolean operations.

This matches Part WB's Boolean behavior which does not use bakeInTransform() and has working refine functionality.

Before:
image

After:
image

Resolves: #26740

@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 7, 2026
@maxwxyz maxwxyz added this to the 1.1 milestone Jan 7, 2026
@maxwxyz maxwxyz moved this from Queue to Merge Meeting in Merge Queue Jan 7, 2026
@Roy-043
Copy link
Contributor

Roy-043 commented Jan 7, 2026

The resultant shape should not have BSplineSurfaces. Please verify if that is the case.

@kadet1090
Copy link
Member

The bakeInTransform must be probably removed from there - it will fix the refine but anything after it will be broken as well. It is pretty stupid that it changes the underlying geometry to bspline, I expected it only to move points to new coordinate system and not change geometry types - well, I guess I was wrong.

This reverts commit 527b2de.

The `bakeInTransform()` call uses `transformGeometry()` which converts
planar faces to BSplineSurfaces. This prevents the refine algorithm
(BRepBuilderAPI_RefineModel) from detecting and merging coplanar faces,
breaking the Refine option for Boolean operations.

This matches Part WB's Boolean behavior which does not use
`bakeInTransform()` and has working refine functionality.
@tetektoza tetektoza force-pushed the fix/26740_fix_refine_not_working_with_subshapebinder_and_boolean branch from 144aa3e to a7ec783 Compare January 7, 2026 21:23
@tetektoza
Copy link
Member Author

tetektoza commented Jan 7, 2026

@Roy-043 good catch, I've verified and everything is BSplineSurface after that:

    >>> for i, face in enumerate(obj.Shape.Faces):
    ...     print(f"Face {i}: {type(face.Surface).__name__}")
    Face 0: BSplineSurface
    Face 1: BSplineSurface
    ...

As discussed with @kadet1090 I reverted that line and commit. Result is that we have normal surfaces:

>>> obj = FreeCAD.ActiveDocument.Boolean
>>> for i, face in enumerate(obj.Shape.Faces):
...     print(f"Face {i}: {type(face.Surface).__name__}")
... 
Face 0: Plane
Face 1: Cylinder
Face 2: Plane
Face 3: Plane
Face 4: Plane
Face 5: Plane
Face 6: Plane
Face 7: Plane

@kadet1090 kadet1090 enabled auto-merge (rebase) January 7, 2026 22:51
@kadet1090
Copy link
Member

Let's merge that and re-open #25578

@github-actions github-actions bot added the Mod: Part Design Related to the Part Design Workbench label Jan 8, 2026
@Roy-043
Copy link
Contributor

Roy-043 commented Jan 8, 2026

The other way to reset the placement is to put the shape in a compound.

@kadet1090
Copy link
Member

The other way to reset the placement is to put the shape in a compound.

IIRC the problem was because the object is in compound and then solids are extracted as subshapes from it loosing the transform (or regaining it?) in the process. I did output the transform for each internal shape and my conclusion was that one of them is simply not accounted for by boolean operation. I have not tried to put it in yet another compound thought, and I'll try to do that - so thanks for suggestion.

@kadet1090 kadet1090 merged commit 0baf444 into FreeCAD:main Jan 8, 2026
13 checks passed
@github-project-automation github-project-automation bot moved this from Merge Meeting to Done in Merge Queue Jan 8, 2026
@freecad-ci-runner
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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

PartDesign: refine not working when using SubShapeBinder and Boolean

5 participants