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

Boolean operation syntactic sugar #569

Merged
merged 8 commits into from
Feb 12, 2021
Merged

Conversation

RubenRubens
Copy link
Contributor

No description provided.

@marcus7070
Copy link
Member

It might be worth mentioning in the docs that with r = a + b, r.parent == a and r has the same CQContext object as a.

Or perhaps just state r = a + b is equivalent to r = a.union(b).

@jmwright
Copy link
Member

jmwright commented Jan 8, 2021

@RubenRubens It looks like the lint check is failing.

@RubenRubens
Copy link
Contributor Author

I think it's OK now. Thanks for the helpful comments.

@codecov
Copy link

codecov bot commented Jan 8, 2021

Codecov Report

Merging #569 (79f4bb8) into master (f4b5e82) will decrease coverage by 0.31%.
The diff coverage is 90.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #569      +/-   ##
==========================================
- Coverage   94.26%   93.94%   -0.32%     
==========================================
  Files          29       31       +2     
  Lines        6348     6542     +194     
  Branches      675      712      +37     
==========================================
+ Hits         5984     6146     +162     
- Misses        226      258      +32     
  Partials      138      138              
Impacted Files Coverage Δ
cadquery/cq.py 89.66% <85.71%> (+<0.01%) ⬆️
tests/test_cadquery.py 99.09% <100.00%> (+0.05%) ⬆️
tests/test_assembly.py 100.00% <0.00%> (ø)
tests/test_exporters.py 100.00% <0.00%> (ø)
cadquery/occ_impl/shapes.py 91.92% <0.00%> (ø)
cadquery/occ_impl/exporters/__init__.py 93.06% <0.00%> (ø)
cadquery/cq_directive.py 30.95% <0.00%> (ø)
tests/test_examples.py 89.74% <0.00%> (ø)
... and 3 more

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 f4b5e82...79f4bb8. Read the comment docs.

@RubenRubens
Copy link
Contributor Author

RubenRubens commented Jan 13, 2021

There is a discussion in #568 about which operators we should include. Summing up, there are multiple options but... is this the way to go?

  • Union: |
  • Cut: -
  • Intersection &

I'm happy with it and hopefully @adam-urbanczyk would be too. 😄

@adam-urbanczyk
Copy link
Member

I think I'd still add + as an alternative to |. What do you think @jmwright ?

@jmwright
Copy link
Member

jmwright commented Feb 10, 2021

I think I'd still add + as an alternative to |.

+1 I think that's fine.

@marcus7070
Copy link
Member

Sphinx doesn't autosummary dunder methods (except __init__), so these new methods don't appear in the HTML docs at all. Relevant stackoverflow: https://stackoverflow.com/questions/62142793/autosummary-generated-documentation-missing-all-dunder-methods-except-for-ini

Looks easier to just write a section manually than to make sphinx autosummary do what we want.

Linking to #493.

@jmwright
Copy link
Member

There's also this that shows up just after the lint check.

$ mypy cadquery
cadquery/cq.py:3772: error: Unsupported left operand type for + ("Type[Workplane]")
Found 1 error in 1 file (checked 24 source files)
The command "mypy cadquery" exited with 1.

@adam-urbanczyk
Copy link
Member

Yes, MyPy does not like monkey patching. Will fix it.

@adam-urbanczyk
Copy link
Member

@jmwright looks ready to me. Codecov complains about a docstring line...

@jmwright
Copy link
Member

Ok, merging.

@jmwright jmwright merged commit 0d96f63 into CadQuery:master Feb 12, 2021
@RubenRubens RubenRubens deleted the boolean branch April 13, 2021 16:38
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.

4 participants