Skip to content

fix unconstrained assembly.solve() - #592

Merged
jmwright merged 4 commits into
CadQuery:masterfrom
greyltc:fix-empty-solve
Jan 21, 2021
Merged

fix unconstrained assembly.solve()#592
jmwright merged 4 commits into
CadQuery:masterfrom
greyltc:fix-empty-solve

Conversation

@greyltc

@greyltc greyltc commented Jan 18, 2021

Copy link
Copy Markdown
Contributor

Fixes #591

Comment thread cadquery/assembly.py Outdated
@codecov

codecov Bot commented Jan 19, 2021

Copy link
Copy Markdown

Codecov Report

Merging #592 (48d7800) into master (4c77c87) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #592   +/-   ##
=======================================
  Coverage   94.26%   94.27%           
=======================================
  Files          29       29           
  Lines        6348     6353    +5     
  Branches      675      676    +1     
=======================================
+ Hits         5984     5989    +5     
  Misses        226      226           
  Partials      138      138           
Impacted Files Coverage Δ
cadquery/assembly.py 90.54% <100.00%> (+0.09%) ⬆️
tests/test_assembly.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 4c77c87...48d7800. Read the comment docs.

@adam-urbanczyk

Copy link
Copy Markdown
Member

I reworked to raise a ValueError with a clear message. Anything against @greyltc ?

@greyltc

greyltc commented Jan 19, 2021

Copy link
Copy Markdown
Contributor Author

Yeah, it's very likely the user has made a mistake if they call solve() without setting up constraints.

I can imagine a case where it might be convenient for solve() to be a noop (or just throw a warning), like if you're troubleshooting constraints and you've commented them all out or something.

I'm fine with leaving it as an error though.

@adam-urbanczyk

Copy link
Copy Markdown
Member

I'm on the being explicit side on that one - solve only makes sense with constraints.

@adam-urbanczyk

Copy link
Copy Markdown
Member

Are you fine with merging @jmwright ?

@jmwright

Copy link
Copy Markdown
Member

+1

@jmwright
jmwright merged commit c0ebeba into CadQuery:master Jan 21, 2021
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.

crash calling .solve() on an assembly with no constraints

4 participants