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

Face.makeFromWires - check that wires are closed #946

Merged
merged 1 commit into from
Jan 6, 2022

Conversation

lorenzncode
Copy link
Member

This is to resolve #944. The segfault occurs when the outer wire is open and inner wires exist.

An exception (for now?) to the closed wire check is the outer wire need not be closed if inner wires is empty. Existing tests rely on this (Wire.fillet2D, chamfer2D).

Example of an open outer wire that would still be allowed:

s = (
    cq.Sketch()
    .segment((0, 0), (0, 1.0))
    .segment((0, 1.0), (1.0, 1.0))
    .assemble()
)

r = cq.Workplane().placeSketch(s).extrude(0.1)

DXF import previously could result in the following when the inner wire was not closed:
gear

With the inner wire IsClosed() check, the DXF import results in ValueError with message:

  File "/home/lorenzn/devel/cadquery/cadquery/occ_impl/shapes.py", line 2280, in makeFromWires
    raise ValueError("Cannot build face(s): inner wire is not closed")
ValueError: Cannot build face(s): inner wire is not closed

@codecov
Copy link

codecov bot commented Jan 3, 2022

Codecov Report

Merging #946 (9097fe0) into master (9ef08d6) will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #946      +/-   ##
==========================================
+ Coverage   96.06%   96.07%   +0.01%     
==========================================
  Files          39       39              
  Lines        9207     9233      +26     
  Branches     1109     1111       +2     
==========================================
+ Hits         8845     8871      +26     
  Misses        209      209              
  Partials      153      153              
Impacted Files Coverage Δ
cadquery/occ_impl/shapes.py 92.54% <100.00%> (+0.02%) ⬆️
tests/test_cadquery.py 99.27% <100.00%> (+<0.01%) ⬆️
tests/test_importers.py 94.59% <100.00%> (ø)
tests/test_sketch.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9ef08d6...9097fe0. Read the comment docs.

@adam-urbanczyk adam-urbanczyk self-requested a review January 4, 2022 07:07
@adam-urbanczyk adam-urbanczyk self-requested a review January 6, 2022 07:08
Copy link
Member

@jmwright jmwright left a comment

Choose a reason for hiding this comment

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

Thanks @lorenzncode !

@jmwright jmwright merged commit 6c8502f into CadQuery:master Jan 6, 2022
@lorenzncode lorenzncode deleted the issue-944 branch January 8, 2022 20:01
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.

Segfault on Sketch.assemble with open wires
3 participants