summaryrefslogtreecommitdiff
path: root/cubbies.sh
blob: d29769d5f2d518d2a9110b25dd88fb067e56e874 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#!/bin/bash
# this script started off generated using "shopenscad.sh -s cubbies.scad"

usage() {
    cat <<EOF
Usage:
$0 cubby-depth cubby-height cubby-width1 [cubby-width2 ... cubby-widthN]

Examples:

    $0 150 90 20

    Generates two total pieces: a side piece (150mm depth, 90mm height) and a
    bottom piece (150mm depth and 20mm width).

    You will need to print the side piece twice and bottom piece once.

    $0 180 120 20 30 35

    Generates four total pieces, which can be assembled to form a row of
    cubbies: one side piece (180mm depth, 120mm height) and three bottom pieces,
    with widths of 20mm, 30mm, and 35mm (and each sharing the same depth of
    180mm).

    You will need to side piece twice for the first bottom piece, then
    a single side piece for each additional bottom piece.
EOF
}

[ "-h" == "$1" ] && usage && exit;
if [ "$#" -lt 3 ]; then
    echo "$0: Needs atleast three paramaters. See usage:"; usage; exit 1;
fi;

shopenscad_cmd="./shopenscad.sh cubbies.scad "

export $(echo $($shopenscad_cmd -p))
# # $ ./shopenscad.sh -p cubbies.scad
# part='"both"'
# cubby_width=40
# cubby_depth=120
# cubby_height=90
# thickness=5
# strut_thickness=5
# max_bridge=0
# tab_width=10
# tab_padding=5
# tab_tolerance=0.5
# screw_tabs=true

cubby_depth=$1; shift
cubby_height=$1; shift

# generate the single side piece
part='"side"' ${shopenscad_cmd}

# generate each bottom piece
for i in "$@"; do
    part='"bottom"' cubby_width="$i" ${shopenscad_cmd}
done;