Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
changes to allow functional programming style.
example:
To make this possible, each modifying method has to return a modified copy of itself.
This way an transformation doesn't change the receiving object and returns the transformed copy of the object instead. Otherwise variables would be changed by transformations.
As an alternative you could also use functions instead of variables to define a part, but the variables look more natural to me.
This style would look like this:
rod = lambda: Cylinder(r=r, h=l)
ball = lambda: Sphere(r=br)
...
Instead I would like to reserve functions for combined operations or complex or parametric constructions.
Additionally I added unary operators for 'disable' = '-' = '*', 'background' = '+' = '%' and 'debug' = '~' = '#'.
Unfortunately there are only three (single character) unary operators in python, while openscad having four modifiers, so 'root' has no corresponding unary operator, but I think it's already cleaner to use variables for this.
Btw. for functional style it would be more convenient to use methods instead of assignments (e.g. obj.debug() instead of obj.debug = True, however everyone will use the unary operators, anyway.