Skip to content

More free functions#2038

Open
adam-urbanczyk wants to merge 51 commits into
masterfrom
adam-shapes-parity
Open

More free functions#2038
adam-urbanczyk wants to merge 51 commits into
masterfrom
adam-shapes-parity

Conversation

@adam-urbanczyk

@adam-urbanczyk adam-urbanczyk commented May 22, 2026

Copy link
Copy Markdown
Member

This PR should reach (rough) feature parity with Shape.* Closes #1812

  • prism
  • hollow
  • offset2D
  • fillet2D
  • draft
  • set ops for combining selectors

This enables e.g.
selection = f.outerWire() & f.edges('|X')

  • history

Big experimental change. Added a History and Op class. History instance can be passed now to many ops via history= kwarg. Name for the operation can be specified via name=. It can be later queried like so:

h = History()

f = plane(1,1)
res = extrude(f, (0,0,1), history=h, name='ex')

top = h['ex'].last()
side = h[-1].generated(f.edges())
  • tests
  • docs

@adam-urbanczyk adam-urbanczyk marked this pull request as draft May 22, 2026 17:42
@codecov

codecov Bot commented May 22, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 97.46835% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 95.66%. Comparing base (8c17892) to head (d724fc6).

Files with missing lines Patch % Lines
cadquery/occ_impl/shapes.py 97.43% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2038      +/-   ##
==========================================
+ Coverage   95.64%   95.66%   +0.01%     
==========================================
  Files          30       30              
  Lines        8962     9040      +78     
  Branches     1328     1344      +16     
==========================================
+ Hits         8572     8648      +76     
- Misses        240      241       +1     
- Partials      150      151       +1     

☔ View full report in Codecov by Sentry.
📢 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.

@codecov

codecov Bot commented May 23, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.23009% with 8 lines in your changes missing coverage. Please review.
✅ Project coverage is 95.75%. Comparing base (8c17892) to head (8f54845).
⚠️ Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
cadquery/occ_impl/shapes.py 98.21% 2 Missing and 6 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2038      +/-   ##
==========================================
+ Coverage   95.64%   95.75%   +0.10%     
==========================================
  Files          30       30              
  Lines        8962     9356     +394     
  Branches     1328     1391      +63     
==========================================
+ Hits         8572     8959     +387     
- Misses        240      242       +2     
- Partials      150      155       +5     

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

@jmwright jmwright mentioned this pull request Jun 5, 2026
4 tasks
@adam-urbanczyk adam-urbanczyk requested a review from jmwright June 14, 2026 17:16
@adam-urbanczyk

Copy link
Copy Markdown
Member Author

@jmwright @lorenzncode could you do a second pass and take a look at the docs? Summary of changes:

  • Added history and set operators + example
  • Slight rephrasing regarding free function API/removal of "Direct API"
  • Added quickstart example rewritten using free func
  • Mentioned fig.show

@lorenzncode lorenzncode left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This looks good. I've added only a few doc items.

Comment thread doc/vis.rst
Non-blocking visualization
==========================

For non-blocking visualization, one can use the :meth:`~cadquery.fig.show` function. It relies on VTK/Trame and opens a web browser window.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This renders only as show in the sphinx output so it isn't obvious that it's different than the previous section on vis.show. Suggest to mention Figure.

Comment thread doc/vis.rst
Comment thread doc/primer.rst Outdated
Comment thread doc/primer.rst Outdated
Comment thread doc/primer.rst Outdated
Comment thread doc/quickstart.rst Outdated
Comment thread cadquery/occ_impl/shapes.py
Comment thread cadquery/func.py Outdated
Comment thread cadquery/func.py Outdated
Comment thread cadquery/occ_impl/shapes.py Outdated
@jmwright

Copy link
Copy Markdown
Member

@adam-urbanczyk Are the 2D operations ever going to get the history feature?

Comment thread doc/primer.rst
Comment thread cadquery/occ_impl/shapes.py Outdated
Comment thread cadquery/occ_impl/shapes.py
Comment thread cadquery/occ_impl/shapes.py Outdated
Comment thread cadquery/occ_impl/shapes.py Outdated
Comment thread cadquery/occ_impl/shapes.py Outdated
Comment thread cadquery/func.py Outdated
Comment thread cadquery/func.py Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature parity with cq.Shape methods

3 participants