-
Notifications
You must be signed in to change notification settings - Fork 299
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
Fix union with None #1560
Fix union with None #1560
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1560 +/- ##
=======================================
Coverage 94.54% 94.54%
=======================================
Files 28 28
Lines 5846 5848 +2
Branches 1165 1166 +1
=======================================
+ Hits 5527 5529 +2
Misses 193 193
Partials 126 126 ☔ View full report in Codecov by Sentry. |
Wow! Really grateful that this has finally been changed. I can't tell you how much boilerplate code I've written to handle the inevitable union to "None" scenario when making composite solids/geometries from iteration. |
Thanks @michaelgale ! Was there something stopping you from opening an issue or PR? Or did we miss it somehow? |
I am somewhat hesitant to suggest changes to a mature core API since these types of changes can have unpredictable consequences for other users. Since this issue didn't represent a bug or unexpected behaviour, I didn't think to ever raise a PR or issue. Since CQ is so easily extended with plugins, I tend to rely on this mechanism to introduce syntactic shortcuts and convenience functions to streamline my integrations with CQ. In future, I might lower my threshold for raising issues and/or contributing changes with a PR. Thanks again to the CQ team for maintaining this project. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey just one comment regarding boilerplate. This behavior results in additional parents which may be different than current boilerplate. As @michaelgale mentions iteration, I suppose it depends on size of the iteration or sparseness whether there is any significant noticeable impact.
import cadquery as cq
r0 = cq.Workplane().cylinder(1, 10)
for i in range(1, 101):
if i == 50:
obj = cq.Workplane().box(1, 1, 10)
else:
obj = None
r0 = r0.union(obj)
@lorenzncode I'm not sure that I understand. Currently union with |
Looks good, thanks @adam-urbanczyk |
@adam-urbanczyk Right, I'm only pointing out that skipping In #1536 , In the PR branch, calling The result at the end of the chain is the same in either case only that the length of the chain is different. |
That is the intention, |
That makes sense to me. +1 to merge. Thanks @adam-urbanczyk |
Closes #1536