Skip to content

Raise in free fillet and chamfer when the operation fails - #2132

Open
RClaudiuM wants to merge 1 commit into
CadQuery:masterfrom
RClaudiuM:fix/2114-fillet-chamfer-not-done
Open

RClaudiuM wants to merge 1 commit into
CadQuery:masterfrom
RClaudiuM:fix/2114-fillet-chamfer-not-done

Conversation

@RClaudiuM

Copy link
Copy Markdown

cadquery.func.fillet and cadquery.func.chamfer call builder.Shape() even when builder.Build() failed. Shape() then builds again, and that second build of BRepFilletAPI_MakeFillet / BRepFilletAPI_MakeChamfer segfaults inside OCCT, so a fillet that is too large kills the process instead of raising.

This checks IsDone() right after Build() and raises ValueError, the same guard #2106 added for makeNSidedSurface. The check runs before _update_history, so a failed operation is not recorded in the history. The docstrings now list the ValueError.

Fixes #2114

Test

test_fillet_chamfer_failure in tests/test_free_functions.py fillets and chamfers every edge of a unit box by 0.5, which cannot be built, and expects ValueError.

pytest "tests/test_free_functions.py::test_fillet_chamfer_failure"
  • Before: Fatal Python error: Segmentation fault (exit 139) for both fillet and chamfer
  • After: 2 passed; tests/test_free_functions.py 74 passed

black --check (CadQuery fork) is clean. mypy cadquery reports the same errors before and after this change (missing OCP stubs in a pip install). On a pip install on macOS arm64, the full suite gives the same results as master: test_interpPlate also fails on master there, and test_examples / test_jupyter need docutils and IPython.

cadquery.func.fillet and cadquery.func.chamfer called Shape() on the
builder even when Build() had failed. Shape() then builds again, and the
second build of BRepFilletAPI_MakeFillet / MakeChamfer segfaults inside
OCCT. Check IsDone() right after Build() and raise ValueError instead.

Fixes CadQuery#2114
@codecov

codecov Bot commented Nov 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.81%. Comparing base (477d87d) to head (a72ca6f).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #2132   +/-   ##
=======================================
  Coverage   95.81%   95.81%           
=======================================
  Files          30       30           
  Lines        9605     9609    +4     
  Branches     1443     1445    +2     
=======================================
+ Hits         9203     9207    +4     
  Misses        247      247           
  Partials      155      155           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

This branch has not been deployed

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

func.fillet / func.chamfer segfault instead of raising when the operation fails

1 participant