Skip to content
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

Convert all stl_cmds to accept input from stdin and output to stdout #1

Open
jallwine opened this issue Nov 26, 2017 · 2 comments
Open

Comments

@jallwine
Copy link
Member

This is still very rough, but the idea is to make it easier to pipe STL data around to multiple commands. Some hypothetical examples:

# create a cube with a hole in it without any temporary files
stl_cube -w 10 | stl_cylinder -r 5 -h 10 | stl_boolean -d > cube_with_hole.stl

# get the bbox of all files in a directory
stl_cat *.stl | stl_bbox

# layout multiple models created with stl_cmds in a single STL file (using stl_transform exclusively to position more than two models would be cumbersome, so might need to add some basic transforms to the stl_cmds that create primitives)
stl_cube -w 10 | stl_transform -tx 11 | stl_cylinder -r 10 -h 10 | stl_transform -tz 5 | stl_merge > print_bed.stl

# put two STL files side by side in a single STL file (some hypothetical command line arguments used as well)
stl_transform -center -z0 file1.stl | stl_transform -center -z0 -tx w | stl_merge > print_bed.stl

stl_cmds that generate primitives or models of any kind would need to accept input from stdin and forward it on to stdout before adding its model data to the end of the stream. I think the stream would just be one STL file after another, so stl_cmds would use some shared interface to iterate over all STL files in the stream and perform their work on them. Some commands would just consume the input, like stl_bbox or stl_count. Others would combine multiple models through some kind of operation like stl_boolean and stl_merge. A new command stl_cat could be used to add STL files to the stream. stl_transform could perform a transformation on all files in the stream or if a filename is provided, add a single transformed model to the stream.

Again, this hasn't been thoroughly thought out, just a patchwork of ideas right now.

@jallwine jallwine self-assigned this Nov 26, 2017
@jallwine
Copy link
Member Author

The STL header could be used to tag files in the stream and filter them down the line. For example:

# create a cube, sphere and cylinder. Translate the sphere in x 10, and the cube in y 10, leaving the cylinder centered at the origin.
stl_cube -tag cube | stl_sphere -tag sphere | stl_cylinder -tag cylinder | stl_transform -select sphere -tx 10 | stl_transform -select cube -ty 10

@jallwine
Copy link
Member Author

jallwine commented Jan 2, 2018

Or, rather than adding -select to every command make any file input argument accept some kind of selector format:
@Index[integer index] | @select[tag] | @file[filename] | filename

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant