Skip to content

Wire.fillet with line+circle results in incorrect fillet direction #1852

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

Open
sAlexander opened this issue Jun 1, 2025 · 1 comment
Open

Comments

@sAlexander
Copy link

When adding a fillet to a (line + circle) connected edge, the fillet occasionally goes the wrong direction, resulting in a very awkward sharp angle.

The following code reproduces on cadquery-2.5.2 and cadquery-ocp-7.7.2:

def clearPendingWires(workplane):
    workplane.ctx.pendingWires = []
    return workplane

(
    cq.Workplane("XY")
    # Create the 2d shape.
    .lineTo(1, 0)
    .threePointArc((2, 0.75), (3.0, 0))
    .lineTo(4, 0)
    .lineTo(4, 2)
    .threePointArc((2, 3), (0, 2))
    .close()
    .export("before_fillet.dxf")
    .invoke(clearPendingWires)
    # Perform a 2d fillet. This is where the issue occurs.
    .map(lambda w: w.fillet(0.25))
    .export("after_fillet.dxf")
)

before_fillet.dxf:
Image

after_fillet.dxf:
Image

@lorenzncode
Copy link
Member

You might try Sketch as a workaround.

from cadquery import Sketch

sk1 = (
    Sketch()
    .segment((0, 0), (1, 0))
    .arc((2, 0.75), (3, 0))
    .segment((4, 0))
    .segment((4, 2))
    .arc((2, 3), (0, 2))
    .close()
    .assemble()
)

sk1 = sk1.vertices().fillet(0.25)

# if you want only the wire from the sketch:
sk1.reset()  # reset selection before selecting the wire
wire1 = sk1.wires().val()

or reusing the original Workplane code:

from cadquery import cq
from cadquery.func import face

wire1 = (
    cq.Workplane("XY")
    # Create the 2d shape.
    .lineTo(1, 0)
    .threePointArc((2, 0.75), (3.0, 0))
    .lineTo(4, 0)
    .lineTo(4, 2)
    .threePointArc((2, 3), (0, 2))
    .close()
    .consolidateWires()
    .val()
)

face1 = face(wire1)
face1 = face1.fillet2D(0.25, face1.vertices())

# to select the wire from the face
wire2 = face1.wires()

In both cases fillet applied to the face is working as expected.

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

No branches or pull requests

2 participants