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
PoC commit for discussion [filter/map/apply/sort/[]] #1514
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1514 +/- ##
==========================================
+ Coverage 94.48% 94.87% +0.39%
==========================================
Files 28 28
Lines 5780 6241 +461
Branches 1071 1264 +193
==========================================
+ Hits 5461 5921 +460
Misses 193 193
- Partials 126 127 +1 ☔ View full report in Codecov by Sentry. |
Thanks, it too me a while to get to this. I'll do some rework. I'd like to descope group for now, feels like too big of a change. |
I like the intent behind With |
|
Some time back I made cq-filter to allow easier manipulation of workplane objects without breaking out of the fluent API. @adam-urbanczyk requested in voneiden/cq-filter#1 to merge some features from cq-filter into cadquery, namely:
and optionally
First off, I've decided to rename
filter
tofilter_objects
andsort
tosort_objects
. I think the verbosity is warranted asWorkplane
is a fairly complex object.The cq-filter implementation of
group
created an intermediary workplane with extra fields to support slicing groups. I never particularly liked doing it this way, so I spent some time thinking how this could be done without the intermediary workplane. One option, used in this PR, is to create a separate Group object that supports slicing. This does require however the ability for theGroup
to iterate through candidate objects independently, so it can not be used withfilter_objects
as it allows the supplied filter function to operate only one oneCQObject
at a time.Therefore I needed to introduce another method, currently named as
map_objects
which hands over the workplane objects to the map function and expects a new list of objects to be returned.Group supports fixed window groups (xn - x0 <= tol) and moving window groups (xn - xn-1 <= tol)
Currently the PR is missing documentation and tests, but I'm opening this to allow discussion of implementation details. I'm flexible regarding the scope of this PR, if it feels like
Group
doesn't belong here then we'll drop it.I'm a bit low on free dev time for the time being so this might progress at a snails pace but we'll get there.