Convert to library; add Makefile, images

hexbrick-preview.png is a generated file, but for technical reasons it
must be committed to git to be shown on the github website.
This commit is contained in:
Jeff Epler 2017-03-31 14:22:56 -05:00
parent 48b9537b65
commit 1369d1d9a5
6 changed files with 60 additions and 28 deletions

4
.gitignore vendored Normal file
View file

@ -0,0 +1,4 @@
hexbrick-demo.scad
*.stl
*.png
!hexbrick-preview.png

24
Makefile Normal file
View file

@ -0,0 +1,24 @@
default: hexbrick-demo.scad hexbrick-demo.stl hexbrick-demo.png hexbrick-preview.png
hexbrick-demo.scad: hexbrick-lib.scad demo.scad
cat $^ > $@
%.stl: %.scad
openscad -o $@ $^
XVFB_RUN := xvfb-run -s "-screen 0 1024x768x24"
%.png: %.scad
$(XVFB_RUN) openscad --camera=15,20,0,30,0,25,120 --autocenter --imgsize 7680,5120 -o $*_4x.png $^
convert -geometry 25% $*_4x.png $@
rm -f $*_4x.png
hexbrick-preview.png: hexbrick-demo.png
convert -geometry 50% $< $@
.PHONY: clean
clean:
rm -f hexbrick-demo.scad hexbrick-demo.stl hexbrick-demo.png
.DELETE_ON_ERROR:

3
README.md Normal file
View file

@ -0,0 +1,3 @@
# Interlocking Hexagonal Toy Bricks
![Hex Bricks rendered by openscad](hexbrick-preview.png "The plated sample bricks")

29
demo.scad Normal file
View file

@ -0,0 +1,29 @@
// A-1
hexgrid(-1,3)
piece_coordlist([[[0,0]]]);
piece_coordlist([
[[0,1]], [[2,0]]
]);
// A-3.1
hexgrid(1,3)
piece_coordlist([
[[0,2]], [[2,1]], [[4,0]]
]);
// A-3.2
hexgrid(4,0)
piece_coordlist([
[[0,2]], [[2,1]], [[3,2]]
]);
// A-3.3
hexgrid(1,1)
piece_coordlist([
[[0,1]], [[2,0]], [[1,2]]
]);
// D-1 (lateral brick)
hexgrid(4,-1)
piece_coordlist([[[0,0],[2,0]]]);

View file

@ -171,31 +171,3 @@ module piece_coordlist(cc) {
}
}
}
// A-1
hexgrid(-1,3)
piece_coordlist([[[0,0]]]);
piece_coordlist([
[[0,1]], [[2,0]]
]);
// A-3.1
hexgrid(1,3)
piece_coordlist([
[[0,2]], [[2,1]], [[4,0]]
]);
// A-3.2
hexgrid(4,0)
piece_coordlist([
[[0,2]], [[2,1]], [[3,2]]
]);
// A-3.3
hexgrid(1,1)
piece_coordlist([
[[0,1]], [[2,0]], [[1,2]]
]);
// D-1 (lateral brick)
hexgrid(4,-1)
piece_coordlist([[[0,0],[2,0]]]);

BIN
hexbrick-preview.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB