Simplify gradual infill steps maximum formula

The case where it reaches '20' is incorrect, it should never give an error, so it should've been 999999 or something. This case is also overly complex.
Say that P is 'infill_line_distance > 0' and Q is 'spaghetti_enabled'...
Then it would be the logarithmic if (P and not Q)...
Then it would be 0 or 20 if (not (P and not Q)), which is ((not P) or Q)...
Then it would be 20 if (((not P) or Q) and not Q), which is (not P)...
And it would be 0 if (((not P) or Q) and Q), which is Q.

So therefore it can be simplified to: 20 if (not P) else 0 if Q else logarithmic. But 20 became 999999, hence the above formula.

Contributes to issue CURA-3700.
This commit is contained in:
Ghostkeeper 2017-04-19 16:24:39 +02:00
parent 50a99eb2b1
commit 16bc9db06d
No known key found for this signature in database
GPG key ID: C5F96EE2BC0F7E75

View file

@ -1301,7 +1301,7 @@
"type": "int",
"minimum_value": "0",
"maximum_value_warning": "4",
"maximum_value": "(20 - math.log(infill_line_distance) / math.log(2)) if infill_line_distance > 0 and not spaghetti_infill_enabled else (0 if spaghetti_infill_enabled else 20)",
"maximum_value": "0 if spaghetti_infill_enabled else (999999 if infill_line_distance == 0 else (20 - math.log(infill_line_distance) / math.log(2)))",
"enabled": "infill_sparse_density > 0 and infill_pattern != 'cubicsubdiv' and not spaghetti_infill_enabled",
"settable_per_mesh": true
},