Skip to content

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

@jallwine

Description

@jallwine

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.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions