apply parameter-less transforms directly#63
Closed
scifuentes wants to merge 1 commit intoSolidCode:masterfrom
Closed
apply parameter-less transforms directly#63scifuentes wants to merge 1 commit intoSolidCode:masterfrom
scifuentes wants to merge 1 commit intoSolidCode:masterfrom
Conversation
|
Something I was thinking: # python set operations
cube(1) | sphere(1) # union, `+` seems also make sense
cube(1) - sphere(1) # difference, already have this
cube(1) & sphere(1) # intersection, `*` doesn't make sense for this
cube(1).union(sphere(1))
cube(1).difference(sphere(1))
cube(1).intersection(sphere(1))
cube(1).translate(1,1,1)
cube(1).translate_x(-1)
cube(1).translate_y(2)
cube(1).scale(1.1, 0, 0)
cube(1).rotate(90, 0, 0)
cube(1).color('red')
cube(1).red()
cube(1).mirror([1,0,0])
cube(1).mirror_x(1)
# support chain operations
(cube(1) | sphere(1) & cylinder(2) - cube(2)).translate_z(2).rotate_z(90).red().mirror_y(1).render() |
|
I have a similar design implemented in solipython-elements repo, in case you need inspiration for the API. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Syntax sugar to allow the application of parameter-less transformations as functions i.o. objects.
Existing OpenScad-esque syntax not affected
e.g.: difference(cube(1), sphere(1)) vs difference()(cube(1). sphere(1))