summaryrefslogtreecommitdiff
path: root/cubbies.sh
blob: 43a24166d9de9e687367aab7e013dd3080195ba9 (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
61
62
63
64
65
#!/bin/bash
# this script started off generated using "shopenscad.sh -s cubbies.scad"

usage() {
    cat <<EOF
$0: generate sets of cubbies. You will need print the side piece twice for your
first bottom piece, then a single side piece for each additional bottom piece.

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). The side piece will need to be printed 4 times, and each bottom
    piece printed once.

    thickness=3 strut_thickness=4 $0 200 140 20

    You can override any of the other variables from your scad file by passing
    them into $0 in this manner.
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;